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

Kenneth C. Arnold kcarnold at xiph.org
Sun Aug 12 11:34:53 PDT 2001



kcarnold    01/08/12 11:34:52

  Modified:    ogg123   Tag: kcarnold_work ao_interface.c ao_interface.h
                        ogg123.1 ogg123.c
  Log:
  Stan Seibert's latest patch, modified for my branch.

Revision  Changes    Path
No                   revision

No                   revision

1.5.2.6   +2 -43     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.5.2.5
retrieving revision 1.5.2.6
diff -u -r1.5.2.5 -r1.5.2.6
--- ao_interface.c	2001/08/12 03:59:31	1.5.2.5
+++ ao_interface.c	2001/08/12 18:34:46	1.5.2.6
@@ -11,7 +11,7 @@
  *                                                                  *
  ********************************************************************
 
- last mod: $Id: ao_interface.c,v 1.5.2.5 2001/08/12 03:59:31 kcarnold Exp $
+ last mod: $Id: ao_interface.c,v 1.5.2.6 2001/08/12 18:34:46 kcarnold Exp $
 
  ********************************************************************/
 
@@ -43,7 +43,7 @@
     return devices_list;
 }
 
-size_t devices_write(void *ptr, size_t size, size_t nmemb, devices_t * d, char iseos)
+size_t devices_write(void *ptr, size_t size, size_t nmemb, devices_t * d)
 {
   size_t i, total = 0;
   devices_t * start = d;
@@ -82,47 +82,6 @@
     free(key);
 
     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;
 }
 
 void close_audio_devices (devices_t *devices)

1.1.2.3   +2 -3      vorbis-tools/ogg123/Attic/ao_interface.h

Index: ao_interface.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/Attic/ao_interface.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- ao_interface.h	2001/08/11 02:55:37	1.1.2.2
+++ ao_interface.h	2001/08/12 18:34:46	1.1.2.3
@@ -11,7 +11,7 @@
  *                                                                  *
  ********************************************************************
  
- last mod: $Id: ao_interface.h,v 1.1.2.2 2001/08/11 02:55:37 kcarnold Exp $
+ last mod: $Id: ao_interface.h,v 1.1.2.3 2001/08/12 18:34:46 kcarnold Exp $
  
 ********************************************************************/
 
@@ -33,9 +33,8 @@
 
 devices_t *append_device(devices_t * devices_list, int driver_id,
                          ao_option * options, char *filename);
-size_t devices_write(void *ptr, size_t size, size_t nmemb, devices_t * d, char iseos);
+size_t devices_write(void *ptr, size_t size, size_t nmemb, devices_t * d);
 int add_option(ao_option ** op_h, const char *optstring);
-int get_default_device(void);
 void ao_onexit (int exitcode, void *devices);
 void close_audio_devices (devices_t *devices);
 void free_audio_devices (devices_t *devices);

1.6.2.2   +13 -7     vorbis-tools/ogg123/ogg123.1

Index: ogg123.1
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.1,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -u -r1.6.2.1 -r1.6.2.2
--- ogg123.1	2001/08/06 21:35:40	1.6.2.1
+++ ogg123.1	2001/08/12 18:34:46	1.6.2.2
@@ -246,13 +246,17 @@
 
 .SH NOTES
 
-The use of
+Configuration for many parameters can be specified in 
 .B /etc/ogg123rc
 and
-.B ~/.ogg123rc
-has been deprecated in favor of the configuration system provided by
-libao.
+.B ~/.ogg123rc.
+To see the available configuration options, use:
+.RS
+.B ogg123 -c
+.RS
+This needs more documentation.
 
+
 .SH FILES
 
 .TP
@@ -266,9 +270,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.39.2.14 +30 -9     vorbis-tools/ogg123/ogg123.c

Index: ogg123.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.c,v
retrieving revision 1.39.2.13
retrieving revision 1.39.2.14
diff -u -r1.39.2.13 -r1.39.2.14
--- ogg123.c	2001/08/12 03:59:31	1.39.2.13
+++ ogg123.c	2001/08/12 18:34:47	1.39.2.14
@@ -14,7 +14,7 @@
  *                                                                  *
  ********************************************************************
 
- last mod: $Id: ogg123.c,v 1.39.2.13 2001/08/12 03:59:31 kcarnold Exp $
+ last mod: $Id: ogg123.c,v 1.39.2.14 2001/08/12 18:34:47 kcarnold Exp $
 
  ********************************************************************/
 
@@ -85,6 +85,7 @@
     {0, 0, 0, 0}
 };
 
+/* configuration interface */
 int ConfigErrorFunc (void *arg, ParseCode pcode, int lineno, char *filename, char *line)
 {
   if (pcode == parse_syserr)
@@ -119,7 +120,21 @@
   }
   ReadConfig (opts, "/etc/ogg123rc");
 }
+/* /configuration interface */
 
+/* buffer interface */
+size_t OutBufferWrite(void *ptr, size_t size, size_t nmemb, void *arg, char iseos)
+{
+  static ogg_int64_t cursample = 0;
+  
+  /* update status */
+  /* update cursample */
+  if (iseos)
+    cursample = 0;
+  devices_write (ptr, size, nmemb, (devices_t *) arg);
+}
+/* /buffer interface */
+
 void usage(void)
 {
   FILE *o = stderr;
@@ -249,16 +264,21 @@
             current_options = &current->options;
             break;
         case 'f':
+	  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);
+	      free(current->filename);
+	      current->filename = strdup(optarg);
             } else {
-	        fprintf(stderr, "Driver %s is not a file output driver.\n",
-			info->short_name);
-	        exit(1);
+	      fprintf(stderr, "Driver %s is not a file output driver.\n",
+		      info->short_name);
+	      exit(1);
             }
-	    break;
+	  } else {
+	    fprintf (stderr, "Cannot specify output file without specifying a driver.\n");
+	    exit (1);
+	  }
+	  break;
         case 'k':
             opt.seekpos = atof(optarg);
             break;
@@ -331,6 +351,7 @@
               "Could not load default driver and no driver specified in config file. Exiting.\n");
       exit(1);
     }
+
     opt.outdevices = append_device(opt.outdevices, temp_driver_id, 
                                    temp_options, NULL);
 
@@ -341,7 +362,7 @@
         opt.outbuffer_size *= 1024;
         opt.outprebuffer = (opt.outprebuffer * (float) opt.outbuffer_size / 100.0f);
         OutBuffer = StartBuffer (opt.outbuffer_size, (int) opt.outprebuffer,
-				 opt.outdevices, (pWriteFunc) devices_write,
+				 opt.outdevices, (pWriteFunc) OutBufferWrite,
                                  NULL, NULL, 4096);
       }
     
@@ -579,7 +600,7 @@
                     if (OutBuffer)
                         SubmitData (OutBuffer, convbuffer, ret, 1);
                     else
-		      devices_write(convbuffer, ret, 1, opt->outdevices, 0);
+		      devices_write(convbuffer, ret, 1, opt->outdevices);
                     nthc = opt->nth - 1;
                   }
                 } while (++ntimesc < opt->ntimes);

--- >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