[xiph-cvs] cvs commit: ao/src audio_out.c

Ralph Giles giles at xiph.org
Sun Dec 17 12:28:35 PST 2000



giles       00/12/17 12:28:35

  Modified:    .        AUTHORS CHANGES README configure.in
               doc      API USAGE
               include/ao ao.h
               src      audio_out.c
  Log:
  API change. Rather than passing the driver options as single "key:value"
  string, we have a slot for each in ao_append_option()
  
  corresponding documentation changes, harmonized ao_append_option()
  definition in the header and docs, plus some other doc fixups.

Revision  Changes    Path
1.3       +1 -0      ao/AUTHORS

Index: AUTHORS
===================================================================
RCS file: /usr/local/cvsroot/ao/AUTHORS,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AUTHORS	2000/10/31 07:08:40	1.2
+++ AUTHORS	2000/12/17 20:28:33	1.3
@@ -1,3 +1,4 @@
 Aaron Holtzman
 Stan Seibert <indigo at aztec.asu.edu>
 Jack Moffitt <jack at icecast.org>
+Ralph Giles <giles at ashlu.bc.ca>

1.3       +4 -0      ao/CHANGES

Index: CHANGES
===================================================================
RCS file: /usr/local/cvsroot/ao/CHANGES,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CHANGES	2000/10/31 07:08:40	1.2
+++ CHANGES	2000/12/17 20:28:33	1.3
@@ -1,3 +1,7 @@
+0.6.0 - December 2000
+- slight api modification with ao_append_option()
+- fixed an option leak
+
 0.5.0 - November 2000
 - first official release under the Xiphophorus projects
 

1.3       +1 -1      ao/README

Index: README
===================================================================
RCS file: /usr/local/cvsroot/ao/README,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- README	2000/10/31 07:08:40	1.2
+++ README	2000/12/17 20:28:33	1.3
@@ -1,4 +1,4 @@
-libao - A Cross-platform Audio Library, Version 0.5.0
+libao - A Cross-platform Audio Library, Version 0.6.0
 
 Originally Copyright (C) Aaron Holtzman - May 1999
 Changes Copyright (C) Stan Seibert - July 2000

1.12      +2 -2      ao/configure.in

Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/ao/configure.in,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- configure.in	2000/11/18 04:12:43	1.11
+++ configure.in	2000/12/17 20:28:33	1.12
@@ -1,11 +1,11 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT(src/audio_out.c)
 
-AM_INIT_AUTOMAKE(libao,0.5.0)
+AM_INIT_AUTOMAKE(libao,0.6.0)
 AM_DISABLE_STATIC
 
 dnl Library versioning
-LIB_CURRENT=0
+LIB_CURRENT=1
 LIB_REVISION=0
 LIB_AGE=0
 AC_SUBST(LIB_CURRENT)

1.2       +10 -8     ao/doc/API

Index: API
===================================================================
RCS file: /usr/local/cvsroot/ao/doc/API,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- API	2000/10/31 07:08:41	1.1
+++ API	2000/12/17 20:28:34	1.2
@@ -20,8 +20,8 @@
      initialize it to NULL.
 
    * Through successive calls to ao_append_option(), add any driver
-     specific options you need.  Note that the option string has the
-     form "key:value" where supported keys are listed in the
+     specific options you need.  Note that the options take the
+     form of key-value pairs where supported keys are listed in the
      DRIVER file.
 
    * Call ao_open() and save the returned device pointer.
@@ -82,13 +82,15 @@
 
 ---
 
-int ao_append_options(ao_option_t **options, const char *op_str)
+int ao_append_option(ao_option_t **options, const char *key, const char *value)
 
 Purpose: Append an option to a linked list of options.
 
 Parameters:
-    ao_option_t **options - A pointer to the linked list pointer.
-    const char* op_str - The option string.  Form "key:value".
+    ao_option_t **options - Address of a pointer to the head of the
+                    option list, which may be NULL.
+    const char* key   - The option key
+    const char* value - the setting for this particular option
 
 Returns: 1 if the option was appended successfully
          0 if the option was not appended (either due to memory
@@ -113,8 +115,8 @@
 
 Parameters:
     int driver_id - ID number for the driver to use with this device
-    uint_32 bits - Bits per audio sample (8 or 16)
-    uint_32 rate - Samples per second (44100, 22050, etc.)
+    uint_32 bits  - Bits per audio sample (8 or 16)
+    uint_32 rate  - Samples per second (44100, 22050, etc.)
     uint_32 channels - Audio channels (1 = mono, 2 = stereo)
     ao_option_t *options - Option list
 
@@ -130,7 +132,7 @@
 Purpose: To ouput some audio data to the device.
 
 Parameters:
-    ao_device_t *device - Device pointer
+    ao_device_t *device  - Device pointer
     void *output_samples - Memory buffer containing audio data
     uint_32 num_bytes - Number of bytes of audio data in memory buffer
 

1.2       +1 -1      ao/doc/USAGE

Index: USAGE
===================================================================
RCS file: /usr/local/cvsroot/ao/doc/USAGE,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- USAGE	2000/10/31 07:08:41	1.1
+++ USAGE	2000/12/17 20:28:34	1.2
@@ -7,7 +7,7 @@
 If you are using autoconf and automake, include the ao.m4 project in
 your project (acinclude.m4 is the usual place) and call
 
-AM_PATH_AO(minimum-required-version, action-if-found, action-if-not-found)
+AM_PATH_AO(action-if-found, action-if-not-found)
 
 in your configure.in.  Please look at the ogg123 project for an example
 of how this works.

1.7       +1 -1      ao/include/ao/ao.h

Index: ao.h
===================================================================
RCS file: /usr/local/cvsroot/ao/include/ao/ao.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ao.h	2000/10/31 07:08:43	1.6
+++ ao.h	2000/12/17 20:28:34	1.7
@@ -81,7 +81,7 @@
 ao_info_t *ao_get_driver_info(int driver_id);
 
 /* driver options */
-int ao_append_options(ao_option_t **options, const char *op_str);
+int ao_append_option(ao_option_t **options, const char *key, const char *value);
 void ao_free_options(ao_option_t *options);
 
 /* the meat: open/play/close */

1.9       +13 -38    ao/src/audio_out.c

Index: audio_out.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/audio_out.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- audio_out.c	2000/12/17 13:24:10	1.8
+++ audio_out.c	2000/12/17 20:28:35	1.9
@@ -272,50 +272,25 @@
 
 /* --- Option Functions --- */
 
-ao_option_t* _parse_option(const char* op_str)
+int ao_append_option(ao_option_t **options, const char *key, const char *value)
 {
-	char *copy;
-	char *value_ptr;
-	char *colon;
-        ao_option_t *op = NULL;
-	
-        copy = strdup(op_str);
-	
-        colon = strchr(copy, ':');
-        if (colon != NULL) {
-                value_ptr = colon + 1;
-                *colon = 0x00; // Null terminate the key part
-                
-                /* Allocate the option structure */
-                op = malloc(sizeof(ao_option_t));
-                if (op != NULL) {
-                        op->key = strdup(copy);
-                        op->value = strdup(value_ptr);
-                        op->next = NULL;
-                }
-        }
-	
-        free(copy);
-        return op;
-}
+	ao_option_t *op, *list;
 
+	op = malloc(sizeof(ao_option_t));
+	if (op == NULL) return 0;
 
-int ao_append_option(ao_option_t **options, const char *op_str)
-{
-	ao_option_t *temp;
-
-	temp = _parse_option(op_str);
+	op->key = strdup(key);
+	op->value = strdup(value);
+	op->next = NULL;
 
-	if (temp == NULL)
-		return 0; //Bad option format
-
-	if (*options != NULL) {
-		while ((*options)->next != NULL)
-			*options = (*options)->next;
-		(*options)->next = temp;
+	if ((list = *options) != NULL) {
+		list = *options;
+		while (list->next != NULL) list = list->next;
+		list->next = op;
         } else {
-		*options = temp;
+		*options = op;
         }
+
 
         return 1;
 }

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