diff options
author | Max Kellermann <max@duempel.org> | 2008-09-07 19:19:55 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-07 19:19:55 +0200 |
commit | f1dd9c209c3a1cf6826d3a38b60f638e0faeadab (patch) | |
tree | 91e369d89eac8d298f1473c0dbcdf43065ae3b40 | |
parent | bd81fd8b0c4f4f3c20533e21d6a837326eb8682b (diff) | |
download | mpd-f1dd9c209c3a1cf6826d3a38b60f638e0faeadab.tar.gz mpd-f1dd9c209c3a1cf6826d3a38b60f638e0faeadab.tar.xz mpd-f1dd9c209c3a1cf6826d3a38b60f638e0faeadab.zip |
audio_format: converted typedef AudioFormat to struct audio_format
Get rid of CamelCase, and don't use a typedef, so we can
forward-declare it, and unclutter the include dependencies.
Diffstat (limited to '')
34 files changed, 98 insertions, 83 deletions
diff --git a/src/audio.c b/src/audio.c index 5715ec8b5..0e347d6ad 100644 --- a/src/audio.c +++ b/src/audio.c @@ -17,6 +17,7 @@ */ #include "audio.h" +#include "audio_format.h" #include "audioOutput.h" #include "log.h" #include "path.h" @@ -27,9 +28,9 @@ #define AUDIO_DEVICE_STATE_LEN (sizeof(AUDIO_DEVICE_STATE)-1) #define AUDIO_BUFFER_SIZE 2*MPD_PATH_MAX -static AudioFormat audio_format; +static struct audio_format audio_format; -static AudioFormat *audio_configFormat; +static struct audio_format *audio_configFormat; static AudioOutput *audioOutputArray; static unsigned int audioOutputArraySize; @@ -63,15 +64,15 @@ static unsigned int audio_output_count(void) return nr; } -void copyAudioFormat(AudioFormat * dest, const AudioFormat * src) +void copyAudioFormat(struct audio_format *dest, const struct audio_format *src) { if (!src) return; - memcpy(dest, src, sizeof(AudioFormat)); + memcpy(dest, src, sizeof(*dest)); } -int cmpAudioFormat(const AudioFormat * f1, const AudioFormat * f2) +int cmpAudioFormat(const struct audio_format *f1, const struct audio_format *f2) { if (f1 && f2 && (f1->sampleRate == f2->sampleRate) && (f1->bits == f2->bits) && (f1->channels == f2->channels)) @@ -141,8 +142,8 @@ void initAudioDriver(void) } } -void getOutputAudioFormat(const AudioFormat * inAudioFormat, - AudioFormat * outAudioFormat) +void getOutputAudioFormat(const struct audio_format *inAudioFormat, + struct audio_format *outAudioFormat) { if (audio_configFormat) { copyAudioFormat(outAudioFormat, audio_configFormat); @@ -157,7 +158,7 @@ void initAudioConfig(void) if (NULL == param || NULL == param->value) return; - audio_configFormat = xmalloc(sizeof(AudioFormat)); + audio_configFormat = xmalloc(sizeof(*audio_configFormat)); if (0 != parseAudioConfig(audio_configFormat, param->value)) { FATAL("error parsing \"%s\" at line %i\n", @@ -165,11 +166,11 @@ void initAudioConfig(void) } } -int parseAudioConfig(AudioFormat * audioFormat, char *conf) +int parseAudioConfig(struct audio_format *audioFormat, char *conf) { char *test; - memset(audioFormat, 0, sizeof(AudioFormat)); + memset(audioFormat, 0, sizeof(*audioFormat)); audioFormat->sampleRate = strtol(conf, &test, 10); @@ -251,7 +252,7 @@ void finishAudioDriver(void) audioOutputArraySize = 0; } -int isCurrentAudioFormat(const AudioFormat * audioFormat) +int isCurrentAudioFormat(const struct audio_format *audioFormat) { if (!audioFormat) return 1; @@ -320,7 +321,7 @@ static int flushAudioBuffer(void) return ret; } -int openAudioDevice(const AudioFormat * audioFormat) +int openAudioDevice(const struct audio_format *audioFormat) { int ret = -1; unsigned int i; diff --git a/src/audio.h b/src/audio.h index 2d62407a9..bad9c2592 100644 --- a/src/audio.h +++ b/src/audio.h @@ -20,21 +20,21 @@ #define AUDIO_H #include "os_compat.h" -#include "audio_format.h" #define AUDIO_AO_DRIVER_DEFAULT "default" +struct audio_format; struct tag; struct client; -void copyAudioFormat(AudioFormat * dest, const AudioFormat * src); +void copyAudioFormat(struct audio_format *dest, const struct audio_format *src); -int cmpAudioFormat(const AudioFormat * dest, const AudioFormat * src); +int cmpAudioFormat(const struct audio_format *dest, const struct audio_format *src); -void getOutputAudioFormat(const AudioFormat * inFormat, - AudioFormat * outFormat); +void getOutputAudioFormat(const struct audio_format *inFormat, + struct audio_format *outFormat); -int parseAudioConfig(AudioFormat * audioFormat, char *conf); +int parseAudioConfig(struct audio_format *audioFormat, char *conf); /* make sure initPlayerData is called before this function!! */ void initAudioConfig(void); @@ -45,7 +45,7 @@ void initAudioDriver(void); void finishAudioDriver(void); -int openAudioDevice(const AudioFormat * audioFormat); +int openAudioDevice(const struct audio_format *audioFormat); int playAudio(const char *playChunk, size_t size); @@ -55,7 +55,7 @@ void closeAudioDevice(void); int isAudioDeviceOpen(void); -int isCurrentAudioFormat(const AudioFormat * audioFormat); +int isCurrentAudioFormat(const struct audio_format *audioFormat); void sendMetadataToAudioDevice(const struct tag *tag); diff --git a/src/audioOutput.c b/src/audioOutput.c index f197a789b..7e9793f93 100644 --- a/src/audioOutput.c +++ b/src/audioOutput.c @@ -130,9 +130,9 @@ int initAudioOutput(AudioOutput *ao, ConfigParam * param) ao->convBuffer = NULL; ao->convBufferLen = 0; - memset(&ao->inAudioFormat, 0, sizeof(AudioFormat)); - memset(&ao->outAudioFormat, 0, sizeof(AudioFormat)); - memset(&ao->reqAudioFormat, 0, sizeof(AudioFormat)); + memset(&ao->inAudioFormat, 0, sizeof(ao->inAudioFormat)); + memset(&ao->outAudioFormat, 0, sizeof(ao->outAudioFormat)); + memset(&ao->reqAudioFormat, 0, sizeof(ao->reqAudioFormat)); memset(&ao->convState, 0, sizeof(ConvState)); if (format) { @@ -152,7 +152,7 @@ int initAudioOutput(AudioOutput *ao, ConfigParam * param) } int openAudioOutput(AudioOutput * audioOutput, - const AudioFormat * audioFormat) + const struct audio_format *audioFormat) { int ret = 0; diff --git a/src/audioOutput.h b/src/audioOutput.h index 16751cb12..d706b602e 100644 --- a/src/audioOutput.h +++ b/src/audioOutput.h @@ -65,9 +65,9 @@ struct _AudioOutput { AudioOutputSendMetadataFunc sendMetdataFunc; int convertAudioFormat; - AudioFormat inAudioFormat; - AudioFormat outAudioFormat; - AudioFormat reqAudioFormat; + struct audio_format inAudioFormat; + struct audio_format outAudioFormat; + struct audio_format reqAudioFormat; ConvState convState; char *convBuffer; size_t convBufferLen; @@ -97,7 +97,7 @@ void unloadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin); int initAudioOutput(AudioOutput *, ConfigParam * param); int openAudioOutput(AudioOutput * audioOutput, - const AudioFormat * audioFormat); + const struct audio_format *audioFormat); int playAudioOutput(AudioOutput * audioOutput, const char *playChunk, size_t size); void dropBufferedAudioOutput(AudioOutput * audioOutput); diff --git a/src/audioOutputs/audioOutput_alsa.c b/src/audioOutputs/audioOutput_alsa.c index f0aa32713..9bb962fb5 100644 --- a/src/audioOutputs/audioOutput_alsa.c +++ b/src/audioOutputs/audioOutput_alsa.c @@ -123,7 +123,7 @@ static int alsa_testDefault(void) static int alsa_openDevice(AudioOutput * audioOutput) { AlsaData *ad = audioOutput->data; - AudioFormat *audioFormat = &audioOutput->outAudioFormat; + struct audio_format *audioFormat = &audioOutput->outAudioFormat; snd_pcm_format_t bitformat; snd_pcm_hw_params_t *hwparams; snd_pcm_sw_params_t *swparams; diff --git a/src/audioOutputs/audioOutput_jack.c b/src/audioOutputs/audioOutput_jack.c index b8add85d9..d9b6010e5 100644 --- a/src/audioOutputs/audioOutput_jack.c +++ b/src/audioOutputs/audioOutput_jack.c @@ -118,7 +118,7 @@ static void jack_finishDriver(AudioOutput *audioOutput) static int srate(mpd_unused jack_nframes_t rate, void *data) { JackData *jd = (JackData *) ((AudioOutput*) data)->data; - AudioFormat *audioFormat = &(((AudioOutput*) data)->outAudioFormat); + struct audio_format *audioFormat = &(((AudioOutput*) data)->outAudioFormat); audioFormat->sampleRate = (int)jack_get_sample_rate(jd->client); @@ -183,7 +183,7 @@ static void shutdown_callback(void *arg) static void set_audioformat(AudioOutput *audioOutput) { JackData *jd = audioOutput->data; - AudioFormat *audioFormat = &audioOutput->outAudioFormat; + struct audio_format *audioFormat = &audioOutput->outAudioFormat; audioFormat->sampleRate = (int) jack_get_sample_rate(jd->client); DEBUG("samplerate = %d\n", audioFormat->sampleRate); diff --git a/src/audioOutputs/audioOutput_oss.c b/src/audioOutputs/audioOutput_oss.c index 2df7d5728..0c9d408f4 100644 --- a/src/audioOutputs/audioOutput_oss.c +++ b/src/audioOutputs/audioOutput_oss.c @@ -484,7 +484,7 @@ static int oss_openDevice(AudioOutput * audioOutput) { int ret; OssData *od = audioOutput->data; - AudioFormat *audioFormat = &audioOutput->outAudioFormat; + struct audio_format *audioFormat = &audioOutput->outAudioFormat; od->channels = (mpd_sint8)audioFormat->channels; od->sampleRate = audioFormat->sampleRate; diff --git a/src/audioOutputs/audioOutput_pulse.c b/src/audioOutputs/audioOutput_pulse.c index a67c2bae6..70e35b4d9 100644 --- a/src/audioOutputs/audioOutput_pulse.c +++ b/src/audioOutputs/audioOutput_pulse.c @@ -112,7 +112,7 @@ static int pulse_testDefault(void) static int pulse_openDevice(AudioOutput * audioOutput) { PulseData *pd; - AudioFormat *audioFormat; + struct audio_format *audioFormat; pa_sample_spec ss; time_t t; int error; diff --git a/src/audioOutputs/audioOutput_shout.c b/src/audioOutputs/audioOutput_shout.c index 7a07f5357..e5d87dbfe 100644 --- a/src/audioOutputs/audioOutput_shout.c +++ b/src/audioOutputs/audioOutput_shout.c @@ -66,7 +66,7 @@ typedef struct _ShoutData { Timer *timer; /* just a pointer to audioOutput->outAudioFormat */ - AudioFormat *audioFormat; + struct audio_format *audioFormat; } ShoutData; static ShoutData *newShoutData(void) diff --git a/src/audio_format.h b/src/audio_format.h index ade9d8810..fa892b846 100644 --- a/src/audio_format.h +++ b/src/audio_format.h @@ -21,18 +21,18 @@ #include "mpd_types.h" -typedef struct _AudioFormat { +struct audio_format { mpd_sint8 channels; mpd_uint32 sampleRate; mpd_sint8 bits; -} AudioFormat; +}; -static inline double audio_format_time_to_size(const AudioFormat * af) +static inline double audio_format_time_to_size(const struct audio_format *af) { return af->sampleRate * af->bits * af->channels / 8.0; } -static inline double audioFormatSizeToTime(const AudioFormat * af) +static inline double audioFormatSizeToTime(const struct audio_format *af) { return 8.0 / af->bits / af->channels / af->sampleRate; } diff --git a/src/crossfade.c b/src/crossfade.c index bf5fa5355..b99b9f7f0 100644 --- a/src/crossfade.c +++ b/src/crossfade.c @@ -22,7 +22,7 @@ #include "pcm_utils.h" unsigned cross_fade_calc(float duration, float total_time, - const AudioFormat * af, + const struct audio_format *af, unsigned max_chunks) { unsigned int chunks; @@ -46,7 +46,7 @@ unsigned cross_fade_calc(float duration, float total_time, } void cross_fade_apply(ob_chunk * a, const ob_chunk * b, - const AudioFormat * format, + const struct audio_format *format, unsigned int current_chunk, unsigned int num_chunks) { assert(current_chunk <= num_chunks); diff --git a/src/crossfade.h b/src/crossfade.h index 544418e6f..918c6e97e 100644 --- a/src/crossfade.h +++ b/src/crossfade.h @@ -20,15 +20,16 @@ #ifndef CROSSFADE_H #define CROSSFADE_H -#include "audio_format.h" #include "outputBuffer.h" +struct audio_format; + unsigned cross_fade_calc(float duration, float total_time, - const AudioFormat * af, + const struct audio_format *af, unsigned max_chunks); void cross_fade_apply(ob_chunk * a, const ob_chunk * b, - const AudioFormat * format, + const struct audio_format *format, unsigned int current_chunk, unsigned int num_chunks); #endif diff --git a/src/decoder_api.c b/src/decoder_api.c index bf36886ba..db1820db4 100644 --- a/src/decoder_api.c +++ b/src/decoder_api.c @@ -39,7 +39,7 @@ void decoder_plugin_unregister(struct decoder_plugin *plugin) } void decoder_initialized(struct decoder * decoder, - const AudioFormat * audio_format, + const struct audio_format *audio_format, float total_time) { assert(dc.state == DECODE_STATE_START); diff --git a/src/decoder_api.h b/src/decoder_api.h index 3ab388289..ec1f139df 100644 --- a/src/decoder_api.h +++ b/src/decoder_api.h @@ -30,6 +30,7 @@ #include "replayGain.h" #include "tag.h" #include "tag_id3.h" +#include "audio_format.h" #include "playerData.h" @@ -112,7 +113,7 @@ struct decoder; * that it has read the song's meta data. */ void decoder_initialized(struct decoder * decoder, - const AudioFormat * audio_format, + const struct audio_format *audio_format, float total_time); const char *decoder_get_url(struct decoder * decoder, char * buffer); diff --git a/src/decoder_control.h b/src/decoder_control.h index e3fe53da7..8c19d3d50 100644 --- a/src/decoder_control.h +++ b/src/decoder_control.h @@ -48,7 +48,7 @@ struct decoder_control { volatile mpd_sint8 seekError; volatile mpd_sint8 seekable; volatile double seekWhere; - AudioFormat audioFormat; + struct audio_format audioFormat; Song *current_song; Song *volatile next_song; volatile float totalTime; diff --git a/src/inputPlugins/_flac_common.h b/src/inputPlugins/_flac_common.h index c4ca61cc1..a758a7369 100644 --- a/src/inputPlugins/_flac_common.h +++ b/src/inputPlugins/_flac_common.h @@ -143,7 +143,7 @@ typedef struct { size_t chunk_length; float time; unsigned int bitRate; - AudioFormat audio_format; + struct audio_format audio_format; float total_time; FLAC__uint64 position; struct decoder *decoder; diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c index 789b87b57..dc93b26b5 100644 --- a/src/inputPlugins/aac_plugin.c +++ b/src/inputPlugins/aac_plugin.c @@ -310,7 +310,7 @@ static int aac_stream_decode(struct decoder * mpd_decoder, faacDecFrameInfo frameInfo; faacDecConfigurationPtr config; long bread; - AudioFormat audio_format; + struct audio_format audio_format; uint32_t sampleRate; unsigned char channels; unsigned int sampleCount; @@ -444,7 +444,7 @@ static int aac_decode(struct decoder * mpd_decoder, char *path) faacDecFrameInfo frameInfo; faacDecConfigurationPtr config; long bread; - AudioFormat audio_format; + struct audio_format audio_format; uint32_t sampleRate; unsigned char channels; unsigned int sampleCount; diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c index 9511c84ed..a2fc39881 100644 --- a/src/inputPlugins/audiofile_plugin.c +++ b/src/inputPlugins/audiofile_plugin.c @@ -48,7 +48,7 @@ static int audiofile_decode(struct decoder * decoder, char *path) int fs, frame_count; AFfilehandle af_fp; int bits; - AudioFormat audio_format; + struct audio_format audio_format; float total_time; mpd_uint16 bitRate; struct stat st; diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c index 4b891f609..2fcf7b801 100644 --- a/src/inputPlugins/mod_plugin.c +++ b/src/inputPlugins/mod_plugin.c @@ -171,7 +171,7 @@ static void mod_close(mod_Data * data) static int mod_decode(struct decoder * decoder, char *path) { mod_Data *data; - AudioFormat audio_format; + struct audio_format audio_format; float total_time = 0.0; int ret; float secPerByte; diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c index 11486ce9d..24e0c368f 100644 --- a/src/inputPlugins/mp3_plugin.c +++ b/src/inputPlugins/mp3_plugin.c @@ -1021,7 +1021,7 @@ mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo) } static void initAudioFormatFromMp3DecodeData(mp3DecodeData * data, - AudioFormat * af) + struct audio_format * af) { af->bits = 16; af->sampleRate = (data->frame).header.samplerate; @@ -1033,7 +1033,7 @@ static int mp3_decode(struct decoder * decoder, InputStream * inStream) mp3DecodeData data; struct tag *tag = NULL; ReplayGainInfo *replayGainInfo = NULL; - AudioFormat audio_format; + struct audio_format audio_format; if (openMp3FromInputStream(inStream, &data, decoder, &tag, &replayGainInfo) < 0) { diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index ab712ef5f..1bf46efa0 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -88,7 +88,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) faacDecHandle decoder; faacDecFrameInfo frameInfo; faacDecConfigurationPtr config; - AudioFormat audio_format; + struct audio_format audio_format; unsigned char *mp4Buffer; unsigned int mp4BufferSize; uint32_t sampleRate; diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c index 54e7e5479..ec76b035f 100644 --- a/src/inputPlugins/mpc_plugin.c +++ b/src/inputPlugins/mpc_plugin.c @@ -102,7 +102,7 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream) mpc_decoder decoder; mpc_reader reader; mpc_streaminfo info; - AudioFormat audio_format; + struct audio_format audio_format; MpcCallbackData data; diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index d8ee63bfe..4f53ca988 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -210,7 +210,7 @@ static int oggvorbis_decode(struct decoder * decoder, InputStream * inStream) OggVorbis_File vf; ov_callbacks callbacks; OggCallbackData data; - AudioFormat audio_format; + struct audio_format audio_format; int current_section; int prev_section = -1; long ret; diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c index 38e970fa6..82abcee59 100644 --- a/src/inputPlugins/wavpack_plugin.c +++ b/src/inputPlugins/wavpack_plugin.c @@ -131,7 +131,7 @@ static void wavpack_decode(struct decoder * decoder, WavpackContext *wpc, int canseek, ReplayGainInfo *replayGainInfo) { - AudioFormat audio_format; + struct audio_format audio_format; void (*format_samples)(int Bps, void *buffer, uint32_t samcnt); char chunk[CHUNK_SIZE]; float file_time; diff --git a/src/normalize.c b/src/normalize.c index b50e5bdcd..da655a648 100644 --- a/src/normalize.c +++ b/src/normalize.c @@ -19,6 +19,7 @@ #include "normalize.h" #include "compress.h" #include "conf.h" +#include "audio_format.h" #define DEFAULT_VOLUME_NORMALIZATION 0 @@ -39,7 +40,8 @@ void finishNormalization(void) if (normalizationEnabled) CompressFree(); } -void normalizeData(char *buffer, int bufferSize, const AudioFormat *format) +void normalizeData(char *buffer, int bufferSize, + const struct audio_format *format) { if ((format->bits != 16) || (format->channels != 2)) return; diff --git a/src/normalize.h b/src/normalize.h index 81c9c81c4..a67899c15 100644 --- a/src/normalize.h +++ b/src/normalize.h @@ -19,7 +19,7 @@ #ifndef NORMALIZE_H #define NORMALIZE_H -#include "audio_format.h" +struct audio_format; extern int normalizationEnabled; @@ -27,6 +27,7 @@ void initNormalization(void); void finishNormalization(void); -void normalizeData(char *buffer, int bufferSize, const AudioFormat *format); +void normalizeData(char *buffer, int bufferSize, + const struct audio_format *format); #endif /* !NORMALIZE_H */ diff --git a/src/outputBuffer.h b/src/outputBuffer.h index 512334d90..b6fdda926 100644 --- a/src/outputBuffer.h +++ b/src/outputBuffer.h @@ -51,7 +51,7 @@ struct output_buffer { the buffer becomes non-empty */ int lazy; - AudioFormat audioFormat; + struct audio_format audioFormat; Notify *notify; }; diff --git a/src/pcm_utils.c b/src/pcm_utils.c index 90856fa1d..a9706e019 100644 --- a/src/pcm_utils.c +++ b/src/pcm_utils.c @@ -22,9 +22,11 @@ #include "log.h" #include "utils.h" #include "conf.h" +#include "audio_format.h" #include "os_compat.h" -void pcm_volumeChange(char *buffer, int bufferSize, const AudioFormat * format, +void pcm_volumeChange(char *buffer, int bufferSize, + const struct audio_format *format, int volume) { mpd_sint32 temp32; @@ -76,7 +78,7 @@ void pcm_volumeChange(char *buffer, int bufferSize, const AudioFormat * format, static void pcm_add(char *buffer1, const char *buffer2, size_t bufferSize1, size_t bufferSize2, int vol1, int vol2, - const AudioFormat * format) + const struct audio_format *format) { mpd_sint32 temp32; mpd_sint8 *buffer8_1 = (mpd_sint8 *) buffer1; @@ -130,7 +132,8 @@ static void pcm_add(char *buffer1, const char *buffer2, size_t bufferSize1, } void pcm_mix(char *buffer1, const char *buffer2, size_t bufferSize1, - size_t bufferSize2, const AudioFormat * format, float portion1) + size_t bufferSize2, const struct audio_format *format, + float portion1) { int vol1; float s = sin(M_PI_2 * portion1); @@ -392,9 +395,9 @@ static const char *pcm_convertTo16bit(mpd_sint8 bits, const char *inBuffer, } /* outFormat bits must be 16 and channels must be 1 or 2! */ -size_t pcm_convertAudioFormat(const AudioFormat * inFormat, +size_t pcm_convertAudioFormat(const struct audio_format *inFormat, const char *inBuffer, size_t inSize, - const AudioFormat * outFormat, + const struct audio_format *outFormat, char *outBuffer, ConvState *convState) { const char *buf; @@ -430,8 +433,8 @@ size_t pcm_convertAudioFormat(const AudioFormat * inFormat, return len; } -size_t pcm_sizeOfConvBuffer(const AudioFormat * inFormat, size_t inSize, - const AudioFormat * outFormat) +size_t pcm_sizeOfConvBuffer(const struct audio_format *inFormat, size_t inSize, + const struct audio_format *outFormat) { const double ratio = (double)outFormat->sampleRate / (double)inFormat->sampleRate; diff --git a/src/pcm_utils.h b/src/pcm_utils.h index 2ecb56201..414691f5a 100644 --- a/src/pcm_utils.h +++ b/src/pcm_utils.h @@ -21,13 +21,15 @@ #include "../config.h" -#include "audio_format.h" +#include "mpd_types.h" #include "os_compat.h" #ifdef HAVE_LIBSAMPLERATE #include <samplerate.h> #endif +struct audio_format; + typedef struct _ConvState { #ifdef HAVE_LIBSAMPLERATE SRC_STATE *state; @@ -42,17 +44,17 @@ typedef struct _ConvState { int error; } ConvState; -void pcm_volumeChange(char *buffer, int bufferSize, const AudioFormat * format, +void pcm_volumeChange(char *buffer, int bufferSize, const struct audio_format *format, int volume); void pcm_mix(char *buffer1, const char *buffer2, size_t bufferSize1, - size_t bufferSize2, const AudioFormat * format, float portion1); + size_t bufferSize2, const struct audio_format *format, float portion1); -size_t pcm_convertAudioFormat(const AudioFormat * inFormat, +size_t pcm_convertAudioFormat(const struct audio_format *inFormat, const char *inBuffer, size_t inSize, - const AudioFormat * outFormat, + const struct audio_format *outFormat, char *outBuffer, ConvState *convState); -size_t pcm_sizeOfConvBuffer(const AudioFormat * inFormat, size_t inSize, - const AudioFormat * outFormat); +size_t pcm_sizeOfConvBuffer(const struct audio_format *inFormat, size_t inSize, + const struct audio_format *outFormat); #endif diff --git a/src/player_thread.c b/src/player_thread.c index 1b13fd415..cf5e71f61 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -158,7 +158,7 @@ static void processDecodeInput(int *pause_r, unsigned int *bbp_r, } static int playChunk(ob_chunk * chunk, - const AudioFormat * format, double sizeToTime) + const struct audio_format *format, double sizeToTime) { pc.elapsedTime = chunk->times; pc.bitRate = chunk->bitRate; diff --git a/src/replayGain.c b/src/replayGain.c index 8926138bb..27caac1be 100644 --- a/src/replayGain.c +++ b/src/replayGain.c @@ -22,6 +22,8 @@ #include "log.h" #include "conf.h" +#include "audio_format.h" +#include "mpd_types.h" #include "os_compat.h" /* Added 4/14/2004 by AliasMrJones */ @@ -104,7 +106,7 @@ void freeReplayGainInfo(ReplayGainInfo * info) } void doReplayGain(ReplayGainInfo * info, char *buffer, int bufferSize, - const AudioFormat * format) + const struct audio_format *format) { mpd_sint16 *buffer16; mpd_sint8 *buffer8; diff --git a/src/replayGain.h b/src/replayGain.h index 8282da785..8b634cad6 100644 --- a/src/replayGain.h +++ b/src/replayGain.h @@ -20,12 +20,12 @@ #ifndef REPLAYGAIN_H #define REPLAYGAIN_H -#include "audio_format.h" - #define REPLAYGAIN_OFF 0 #define REPLAYGAIN_TRACK 1 #define REPLAYGAIN_ALBUM 2 +struct audio_format; + extern int replayGainState; typedef struct _ReplayGainInfo { @@ -45,6 +45,6 @@ void freeReplayGainInfo(ReplayGainInfo * info); void initReplayGainState(void); void doReplayGain(ReplayGainInfo * info, char *buffer, int bufferSize, - const AudioFormat * format); + const struct audio_format *format); #endif diff --git a/src/timer.c b/src/timer.c index 29c15eabc..0d8f07f5c 100644 --- a/src/timer.c +++ b/src/timer.c @@ -18,6 +18,7 @@ #include "timer.h" #include "utils.h" +#include "audio_format.h" #include "os_compat.h" static uint64_t now(void) @@ -29,7 +30,7 @@ static uint64_t now(void) return ((uint64_t)tv.tv_sec * 1000000) + tv.tv_usec; } -Timer *timer_new(AudioFormat *af) +Timer *timer_new(struct audio_format *af) { Timer *timer; diff --git a/src/timer.h b/src/timer.h index 6851a1535..80bef952d 100644 --- a/src/timer.h +++ b/src/timer.h @@ -19,16 +19,17 @@ #ifndef MPD_TIMER_H #define MPD_TIMER_H -#include "audio_format.h" #include "os_compat.h" +struct audio_format; + typedef struct _Timer { uint64_t time; int started; int rate; } Timer; -Timer *timer_new(AudioFormat *af); +Timer *timer_new(struct audio_format *af); void timer_free(Timer *timer); |