[Mplayer-cvslog] CVS: main mplayer.c,1.171,1.172 cfg-mplayer.h,1.65,1.66

LGB Z lgb at mplayer.dev.hu
Fri Jul 6 23:17:25 CEST 2001


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

Modified Files:
	mplayer.c cfg-mplayer.h 
Log Message:
-vcodec option (maybe some other name would be better though) to select between driver types without editing codecs.conf. mplayer will default to normal codec search loop if it does not find codec for the specified driver type. config range checking for the parameter (an integer) should be cleaned, IMHO

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -r1.171 -r1.172
--- mplayer.c	2 Jul 2001 19:25:34 -0000	1.171
+++ mplayer.c	6 Jul 2001 21:17:22 -0000	1.172
@@ -317,6 +317,8 @@
 //int has_video=1;
 int audio_format=0; // override
 
+int force_vcodec=-1;
+
 #ifdef USE_DIRECTSHOW
 int allow_dshow=1;
 #else
@@ -1164,10 +1166,17 @@
 
 // Go through the codec.conf and find the best codec...
 sh_video->codec=NULL;
+if (force_vcodec!=-1) printf("Trying to use forced video codec driver %d ...\n",force_vcodec);
 while(1){
   sh_video->codec=find_codec(sh_video->format,
     sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,sh_video->codec,0);
   if(!sh_video->codec){
+    if(force_vcodec!=-1) {
+      sh_video->codec=NULL; /* re-search */
+      printf("Can't find video codec for forced driver %d, defaulting to other drivers.\n",force_vcodec);
+      force_vcodec=-1;
+      continue;      
+    }
     printf("Can't find codec for video format 0x%X !\n",sh_video->format);
       printf("*** Try to upgrade %s from DOCS/codecs.conf\n",get_path("codecs.conf"));
       printf("*** If it's still not OK, then read DOCS/CODECS!\n");
@@ -1181,6 +1190,8 @@
     #endif
     exit(1);
   }
+  if(sh_video->codec->driver==force_vcodec) break;  /* OK, we find our codec */
+  if(force_vcodec!=-1&&sh_video->codec->driver!=force_vcodec) continue;
   if(!allow_dshow && sh_video->codec->driver==4) continue; // skip DShow
   break;
 }

Index: cfg-mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mplayer.h,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- cfg-mplayer.h	3 Jul 2001 23:44:19 -0000	1.65
+++ cfg-mplayer.h	6 Jul 2001 21:17:22 -0000	1.66
@@ -40,6 +40,8 @@
 extern char *mDisplayName;
 #endif
 
+extern int force_vcodec;
+
 struct config conf[]={
 	/* name, pointer, type, flags, min, max */
 	{"include", cfg_include, CONF_TYPE_FUNC_PARAM, 0, 0, 0}, /* this must be the first!!! */
@@ -55,6 +57,7 @@
 	{"display", &mDisplayName, CONF_TYPE_STRING, 0, 0, 0},
 #endif
 	{"osdlevel", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 2 },
+	{"vcodec", &force_vcodec, CONF_TYPE_INT, CONF_RANGE, 1, 5 },
 #ifdef HAVE_LIBCSS
         {"dvdauth", &dvd_auth_device, CONF_TYPE_STRING, 0, 0, 0},
         {"dvdkey", &dvdimportkey, CONF_TYPE_STRING, 0, 0, 0},


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list