From befd734aac2c925df9c5701d1ddfb3063b45ac76 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 18 Aug 2004 01:00:18 +0000 Subject: add version routines to polyplib git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@139 fefdeb5f-60dc-0310-8127-8f9354f1896f --- polyp/Makefile.am | 2 ++ polyp/module-protocol-stub.c | 54 ++++++++++++++++++++------------------------ polyp/polyplib-context.c | 4 ++++ polyp/polyplib-version.h.in | 33 +++++++++++++++++++++++++++ polyp/polyplib.h | 11 ++++++++- 5 files changed, 73 insertions(+), 31 deletions(-) create mode 100644 polyp/polyplib-version.h.in (limited to 'polyp') diff --git a/polyp/Makefile.am b/polyp/Makefile.am index 5a49201a..ac98e86e 100644 --- a/polyp/Makefile.am +++ b/polyp/Makefile.am @@ -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 \ diff --git a/polyp/module-protocol-stub.c b/polyp/module-protocol-stub.c index 3b1a0270..e681732f 100644 --- a/polyp/module-protocol-stub.c +++ b/polyp/module-protocol-stub.c @@ -36,43 +36,37 @@ #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[] = { diff --git a/polyp/polyplib-context.c b/polyp/polyplib-context.c index fcf3f6b9..d048cda9 100644 --- a/polyp/polyplib-context.c +++ b/polyp/polyplib-context.c @@ -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 index 00000000..b44dc008 --- /dev/null +++ b/polyp/polyplib-version.h.in @@ -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 diff --git a/polyp/polyplib.h b/polyp/polyplib.h index daaed649..f4e41934 100644 --- a/polyp/polyplib.h +++ b/polyp/polyplib.h @@ -22,6 +22,7 @@ USA. ***/ +#include "cdecl.h" #include "mainloop-api.h" #include "sample.h" #include "polyplib-def.h" @@ -30,11 +31,12 @@ #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 @@ -81,4 +83,11 @@ * 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 -- cgit