[FFmpeg-cvslog] aac: decode directly to the user-provided AVFrame
Justin Ruggles
git at videolan.org
Wed Feb 13 11:31:59 CET 2013
ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Sun Dec 23 16:37:23 2012 -0500| [ffd2123095bd1ab5109c78f78c72759bb838805b] | committer: Justin Ruggles
aac: decode directly to the user-provided AVFrame
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ffd2123095bd1ab5109c78f78c72759bb838805b
---
libavcodec/aac.h | 2 +-
libavcodec/aacdec.c | 17 +++++++----------
2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index dd337a0..97f46e2 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -262,7 +262,7 @@ typedef struct ChannelElement {
*/
typedef struct AACContext {
AVCodecContext *avctx;
- AVFrame frame;
+ AVFrame *frame;
int is_saved; ///< Set if elements have stored overlap from previous frame.
DynamicRangeControl che_drc;
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 5afc9b8..133a557 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -180,8 +180,8 @@ static int frame_configure_elements(AVCodecContext *avctx)
}
/* get output buffer */
- ac->frame.nb_samples = 2048;
- if ((ret = ff_get_buffer(avctx, &ac->frame)) < 0) {
+ ac->frame->nb_samples = 2048;
+ if ((ret = ff_get_buffer(avctx, ac->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -189,7 +189,7 @@ static int frame_configure_elements(AVCodecContext *avctx)
/* map output channel pointers to AVFrame data */
for (ch = 0; ch < avctx->channels; ch++) {
if (ac->output_element[ch])
- ac->output_element[ch]->ret = (float *)ac->frame.extended_data[ch];
+ ac->output_element[ch]->ret = (float *)ac->frame->extended_data[ch];
}
return 0;
@@ -918,9 +918,6 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
cbrt_tableinit();
- avcodec_get_frame_defaults(&ac->frame);
- avctx->coded_frame = &ac->frame;
-
return 0;
}
@@ -2389,6 +2386,8 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
int err, elem_id;
int samples = 0, multiplier, audio_found = 0, pce_found = 0;
+ ac->frame = data;
+
if (show_bits(gb, 12) == 0xfff) {
if (parse_adts_frame_header(ac, gb) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error decoding AAC frame header.\n");
@@ -2503,10 +2502,8 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
multiplier = (ac->oc[1].m4ac.sbr == 1) ? ac->oc[1].m4ac.ext_sample_rate > ac->oc[1].m4ac.sample_rate : 0;
samples <<= multiplier;
- if (samples) {
- ac->frame.nb_samples = samples;
- *(AVFrame *)data = ac->frame;
- }
+ if (samples)
+ ac->frame->nb_samples = samples;
*got_frame_ptr = !!samples;
if (ac->oc[1].status && audio_found) {
More information about the ffmpeg-cvslog
mailing list