[Mplayer-cvslog] CVS: main mplayer.c,1.346,1.347 mencoder.c,1.50,1.51

Atmosfear atmos4 at mplayer.dev.hu
Mon Dec 24 15:01:57 CET 2001


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

Modified Files:
	mplayer.c mencoder.c 
Log Message:
fixed priority support, tested with -vfm -vc, etc.

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.346
retrieving revision 1.347
diff -u -r1.346 -r1.347
--- mplayer.c	19 Dec 2001 16:55:31 -0000	1.346
+++ mplayer.c	24 Dec 2001 14:01:55 -0000	1.347
@@ -1020,28 +1020,48 @@
 // Go through the codec.conf and find the best codec...
 sh_video->codec=NULL;
 if(video_family!=-1) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_TryForceVideoFmt,video_family);
+{ /* local vars */
+short bestprio=-1;
+struct codecs_st *bestcodec=NULL;
 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(!sh_video->codec/* && bestprio==-1*/){
     if(video_family!=-1) {
-      sh_video->codec=NULL; /* re-search */
+      //sh_video->codec=NULL; /* re-search */
       mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_CantFindVfmtFallback);
       video_family=-1;
       continue;      
     }
+		if(bestprio==-1 || !video_codec) {
     mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantFindVideoCodec,sh_video->format);
     mp_msg(MSGT_CPLAYER,MSGL_HINT, MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("codecs.conf"));
     goto goto_next_file; // exit_player(MSGTR_Exit_error);
-  }
-  // is next line needed anymore? - atmos ::
-  if(!allow_dshow && sh_video->codec->driver==VFM_DSHOW) continue; // skip DShow
-  else if(video_codec && strcmp(sh_video->codec->name,video_codec)) continue;
-  else if(video_family!=-1 && sh_video->codec->driver!=video_family) continue;
+    }
+  } else {
+    // is next line needed anymore? - atmos ::
+    if(!allow_dshow && sh_video->codec->driver==VFM_DSHOW) continue; // skip DShow
+    else if(video_codec && strcmp(sh_video->codec->name,video_codec)) continue;
+    else if(video_family!=-1 && sh_video->codec->driver!=video_family) continue;
+	  else if(video_family==-1 && !video_codec && sh_video->codec->priority) {
+	    if(sh_video->codec->priority > bestprio) {
+        //printf("\n\n!!! setting bestprio from %d to %d for %s!!!\n\n", bestprio, sh_video->codec->priority, sh_video->codec->name);
+        bestprio=sh_video->codec->priority;
+        bestcodec=sh_video->codec;
+      }
+      continue;
+    }
+  } /* sh_video->codec */
   break;
 }
+if(bestprio!=-1) {
+  //printf("chose codec %s by priority.\n", bestcodec->name);
+  sh_video->codec=bestcodec;
+}
+
+} /* end local vars */
 
-mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s video codec: [%s] drv:%d (%s)\n",video_codec?"Forcing":"Detected",sh_video->codec->name,sh_video->codec->driver,sh_video->codec->info);
+mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s video codec: [%s] drv:%d prio:%d (%s)\n",video_codec?"Forcing":"Detected",sh_video->codec->name,sh_video->codec->driver,sh_video->codec->priority!=-1?sh_video->codec->priority:0,sh_video->codec->info);
 
 for(i=0;i<CODECS_MAX_OUTFMT;i++){
 //    int ret;

Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- mencoder.c	24 Dec 2001 10:54:11 -0000	1.50
+++ mencoder.c	24 Dec 2001 14:01:55 -0000	1.51
@@ -411,7 +411,7 @@
 if(out_video_codec>1){
 
 if(video_family!=-1) mp_msg(MSGT_MENCODER,MSGL_INFO,MSGTR_TryForceVideoFmt,video_family);
-{
+{ /* local vars */
 short bestprio=-1;
 struct codecs_st *bestcodec=NULL;
 while(1){
@@ -419,23 +419,28 @@
     sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,sh_video->codec,0);
   if(!sh_video->codec){
     if(video_family!=-1) {
-      sh_video->codec=NULL; /* re-search */
+      //sh_video->codec=NULL; /* re-search */
       mp_msg(MSGT_MENCODER,MSGL_WARN,MSGTR_CantFindVfmtFallback);
       video_family=-1;
       continue;      
     }
-    mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantFindVideoCodec,sh_video->format);
-    mp_msg(MSGT_MENCODER,MSGL_HINT, MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("codecs.conf"));
-    exit(1);
-  }
-  if(video_codec && strcmp(sh_video->codec->name,video_codec)) continue;
-  else if(video_family!=-1 && sh_video->codec->driver!=video_family) continue;
-  else if(sh_video->codec && sh_video->codec->priority > bestprio) {
-    //printf("\n\n!!! setting bestprio from %d to %d for %s!!!\n\n", bestprio, sh_video->codec->priority, sh_video->codec->name);
-    bestprio=sh_video->codec->priority;
-    bestcodec=sh_video->codec;
-    continue;
-  }
+    if(bestprio==-1 || !video_codec) {
+      mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantFindVideoCodec,sh_video->format);
+      mp_msg(MSGT_MENCODER,MSGL_HINT, MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("codecs.conf"));
+      exit(1);
+    }
+  } else {
+    if(video_codec && strcmp(sh_video->codec->name,video_codec)) continue;
+    else if(video_family!=-1 && sh_video->codec->driver!=video_family) continue;
+    else if(video_family==-1 && !video_codec && sh_video->codec->priority) {
+	    if(sh_video->codec->priority > bestprio) {
+        //printf("\n\n!!! setting bestprio from %d to %d for %s!!!\n\n", bestprio, sh_video->codec->priority, sh_video->codec->name);
+        bestprio=sh_video->codec->priority;
+        bestcodec=sh_video->codec;
+      }
+      continue;
+    }
+  } /* sh_video->codec */
   break;
 }
 if(bestprio!=-1) {
@@ -443,7 +448,7 @@
   sh_video->codec=bestcodec;
 }
 
-}
+} /* end local vars */
 
 mp_msg(MSGT_MENCODER,MSGL_INFO,"%s video codec: [%s] drv:%d prio:%d (%s)\n",video_codec?"Forcing":"Detected",sh_video->codec->name,sh_video->codec->driver,sh_video->codec->priority!=-1?sh_video->codec->priority:0,sh_video->codec->info);
 




More information about the MPlayer-cvslog mailing list