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.
This commit is contained in:
parent
bd81fd8b0c
commit
f1dd9c209c
25
src/audio.c
25
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;
|
||||
|
16
src/audio.h
16
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);
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -51,7 +51,7 @@ struct output_buffer {
|
||||
the buffer becomes non-empty */
|
||||
int lazy;
|
||||
|
||||
AudioFormat audioFormat;
|
||||
struct audio_format audioFormat;
|
||||
|
||||
Notify *notify;
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user