add version routines to polyplib
authorLennart Poettering <lennart@poettering.net>
Wed, 18 Aug 2004 01:00:18 +0000 (01:00 +0000)
committerLennart Poettering <lennart@poettering.net>
Wed, 18 Aug 2004 01:00:18 +0000 (01:00 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@139 fefdeb5f-60dc-0310-8127-8f9354f1896f

polyp/Makefile.am
polyp/module-protocol-stub.c
polyp/polyplib-context.c
polyp/polyplib-version.h.in [new file with mode: 0644]
polyp/polyplib.h

index 5a49201..ac98e86 100644 (file)
@@ -27,6 +27,8 @@ EXTRA_DIST = polypaudio.pa depmod.py
 bin_PROGRAMS = polypaudio pacat pactl
 noinst_PROGRAMS = mainloop-test mainloop-test-glib pacat-simple parec-simple 
 
+BUILT_SOURCES=polyplib-version.h
+
 polypinclude_HEADERS=polyplib.h \
                polyplib-def.h \
                polyplib-simple.h \
index 3b1a027..e681732 100644 (file)
 #include "util.h"
 #include "modargs.h"
 
-#ifdef USE_PROTOCOL_SIMPLE
+#if defined(USE_PROTOCOL_SIMPLE)
   #include "protocol-simple.h"
   #define protocol_new pa_protocol_simple_new
   #define protocol_free pa_protocol_simple_free
   #define IPV4_PORT 4711
   #define UNIX_SOCKET "/tmp/polypaudio/simple"
   #define MODULE_ARGUMENTS "rate", "format", "channels", "sink", "source", "playback", "record",
+#elif defined(USE_PROTOCOL_CLI)
+  #include "protocol-cli.h" 
+  #define protocol_new pa_protocol_cli_new
+  #define protocol_free pa_protocol_cli_free
+  #define IPV4_PORT 4712
+  #define UNIX_SOCKET "/tmp/polypaudio/cli"
+  #define MODULE_ARGUMENTS 
+#elif defined(USE_PROTOCOL_NATIVE)
+  #include "protocol-native.h"
+  #define protocol_new pa_protocol_native_new
+  #define protocol_free pa_protocol_native_free
+  #define IPV4_PORT 4713
+  #define UNIX_SOCKET "/tmp/polypaudio/native"
+  #define MODULE_ARGUMENTS "public", "cookie",
+#elif defined(USE_PROTOCOL_ESOUND)
+  #include "protocol-esound.h"
+  #include "esound.h"
+  #define protocol_new pa_protocol_esound_new
+  #define protocol_free pa_protocol_esound_free
+  #define IPV4_PORT ESD_DEFAULT_PORT
+  #define UNIX_SOCKET ESD_UNIX_SOCKET_NAME
+  #define MODULE_ARGUMENTS "sink", "source", "public", "cookie",
 #else
-  #ifdef USE_PROTOCOL_CLI
-    #include "protocol-cli.h" 
-    #define protocol_new pa_protocol_cli_new
-    #define protocol_free pa_protocol_cli_free
-    #define IPV4_PORT 4712
-    #define UNIX_SOCKET "/tmp/polypaudio/cli"
-    #define MODULE_ARGUMENTS 
-  #else
-    #ifdef USE_PROTOCOL_NATIVE
-      #include "protocol-native.h"
-      #define protocol_new pa_protocol_native_new
-      #define protocol_free pa_protocol_native_free
-      #define IPV4_PORT 4713
-      #define UNIX_SOCKET "/tmp/polypaudio/native"
-      #define MODULE_ARGUMENTS "public", "cookie",
-    #else
-      #ifdef USE_PROTOCOL_ESOUND
-        #include "protocol-esound.h"
-        #include "esound.h"
-        #define protocol_new pa_protocol_esound_new
-        #define protocol_free pa_protocol_esound_free
-        #define IPV4_PORT ESD_DEFAULT_PORT
-        #define UNIX_SOCKET ESD_UNIX_SOCKET_NAME
-        #define MODULE_ARGUMENTS "sink", "source", "public", "cookie",
-      #else
-        #error "Broken build system" 
-      #endif
-    #endif 
-  #endif
+  #error "Broken build system" 
 #endif
 
 static const char* const valid_modargs[] = {
index fcf3f6b..d048cda 100644 (file)
@@ -532,3 +532,7 @@ struct pa_operation* pa_context_send_simple_command(struct pa_context *c, uint32
 
     return pa_operation_ref(o);
 }
+
+const char* pa_get_library_version(void) {
+    return PACKAGE_VERSION;
+}
diff --git a/polyp/polyplib-version.h.in b/polyp/polyplib-version.h.in
new file mode 100644 (file)
index 0000000..b44dc00
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef foopolyplibversionhfoo /*-*-C-*-*/
+#define foopolyplibversionhfoo
+
+/* $Id$ */
+
+/***
+  This file is part of polypaudio.
+  polypaudio 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 of the License,
+  or (at your option) any later version.
+  polypaudio 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 polypaudio; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+  USA.
+***/
+
+/** \file
+ * Define header version */
+
+/** Return the version of the header files. Keep in mind that this is
+a macro and not a function, so it is impossible to get the pointer of
+it. */
+#define pa_get_headers_version() ("@PACKAGE_VERSION@")
+
+#endif
index daaed64..f4e4193 100644 (file)
@@ -22,6 +22,7 @@
   USA.
 ***/
 
+#include "cdecl.h"
 #include "mainloop-api.h"
 #include "sample.h"
 #include "polyplib-def.h"
 #include "polyplib-introspect.h"
 #include "polyplib-subscribe.h"
 #include "polyplib-scache.h"
+#include "polyplib-version.h"
 
 /** \file
  * Include all polyplib header file at once. The following files are included: \ref mainloop-api.h, \ref sample.h,
  * \ref polyplib-def.h, \ref polyplib-context.h, \ref polyplib-stream.h,
- * \ref polyplib-introspect.h, \ref polyplib-subscribe.h and \ref polyplib-scache.h
+ * \ref polyplib-introspect.h, \ref polyplib-subscribe.h and \ref polyplib-scache.h \ref polyplib-version.h
  * at once */
 
 /** \mainpage
  * synchronous API is available as "polyplib-simple".
  */
 
+PA_C_DECL_BEGIN
+
+/** Return the version of the library the current application is linked to */
+const char* pa_get_library_version(void);
+
+PA_C_DECL_END
+
 #endif