[FFmpeg-cvslog] commit: also support decoding of AVPackets with multiple wma packets ( Sascha Sommer )

git at videolan.org git
Sat Jan 15 13:06:36 CET 2011


ffmpeg | branch: master | Sascha Sommer <saschasommer at freenet.de> | Fri Jan 14 23:58:55 2011 +0000| [3cdf69eefa055ec6a08972e9e69f7e90854e42f9] | committer: Sascha Sommer 

also support decoding of AVPackets with multiple wma packets
fixes issue 2539

Originally committed as revision 26346 to svn://svn.ffmpeg.org/ffmpeg/trunk

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

 libavcodec/wmaprodec.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index d705cc7..9fc2aba 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1,7 +1,7 @@
 /*
  * Wmapro compatible decoder
  * Copyright (c) 2007 Baptiste Coudurier, Benjamin Larsson, Ulion
- * Copyright (c) 2008 - 2009 Sascha Sommer, Benjamin Larsson
+ * Copyright (c) 2008 - 2011 Sascha Sommer, Benjamin Larsson
  *
  * This file is part of FFmpeg.
  *
@@ -191,6 +191,7 @@ typedef struct WMAProDecodeCtx {
 
     /* packet decode state */
     GetBitContext    pgb;                           ///< bitstream reader context for the packet
+    int              next_packet_start;             ///< start offset of the next wma packet in the demuxer packet
     uint8_t          packet_offset;                 ///< frame offset in the packet
     uint8_t          packet_sequence_number;        ///< current packet number
     int              num_saved_bits;                ///< saved number of bits
@@ -1476,13 +1477,14 @@ static int decode_packet(AVCodecContext *avctx,
 
     if (s->packet_done || s->packet_loss) {
         s->packet_done = 0;
-        s->buf_bit_size = buf_size << 3;
 
         /** sanity check for the buffer length */
         if (buf_size < avctx->block_align)
             return 0;
 
+        s->next_packet_start = buf_size - avctx->block_align;
         buf_size = avctx->block_align;
+        s->buf_bit_size = buf_size << 3;
 
         /** parse packet header */
         init_get_bits(gb, buf, s->buf_bit_size);
@@ -1528,7 +1530,7 @@ static int decode_packet(AVCodecContext *avctx,
 
     } else {
         int frame_size;
-        s->buf_bit_size = avpkt->size << 3;
+        s->buf_bit_size = (avpkt->size - s->next_packet_start) << 3;
         init_get_bits(gb, avpkt->data, s->buf_bit_size);
         skip_bits(gb, s->packet_offset);
         if (s->len_prefix && remaining_bits(s, gb) > s->log2_frame_size &&




More information about the ffmpeg-cvslog mailing list