]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Compiles under gcc-10 with -fno-common
authorMike Brady <mikebrady@eircom.net>
Thu, 13 Feb 2020 17:37:41 +0000 (17:37 +0000)
committerMike Brady <mikebrady@eircom.net>
Thu, 13 Feb 2020 17:37:41 +0000 (17:37 +0000)
audio_alsa.c
common.c
common.h
mdns.h
player.c
player.h
rtsp.c
rtsp.h

index 27e35ed827ea17b6d2bf4ee46898a8e093b436ae..39e4d05148c6267424c53c2981a727197c418954 100644 (file)
@@ -123,7 +123,7 @@ int frame_size; // in bytes for interleaved stereo
 int alsa_device_initialised; // boolean to ensure the initialisation is only
                              // done once
 
-enum yndk_type precision_delay_available_status =
+yndk_type precision_delay_available_status =
     YNDK_DONT_KNOW; // initially, we don't know if the device can do precision delay
 
 snd_pcm_t *alsa_handle = NULL;
@@ -159,14 +159,14 @@ int volume_based_mute_is_active =
 snd_pcm_sframes_t (*alsa_pcm_write)(snd_pcm_t *, const void *, snd_pcm_uframes_t) = snd_pcm_writei;
 
 int precision_delay_and_status(snd_pcm_state_t *state, snd_pcm_sframes_t *delay,
-                               enum yndk_type *using_update_timestamps);
+                               yndk_type *using_update_timestamps);
 int standard_delay_and_status(snd_pcm_state_t *state, snd_pcm_sframes_t *delay,
-                              enum yndk_type *using_update_timestamps);
+                              yndk_type *using_update_timestamps);
 
 // use this to allow the use of standard or precision delay calculations, with standard the, uh,
 // standard.
 int (*delay_and_status)(snd_pcm_state_t *state, snd_pcm_sframes_t *delay,
-                        enum yndk_type *using_update_timestamps) = standard_delay_and_status;
+                        yndk_type *using_update_timestamps) = standard_delay_and_status;
 
 // this will return true if the DAC can return precision delay information and false if not
 // if it is not yet known, it will test the output device to find out
@@ -216,7 +216,7 @@ int precision_delay_available() {
       do_play(silence, frames_of_silence);
       pthread_cleanup_pop(1);
       // now we can get the delay, and we'll note if it uses update timestamps
-      enum yndk_type uses_update_timestamps;
+      yndk_type uses_update_timestamps;
       snd_pcm_state_t state;
       snd_pcm_sframes_t delay;
       int ret = precision_delay_and_status(&state, &delay, &uses_update_timestamps);
@@ -392,7 +392,7 @@ format_record fr[] = {
 // be added at the lowest possible level.
 // Hence, selecting the greatest bit depth is always either beneficial or neutral.
 
-enum sps_format_t auto_format_check_sequence[] = {
+sps_format_t auto_format_check_sequence[] = {
     SPS_FORMAT_S32,    SPS_FORMAT_S32_LE,  SPS_FORMAT_S32_BE,  SPS_FORMAT_S24, SPS_FORMAT_S24_LE,
     SPS_FORMAT_S24_BE, SPS_FORMAT_S24_3LE, SPS_FORMAT_S24_3BE, SPS_FORMAT_S16, SPS_FORMAT_S16_LE,
     SPS_FORMAT_S16_BE, SPS_FORMAT_S8,      SPS_FORMAT_U8,
@@ -508,12 +508,12 @@ int actual_open_alsa_device(int do_auto_setup) {
     }
   } else { // auto format
     int number_of_formats_to_try;
-    enum sps_format_t *formats;
+    sps_format_t *formats;
     formats = auto_format_check_sequence;
     number_of_formats_to_try = sizeof(auto_format_check_sequence) / sizeof(sps_format_t);
     int i = 0;
     int format_found = 0;
-    enum sps_format_t trial_format = SPS_FORMAT_UNKNOWN;
+    sps_format_t trial_format = SPS_FORMAT_UNKNOWN;
     while ((i < number_of_formats_to_try) && (format_found == 0)) {
       trial_format = formats[i];
       sf = fr[trial_format].alsa_code;
@@ -1422,7 +1422,7 @@ static void start(__attribute__((unused)) int i_sample_rate,
 }
 
 int standard_delay_and_status(snd_pcm_state_t *state, snd_pcm_sframes_t *delay,
-                              enum yndk_type *using_update_timestamps) {
+                              yndk_type *using_update_timestamps) {
   int ret = 0;
   if (using_update_timestamps)
     *using_update_timestamps = YNDK_NO;
@@ -1444,7 +1444,7 @@ int standard_delay_and_status(snd_pcm_state_t *state, snd_pcm_sframes_t *delay,
 }
 
 int precision_delay_and_status(snd_pcm_state_t *state, snd_pcm_sframes_t *delay,
-                               enum yndk_type *using_update_timestamps) {
+                               yndk_type *using_update_timestamps) {
   snd_pcm_status_t *alsa_snd_pcm_status;
   snd_pcm_status_alloca(&alsa_snd_pcm_status);
 
index ff643ef38b1c29ea4e97c20237da991aebc2cc67..3d41cb6c8904896f166f22fe21f3dd30d7ded04e 100644 (file)
--- a/common.c
+++ b/common.c
 void set_alsa_out_dev(char *);
 #endif
 
+config_t config_file_stuff;
+pthread_t main_thread_id;
+uint64_t fp_time_at_startup, fp_time_at_last_debug_message;
+
 // always lock use this when accessing the fp_time_at_last_debug_message
 static pthread_mutex_t debug_timing_lock = PTHREAD_MUTEX_INITIALIZER;
 
@@ -96,7 +100,7 @@ const char *sps_format_description_string_array[] = {
     "unknown", "S8",      "U8",      "S16", "S16_LE", "S16_BE", "S24",  "S24_LE",
     "S24_BE",  "S24_3LE", "S24_3BE", "S32", "S32_LE", "S32_BE", "auto", "invalid"};
 
-const char *sps_format_description_string(enum sps_format_t format) {
+const char *sps_format_description_string(sps_format_t format) {
   if ((format >= SPS_FORMAT_UNKNOWN) && (format <= SPS_FORMAT_AUTO))
     return sps_format_description_string_array[format];
   else
@@ -1381,7 +1385,7 @@ char *get_version_string() {
   return version_string;
 }
 
-int64_t generate_zero_frames(char *outp, size_t number_of_frames, enum sps_format_t format,
+int64_t generate_zero_frames(char *outp, size_t number_of_frames, sps_format_t format,
                              int with_dither, int64_t random_number_in) {
   // return the last random number used
   // assuming the buffer has been assigned
index 37217ab8aa99a2932a63598a5c87237b90c4eb0f..35b21bd96f421ff3ddf707eef7e468fd664fa37a 100644 (file)
--- a/common.h
+++ b/common.h
@@ -34,24 +34,24 @@ enum dbus_session_type {
 #define sps_extra_code_output_state_cannot_make_ready 32769
 
 // yeah/no/auto
-enum yna_type { YNA_AUTO = -1, YNA_NO = 0, YNA_YES = 1 } yna_type;
+typedef enum { YNA_AUTO = -1, YNA_NO = 0, YNA_YES = 1 } yna_type;
 
 // yeah/no/dont-care
-enum yndk_type { YNDK_DONT_KNOW = -1, YNDK_NO = 0, YNDK_YES = 1 } yndk_type;
+typedef enum { YNDK_DONT_KNOW = -1, YNDK_NO = 0, YNDK_YES = 1 } yndk_type;
 
-enum endian_type {
+typedef enum {
   SS_LITTLE_ENDIAN = 0,
   SS_PDP_ENDIAN,
   SS_BIG_ENDIAN,
 } endian_type;
 
-enum stuffing_type {
+typedef enum {
   ST_basic = 0, // straight deletion or insertion of a frame in a 352-frame packet
   ST_soxr,      // use libsoxr to make a 352 frame packet one frame longer or shorter
   ST_auto,      // use soxr if compiled for it and if the soxr_index is low enough
-} s_type;
+} stuffing_type;
 
-enum playback_mode_type {
+typedef enum {
   ST_stereo = 0,
   ST_mono,
   ST_reverse_stereo,
@@ -59,26 +59,26 @@ enum playback_mode_type {
   ST_right_only,
 } playback_mode_type;
 
-enum volume_control_profile_type {
+typedef enum {
   VCP_standard = 0,
   VCP_flat,
 } volume_control_profile_type;
 
-enum decoders_supported_type {
+typedef enum {
   decoder_hammerton = 0,
   decoder_apple_alac,
 } decoders_supported_type;
 
-enum disable_standby_mode_type {
+typedef enum {
   disable_standby_off = 0,
   disable_standby_auto,
   disable_standby_always
-};
+} disable_standby_mode_type;
 
 // the following enum is for the formats recognised -- currently only S16LE is recognised for input,
 // so these are output only for the present
 
-enum sps_format_t {
+typedef enum {
   SPS_FORMAT_UNKNOWN = 0,
   SPS_FORMAT_S8,
   SPS_FORMAT_U8,
@@ -97,7 +97,7 @@ enum sps_format_t {
   SPS_FORMAT_INVALID,
 } sps_format_t;
 
-const char *sps_format_description_string(enum sps_format_t format);
+const char *sps_format_description_string(sps_format_t format);
 
 typedef struct {
   double resend_control_first_check_time; // wait this long before asking for a missing packet to be resent
@@ -182,12 +182,12 @@ typedef struct {
   int debugger_show_relative_time; // in the debug message, display the time since the last one
   int debugger_show_file_and_line; // in the debug message, display the filename and line number
   int statistics_requested, use_negotiated_latencies;
-  enum playback_mode_type playback_mode;
+  playback_mode_type playback_mode;
   char *cmd_start, *cmd_stop, *cmd_set_volume, *cmd_unfixable;
   char *cmd_active_start, *cmd_active_stop;
   int cmd_blocking, cmd_start_returns_output;
   double tolerance; // allow this much drift before attempting to correct it
-  enum stuffing_type packet_stuffing;
+  stuffing_type packet_stuffing;
   int soxr_delay_index;
   int soxr_delay_threshold; // the soxr delay must be less or equal to this for soxr interpolation
                             // to be enabled under the auto setting
@@ -221,10 +221,10 @@ typedef struct {
                                 // attenuators, lowering the volume, use all the hw attenuation
                                 // before using
                                 // sw attenuation
-  enum volume_control_profile_type volume_control_profile;
+  volume_control_profile_type volume_control_profile;
 
   int output_format_auto_requested; // true if the configuration requests auto configuration
-  enum sps_format_t output_format;
+  sps_format_t output_format;
   int output_rate_auto_requested; // true if the configuration requests auto configuration
   unsigned int output_rate;
 
@@ -240,9 +240,9 @@ typedef struct {
   float loudness_reference_volume_db;
   int alsa_use_hardware_mute;
   double alsa_maximum_stall_time;
-  enum disable_standby_mode_type disable_standby_mode;
+  disable_standby_mode_type disable_standby_mode;
   volatile int keep_dac_busy;
-  enum yna_type use_precision_timing; // defaults to no
+  yna_type use_precision_timing; // defaults to no
 
 #if defined(CONFIG_DBUS_INTERFACE)
   enum dbus_session_type dbus_service_bus_type;
@@ -321,7 +321,7 @@ int64_t r64i();
 void resetFreeUDPPort();
 uint16_t nextFreeUDPPort();
 
-volatile int debuglev;
+extern volatile int debuglev;
 
 void _die(const char *filename, const int linenumber, const char *format, ...);
 void _warn(const char *filename, const int linenumber, const char *format, ...);
@@ -352,17 +352,17 @@ double vol2attn(double vol, long max_db, long min_db);
 uint64_t get_absolute_time_in_fp(void);
 
 // time at startup for debugging timing
-uint64_t fp_time_at_startup, fp_time_at_last_debug_message;
+extern uint64_t fp_time_at_startup, fp_time_at_last_debug_message;
 
 // this is for reading an unsigned 32 bit number, such as an RTP timestamp
 
 uint32_t uatoi(const char *nptr);
 
 // this is for allowing us to cancel the whole program
-pthread_t main_thread_id;
+extern pthread_t main_thread_id;
 
-shairport_cfg config;
-config_t config_file_stuff;
+extern shairport_cfg config;
+extern config_t config_file_stuff;
 
 int config_set_lookup_bool(config_t *cfg, char *where, int *dst);
 
@@ -377,7 +377,7 @@ void shairport_shutdown();
 
 extern sigset_t pselect_sigset;
 
-pthread_mutex_t the_conn_lock;
+extern pthread_mutex_t the_conn_lock;
 
 #define conn_lock(arg)                                                                             \
   pthread_mutex_lock(&the_conn_lock);                                                              \
@@ -412,7 +412,7 @@ void pthread_cleanup_debug_mutex_unlock(void *arg);
 
 #define config_unlock pthread_mutex_unlock(&config.lock)
 
-pthread_mutex_t r64_mutex;
+extern pthread_mutex_t r64_mutex;
 
 #define r64_lock pthread_mutex_lock(&r64_mutex)
 
@@ -423,7 +423,7 @@ char *get_version_string(); // mallocs a string space -- remember to free it aft
 void sps_nanosleep(const time_t sec,
                    const long nanosec); // waits for this time, even through interruptions
 
-int64_t generate_zero_frames(char *outp, size_t number_of_frames, enum sps_format_t format,
+int64_t generate_zero_frames(char *outp, size_t number_of_frames, sps_format_t format,
                              int with_dither, int64_t random_number_in);
 
 void malloc_cleanup(void *arg);
diff --git a/mdns.h b/mdns.h
index 8dc919f26c7f71d0819aff1aa35e1eb7ecf49174..b69f4c85d14aa22d932f6705c5b8428f332ab0df 100644 (file)
--- a/mdns.h
+++ b/mdns.h
@@ -2,7 +2,7 @@
 #define _MDNS_H
 
 #include "config.h"
-#include <player.h>
+#include "player.h"
 #include <stdint.h>
 
 extern int mdns_pid;
index 21eb432f1d981fd3a0bc937942369d9a7ed00dbf..5876bd334a2ccfef2323a7fa9da81f277e0e4339 100644 (file)
--- a/player.c
+++ b/player.c
@@ -660,7 +660,7 @@ int32_t rand_in_range(int32_t exclusive_range_limit) {
   return sp >> 32;
 }
 
-static inline void process_sample(int32_t sample, char **outp, enum sps_format_t format, int volume,
+static inline void process_sample(int32_t sample, char **outp, sps_format_t format, int volume,
                                   int dither, rtsp_conn_info *conn) {
   /*
   {
@@ -1392,7 +1392,7 @@ static inline int32_t mean_32(int32_t a, int32_t b) {
 // formats accepted so far include U8, S8, S16, S24, S24_3LE, S24_3BE and S32
 
 // stuff: 1 means add 1; 0 means do nothing; -1 means remove 1
-static int stuff_buffer_basic_32(int32_t *inptr, int length, enum sps_format_t l_output_format,
+static int stuff_buffer_basic_32(int32_t *inptr, int length, sps_format_t l_output_format,
                                  char *outptr, int stuff, int dither, rtsp_conn_info *conn) {
   int tstuff = stuff;
   char *l_outptr = outptr;
@@ -1458,7 +1458,7 @@ double longest_soxr_execution_time_us = 0.0;
 int64_t packets_processed = 0;
 
 int stuff_buffer_soxr_32(int32_t *inptr, int32_t *scratchBuffer, int length,
-                         enum sps_format_t l_output_format, char *outptr, int stuff, int dither,
+                         sps_format_t l_output_format, char *outptr, int stuff, int dither,
                          rtsp_conn_info *conn) {
   if (scratchBuffer == NULL) {
     die("soxr scratchBuffer not initialised.");
index 3be249dc50b1d711726d6a95f35e62e1ef8c4cf7..b6cae8a967a0f1caee0b835663e07650f9fb52b1 100644 (file)
--- a/player.h
+++ b/player.h
@@ -63,17 +63,17 @@ typedef struct audio_buffer_entry { // decoded audio packets
 
 #define BUFFER_FRAMES 1024
 
-enum audio_stream_type {
+typedef enum {
   ast_unknown,
   ast_uncompressed, // L16/44100/2
   ast_apple_lossless,
-} ast_type;
+} audio_stream_type;
 
 typedef struct {
   int encrypted;
   uint8_t aesiv[16], aeskey[16];
   int32_t fmtp[12];
-  enum audio_stream_type type;
+  audio_stream_type type;
 } stream_cfg;
 
 typedef struct {
diff --git a/rtsp.c b/rtsp.c
index 0bf684572f9509a3e78883265c86293f06177c22..6cf5392762409e440498c2e753daca008d1997c5 100644 (file)
--- a/rtsp.c
+++ b/rtsp.c
@@ -89,7 +89,8 @@ enum rtsp_read_request_response {
   rtsp_read_request_response_error
 };
 
-// Mike Brady's part...
+rtsp_conn_info *playing_conn;
+rtsp_conn_info **conns;
 
 int metadata_running = 0;
 
diff --git a/rtsp.h b/rtsp.h
index 71e5b22cb1a17292f3feada858b982127bab930a..703c100682a78a76d4f7f94a6fd50932329dfba1 100644 (file)
--- a/rtsp.h
+++ b/rtsp.h
@@ -3,8 +3,8 @@
 
 #include "player.h"
 
-rtsp_conn_info *playing_conn;
-rtsp_conn_info **conns;
+extern rtsp_conn_info *playing_conn;
+extern rtsp_conn_info **conns;
 
 void rtsp_listen_loop(void);
 // void rtsp_shutdown_stream(void);