changeset 956:a6cecd9a1bad

'-ao' switch (including '-ao help'), fixing Arpi's bug (short name 'null' for both of oss and null driver ;)
author lgb
date Sun, 03 Jun 2001 00:24:49 +0000
parents 3a3304cd9fd5
children 1a8811b0da3b
files cfg-mplayer.h libao2/ao_oss.c mplayer.c
diffstat 3 files changed, 31 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-mplayer.h	Sat Jun 02 23:30:26 2001 +0000
+++ b/cfg-mplayer.h	Sun Jun 03 00:24:49 2001 +0000
@@ -36,6 +36,7 @@
 	{"o", "Option -o has been renamed to -vo (video-out), use -vo !\n",
             CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
 	{"vo", &video_driver, CONF_TYPE_STRING, 0, 0, 0},
+	{"ao", &audio_driver, CONF_TYPE_STRING, 0, 0, 0},
 	{"dsp", &dsp, CONF_TYPE_STRING, 0, 0, 0},
         {"mixer", &mixer_device, CONF_TYPE_STRING, 0, 0, 0},
 #ifdef HAVE_X11
--- a/libao2/ao_oss.c	Sat Jun 02 23:30:26 2001 +0000
+++ b/libao2/ao_oss.c	Sun Jun 03 00:24:49 2001 +0000
@@ -17,7 +17,7 @@
 static ao_info_t info = 
 {
 	"OSS/ioctl audio output",
-	"null",
+	"oss",
 	"A'rpi",
 	""
 };
--- a/mplayer.c	Sat Jun 02 23:30:26 2001 +0000
+++ b/mplayer.c	Sun Jun 03 00:24:49 2001 +0000
@@ -434,6 +434,7 @@
 char* title="MPlayer";
 // screen info:
 char* video_driver=NULL; //"mga"; // default
+char* audio_driver=NULL;
 int fullscreen=0;
 int vidmode=0;
 int softzoom=0;
@@ -521,7 +522,17 @@
       }
       printf("\n");
       exit(0);
-     }
+    }
+    if(audio_driver && strcmp(audio_driver,"help")==0){
+      printf("Available audio output drivers:\n");
+      i=0;
+      while (audio_out_drivers[i]) {
+        const ao_info_t *info = audio_out_drivers[i++]->info;
+	printf("\t%s\t%s\n", info->short_name, info->name);
+      }
+      printf("\n");
+      exit(0);
+    }
 #ifdef HAVE_GUI
    }
 #endif
@@ -544,12 +555,27 @@
     }
   }
   if(!video_out){
-    printf("Invalid video output driver name: %s\n",video_driver);
+    printf("Invalid video output driver name: %s\nUse '-vo help' to get a list of available video drivers.\n",video_driver);
+    return 0;
+  }
+  
+// check audio_out driver name:
+  if(!audio_driver)
+    audio_out=audio_out_drivers[0];
+  else
+  for (i=0; audio_out_drivers[i] != NULL; i++){
+    const ao_info_t *info = audio_out_drivers[i]->info;
+    if(strcmp(info->short_name,audio_driver) == 0){
+      audio_out = audio_out_drivers[i];break;
+    }
+  }
+  if (!audio_out){
+    printf("Invalid audio output driver name: %s\nUse '-ao help' to get a list of available audio drivers.\n",audio_driver);
     return 0;
   }
 
 // check audio_out
-audio_out=audio_out_drivers[0];
+//audio_out=audio_out_drivers[0];
 
 // check codec.conf
 if(!parse_codec_cfg(get_path("codecs.conf"))){