[FFmpeg-cvslog] atrac3: decode directly to the user-provided AVFrame

Justin Ruggles git at videolan.org
Wed Feb 13 11:51:19 CET 2013


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Sun Dec 23 17:24:53 2012 -0500| [9a75ace2b2cb970ab742cd9390ead729d927bd8d] | committer: Justin Ruggles

atrac3: decode directly to the user-provided AVFrame

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9a75ace2b2cb970ab742cd9390ead729d927bd8d
---

 libavcodec/atrac3.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
index a46b0b1..0474268 100644
--- a/libavcodec/atrac3.c
+++ b/libavcodec/atrac3.c
@@ -86,7 +86,6 @@ typedef struct ChannelUnit {
 } ChannelUnit;
 
 typedef struct ATRAC3Context {
-    AVFrame frame;
     GetBitContext gb;
     //@{
     /** stream data */
@@ -798,6 +797,7 @@ static int decode_frame(AVCodecContext *avctx, const uint8_t *databuf,
 static int atrac3_decode_frame(AVCodecContext *avctx, void *data,
                                int *got_frame_ptr, AVPacket *avpkt)
 {
+    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     ATRAC3Context *q = avctx->priv_data;
@@ -811,8 +811,8 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data,
     }
 
     /* get output buffer */
-    q->frame.nb_samples = SAMPLES_PER_FRAME;
-    if ((ret = ff_get_buffer(avctx, &q->frame)) < 0) {
+    frame->nb_samples = SAMPLES_PER_FRAME;
+    if ((ret = ff_get_buffer(avctx, frame)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
         return ret;
     }
@@ -825,14 +825,13 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data,
         databuf = buf;
     }
 
-    ret = decode_frame(avctx, databuf, (float **)q->frame.extended_data);
+    ret = decode_frame(avctx, databuf, (float **)frame->extended_data);
     if (ret) {
         av_log(NULL, AV_LOG_ERROR, "Frame decoding error!\n");
         return ret;
     }
 
-    *got_frame_ptr   = 1;
-    *(AVFrame *)data = q->frame;
+    *got_frame_ptr = 1;
 
     return avctx->block_align;
 }
@@ -986,9 +985,6 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
         return AVERROR(ENOMEM);
     }
 
-    avcodec_get_frame_defaults(&q->frame);
-    avctx->coded_frame = &q->frame;
-
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list