changeset 1299:fa50e6bc6091

As promised, -afm and -vfm to prefer audio/video driver family, -ac and -vc have higher precedence, so they can override -afm/-vfm.
author atmos4
date Sun, 08 Jul 2001 22:45:56 +0000
parents ea586e73d3b3
children c49c024e68b3
files cfg-mplayer.h mplayer.c
diffstat 2 files changed, 23 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-mplayer.h	Sun Jul 08 19:54:43 2001 +0000
+++ b/cfg-mplayer.h	Sun Jul 08 22:45:56 2001 +0000
@@ -134,7 +134,8 @@
 	{"mc", &default_max_pts_correction, CONF_TYPE_FLOAT, CONF_RANGE, 0, 10},
 	{"fps", &force_fps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0},
 	{"srate", &force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000+1},
-	{"afm", &audio_format, CONF_TYPE_INT, CONF_RANGE, 1, 6}, // This might be removed later - atmos ::
+	{"afm", &audio_family, CONF_TYPE_INT, CONF_RANGE, 0, 9}, // keep ranges in sync
+	{"vfm", &video_family, CONF_TYPE_INT, CONF_RANGE, 0, 6}, // with codec-cfg.c
 	{"ac", &audio_codec, CONF_TYPE_STRING, 0, 0, 0},
 	{"vc", &video_codec, CONF_TYPE_STRING, 0, 0, 0},
 	{"dshow", &allow_dshow, CONF_TYPE_FLAG, 0, 0, 1}, // Is this still needed? atmos ::
--- a/mplayer.c	Sun Jul 08 19:54:43 2001 +0000
+++ b/mplayer.c	Sun Jul 08 22:45:56 2001 +0000
@@ -256,8 +256,11 @@
 //int has_video=1;
 char *audio_codec=NULL; // override audio codec
 char *video_codec=NULL; // override video codec
-int audio_format=0; // override - This might be removed - atmos ::
+int audio_family=-1;     // override audio codec family 
+int video_family=-1;     // override video codec family 
 
+// IMHO this stuff is no longer of use, or is there a special
+// reason why dshow should be completely disabled? - atmos ::
 #ifdef USE_DIRECTSHOW
 int allow_dshow=1;
 #else
@@ -727,7 +730,7 @@
   stream_seek(demuxer->stream,seek_to_byte);
   // Arpi? why is this extra and not in codec selection? - atmos ::
   // Hmm. This should be fixed somehow... I'll check diz later. - arpi
-  if(audio_format) demuxer->audio->type=audio_format; // override audio format
+  if(audio_family!=-1) demuxer->audio->type=audio_family; // override audio format
   if(ds_fill_buffer(demuxer->video)){
     printf("Detected MPEG-PS file format!\n");
     file_format=DEMUXER_TYPE_MPEG_PS;
@@ -1079,9 +1082,16 @@
 if(has_audio){
   // Go through the codec.conf and find the best codec...
   sh_audio->codec=NULL;
+  if(audio_family!=-1) printf("Trying to force audio codec driver family %d ...\n",video_family);
   while(1){
     sh_audio->codec=find_codec(sh_audio->format,NULL,sh_audio->codec,1);
     if(!sh_audio->codec){
+      if(audio_family!=-1) {
+        sh_audio->codec=NULL; /* re-search */
+        printf("Can't find audio codec for forced driver family, fallback to other drivers.\n");
+        audio_family=-1;
+        continue;      
+      }
       printf("Can't find codec for audio format 0x%X !\n",sh_audio->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");
@@ -1089,6 +1099,7 @@
       break;
     }
     if(audio_codec && strcmp(sh_audio->codec->name,audio_codec)) continue;
+    else if(audio_family!=-1 && sh_audio->codec->driver!=audio_family) continue;
     printf("%s audio codec: [%s] drv:%d (%s)\n",audio_codec?"Forcing":"Detected",sh_audio->codec->name,sh_audio->codec->driver,sh_audio->codec->info);
     //has_audio=sh_audio->codec->driver;
     break;
@@ -1110,10 +1121,17 @@
 
 // Go through the codec.conf and find the best codec...
 sh_video->codec=NULL;
+if(video_family!=-1) printf("Trying to force video codec driver family %d ...\n",video_family);
 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(video_family!=-1) {
+      sh_video->codec=NULL; /* re-search */
+      printf("Can't find video codec for forced driver family, fallback to other drivers.\n");
+      video_family=-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");
@@ -1130,6 +1148,7 @@
   // is next line needed anymore? - atmos ::
   if(!allow_dshow && sh_video->codec->driver==4) 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;
   break;
 }
 //has_video=sh_video->codec->driver;