summaryrefslogtreecommitdiff
path: root/libavcodec/wavpack.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-09-05 22:10:26 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-05 22:29:16 +0200
commit3c54e7ed4f42d8ed5aece9484190b5294e272c36 (patch)
tree65e03151a2e17d9ac11aa76cc53b388a3185e3d6 /libavcodec/wavpack.c
parent27bf599350a869877a1c9304abf9c95991692dd2 (diff)
parentae264bb29be3506a489347c6e27a04cded0de621 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: ac3enc: Add channel coupling support for the fixed-point AC-3 encoder. ac3enc: scale floating-point coupling channel coefficients in scale_coefficients() rather than in apply_channel_coupling() ac3enc: fix encoding of stereo ac3 files when rematrixing is disabled. wavpack: fix wrong return value in wavpack_decode_block() avconv: fix parsing metadata specifiers. fate: use +frame+slice named constants instead of '3' mpeg12: propagate more real return values through chunk decode error return and fix some indentation wavpack: use context reset in appropriate places avconv: move mux_preload and mux_max_delay to options context avconv: move bitstream filters to options context. avconv: move rate_emu to options context. avconv: move max_frames to options context. avconv: move metadata to options context. avconv: move ts scale to options context. avconv: move chapter maps to options context. avconv: move metadata maps to options context. avconv: move codec_names to options context. Conflicts: avconv.c tests/fate-run.sh Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/wavpack.c')
-rw-r--r--libavcodec/wavpack.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index ca52d0ac74..9da1f91d1d 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -470,6 +470,7 @@ static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S)
static void wv_reset_saved_context(WavpackFrameContext *s)
{
s->pos = 0;
+ s->samples_left = 0;
s->sc.crc = s->extra_sc.crc = 0xFFFFFFFF;
}
@@ -582,6 +583,7 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb, vo
s->samples_left -= count;
if(!s->samples_left){
+ wv_reset_saved_context(s);
if(crc != s->CRC){
av_log(s->avctx, AV_LOG_ERROR, "CRC error\n");
return -1;
@@ -590,7 +592,6 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb, vo
av_log(s->avctx, AV_LOG_ERROR, "Extra bits CRC error\n");
return -1;
}
- wv_reset_saved_context(s);
}else{
s->pos = pos;
s->sc.crc = crc;
@@ -660,6 +661,7 @@ static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb, void
s->samples_left -= count;
if(!s->samples_left){
+ wv_reset_saved_context(s);
if(crc != s->CRC){
av_log(s->avctx, AV_LOG_ERROR, "CRC error\n");
return -1;
@@ -668,7 +670,6 @@ static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb, void
av_log(s->avctx, AV_LOG_ERROR, "Extra bits CRC error\n");
return -1;
}
- wv_reset_saved_context(s);
}else{
s->pos = pos;
s->sc.crc = crc;
@@ -779,7 +780,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
s->samples = AV_RL32(buf); buf += 4;
if(!s->samples){
*data_size = 0;
- return buf_size;
+ return 0;
}
}else{
s->samples = wc->samples;
@@ -1195,7 +1196,7 @@ static void wavpack_decode_flush(AVCodecContext *avctx)
int i;
for (i = 0; i < s->fdec_num; i++)
- s->fdec[i]->samples_left = 0;
+ wv_reset_saved_context(s->fdec[i]);
}
AVCodec ff_wavpack_decoder = {