[xiph-commits] r16795 - in trunk/ao: . include/ao src win32

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Fri Jan 22 23:24:12 PST 2010


Author: xiphmont
Date: 2010-01-22 23:24:12 -0800 (Fri, 22 Jan 2010)
New Revision: 16795

Added:
   trunk/ao/include/ao/ao_private.h
Removed:
   trunk/ao/src/ao_private.h
Modified:
   trunk/ao/configure.ac
   trunk/ao/include/ao/Makefile.am
   trunk/ao/include/ao/ao.h
   trunk/ao/src/config.c
   trunk/ao/win32/ao.dsp
Log:
Make private data private.
Extend now-private portions of API to store channel matrixing data

Add a number of output-channel ordering defines to public interface; 
these are intended to be ORed with format->channels to request specific 
output channel behavior.  The old behavior of passing through with no 
matrixing is thus preserved as the default for apps currently relying on 
that behavior.



Modified: trunk/ao/configure.ac
===================================================================
--- trunk/ao/configure.ac	2010-01-22 07:26:08 UTC (rev 16794)
+++ trunk/ao/configure.ac	2010-01-23 07:24:12 UTC (rev 16795)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 
-AC_INIT([libao],[0.8.9svn],[monty at xiph.org])
+AC_INIT([libao],[0.9.0svn],[monty at xiph.org])
 AM_INIT_AUTOMAKE([gnu 1.6])
 
 AM_MAINTAINER_MODE
@@ -9,9 +9,9 @@
 AM_DISABLE_STATIC
 
 dnl Library versioning
-LIB_CURRENT=3
-LIB_REVISION=4
-LIB_AGE=2
+LIB_CURRENT=4
+LIB_REVISION=0
+LIB_AGE=0
 AC_SUBST(LIB_CURRENT)
 AC_SUBST(LIB_REVISION)
 AC_SUBST(LIB_AGE)
@@ -95,11 +95,10 @@
                 PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
         esac
 fi
-CFLAGS="$CFLAGS $cflags_save"
-DEBUG="$DEBUG $cflags_save"
-PROFILE="$PROFILE $cflags_save"
+CFLAGS="$CFLAGS $cflags_save -DAO_BUILDING_LIBAO"
+DEBUG="$DEBUG $cflags_save -DAO_BUILDING_LIBAO"
+PROFILE="$PROFILE $cflags_save -DAO_BUILDING_LIBAO"
 
-
 AC_SUBST(DEBUG)
 AC_SUBST(PROFILE)
 

Modified: trunk/ao/include/ao/Makefile.am
===================================================================
--- trunk/ao/include/ao/Makefile.am	2010-01-22 07:26:08 UTC (rev 16794)
+++ trunk/ao/include/ao/Makefile.am	2010-01-23 07:24:12 UTC (rev 16795)
@@ -5,4 +5,4 @@
 includedir = $(prefix)/include/ao
 
 include_HEADERS = ao.h plugin.h
-nodist_include_HEADERS = os_types.h
+nodist_include_HEADERS = os_types.h ao_private.h

Modified: trunk/ao/include/ao/ao.h
===================================================================
--- trunk/ao/include/ao/ao.h	2010-01-22 07:26:08 UTC (rev 16794)
+++ trunk/ao/include/ao/ao.h	2010-01-23 07:24:12 UTC (rev 16795)
@@ -1,7 +1,7 @@
 /*
  *
  *  ao.h 
- *    
+ *
  *	Original Copyright (C) Aaron Holtzman - May 1999
  *      Modifications Copyright (C) Stan Seibert - July 2000, July 2001
  *      More Modifications Copyright (C) Jack Moffitt - October 2000
@@ -21,7 +21,7 @@
  *
  *  You should have received a copy of the GNU General Public License
  *  along with GNU Make; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.	
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  */
 #ifndef __AO_H__
@@ -32,7 +32,7 @@
 {
 #endif /* __cplusplus */
 
-#include <stdio.h>	
+#include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
 #include "os_types.h"
@@ -58,6 +58,124 @@
 #define AO_FMT_BIG    2
 #define AO_FMT_NATIVE 4
 
+/* Specify the ordering channels will appear in the stream; not
+   functionally necessary, but saves the application having to
+   byte-twiddle streams into a single supported input order when AO
+   will likelyhave to re-twiddle for specific hardware interfaces */
+
+/* the native channel ordering used by OSS/ALSA/PULSE [L R BL BR C LFE SL SR] */
+#define AO_CHANORDER_LINUX            0x00000100U
+/* FLAC, WAV and WMA use Windows ordering [L R C LFE BL BR SL SR] */
+#define AO_CHANORDER_WIN              0x00000200U
+/* AC3, Vorbis use the classic 8-track theater order [L C R BL BR SL SR LFE] */
+#define AO_CHANORDER_THEATER          0x00000300U
+/* AAC and DTS use variant theater order [C LC RC L R BL BR LFE] */
+#define AO_CHANORDER_AAC              0x00000400U
+/* AIFF[-C] is yet different [L BL C R BR LFE [SL SR?]] */
+#define AO_CHANORDER_AIF              0x00000500U
+
+/* input channel masks; mark which channels are present */
+
+/* not an exhaustive list, but what we will support for now */
+#define AO_CHAN_LEFT                    0x00001000U
+#define AO_CHAN_RIGHT                   0x00002000U
+#define AO_CHAN_CENTER                  0x00004000U
+
+#define AO_CHAN_REAR_SURROUND_LEFT      0x00008000U
+#define AO_CHAN_REAR_SURROUND_RIGHT     0x00010000U
+#define AO_CHAN_REAR_SURROUND_CENTER    0x00020000U
+
+#define AO_CHAN_SIDE_SURROUND_LEFT      0x00040000U
+#define AO_CHAN_SIDE_SURROUND_RIGHT     0x00080000U
+
+#define AO_CHAN_LEFT_OF_CENTER          0x00100000U
+#define AO_CHAN_RIGHT_OF_CENTER         0x00200000U
+
+#define AO_CHAN_LFE                     0x40000000U
+
+
+/* shortcuts */
+
+#define AO_CHANMAP_2_1_STEREO         (AO_CHAN_LEFT |\
+                                       AO_CHAN_RIGHT |\
+                                       AO_CHAN_LFE)
+
+#define AO_CHANMAP_3_0_WIDESTEREO     (AO_CHAN_LEFT |\
+                                       AO_CHAN_RIGHT |\
+                                       AO_CHAN_CENTER)
+
+#define AO_CHANMAP_3_0_SURROUND_DOLBY (AO_CHAN_LEFT |\
+                                       AO_CHAN_RIGHT |\
+                                       AO_CHAN_REAR_SURROUND_CENTER)
+
+#define AO_CHANMAP_4_0_QUAD           (AO_CHAN_LEFT |\
+                                       AO_CHAN_RIGHT |\
+                                       AO_CHAN_REAR_SURROUND_LEFT |\
+                                       AO_CHAN_REAR_SURROUND_RIGHT)
+
+#define AO_CHANMAP_4_0_SURROUND_DOLBY (AO_CHAN_LEFT |\
+                                       AO_CHAN_RIGHT |\
+                                       AO_CHAN_CENTER |\
+                                       AO_CHAN_REAR_SURROUND_CENTER)
+
+#define AO_CHANMAP_4_1_QUAD           (AO_CHAN_LEFT |\
+                                       AO_CHAN_RIGHT |\
+                                       AO_CHAN_REAR_SURROUND_LEFT |\
+                                       AO_CHAN_REAR_SURROUND_RIGHT |\
+                                       AO_CHAN_LFE)
+
+#define AO_CHANMAP_4_1_SURROUND_DOLBY (AO_CHAN_LEFT |\
+                                       AO_CHAN_RIGHT |\
+                                       AO_CHAN_CENTER |\
+                                       AO_CHAN_REAR_SURROUND_CENTER |\
+                                       AO_CHAN_LFE)
+
+#define AO_CHANMAP_5_0_SURROUND       (AO_CHAN_LEFT |\
+                                       AO_CHAN_CENTER |\
+                                       AO_CHAN_RIGHT |\
+                                       AO_CHAN_REAR_SURROUND_LEFT |\
+                                       AO_CHAN_REAR_SURROUND_RIGHT)
+
+#define AO_CHANMAP_5_1_SURROUND       (AO_CHAN_LEFT |\
+                                       AO_CHAN_CENTER |\
+                                       AO_CHAN_RIGHT |\
+                                       AO_CHAN_REAR_SURROUND_LEFT |\
+                                       AO_CHAN_REAR_SURROUND_RIGHT |\
+                                       AO_CHAN_LFE)
+
+#define AO_CHANMAP_6_0_SURROUND_HEX   (AO_CHAN_LEFT |\
+                                       AO_CHAN_RIGHT |\
+                                       AO_CHAN_SIDE_SURROUND_LEFT |\
+                                       AO_CHAN_SIDE_SURROUND_RIGHT |\
+                                       AO_CHAN_REAR_SURROUND_LEFT |\
+                                       AO_CHAN_REAR_SURROUND_RIGHT)
+
+#define AO_CHANMAP_6_1_SURROUND       (AO_CHAN_LEFT |\
+                                       AO_CHAN_RIGHT |\
+                                       AO_CHAN_CENTER |\
+                                       AO_CHAN_SIDE_SURROUND_LEFT |\
+                                       AO_CHAN_SIDE_SURROUND_RIGHT |\
+                                       AO_CHAN_REAR_SURROUND_CENTER |\
+                                       AO_CHAN_LFE)
+
+#define AO_CHANMAP_7_1_SURROUND       (AO_CHAN_LEFT |\
+                                       AO_CHAN_CENTER |\
+                                       AO_CHAN_RIGHT |\
+                                       AO_CHAN_REAR_SURROUND_LEFT |\
+                                       AO_CHAN_REAR_SURROUND_RIGHT |\
+                                       AO_CHAN_SIDE_SURROUND_LEFT |\
+                                       AO_CHAN_SIDE_SURROUND_RIGHT |\
+                                       AO_CHAN_LFE)
+
+#define AO_CHANMAP_7_1_WIDEDTS        (AO_CHAN_LEFT |\
+                                       AO_CHAN_CENTER |\
+                                       AO_CHAN_RIGHT |\
+                                       AO_CHAN_LEFT_OF_CENTER |\
+                                       AO_CHAN_RIGHT_OF_CENTER |\
+                                       AO_CHAN_REAR_SURROUND_LEFT |\
+                                       AO_CHAN_REAR_SURROUND_RIGHT |\
+                                       AO_CHAN_LFE)
+
 /* --- Structures --- */
 
 typedef struct ao_info {
@@ -72,21 +190,9 @@
 	int  option_count;
 } ao_info;
 
-typedef struct ao_functions ao_functions; /* Forward decl to make C happy */
+typedef struct ao_functions ao_functions;
+typedef struct ao_device ao_device;
 
-typedef struct ao_device {
-	int  type; /* live output or file output? */
-	int  driver_id;
-	ao_functions *funcs;
-	FILE *file; /* File for output if this is a file driver */
-	int  client_byte_format;
-	int  machine_byte_format;
-	int  driver_byte_format;
-	char *swap_buffer;
-	int  swap_buffer_size; /* Bytes allocated to swap_buffer */
-	void *internal; /* Pointer to driver-specific data */
-} ao_device;
-
 typedef struct ao_sample_format {
 	int bits; /* bits per sample */
 	int rate; /* samples per second (in a single channel) */
@@ -94,26 +200,16 @@
 	int byte_format; /* Byte ordering in sample, see constants below */
 } ao_sample_format;
 
-struct ao_functions {
-	int (*test)(void);
-	ao_info* (*driver_info)(void);
-	int (*device_init)(ao_device *device);
-	int (*set_option)(ao_device *device, const char *key, 
-			  const char *value);
-	int (*open)(ao_device *device, ao_sample_format *format);
-	int (*play)(ao_device *device, const char *output_samples,
-			   uint_32 num_bytes);
-	int (*close)(ao_device *device);
-	void (*device_clear)(ao_device *device);
-	char* (*file_extension)(void);
-};
-
 typedef struct ao_option {
 	char *key;
 	char *value;
 	struct ao_option *next;
-} ao_option;		
+} ao_option;
 
+#if defined(AO_BUILDING_LIBAO)
+#include "ao_private.h"
+#endif
+
 /* --- Functions --- */
 
 /* library setup/teardown */

Copied: trunk/ao/include/ao/ao_private.h (from rev 16776, trunk/ao/src/ao_private.h)
===================================================================
--- trunk/ao/include/ao/ao_private.h	                        (rev 0)
+++ trunk/ao/include/ao/ao_private.h	2010-01-23 07:24:12 UTC (rev 16795)
@@ -0,0 +1,100 @@
+/*
+ *
+ *  ao_private.c
+ *
+ *       Copyright (C) Stan Seibert - July 2001
+ *
+ *  This file is part of libao, a cross-platform audio output library.  See
+ *  README for a history of this source code.
+ *
+ *  libao is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  libao is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GNU Make; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef __AO_PRIVATE_H__
+#define __AO_PRIVATE_H__
+
+/* --- Operating System Compatibility --- */
+
+/* 
+  OpenBSD systems with a.out binaries require dlsym()ed symbols to be
+  prepended with an underscore, so we need the following nasty #ifdef
+  hack.
+*/
+#if defined(__OpenBSD__) && !defined(__ELF__)
+#define dlsym(h,s) dlsym(h, "_" s)
+#endif
+
+/* RTLD_NOW is the preferred symbol resolution behavior, but
+ * some platforms do not support it.  The autoconf script will have
+ * already defined DLOPEN_FLAG if the default is unacceptable on the
+ * current platform.
+ *
+ * ALSA requires RTLD_GLOBAL.
+ */
+#if !defined(DLOPEN_FLAG)
+#define DLOPEN_FLAG (RTLD_NOW | RTLD_GLOBAL)
+#endif
+
+/* --- Constants --- */
+
+#ifndef AO_SYSTEM_CONFIG
+#define AO_SYSTEM_CONFIG "/etc/libao.conf"
+#endif
+#ifndef AO_USER_CONFIG
+#define AO_USER_CONFIG   "/.libao"
+#endif
+
+/* --- Structures --- */
+
+typedef struct ao_config {
+	char *default_driver;
+} ao_config;
+
+struct ao_device {
+	int  type; /* live output or file output? */
+	int  driver_id;
+	ao_functions *funcs;
+	FILE *file; /* File for output if this is a file driver */
+	int  client_byte_format;
+	int  machine_byte_format;
+	int  driver_byte_format;
+	char *swap_buffer;
+	int  swap_buffer_size; /* Bytes allocated to swap_buffer */
+        int  *output_channels;
+        int  *permute_channels;
+	void *internal; /* Pointer to driver-specific data */
+};
+
+struct ao_functions {
+	int (*test)(void);
+	ao_info* (*driver_info)(void);
+	int (*device_init)(ao_device *device);
+	int (*set_option)(ao_device *device, const char *key,
+			  const char *value);
+	int (*open)(ao_device *device, ao_sample_format *format);
+	int (*play)(ao_device *device, const char *output_samples,
+			   uint_32 num_bytes);
+	int (*close)(ao_device *device);
+	void (*device_clear)(ao_device *device);
+	char* (*file_extension)(void);
+};
+
+/* --- Functions --- */
+
+void read_config_files (ao_config *config);
+int read_config_file(ao_config *config, const char *config_file);
+
+#endif /* __AO_PRIVATE_H__ */

Deleted: trunk/ao/src/ao_private.h
===================================================================
--- trunk/ao/src/ao_private.h	2010-01-22 07:26:08 UTC (rev 16794)
+++ trunk/ao/src/ao_private.h	2010-01-23 07:24:12 UTC (rev 16795)
@@ -1,71 +0,0 @@
-/*
- *
- *  ao_private.c
- *
- *       Copyright (C) Stan Seibert - July 2001
- *
- *  This file is part of libao, a cross-platform audio output library.  See
- *  README for a history of this source code.
- *
- *  libao is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  libao is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with GNU Make; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#ifndef __AO_PRIVATE_H__
-#define __AO_PRIVATE_H__
-
-/* --- Operating System Compatibility --- */
-
-/* 
-  OpenBSD systems with a.out binaries require dlsym()ed symbols to be
-  prepended with an underscore, so we need the following nasty #ifdef
-  hack.
-*/
-#if defined(__OpenBSD__) && !defined(__ELF__)
-#define dlsym(h,s) dlsym(h, "_" s)
-#endif
-
-/* RTLD_NOW is the preferred symbol resolution behavior, but
- * some platforms do not support it.  The autoconf script will have
- * already defined DLOPEN_FLAG if the default is unacceptable on the
- * current platform.
- *
- * ALSA requires RTLD_GLOBAL.
- */
-#if !defined(DLOPEN_FLAG)
-#define DLOPEN_FLAG (RTLD_NOW | RTLD_GLOBAL)
-#endif
-
-/* --- Constants --- */
-
-#ifndef AO_SYSTEM_CONFIG
-#define AO_SYSTEM_CONFIG "/etc/libao.conf"
-#endif
-#ifndef AO_USER_CONFIG
-#define AO_USER_CONFIG   "/.libao"
-#endif
-
-/* --- Structures --- */
-
-typedef struct ao_config {
-	char *default_driver;
-} ao_config;
-
-/* --- Functions --- */
-
-void read_config_files (ao_config *config);
-int read_config_file(ao_config *config, const char *config_file);
-
-#endif /* __AO_PRIVATE_H__ */

Modified: trunk/ao/src/config.c
===================================================================
--- trunk/ao/src/config.c	2010-01-22 07:26:08 UTC (rev 16794)
+++ trunk/ao/src/config.c	2010-01-23 07:24:12 UTC (rev 16795)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "ao_private.h"
+#include "ao.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>

Modified: trunk/ao/win32/ao.dsp
===================================================================
--- trunk/ao/win32/ao.dsp	2010-01-22 07:26:08 UTC (rev 16794)
+++ trunk/ao/win32/ao.dsp	2010-01-23 07:24:12 UTC (rev 16795)
@@ -152,7 +152,7 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\src\ao_private.h
+SOURCE=..\include\ao\ao_private.h
 # End Source File
 # Begin Source File
 



More information about the commits mailing list