[xiph-cvs] cvs commit: vorbis-tools/ogg123 ao_interface.c ogg123.1 ogg123.c ogg123.h

Stan Seibert volsung at xiph.org
Sun Aug 12 07:04:22 PDT 2001



volsung     01/08/12 07:04:22

  Modified:    ogg123   ao_interface.c ogg123.1 ogg123.c ogg123.h
  Log:
  - Removed support for .ogg123rc.  .libao should be used instead.  Made this
  more clear in the man page.
  - Made explanation of WAV pipe problem more clear in man page.
  - Fixed bug that caused ogg123 to crash if -f was used without specifying
  a driver.

Revision  Changes    Path
1.7       +0 -41     vorbis-tools/ogg123/ao_interface.c

Index: ao_interface.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ao_interface.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ao_interface.c	2001/08/04 02:57:01	1.6
+++ ao_interface.c	2001/08/12 14:04:21	1.7
@@ -57,44 +57,3 @@
 
     return (result);
 }
-
-int get_default_device(void)
-{
-    FILE *fp;
-    char filename[FILENAME_MAX];
-    char line[100];
-    char *device = NULL;
-    char *homedir = getenv("HOME");
-    int i;
-
-    /* Maybe I'm being extremely paranoid, but if ogg123 is ever suid
-       root (to access audio devices), this is a possible buffer overflow. */
-    if (homedir == NULL || strlen(homedir) >= FILENAME_MAX - 10)
-	return -1;
-
-    strncpy(filename, homedir, FILENAME_MAX);
-    strcat(filename, "/.ogg123rc");
-
-    fp = fopen(filename, "r");
-    /* if no ~/.ogg123rc can be found, try /etc/ogg123rc instead */
-    if (!fp) fp = fopen("/etc/ogg123rc", "r");
-
-    /* This is a very simplistic parser. If more options are ever added,
-       it will need a serious overhaul. */
-    if (fp) {
-      while (fgets(line, 100, fp)) {
-	if (strncmp(line, "default_device=", 15) == 0) {
-	  device = &line[15];
-	  for (i = 0; i < strlen(device); i++)
-	    if (device[i] == '\n' || device[i] == '\r')
-	      device[i] = 0;
-	}
-      }
-      fclose(fp);
-    }
-    
-    if (device)
-      return ao_driver_id(device);
-    
-    return -1;
-}

1.10      +6 -4      vorbis-tools/ogg123/ogg123.1

Index: ogg123.1
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.1,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ogg123.1	2001/08/04 23:54:37	1.9
+++ ogg123.1	2001/08/12 14:04:21	1.10
@@ -250,7 +250,7 @@
 .B /etc/ogg123rc
 and
 .B ~/.ogg123rc
-has been deprecated in favor of the configuration system provided by
+has been removed in favor of the configuration system provided by
 libao.
 
 .SH FILES
@@ -266,9 +266,11 @@
 
 .SH BUGS
 
-Note that there are issues with streaming WAV-format audio, so there
-is no way to fix this properly. Use the raw or au output driver if you
-need to use ogg123 in a pipe.
+Piped WAV files may cause strange behavior in other programs.  This is
+because WAV files store the data length in the header.  However, the
+output driver does not know the length when it writes the header, and
+there is no value that means "length unknown".  Use the raw or au
+output driver if you need to use ogg123 in a pipe.
 
 .SH SEE ALSO
 .BR libao.conf(5)

1.45      +18 -16    vorbis-tools/ogg123/ogg123.c

Index: ogg123.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- ogg123.c	2001/08/07 21:37:50	1.44
+++ ogg123.c	2001/08/12 14:04:21	1.45
@@ -14,7 +14,7 @@
  *                                                                  *
  ********************************************************************
 
- last mod: $Id: ogg123.c,v 1.44 2001/08/07 21:37:50 volsung Exp $
+ last mod: $Id: ogg123.c,v 1.45 2001/08/12 14:04:21 volsung Exp $
 
  ********************************************************************/
 
@@ -163,14 +163,19 @@
             current_options = &current->options;
             break;
         case 'f':
-	    info = ao_driver_info(temp_driver_id);
-	    if (info->type == AO_TYPE_FILE) {
-	        free(current->filename);
+	    if (temp_driver_id >= 0) {
+	      info = ao_driver_info(temp_driver_id);
+	      if (info->type == AO_TYPE_FILE) {
+		free(current->filename);
                 current->filename = strdup(optarg);
-	    } else {
+	      } else {
                 fprintf(stderr, "Driver %s is not a file output driver.\n",
                         info->short_name);
                 exit(1);
+	      }
+	    } else {
+	      fprintf(stderr, "Cannot specify output file without specifying a driver.\n");
+	      exit (1);
             }
             break;
         case 'k':
@@ -209,19 +214,16 @@
     }
 
     /* Add last device to device list or use the default device */
+    if (temp_driver_id < 0) 
+        temp_driver_id = ao_default_driver_id();
+	
     if (temp_driver_id < 0) {
-	temp_driver_id = get_default_device();
-	if(temp_driver_id < 0) {
-		temp_driver_id = ao_default_driver_id();
-	}
-	if (temp_driver_id < 0) {
-	    fprintf(stderr,
-		    "Could not load default driver and no ~/.ogg123rc found. Exiting.\n");
-	    exit(1);
-	}
-	opt.outdevices = append_device(opt.outdevices, temp_driver_id, 
-				       temp_options, NULL);
+        fprintf(stderr,
+	      "Could not load default driver.  Audio devices may be already in use.\nExiting.\n");
+        exit(1);
     }
+    opt.outdevices = append_device(opt.outdevices, temp_driver_id, 
+				       temp_options, NULL);
 
     if (optind == argc) {
         usage();

1.9       +0 -1      vorbis-tools/ogg123/ogg123.h

Index: ogg123.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ogg123.h	2001/08/04 02:57:01	1.8
+++ ogg123.h	2001/08/12 14:04:21	1.9
@@ -43,7 +43,6 @@
 void devices_write(void *ptr, size_t size, devices_t * d);
 void usage(void);
 int add_option(ao_option ** op_h, const char *optstring);
-int get_default_device(void);
 void play_file(ogg123_options_t opt);
 int get_tcp_socket(void); /* Will be going soon. */
 FILE *http_open(char *server, int port, char *path); /* ditto */

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list