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

Stan Seibert volsung at xiph.org
Wed Nov 14 09:11:45 PST 2001



volsung     01/11/14 09:11:44

  Modified:    doc      drivers.html
               src      ao_null.c
  Log:
  The null driver should not be printing junk to stderr unless it is
  requested.  Thanks to Joe Drew <hoserhead at woot.net> for pointing this out.

Revision  Changes    Path
1.6       +5 -1      ao/doc/drivers.html

Index: drivers.html
===================================================================
RCS file: /usr/local/cvsroot/ao/doc/drivers.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- drivers.html	2001/08/31 17:34:15	1.5
+++ drivers.html	2001/11/14 17:11:44	1.6
@@ -32,7 +32,11 @@
 audio data anywhere.
 <p>
 
-<b>Option keys:</b> None.
+<b>Option keys:</b>
+<ul>
+<li>"debug" - Print the number of bytes written to the device to stderr
+when the device is closed.  The option value is ignored.
+</ul>
 <p>
 
 <hr width="50%">

1.7       +15 -4     ao/src/ao_null.c

Index: ao_null.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/ao_null.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ao_null.c	2001/09/05 19:33:51	1.6
+++ ao_null.c	2001/11/14 17:11:44	1.7
@@ -25,6 +25,7 @@
  */
 
 #include <stdio.h>
+#include <string.h>
 #include <ao/ao.h>
 
 static ao_info ao_null_info = {
@@ -42,6 +43,7 @@
 
 typedef struct ao_null_internal {
         unsigned long byte_counter;
+	int debug_output;
 } ao_null_internal;
 
 
@@ -67,7 +69,8 @@
                 return 0; /* Could not initialize device memory */
         
         internal->byte_counter = 0;
-	
+	internal->debug_output = 0;
+
         device->internal = internal;
 
         return 1; /* Memory alloc successful */
@@ -77,7 +80,13 @@
 static int ao_null_set_option(ao_device *device, const char *key, 
                               const char *value)
 {
-	return 1; /* No options! */
+	ao_null_internal *internal = (ao_null_internal *) device->internal;
+
+	if (!strcmp(key, "debug")) {
+		internal->debug_output = 1;
+	}
+
+	return 1;
 }
 
 
@@ -106,8 +115,10 @@
 {
         ao_null_internal *internal = (ao_null_internal *) device->internal;
 
-	fprintf(stderr, "ao_null: %ld bytes sent to null device.\n",
-		internal->byte_counter);
+	if (internal->debug_output) {
+	  fprintf(stderr, "ao_null: %ld bytes sent to null device.\n",
+		  internal->byte_counter);
+	}
 
         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