Kill supported_audio_formats().
authorAndre Noll <maan@systemlinux.org>
Tue, 22 Jun 2010 20:00:28 +0000 (22:00 +0200)
committerAndre Noll <maan@systemlinux.org>
Tue, 13 Jul 2010 12:40:41 +0000 (14:40 +0200)
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
afh_common.c
command.c
configure.ac
vss.c
vss.h

diff --git a/afh.h b/afh.h
index 95cd0514224f0ab462daeff25011f742bbad44d3..6dfd03ed0d89d15568fa2096ada83909531d5bab 100644 (file)
--- 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.
  *
index f28acaafda9f74138b5871d3d1d2590608135054..498f492142d9fe14ff562dc33c8c7e2acb4cc2db 100644 (file)
@@ -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));
index bcbbc3406def48eba64adeb31eecd81997f634b2..1ca5db3c97aea79477fd935569e989de7052064d 100644 (file)
--- 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);
index d8f55ce26c5967cf16075323283db93cae7da98c..be370c715eeb33a1a3b85571942d462a25e2fd82 100644 (file)
@@ -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 adc0cb63cea1204d3bfef811c492b807b74001c2..e26e8c8303c2c228a59adfaf64e6b7c5fd7b0fdf 100644 (file)
--- 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 9412da81a3841425258c07a52e8a1efeca6f5beb..c7e41b9d6159c8f93faae559e4a1e16645391554 100644 (file)
--- 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