aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-23 23:59:55 +0200
committerEric Wong <normalperson@yhbt.net>2008-09-29 01:58:44 -0700
commita748ea5a55f4f5d9f9d58b0e6c7667d61cfde501 (patch)
tree96eac268d20ee71a26cf5bdd818bb9498077f8fd /src/inputPlugins
parent09edfb67ec85096ec148852e673f370d39b05b9d (diff)
downloadmpd-a748ea5a55f4f5d9f9d58b0e6c7667d61cfde501.tar.gz
mpd-a748ea5a55f4f5d9f9d58b0e6c7667d61cfde501.tar.xz
mpd-a748ea5a55f4f5d9f9d58b0e6c7667d61cfde501.zip
flac: merged flacSendChunk() into flac_common_write()
Since flacSendChunk() is a trivial function and is only used in one location, move the code there. The advantage is that calling decoder_data() directly returns the decoder_command value, so we can eliminate one decoder_get_command() call. [ew: using the terser API in the main branch, it always eliminated the dc_intr()/dc_seek() call, but I agree that killing a camel, err.. camelCase function is a good thing]
Diffstat (limited to 'src/inputPlugins')
-rw-r--r--src/inputPlugins/_flac_common.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/inputPlugins/_flac_common.c b/src/inputPlugins/_flac_common.c
index 1ca3aa8c0..1cbce9488 100644
--- a/src/inputPlugins/_flac_common.c
+++ b/src/inputPlugins/_flac_common.c
@@ -194,16 +194,6 @@ void flac_error_common_cb(const char *plugin,
}
}
-/* keep this inlined, this is just macro but prettier :) */
-static inline enum dc_action flacSendChunk(FlacData * data)
-{
- enum dc_action ret = ob_send(data->chunk, data->chunk_length,
- data->time, data->bitRate,
- data->replayGainInfo);
- data->chunk_length = 0;
- return ret;
-}
-
static void flac_convert_stereo16(int16_t *dest,
const FLAC__int32 * const buf[],
unsigned int position, unsigned int end)
@@ -295,6 +285,7 @@ flac_common_write(FlacData *data, const FLAC__Frame * frame,
bytes_per_sample * frame->header.channels;
const unsigned int max_samples = FLAC_CHUNK_SIZE / bytes_per_channel;
unsigned int num_samples;
+ enum dc_action action;
assert(dc.audio_format.bits > 0);
@@ -315,7 +306,11 @@ flac_common_write(FlacData *data, const FLAC__Frame * frame,
data->chunk_length = num_samples * bytes_per_channel;
- switch (flacSendChunk(data)) {
+ action = ob_send(data->chunk, data->chunk_length,
+ data->time, data->bitRate,
+ data->replayGainInfo);
+ data->chunk_length = 0;
+ switch (action) {
case DC_ACTION_STOP:
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
case DC_ACTION_SEEK: