diff options
author | Sascha Sommer <saschasommer@freenet.de> | 2011-01-14 23:58:55 +0000 |
---|---|---|
committer | Sascha Sommer <saschasommer@freenet.de> | 2011-01-14 23:58:55 +0000 |
commit | 3cdf69eefa055ec6a08972e9e69f7e90854e42f9 (patch) | |
tree | c809540e62e5eb8ac81ff0704b3e5a2729d15a99 /libavcodec | |
parent | 65344775b8c3683d17bcea8b56fc8a0328a114dd (diff) | |
download | ffmpeg-3cdf69eefa055ec6a08972e9e69f7e90854e42f9.tar.gz |
also support decoding of AVPackets with multiple wma packets
fixes issue 2539
Originally committed as revision 26346 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/wmaprodec.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index d705cc725c..9fc2abafc9 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 && |