aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpc8.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2010-11-21 20:42:06 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2010-11-21 20:42:06 +0000
commit7d3829a87a7465f3effe8e0e09760882578e5a0a (patch)
treeff9437b356567089b0a5bbe3016629dfd163f10e /libavcodec/mpc8.c
parent63e8d9760f23a4edf81e9ae58c4f6d3baa6ff4dd (diff)
downloadffmpeg-7d3829a87a7465f3effe8e0e09760882578e5a0a.tar.gz
Musepack SV8 supports "mono" files (though it still codes them as stereo),
so extend decoder to output only one channel for it. This fixes issue 2368. Originally committed as revision 25790 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpc8.c')
-rw-r--r--libavcodec/mpc8.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
index 1296f255a4..d8d62edd9c 100644
--- a/libavcodec/mpc8.c
+++ b/libavcodec/mpc8.c
@@ -99,6 +99,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
MPCContext *c = avctx->priv_data;
GetBitContext gb;
static int vlc_initialized = 0;
+ int channels;
static VLC_TYPE band_table[542][2];
static VLC_TYPE q1_table[520][2];
@@ -125,7 +126,11 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
skip_bits(&gb, 3);//sample rate
c->maxbands = get_bits(&gb, 5) + 1;
- skip_bits(&gb, 4);//channels
+ channels = get_bits(&gb, 4) + 1;
+ if (channels > 2) {
+ av_log_missing_feature(avctx, "Multichannel MPC SV8", 1);
+ return -1;
+ }
c->MSS = get_bits1(&gb);
c->frames = 1 << (get_bits(&gb, 3) * 2);
@@ -387,14 +392,14 @@ static int mpc8_decode_frame(AVCodecContext * avctx,
}
}
- ff_mpc_dequantize_and_synth(c, maxband, data);
+ ff_mpc_dequantize_and_synth(c, maxband, data, avctx->channels);
c->cur_frame++;
c->last_bits_used = get_bits_count(gb);
if(c->cur_frame >= c->frames)
c->cur_frame = 0;
- *data_size = MPC_FRAME_SIZE * 4;
+ *data_size = MPC_FRAME_SIZE * 2 * avctx->channels;
return c->cur_frame ? c->last_bits_used >> 3 : buf_size;
}