diff options
-rw-r--r-- | src/audioOutputs/audioOutput_jack.c | 17 | ||||
-rw-r--r-- | src/audioOutputs/audioOutput_shout.c | 4 | ||||
-rw-r--r-- | src/inputPlugins/mod_plugin.c | 17 | ||||
-rw-r--r-- | src/inputPlugins/wavpack_plugin.c | 12 | ||||
-rw-r--r-- | src/pcm_utils.c | 19 |
5 files changed, 42 insertions, 27 deletions
diff --git a/src/audioOutputs/audioOutput_jack.c b/src/audioOutputs/audioOutput_jack.c index 8818bb739..77ee077a4 100644 --- a/src/audioOutputs/audioOutput_jack.c +++ b/src/audioOutputs/audioOutput_jack.c @@ -31,8 +31,8 @@ static const size_t sample_size = sizeof(jack_default_audio_sample_t); typedef struct _JackData { /* configuration */ - char *name; - char *output_ports[2]; + const char *name; + const char *output_ports[2]; int ringbuf_sz; /* locks */ @@ -52,6 +52,7 @@ typedef struct _JackData { static JackData *newJackData(void) { JackData *ret; + ret = xcalloc(sizeof(JackData), 1); ret->name = "mpd"; @@ -97,12 +98,12 @@ static void freeJackData(AudioOutput *audioOutput) freeJackClient(jd); if (strcmp(jd->name, "mpd") != 0) - free(jd->name); + free(deconst_ptr(jd->name)); for ( i = ARRAY_SIZE(jd->output_ports); --i >= 0; ) { if (!jd->output_ports[i]) continue; - free(jd->output_ports[i]); + free(deconst_ptr(jd->output_ports[i])); } free(jd); @@ -267,7 +268,7 @@ static int jack_testDefault(void) static int connect_jack(AudioOutput *audioOutput) { JackData *jd = audioOutput->data; - char **jports; + const char **jports; char *port_name; if ( (jd->client = jack_client_new(jd->name)) == NULL ) { @@ -304,9 +305,9 @@ static int connect_jack(AudioOutput *audioOutput) /* hay que buscar que hay */ if ( !jd->output_ports[1] - && (jports = (char **)jack_get_ports(jd->client, NULL, NULL, - JackPortIsPhysical| - JackPortIsInput)) ) { + && (jports = jack_get_ports(jd->client, NULL, NULL, + JackPortIsPhysical| + JackPortIsInput)) ) { jd->output_ports[0] = jports[0]; jd->output_ports[1] = jports[1] ? jports[1] : jports[0]; DEBUG("output_ports: %s %s\n", diff --git a/src/audioOutputs/audioOutput_shout.c b/src/audioOutputs/audioOutput_shout.c index b65a8253f..2ee942809 100644 --- a/src/audioOutputs/audioOutput_shout.c +++ b/src/audioOutputs/audioOutput_shout.c @@ -636,8 +636,8 @@ static int myShout_play(AudioOutput * audioOutput, for (i = 0; i < samples; i++) { for (j = 0; j < sd->audioFormat->channels; j++) { - vorbbuf[j][i] = - (*((mpd_sint16 *)deconst_ptr(playChunk))) / 32768.0; + vorbbuf[j][i] = (*((const mpd_sint16 *) playChunk)) + / 32768.0; playChunk += bytes; } } diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c index 586d87ae9..6b09e3cf0 100644 --- a/src/inputPlugins/mod_plugin.c +++ b/src/inputPlugins/mod_plugin.c @@ -48,14 +48,21 @@ static BOOL mod_mpd_IsThere(void) return 1; } +static char drv_name[] = "MPD"; +static char drv_version[] = "MPD Output Driver v0.1"; + +#if (LIBMIKMOD_VERSION > 0x030106) +static char drv_alias[] = "mpd"; +#endif + static MDRIVER drv_mpd = { NULL, - "MPD", - "MPD Output Driver v0.1", + drv_name, + drv_version, 0, 255, #if (LIBMIKMOD_VERSION > 0x030106) - "mpd", /* Alias */ + drv_alias, #if (LIBMIKMOD_VERSION >= 0x030200) NULL, /* CmdLineHelp */ #endif @@ -92,6 +99,8 @@ static int mod_mikModInitError; static int mod_initMikMod(void) { + static char params[] = ""; + if (mod_mikModInitError) return -1; @@ -110,7 +119,7 @@ static int mod_initMikMod(void) md_mode = (DMODE_SOFT_MUSIC | DMODE_INTERP | DMODE_STEREO | DMODE_16BITS); - if (MikMod_Init("")) { + if (MikMod_Init(params)) { ERROR("Could not init MikMod: %s\n", MikMod_strerror(MikMod_errno)); mod_mikModInitError = 1; diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c index 77339dabd..8bba8ae2b 100644 --- a/src/inputPlugins/wavpack_plugin.c +++ b/src/inputPlugins/wavpack_plugin.c @@ -224,34 +224,38 @@ static char *wavpack_tag(WavpackContext *wpc, char *key) static ReplayGainInfo *wavpack_replaygain(WavpackContext *wpc) { + static char replaygain_track_gain[] = "replaygain_track_gain"; + static char replaygain_album_gain[] = "replaygain_album_gain"; + static char replaygain_track_peak[] = "replaygain_track_peak"; + static char replaygain_album_peak[] = "replaygain_album_peak"; ReplayGainInfo *replayGainInfo; int found = 0; char *value; replayGainInfo = newReplayGainInfo(); - value = wavpack_tag(wpc, "replaygain_track_gain"); + value = wavpack_tag(wpc, replaygain_track_gain); if (value) { replayGainInfo->trackGain = atof(value); free(value); found = 1; } - value = wavpack_tag(wpc, "replaygain_album_gain"); + value = wavpack_tag(wpc, replaygain_album_gain); if (value) { replayGainInfo->albumGain = atof(value); free(value); found = 1; } - value = wavpack_tag(wpc, "replaygain_track_peak"); + value = wavpack_tag(wpc, replaygain_track_peak); if (value) { replayGainInfo->trackPeak = atof(value); free(value); found = 1; } - value = wavpack_tag(wpc, "replaygain_album_peak"); + value = wavpack_tag(wpc, replaygain_album_peak); if (value) { replayGainInfo->albumPeak = atof(value); free(value); diff --git a/src/pcm_utils.c b/src/pcm_utils.c index f716c279d..90856fa1d 100644 --- a/src/pcm_utils.c +++ b/src/pcm_utils.c @@ -149,6 +149,7 @@ static int pcm_getSampleRateConverter(void) const char *conf = getConfigParamValue(CONF_SAMPLERATE_CONVERTER); long convalgo; char *test; + const char *test2; size_t len; if (!conf) { @@ -162,12 +163,12 @@ static int pcm_getSampleRateConverter(void) len = strlen(conf); for (convalgo = 0 ; ; convalgo++) { - test = (char *)src_get_name(convalgo); - if (!test) { + test2 = src_get_name(convalgo); + if (!test2) { convalgo = SRC_SINC_FASTEST; break; } - if (strncasecmp(test, conf, len) == 0) + if (strncasecmp(test2, conf, len) == 0) goto out; } @@ -239,7 +240,7 @@ static size_t pcm_convertSampleRate(mpd_sint8 channels, mpd_uint32 inSampleRate, data->data_out = xrealloc(data->data_out, dataOutSize); } - src_short_to_float_array((short *)inBuffer, data->data_in, + src_short_to_float_array((const short *)inBuffer, data->data_in, data->input_frames * channels); error = src_process(convState->state, data); @@ -305,7 +306,7 @@ static char *pcm_convertChannels(mpd_sint8 channels, const char *inBuffer, static char *buf; static size_t len; char *outBuffer = NULL; - mpd_sint16 *in; + const mpd_sint16 *in; mpd_sint16 *out; int inSamples, i; @@ -320,7 +321,7 @@ static char *pcm_convertChannels(mpd_sint8 channels, const char *inBuffer, outBuffer = buf; inSamples = inSize >> 1; - in = (mpd_sint16 *)inBuffer; + in = (const mpd_sint16 *)inBuffer; out = (mpd_sint16 *)outBuffer; for (i = 0; i < inSamples; i++) { *out++ = *in; @@ -338,7 +339,7 @@ static char *pcm_convertChannels(mpd_sint8 channels, const char *inBuffer, outBuffer = buf; inSamples = inSize >> 2; - in = (mpd_sint16 *)inBuffer; + in = (const mpd_sint16 *)inBuffer; out = (mpd_sint16 *)outBuffer; for (i = 0; i < inSamples; i++) { *out = (*in++) / 2; @@ -359,7 +360,7 @@ static const char *pcm_convertTo16bit(mpd_sint8 bits, const char *inBuffer, static char *buf; static size_t len; char *outBuffer = NULL; - mpd_sint8 *in; + const mpd_sint8 *in; mpd_sint16 *out; size_t i; @@ -372,7 +373,7 @@ static const char *pcm_convertTo16bit(mpd_sint8 bits, const char *inBuffer, } outBuffer = buf; - in = (mpd_sint8 *)inBuffer; + in = (const mpd_sint8 *)inBuffer; out = (mpd_sint16 *)outBuffer; for (i = 0; i < inSize; i++) *out++ = (*in++) << 8; |