From dab27431eccead1ce255b3f82453a0a2e86e0163 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 22 Jun 2010 22:00:28 +0200 Subject: [PATCH 1/1] Kill supported_audio_formats(). It's kind of silly to have a function that just returns a constant string which is known at compile time. Even more silly is to contruct this string using an #ifdef for each optional audio format when we already constructed the space-separated list of supported audio formats during configure. So just use AC_DEFINE_UNQUOTED() in configure.ac to make the list of supported audio formats available via config.h and get rid of supported_audio_formats(). Rename it to SERVER_AUDIO_FORMATS and kill a useless space character while we're at it. --- afh.h | 17 ----------------- afh_common.c | 2 +- command.c | 2 +- configure.ac | 5 ++++- vss.c | 12 ------------ vss.h | 1 - 6 files changed, 6 insertions(+), 33 deletions(-) diff --git a/afh.h b/afh.h index 95cd0514..6dfd03ed 100644 --- a/afh.h +++ b/afh.h @@ -6,23 +6,6 @@ /** \file afh.h structures for audio format handling (para_server) */ -/** \cond */ -#ifdef HAVE_OGGVORBIS -#define OV_AUDIO_FORMAT " ogg" -#else -#define OV_AUDIO_FORMAT "" -#endif - -#ifdef HAVE_FAAD -#define AAC_AUDIO_FORMAT " aac" -#else -#define AAC_AUDIO_FORMAT "" -#endif - -#define SUPPORTED_AUDIO_FORMATS "mp3 " OV_AUDIO_FORMAT AAC_AUDIO_FORMAT " wma " - -/** \endcond */ - /** * The tags used by all audio format handlers. * diff --git a/afh_common.c b/afh_common.c index f28acaaf..498f4921 100644 --- a/afh_common.c +++ b/afh_common.c @@ -89,7 +89,7 @@ void afh_init(void) int i; PARA_INFO_LOG("supported audio formats: %s\n", - SUPPORTED_AUDIO_FORMATS); + SERVER_AUDIO_FORMATS); FOR_EACH_AUDIO_FORMAT(i) { PARA_NOTICE_LOG("initializing %s handler\n", audio_format_name(i)); diff --git a/command.c b/command.c index bcbbc340..1ca5db3c 100644 --- a/command.c +++ b/command.c @@ -268,7 +268,7 @@ int com_si(struct rc4_context *rc4c, int argc, __a_unused char * const * argv) mmd->num_commands, mmd->num_connects, conf.loglevel_arg, - supported_audio_formats(), + SERVER_AUDIO_FORMATS, sender_info ); mutex_unlock(mmd_mutex); diff --git a/configure.ac b/configure.ac index d8f55ce2..be370c71 100644 --- a/configure.ac +++ b/configure.ac @@ -133,7 +133,7 @@ server_errlist_objs="server afh_common mp3_afh vss command net string signal blob playlist sha1 sched acl send_common udp_send color fec server_command_list afs_command_list wma_afh wma_common" server_ldflags="-losl" -server_audio_formats=" mp3 wma" +server_audio_formats="mp3 wma" write_cmdline_objs="add_cmdline(write file_write)" write_errlist_objs="write write_common file_write time fd string sched stdin @@ -737,6 +737,9 @@ AC_DEFINE_UNQUOTED(STATUS_ITEM_ARRAY, [char * array of all status items] ) +AC_DEFINE_UNQUOTED(SERVER_AUDIO_FORMATS, "$server_audio_formats", + [formats supported by para_server and para_afh]) + AC_SUBST(executables, add_para($executables)) diff --git a/vss.c b/vss.c index adc0cb63..e26e8c83 100644 --- a/vss.c +++ b/vss.c @@ -636,18 +636,6 @@ static void vss_eof(struct vss_task *vsst) mmd->events++; } -/** - * Get the list of all supported audio formats. - * - * \return Aa space separated list of all supported audio formats - * It is not allocated at runtime, i.e. there is no need to free - * the returned string in the caller. - */ -const char *supported_audio_formats(void) -{ - return SUPPORTED_AUDIO_FORMATS; -} - static int need_to_request_new_audio_file(struct vss_task *vsst) { struct timeval diff; diff --git a/vss.h b/vss.h index 9412da81..c7e41b9d 100644 --- a/vss.h +++ b/vss.h @@ -13,7 +13,6 @@ unsigned int vss_repos(void); unsigned int vss_paused(void); unsigned int vss_stopped(void); struct timeval *vss_chunk_time(void); -const char *supported_audio_formats(void); /** Stop playing after current audio file. */ #define VSS_NOMORE 1 -- 2.39.2