[FFmpeg-cvslog] alac: use AVPacket fields directly in alac_decode_frame()

Justin Ruggles git at videolan.org
Thu Jul 19 23:35:54 CEST 2012


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Mon Jul  9 13:30:03 2012 -0400| [5138ff143f2ab3ea0dd7a34e03820f15ec64451d] | committer: Justin Ruggles

alac: use AVPacket fields directly in alac_decode_frame()

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

 libavcodec/alac.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index 1fc4dc5..ac51c2f 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -291,8 +291,6 @@ static void interleave_stereo_24(int32_t *buffer[MAX_CHANNELS],
 static int alac_decode_frame(AVCodecContext *avctx, void *data,
                              int *got_frame_ptr, AVPacket *avpkt)
 {
-    const uint8_t *inbuffer = avpkt->data;
-    int input_buffer_size = avpkt->size;
     ALACContext *alac = avctx->priv_data;
 
     int channels;
@@ -303,7 +301,7 @@ static int alac_decode_frame(AVCodecContext *avctx, void *data,
     uint8_t interlacing_leftweight;
     int i, ch, ret;
 
-    init_get_bits(&alac->gb, inbuffer, input_buffer_size * 8);
+    init_get_bits(&alac->gb, avpkt->data, avpkt->size * 8);
 
     channels = get_bits(&alac->gb, 3) + 1;
     if (channels != avctx->channels) {
@@ -457,13 +455,14 @@ static int alac_decode_frame(AVCodecContext *avctx, void *data,
         break;
     }
 
-    if (input_buffer_size * 8 - get_bits_count(&alac->gb) > 8)
-        av_log(avctx, AV_LOG_ERROR, "Error : %d bits left\n", input_buffer_size * 8 - get_bits_count(&alac->gb));
+    if (avpkt->size * 8 - get_bits_count(&alac->gb) > 8)
+        av_log(avctx, AV_LOG_ERROR, "Error : %d bits left\n",
+               avpkt->size * 8 - get_bits_count(&alac->gb));
 
     *got_frame_ptr   = 1;
     *(AVFrame *)data = alac->frame;
 
-    return input_buffer_size;
+    return avpkt->size;
 }
 
 static av_cold int alac_decode_close(AVCodecContext *avctx)



More information about the ffmpeg-cvslog mailing list