comparison mplayer.c @ 4064:3c747168eb6e

1. subs know are readed after reading AVI header so we already know fps 2. modified vplayer format reader - default time is ~6 sec - maybe that should be an option
author atlka
date Wed, 09 Jan 2002 16:35:24 +0000
parents 505f206d80d1
children ae78dd1d8daf
comparison
equal deleted inserted replaced
4063:5a1558a521fb 4064:3c747168eb6e
27 #include "cfgparser.h" 27 #include "cfgparser.h"
28 #include "cfg-mplayer-def.h" 28 #include "cfg-mplayer-def.h"
29 29
30 #ifdef USE_SUB 30 #ifdef USE_SUB
31 #include "subreader.h" 31 #include "subreader.h"
32 void find_sub(subtitle* subtitles,int key);
33 void adjust_subs_time(subtitle* subtitles, float subadj, float fps);
34 #endif 32 #endif
35 33
36 #ifdef USE_LIBVO2 34 #ifdef USE_LIBVO2
37 #include "libvo2/libvo2.h" 35 #include "libvo2/libvo2.h"
38 #else 36 #else
728 } 726 }
729 #endif 727 #endif
730 728
731 if(filename) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_Playing, filename); 729 if(filename) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_Playing, filename);
732 730
733 #ifdef USE_SUB 731 #ifdef USE_SUB_OLD
734 // check .sub 732 // check .sub
735 if(sub_name){ 733 if(sub_name){
736 #if 0 734 #if 0
737 int l=strlen(sub_name); 735 int l=strlen(sub_name);
738 if ((l>4) && ((0==strcmp(&sub_name[l-4],".utf")) 736 if ((l>4) && ((0==strcmp(&sub_name[l-4],".utf"))
750 if(!subtitles) subtitles=sub_read_file(get_path("default.sub")); // try default 748 if(!subtitles) subtitles=sub_read_file(get_path("default.sub")); // try default
751 #endif 749 #endif
752 } 750 }
753 751
754 if(subtitles && stream_dump_type==3) list_sub_file(subtitles); 752 if(subtitles && stream_dump_type==3) list_sub_file(subtitles);
755 if(subtitles && stream_dump_type==4) dump_mpsub(subtitles); 753 if(subtitles && stream_dump_type==4) dump_mpsub(subtitles, fps);
756 #endif 754 #endif
757 755
758 stream=NULL; 756 stream=NULL;
759 demuxer=NULL; 757 demuxer=NULL;
760 d_audio=NULL; 758 d_audio=NULL;
1028 if(!sh_video){ 1026 if(!sh_video){
1029 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_NoVideoStream); 1027 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_NoVideoStream);
1030 goto goto_next_file; // exit_player(MSGTR_Exit_error); 1028 goto goto_next_file; // exit_player(MSGTR_Exit_error);
1031 } 1029 }
1032 1030
1031
1032 #ifdef USE_SUB
1033 // after reading video params we should load subtitles because
1034 // we know fps so now we can adjust subtitles time to ~6 seconds AST
1035 // check .sub
1036 current_module="read_subtitles_file";
1037 if(sub_name){
1038 #if 0
1039 int l=strlen(sub_name);
1040 if ((l>4) && ((0==strcmp(&sub_name[l-4],".utf"))
1041 ||(0==strcmp(&sub_name[l-4],".UTF"))))
1042 sub_utf8=1;
1043 #endif
1044 subtitles=sub_read_file(sub_name, sh_video->fps);
1045 if(!subtitles || sub_num == 0) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadSub,sub_name);
1046 }
1047 if(!sub_name){
1048 if(sub_auto && filename) { // auto load sub file ...
1049 subtitles=sub_read_file( sub_filename( get_path("sub/"), filename ),
1050 sh_video->fps );
1051 }
1052 #if 0
1053 if(!subtitles) subtitles=sub_read_file(get_path("default.sub"),
1054 sh_video->fps); // try default
1055 #endif
1056 }
1057
1058 if(subtitles && stream_dump_type==3) list_sub_file(subtitles);
1059 if(subtitles && stream_dump_type==4) dump_mpsub(subtitles, sh_video->fps);
1060 #endif
1061
1033 /* display clip info */ 1062 /* display clip info */
1034 demux_info_print(demuxer); 1063 demux_info_print(demuxer);
1035 1064
1036 #ifdef USE_SUB
1037 // we know fps so now we can adjust subtitles time to ~6 seconds AST
1038 adjust_subs_time(subtitles, 6.0, sh_video->fps);
1039 #endif
1040
1041 //================== Init AUDIO (codec) ========================== 1065 //================== Init AUDIO (codec) ==========================
1042 1066
1043 current_module="init_audio_codec"; 1067 current_module="init_audio_codec";
1044 1068
1045 if(sh_audio){ 1069 if(sh_audio){