comparison libmpcodecs/dec_audio.c @ 25962:afa125da85cf

typo fix: inited --> initialized
author diego
date Thu, 14 Feb 2008 14:23:55 +0000
parents 293aeec83153
children 4be2b34aa431
comparison
equal deleted inserted replaced
25961:354ad909efcf 25962:afa125da85cf
96 mp_msg(MSGT_DECAUDIO, MSGL_WARN, MSGTR_ADecoderInitFailed); 96 mp_msg(MSGT_DECAUDIO, MSGL_WARN, MSGTR_ADecoderInitFailed);
97 uninit_audio(sh_audio); // free buffers 97 uninit_audio(sh_audio); // free buffers
98 return 0; 98 return 0;
99 } 99 }
100 100
101 sh_audio->inited = 1; 101 sh_audio->initialized = 1;
102 102
103 if (!sh_audio->channels || !sh_audio->samplerate) { 103 if (!sh_audio->channels || !sh_audio->samplerate) {
104 mp_msg(MSGT_DECAUDIO, MSGL_WARN, MSGTR_UnknownAudio); 104 mp_msg(MSGT_DECAUDIO, MSGL_WARN, MSGTR_UnknownAudio);
105 uninit_audio(sh_audio); // free buffers 105 uninit_audio(sh_audio); // free buffers
106 return 0; 106 return 0;
231 char *ac_l_default[2] = { "", (char *) NULL }; 231 char *ac_l_default[2] = { "", (char *) NULL };
232 // hack: 232 // hack:
233 if (!audio_codec_list) 233 if (!audio_codec_list)
234 audio_codec_list = ac_l_default; 234 audio_codec_list = ac_l_default;
235 // Go through the codec.conf and find the best codec... 235 // Go through the codec.conf and find the best codec...
236 sh_audio->inited = 0; 236 sh_audio->initialized = 0;
237 stringset_init(&selected); 237 stringset_init(&selected);
238 while (!sh_audio->inited && *audio_codec_list) { 238 while (!sh_audio->initialized && *audio_codec_list) {
239 char *audio_codec = *(audio_codec_list++); 239 char *audio_codec = *(audio_codec_list++);
240 if (audio_codec[0]) { 240 if (audio_codec[0]) {
241 if (audio_codec[0] == '-') { 241 if (audio_codec[0] == '-') {
242 // disable this codec: 242 // disable this codec:
243 stringset_add(&selected, audio_codec + 1); 243 stringset_add(&selected, audio_codec + 1);
252 // try in stability order: UNTESTED, WORKING, BUGGY. 252 // try in stability order: UNTESTED, WORKING, BUGGY.
253 // never try CRASHING. 253 // never try CRASHING.
254 if (audio_fm_list) { 254 if (audio_fm_list) {
255 char **fmlist = audio_fm_list; 255 char **fmlist = audio_fm_list;
256 // try first the preferred codec families: 256 // try first the preferred codec families:
257 while (!sh_audio->inited && *fmlist) { 257 while (!sh_audio->initialized && *fmlist) {
258 char *audio_fm = *(fmlist++); 258 char *audio_fm = *(fmlist++);
259 mp_msg(MSGT_DECAUDIO, MSGL_INFO, MSGTR_TryForceAudioFmtStr, 259 mp_msg(MSGT_DECAUDIO, MSGL_INFO, MSGTR_TryForceAudioFmtStr,
260 audio_fm); 260 audio_fm);
261 for (status = CODECS_STATUS__MAX; 261 for (status = CODECS_STATUS__MAX;
262 status >= CODECS_STATUS__MIN; --status) 262 status >= CODECS_STATUS__MIN; --status)
263 if (init_audio(sh_audio, NULL, audio_fm, status, &selected)) 263 if (init_audio(sh_audio, NULL, audio_fm, status, &selected))
264 break; 264 break;
265 } 265 }
266 } 266 }
267 if (!sh_audio->inited) 267 if (!sh_audio->initialized)
268 for (status = CODECS_STATUS__MAX; status >= CODECS_STATUS__MIN; 268 for (status = CODECS_STATUS__MAX; status >= CODECS_STATUS__MIN;
269 --status) 269 --status)
270 if (init_audio(sh_audio, NULL, NULL, status, &selected)) 270 if (init_audio(sh_audio, NULL, NULL, status, &selected))
271 break; 271 break;
272 } 272 }
273 } 273 }
274 stringset_free(&selected); 274 stringset_free(&selected);
275 275
276 if (!sh_audio->inited) { 276 if (!sh_audio->initialized) {
277 mp_msg(MSGT_DECAUDIO, MSGL_ERR, MSGTR_CantFindAudioCodec, 277 mp_msg(MSGT_DECAUDIO, MSGL_ERR, MSGTR_CantFindAudioCodec,
278 sh_audio->format); 278 sh_audio->format);
279 mp_msg(MSGT_DECAUDIO, MSGL_HINT, MSGTR_RTFMCodecs); 279 mp_msg(MSGT_DECAUDIO, MSGL_HINT, MSGTR_RTFMCodecs);
280 return 0; // failed 280 return 0; // failed
281 } 281 }
291 mp_msg(MSGT_DECAUDIO, MSGL_V, "Uninit audio filters...\n"); 291 mp_msg(MSGT_DECAUDIO, MSGL_V, "Uninit audio filters...\n");
292 af_uninit(sh_audio->afilter); 292 af_uninit(sh_audio->afilter);
293 free(sh_audio->afilter); 293 free(sh_audio->afilter);
294 sh_audio->afilter = NULL; 294 sh_audio->afilter = NULL;
295 } 295 }
296 if (sh_audio->inited) { 296 if (sh_audio->initialized) {
297 mp_msg(MSGT_DECAUDIO, MSGL_V, MSGTR_UninitAudioStr, 297 mp_msg(MSGT_DECAUDIO, MSGL_V, MSGTR_UninitAudioStr,
298 sh_audio->codec->drv); 298 sh_audio->codec->drv);
299 sh_audio->ad_driver->uninit(sh_audio); 299 sh_audio->ad_driver->uninit(sh_audio);
300 #ifdef DYNAMIC_PLUGINS 300 #ifdef DYNAMIC_PLUGINS
301 if (sh_audio->dec_handle) 301 if (sh_audio->dec_handle)
302 dlclose(sh_audio->dec_handle); 302 dlclose(sh_audio->dec_handle);
303 #endif 303 #endif
304 sh_audio->inited = 0; 304 sh_audio->initialized = 0;
305 } 305 }
306 free(sh_audio->a_out_buffer); 306 free(sh_audio->a_out_buffer);
307 sh_audio->a_out_buffer = NULL; 307 sh_audio->a_out_buffer = NULL;
308 sh_audio->a_out_buffer_size = 0; 308 sh_audio->a_out_buffer_size = 0;
309 if (sh_audio->a_buffer) 309 if (sh_audio->a_buffer)
465 } 465 }
466 466
467 void resync_audio_stream(sh_audio_t *sh_audio) 467 void resync_audio_stream(sh_audio_t *sh_audio)
468 { 468 {
469 sh_audio->a_in_buffer_len = 0; // clear audio input buffer 469 sh_audio->a_in_buffer_len = 0; // clear audio input buffer
470 if (!sh_audio->inited) 470 if (!sh_audio->initialized)
471 return; 471 return;
472 sh_audio->ad_driver->control(sh_audio, ADCTRL_RESYNC_STREAM, NULL); 472 sh_audio->ad_driver->control(sh_audio, ADCTRL_RESYNC_STREAM, NULL);
473 } 473 }
474 474
475 void skip_audio_frame(sh_audio_t *sh_audio) 475 void skip_audio_frame(sh_audio_t *sh_audio)
476 { 476 {
477 if (!sh_audio->inited) 477 if (!sh_audio->initialized)
478 return; 478 return;
479 if (sh_audio->ad_driver->control(sh_audio, ADCTRL_SKIP_FRAME, NULL) == 479 if (sh_audio->ad_driver->control(sh_audio, ADCTRL_SKIP_FRAME, NULL) ==
480 CONTROL_TRUE) 480 CONTROL_TRUE)
481 return; 481 return;
482 // default skip code: 482 // default skip code: