diff options
author | Attila Kinali <attila@kinali.ch> | 2009-11-30 13:25:20 +0300 |
---|---|---|
committer | Attila Kinali <attila@kinali.ch> | 2009-11-30 13:25:20 +0300 |
commit | 76c4a644eef92f1a15af11825486f5593bfb0051 (patch) | |
tree | 90beb1af79733191b2eebee9dfe4c13f51c63e05 /libavcodec/mpc7.c | |
parent | ab8c48de8c85a487a5673907abab6d1348eaec9e (diff) |
Fix an issue uncovered by commit 20623:
The init functions of mpc7 and mpc8 check whether the vlc has been
initialized already and return early if this is the case (eg by calling
init a second time).
But avctx->sample_fmt and channel_layout is set after the vlc initialization,
causing it not to be set on the second call of init.
Move all manipulations of avctx before the initialization of the vlc,
so that it is always set.
Originally committed as revision 20668 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpc7.c')
-rw-r--r-- | libavcodec/mpc7.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index 614a418684..e80b8927f2 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -85,6 +85,9 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx) c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands); c->frames_to_skip = 0; + avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + if(vlc_initialized) return 0; av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n"); scfi_vlc.table = scfi_table; @@ -124,8 +127,6 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx) } } vlc_initialized = 1; - avctx->sample_fmt = SAMPLE_FMT_S16; - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; return 0; } |