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

Justin Ruggles git at videolan.org
Wed Feb 13 12:53:49 CET 2013


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Sun Dec 23 20:13:08 2012 -0500| [9873d71f316cabbe42190d826b8df87791ea1034] | committer: Justin Ruggles

wavpack: decode directly to the user-provided AVFrame

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

 libavcodec/wavpack.c |   14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index e8f34fa..ca639ee 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -127,7 +127,6 @@ typedef struct WavpackFrameContext {
 
 typedef struct WavpackContext {
     AVCodecContext *avctx;
-    AVFrame frame;
 
     WavpackFrameContext *fdec[WV_MAX_FRAME_DECODERS];
     int fdec_num;
@@ -739,9 +738,6 @@ static av_cold int wavpack_decode_init(AVCodecContext *avctx)
 
     s->fdec_num = 0;
 
-    avcodec_get_frame_defaults(&s->frame);
-    avctx->coded_frame = &s->frame;
-
     return 0;
 }
 
@@ -1172,6 +1168,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
     WavpackContext *s  = avctx->priv_data;
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
+    AVFrame *frame     = data;
     int frame_size, ret, frame_flags;
     int samplecount = 0;
 
@@ -1207,8 +1204,8 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
     }
 
     /* get output buffer */
-    s->frame.nb_samples = s->samples;
-    if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
+    frame->nb_samples = s->samples;
+    if ((ret = ff_get_buffer(avctx, frame)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
         return ret;
     }
@@ -1232,7 +1229,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
             return -1;
         }
         if ((samplecount = wavpack_decode_block(avctx, s->block,
-                                                s->frame.data[0], got_frame_ptr,
+                                                frame->data[0], got_frame_ptr,
                                                 buf, frame_size)) < 0) {
             wavpack_decode_flush(avctx);
             return -1;
@@ -1241,9 +1238,6 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
         buf += frame_size; buf_size -= frame_size;
     }
 
-    if (*got_frame_ptr)
-        *(AVFrame *)data = s->frame;
-
     return avpkt->size;
 }
 



More information about the ffmpeg-cvslog mailing list