comparison mplayer.c @ 29686:add9ce0b0e55

Enable loading of external subtitles also for audio-only files.
author reimar
date Mon, 28 Sep 2009 11:26:19 +0000
parents f0b559a7c17b
children 94f1bca4f4b6
comparison
equal deleted inserted replaced
29685:f0b559a7c17b 29686:add9ce0b0e55
3448 if(vo_spudec==NULL && mpctx->sh_video && 3448 if(vo_spudec==NULL && mpctx->sh_video &&
3449 (mpctx->stream->type==STREAMTYPE_DVD || mpctx->stream->type == STREAMTYPE_DVDNAV)){ 3449 (mpctx->stream->type==STREAMTYPE_DVD || mpctx->stream->type == STREAMTYPE_DVDNAV)){
3450 init_vo_spudec(); 3450 init_vo_spudec();
3451 } 3451 }
3452 3452
3453 if(mpctx->sh_video) { 3453 if(1 || mpctx->sh_video) {
3454 // after reading video params we should load subtitles because 3454 // after reading video params we should load subtitles because
3455 // we know fps so now we can adjust subtitle time to ~6 seconds AST 3455 // we know fps so now we can adjust subtitle time to ~6 seconds AST
3456 // check .sub 3456 // check .sub
3457 double fps = mpctx->sh_video ? mpctx->sh_video->fps : 25;
3457 current_module="read_subtitles_file"; 3458 current_module="read_subtitles_file";
3458 if(sub_name){ 3459 if(sub_name){
3459 for (i = 0; sub_name[i] != NULL; ++i) 3460 for (i = 0; sub_name[i] != NULL; ++i)
3460 add_subtitles (sub_name[i], mpctx->sh_video->fps, 0); 3461 add_subtitles (sub_name[i], fps, 0);
3461 } 3462 }
3462 if(sub_auto) { // auto load sub file ... 3463 if(sub_auto) { // auto load sub file ...
3463 char *psub = get_path( "sub/" ); 3464 char *psub = get_path( "sub/" );
3464 char **tmp = sub_filenames((psub ? psub : ""), filename); 3465 char **tmp = sub_filenames((psub ? psub : ""), filename);
3465 int i = 0; 3466 int i = 0;
3466 free(psub); // release the buffer created by get_path() above 3467 free(psub); // release the buffer created by get_path() above
3467 while (tmp[i]) { 3468 while (tmp[i]) {
3468 add_subtitles (tmp[i], mpctx->sh_video->fps, 1); 3469 add_subtitles (tmp[i], fps, 1);
3469 free(tmp[i++]); 3470 free(tmp[i++]);
3470 } 3471 }
3471 free(tmp); 3472 free(tmp);
3472 } 3473 }
3473 if (mpctx->set_of_sub_size > 0) { 3474 if (mpctx->set_of_sub_size > 0) {