comparison mplayer.c @ 32642:7b135236a44a

Factorize subtitles loading between mplayer and mencoder.
author cboesch
date Fri, 24 Dec 2010 23:02:24 +0000
parents b05c02525cb1
children 25b9e4c7f365
comparison
equal deleted inserted replaced
32641:a2822f8f5e6d 32642:7b135236a44a
3506 // after reading video params we should load subtitles because 3506 // after reading video params we should load subtitles because
3507 // we know fps so now we can adjust subtitle time to ~6 seconds AST 3507 // we know fps so now we can adjust subtitle time to ~6 seconds AST
3508 // check .sub 3508 // check .sub
3509 double fps = mpctx->sh_video ? mpctx->sh_video->fps : 25; 3509 double fps = mpctx->sh_video ? mpctx->sh_video->fps : 25;
3510 current_module="read_subtitles_file"; 3510 current_module="read_subtitles_file";
3511 if(sub_name){ 3511 load_subtitles(filename, fps, add_subtitles);
3512 for (i = 0; sub_name[i] != NULL; ++i)
3513 add_subtitles (sub_name[i], fps, 0);
3514 }
3515 if(sub_auto) { // auto load sub file ...
3516 char *psub = get_path( "sub/" );
3517 char **tmp = sub_filenames((psub ? psub : ""), filename);
3518 int i = 0;
3519 free(psub); // release the buffer created by get_path() above
3520 while (tmp[i]) {
3521 add_subtitles (tmp[i], fps, 1);
3522 free(tmp[i++]);
3523 }
3524 free(tmp);
3525 }
3526 if (mpctx->set_of_sub_size > 0) 3512 if (mpctx->set_of_sub_size > 0)
3527 mpctx->sub_counts[SUB_SOURCE_SUBS] = mpctx->set_of_sub_size; 3513 mpctx->sub_counts[SUB_SOURCE_SUBS] = mpctx->set_of_sub_size;
3528 } 3514 }
3529 3515
3530 if (select_subtitle(mpctx)) { 3516 if (select_subtitle(mpctx)) {