comparison mpc7.c @ 10602:987373501407 libavcodec

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.
author attila
date Mon, 30 Nov 2009 10:25:20 +0000
parents f1dc62781766
children 15add32dd717
comparison
equal deleted inserted replaced
10601:5bf8c18a9907 10602:987373501407
82 c->gapless = get_bits1(&gb); 82 c->gapless = get_bits1(&gb);
83 c->lastframelen = get_bits(&gb, 11); 83 c->lastframelen = get_bits(&gb, 11);
84 av_log(avctx, AV_LOG_DEBUG, "IS: %d, MSS: %d, TG: %d, LFL: %d, bands: %d\n", 84 av_log(avctx, AV_LOG_DEBUG, "IS: %d, MSS: %d, TG: %d, LFL: %d, bands: %d\n",
85 c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands); 85 c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands);
86 c->frames_to_skip = 0; 86 c->frames_to_skip = 0;
87
88 avctx->sample_fmt = SAMPLE_FMT_S16;
89 avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
87 90
88 if(vlc_initialized) return 0; 91 if(vlc_initialized) return 0;
89 av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n"); 92 av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n");
90 scfi_vlc.table = scfi_table; 93 scfi_vlc.table = scfi_table;
91 scfi_vlc.table_allocated = 1 << MPC7_SCFI_BITS; 94 scfi_vlc.table_allocated = 1 << MPC7_SCFI_BITS;
122 return -1; 125 return -1;
123 } 126 }
124 } 127 }
125 } 128 }
126 vlc_initialized = 1; 129 vlc_initialized = 1;
127 avctx->sample_fmt = SAMPLE_FMT_S16;
128 avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
129 return 0; 130 return 0;
130 } 131 }
131 132
132 /** 133 /**
133 * Fill samples for given subband 134 * Fill samples for given subband