From: Mike Brady Date: Wed, 24 Aug 2016 15:30:02 +0000 (+0100) Subject: Make it compile -- untested X-Git-Tag: 3.0.d18~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1519f2abe209a456ff12f2afc9a99d5ce6357c0;p=thirdparty%2Fshairport-sync.git Make it compile -- untested --- diff --git a/common.h b/common.h index 625108b0..d67100e7 100644 --- a/common.h +++ b/common.h @@ -48,6 +48,27 @@ enum playback_mode_type { ST_mono, } playback_mode_type; + +// the following enum must _exactly match the snd_pcm_format_t definition in the alsa pcm.h file. + +enum sps_format_t { + SPS_FORMAT_UNKNOWN = -1, SPS_FORMAT_S8 = 0, SPS_FORMAT_U8, SPS_FORMAT_S16_LE, + SPS_FORMAT_S16_BE, SPS_FORMAT_U16_LE, SPS_FORMAT_U16_BE, SPS_FORMAT_S24_LE, + SPS_FORMAT_S24_BE, SPS_FORMAT_U24_LE, SPS_FORMAT_U24_BE, SPS_FORMAT_S32_LE, + SPS_FORMAT_S32_BE, SPS_FORMAT_U32_LE, SPS_FORMAT_U32_BE, SPS_FORMAT_FLOAT_LE, + SPS_FORMAT_FLOAT_BE, SPS_FORMAT_FLOAT64_LE, SPS_FORMAT_FLOAT64_BE, SPS_FORMAT_IEC958_SUBFRAME_LE, + SPS_FORMAT_IEC958_SUBFRAME_BE, SPS_FORMAT_MU_LAW, SPS_FORMAT_A_LAW, SPS_FORMAT_IMA_ADPCM, + SPS_FORMAT_MPEG, SPS_FORMAT_GSM, SPS_FORMAT_SPECIAL = 31, SPS_FORMAT_S24_3LE = 32, + SPS_FORMAT_S24_3BE, SPS_FORMAT_U24_3LE, SPS_FORMAT_U24_3BE, SPS_FORMAT_S20_3LE, + SPS_FORMAT_S20_3BE, SPS_FORMAT_U20_3LE, SPS_FORMAT_U20_3BE, SPS_FORMAT_S18_3LE, + SPS_FORMAT_S18_3BE, SPS_FORMAT_U18_3LE, SPS_FORMAT_U18_3BE, SPS_FORMAT_G723_24, + SPS_FORMAT_G723_24_1B, SPS_FORMAT_G723_40, SPS_FORMAT_G723_40_1B, SPS_FORMAT_DSD_U8, + SPS_FORMAT_DSD_U16_LE, SPS_FORMAT_DSD_U32_LE, SPS_FORMAT_DSD_U16_BE, SPS_FORMAT_DSD_U32_BE, + SPS_FORMAT_LAST = SPS_FORMAT_DSD_U32_BE, SPS_FORMAT_S16 = SPS_FORMAT_S16_LE, SPS_FORMAT_U16 = SPS_FORMAT_U16_LE, SPS_FORMAT_S24 = SPS_FORMAT_S24_LE, + SPS_FORMAT_U24 = SPS_FORMAT_U24_LE, SPS_FORMAT_S32 = SPS_FORMAT_S32_LE, SPS_FORMAT_U32 = SPS_FORMAT_U32_LE, SPS_FORMAT_FLOAT = SPS_FORMAT_FLOAT_LE, + SPS_FORMAT_FLOAT64 = SPS_FORMAT_FLOAT64_LE, SPS_FORMAT_IEC958_SUBFRAME = SPS_FORMAT_IEC958_SUBFRAME_LE +} sps_format_t; + typedef struct { config_t *cfg; char *password; @@ -100,7 +121,7 @@ typedef struct { // audio backend buffer -- the DAC buffer for ALSA long audio_backend_latency_offset; // this will be the offset to compensate for any fixed latency there might be in the audio path uint32_t volume_range_db; // the range, in dB, from max dB to min dB. Zero means use the mixer's native range. - int output_format; + enum sps_format_t output_format; int output_rate; } shairport_cfg; diff --git a/player.c b/player.c index 2083f005..da1a312c 100644 --- a/player.c +++ b/player.c @@ -66,7 +66,6 @@ #include "rtsp.h" #include "alac.h" -#include // parameters from the source static unsigned char *aesiv; @@ -1006,21 +1005,18 @@ static void *player_thread_func(void *arg) { if (config.output_rate!=0) output_sample_ratio = config.output_rate/44100; - max_frame_size_change = 1*sample_ratio; + max_frame_size_change = 1*output_sample_ratio; // we add or subtract one frame at the nominal rate, multiply it by the frame ratio. bytes_per_output_audio_frame = 4; - - switch (config.output_format) { - case SND_PCM_FORMAT_S24_LE: + case SPS_FORMAT_S24_LE: bytes_per_output_audio_frame=6; break; - case SND_PCM_FORMAT_S32_LE: + case SPS_FORMAT_S32_LE: bytes_per_output_audio_frame=8; break; } - - + // check that there are enough buffers to accommodate the desired latency and the latency offset int maximum_latency = config.latency+config.audio_backend_latency_offset; @@ -1270,7 +1266,7 @@ static void *player_thread_func(void *arg) { if (config.no_sync!=0) amount_to_stuff = 0 ; // no stuffing if it's been disabled - if ((amount_to_stuff == 0) && (fix_volume == 0x10000) && ((config.output_rate==0) || (config.output_rate==44100)) && ((config.output_format==0) || (config.output_format==SND_PCM_FORMAT_S16_LE))) { + if ((amount_to_stuff == 0) && (fix_volume == 0x10000) && ((config.output_rate==0) || (config.output_rate==44100)) && ((config.output_format==0) || (config.output_format==SPS_FORMAT_S16_LE))) { // if no stuffing needed and no volume adjustment, then // don't send to stuff_buffer_* and don't copy to outbuf; just send directly to the // output device...