[Mplayer-cvslog] CVS: main Makefile,1.176,1.177 cfg-common.h,1.39,1.40 cfg-mplayer.h,1.145,1.146 mencoder.c,1.119,1.120

Arpi of Ize arpi at mplayerhq.hu
Wed Apr 17 23:51:20 CEST 2002


Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv6614

Modified Files:
	Makefile cfg-common.h cfg-mplayer.h mencoder.c 
Log Message:
enabled new OSD code in -vop expand, subtitles rendering support to mencoder

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/Makefile,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -r1.176 -r1.177
--- Makefile	15 Apr 2002 17:09:23 -0000	1.176
+++ Makefile	17 Apr 2002 21:51:17 -0000	1.177
@@ -25,9 +25,9 @@
 # a BSD compatible 'install' program
 INSTALL = install
 
-SRCS_COMMON = xacodec.c cpudetect.c mp_msg.c codec-cfg.c cfgparser.c my_profile.c spudec.c playtree.c playtreeparser.c asxparser.c vobsub.c
-SRCS_MENCODER = mencoder.c $(SRCS_COMMON) libao2/afmt.c divx4_vbr.c libvo/aclib.c libvo/osd.c me-opt-reg.c
-SRCS_MPLAYER = mplayer.c $(SRCS_COMMON) find_sub.c subreader.c lirc_mp.c mixer.c mp-opt-reg.c
+SRCS_COMMON = xacodec.c cpudetect.c mp_msg.c codec-cfg.c cfgparser.c my_profile.c spudec.c playtree.c playtreeparser.c asxparser.c vobsub.c subreader.c find_sub.c
+SRCS_MENCODER = mencoder.c $(SRCS_COMMON) libao2/afmt.c divx4_vbr.c libvo/aclib.c libvo/osd.c libvo/sub.c libvo/font_load.c me-opt-reg.c
+SRCS_MPLAYER = mplayer.c $(SRCS_COMMON) lirc_mp.c mixer.c mp-opt-reg.c
 
 OBJS_MENCODER = $(SRCS_MENCODER:.c=.o)
 OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o)
@@ -268,18 +268,19 @@
 # do not rebuild after cvs commits if .developer file is present!
 
 # rebuild at every config.h/config.mak change:
-version.h: config.h config.mak Makefile
+version.h:
 	./version.sh `$(CC) --version`
 ifeq ($(wildcard .developer),)
 	$(MAKE) distclean
 endif
 	$(MAKE) depend
 
-# rebuild at every CVS update:
+# rebuild at every CVS update or config/makefile change:
 ifeq ($(wildcard .developer),)
 ifneq ($(wildcard CVS/Entries),)
 version.h: CVS/Entries
 endif
+version.h: config.h config.mak Makefile
 endif
 
 #

Index: cfg-common.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-common.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- cfg-common.h	15 Apr 2002 00:36:21 -0000	1.39
+++ cfg-common.h	17 Apr 2002 21:51:17 -0000	1.40
@@ -99,7 +99,28 @@
 	{"tv", "MPlayer was compiled without TV Interface support\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
 #endif
 	{"vivo", vivoopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
-    {"vop", &vo_plugin_args, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
+	{"vop", &vo_plugin_args, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
+
+// ------------------------- subtitles options --------------------
+
+#ifdef USE_SUB
+	{"sub", &sub_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
+#ifdef USE_ICONV
+	{"subcp", &sub_cp, CONF_TYPE_STRING, 0, 0, 0, NULL},
+#endif	
+	{"subdelay", &sub_delay, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL},
+	{"subfps", &sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL},
+        {"noautosub", &sub_auto, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+	{"unicode", &sub_unicode, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+	{"nounicode", &sub_unicode, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+	{"utf8", &sub_utf8, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+	{"noutf8", &sub_utf8, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+ 	{"subpos",&sub_pos,  CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
+#endif
+#ifdef USE_OSD
+	{"font", &font_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
+	{"ffactor", &font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, NULL},
+#endif
 
 #else
 

Index: cfg-mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mplayer.h,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -r1.145 -r1.146
--- cfg-mplayer.h	16 Apr 2002 11:21:59 -0000	1.145
+++ cfg-mplayer.h	17 Apr 2002 21:51:17 -0000	1.146
@@ -58,15 +58,6 @@
 extern int vo_directrendering;
 extern int vd_use_slices;
 
-#ifdef USE_SUB
-extern int sub_unicode;
-extern int sub_utf8;
-#ifdef USE_ICONV
-extern char *sub_cp;
-#endif
-extern int sub_pos;
-#endif
-
 #ifdef USE_OSD
 extern int osd_level;
 #endif
@@ -191,24 +182,7 @@
 //	{"encode", &encode_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
 	{"vobsub", &vobsub_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
 	{"vobsubid", &vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL},
-#ifdef USE_SUB
-	{"sub", &sub_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
-#ifdef USE_ICONV
-	{"subcp", &sub_cp, CONF_TYPE_STRING, 0, 0, 0, NULL},
-#endif	
-	{"subdelay", &sub_delay, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL},
-	{"subfps", &sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL},
-        {"noautosub", &sub_auto, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-	{"unicode", &sub_unicode, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-	{"nounicode", &sub_unicode, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-	{"utf8", &sub_utf8, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-	{"noutf8", &sub_utf8, CONF_TYPE_FLAG, 0, 1, 0, NULL},
- 	{"subpos",&sub_pos,  CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
-#endif
-#ifdef USE_OSD
-	{"font", &font_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
-	{"ffactor", &font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, NULL},
-#endif
+
 //	{"bg", &play_in_bg, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 //	{"nobg", &play_in_bg, CONF_TYPE_FLAG, 0, 1, 0, NULL},
 	{"sstep", &step_sec, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},

Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -r1.119 -r1.120
--- mencoder.c	15 Apr 2002 02:33:05 -0000	1.119
+++ mencoder.c	17 Apr 2002 21:51:17 -0000	1.120
@@ -148,6 +148,24 @@
 
 static int play_n_frames=-1;
 
+#include "libvo/font_load.h"
+#include "libvo/sub.h"
+
+// sub:
+char *font_name=NULL;
+float font_factor=0.75;
+char *sub_name=NULL;
+float sub_delay=0;
+float sub_fps=0;
+int   sub_auto = 0;
+
+#ifdef USE_SUB
+static subtitle* subtitles=NULL;
+float sub_last_pts = -303;
+#endif
+
+
+
 //char *out_audio_codec=NULL; // override audio codec
 //char *out_video_codec=NULL; // override video codec
 
@@ -218,8 +236,6 @@
 
 //---------------------------------------------------------------------------
 
-void *vo_spudec=NULL;
-
 int dec_audio(sh_audio_t *sh_audio,unsigned char* buffer,int total){
     int size=0;
     int eof=0;
@@ -334,6 +350,21 @@
       gCpuCaps.hasSSE, gCpuCaps.hasSSE2);
 #endif
 
+// check font
+#ifdef USE_OSD
+  if(font_name){
+       vo_font=read_font_desc(font_name,font_factor,verbose>1);
+       if(!vo_font) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name);
+  } else {
+      // try default:
+       vo_font=read_font_desc(get_path("font/font.desc"),font_factor,verbose>1);
+       if(!vo_font)
+       vo_font=read_font_desc(DATADIR"/font/font.desc",font_factor,verbose>1);
+  }
+#endif
+
+  vo_init_osd();
+
   // FIXME: get rid of -dvd and other tricky options and config/playtree
   stream2=open_stream(frameno_filename,0,&i);
   if(stream2){
@@ -481,6 +512,22 @@
 }
 #endif
 
+#ifdef USE_SUB
+// after reading video params we should load subtitles because
+// we know fps so now we can adjust subtitles time to ~6 seconds AST
+// check .sub
+//  current_module="read_subtitles_file";
+  if(sub_name){
+    subtitles=sub_read_file(sub_name, sh_video->fps);
+    if(!subtitles) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadSub,sub_name);
+  } else
+  if(sub_auto) { // auto load sub file ...
+    subtitles=sub_read_file( filename ? sub_filename( get_path("sub/"), filename )
+	                              : "default.sub", sh_video->fps );
+  }
+#endif	
+
+
 // set up output file:
 muxer_f=fopen(out_filename,"wb");
 if(!muxer_f) {
@@ -557,6 +604,8 @@
         mp_msg(MSGT_MENCODER,MSGL_FATAL,"Failed to open the encoder\n");
         mencoder_exit(1,NULL);
     }
+    // append 'expand' filter, it fixes stride problems and renders osd:
+    sh_video->vfilter=vf_open_filter(sh_video->vfilter,"expand","-1:-1:-1:-1:1");
     sh_video->vfilter=append_filters(sh_video->vfilter);
 
 mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
@@ -1027,6 +1076,30 @@
     }
         fflush(stdout);
 
+#ifdef USE_SUB
+  // find sub
+  if(subtitles && d_video->pts>0){
+      float pts=d_video->pts;
+      if(sub_fps==0) sub_fps=sh_video->fps;
+      if (pts > sub_last_pts || pts < sub_last_pts-1.0 ) {
+         find_sub(subtitles,sub_uses_time?(100*(pts+sub_delay)):((pts+sub_delay)*sub_fps)); // FIXME! frame counter...
+         sub_last_pts = pts;
+      }
+  }
+#endif
+
+#ifdef USE_DVDREAD
+// DVD sub:
+ if(vo_spudec){
+     unsigned char* packet=NULL;
+     int len;
+     while((len=ds_get_packet_sub(d_dvdsub,&packet))>0){
+	 mp_msg(MSGT_MENCODER,MSGL_V,"\rDVD sub: len=%d  v_pts=%5.3f  s_pts=%5.3f  \n",len,d_video->pts,d_dvdsub->pts);
+	 spudec_assemble(vo_spudec,packet,len,90000*d_dvdsub->pts);
+     }
+     spudec_heartbeat(vo_spudec,90000*d_video->pts);
+ }
+#endif
 
 
 } // while(!eof)




More information about the MPlayer-cvslog mailing list