aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/wavpack_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-01-03 22:44:23 +0100
committerMax Kellermann <max@duempel.org>2010-01-04 20:42:49 +0100
commitcd8f92c9285e9b3b460ff47d2f251bfabce544da (patch)
tree594de0f646b0fc69405132c3a9e2f05060399abf /src/decoder/wavpack_plugin.c
parente58b4f773f28ad7b8e26c14c9c853fc2798408a1 (diff)
downloadmpd-cd8f92c9285e9b3b460ff47d2f251bfabce544da.tar.gz
mpd-cd8f92c9285e9b3b460ff47d2f251bfabce544da.tar.xz
mpd-cd8f92c9285e9b3b460ff47d2f251bfabce544da.zip
decoder_api: added function decoder_replay_gain()
This function replaces the replay_gain_info parameter for decoder_data(). This allows the decoder to announce replay gain changes, instead of having to pass the same object over and over.
Diffstat (limited to '')
-rw-r--r--src/decoder/wavpack_plugin.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/decoder/wavpack_plugin.c b/src/decoder/wavpack_plugin.c
index 1615d70d0..380985f85 100644
--- a/src/decoder/wavpack_plugin.c
+++ b/src/decoder/wavpack_plugin.c
@@ -155,8 +155,7 @@ wavpack_bits_to_sample_format(bool is_float, int bytes_per_sample)
* Requires an already opened WavpackContext.
*/
static void
-wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek,
- struct replay_gain_info *replay_gain_info)
+wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek)
{
GError *error = NULL;
bool is_float;
@@ -233,8 +232,7 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek,
decoder_data(
decoder, NULL, chunk,
samples_got * output_sample_size,
- bitrate,
- replay_gain_info
+ bitrate
);
}
} while (samples_got > 0);
@@ -544,7 +542,7 @@ wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
return;
}
- wavpack_decode(decoder, wpc, can_seek, NULL);
+ wavpack_decode(decoder, wpc, can_seek);
WavpackCloseFile(wpc);
if (open_flags & OPEN_WVC) {
@@ -575,13 +573,13 @@ wavpack_filedecode(struct decoder *decoder, const char *fname)
}
replay_gain_info = wavpack_replaygain(wpc);
-
- wavpack_decode(decoder, wpc, true, replay_gain_info);
-
- if (replay_gain_info) {
+ if (replay_gain_info != NULL) {
+ decoder_replay_gain(decoder, replay_gain_info);
replay_gain_info_free(replay_gain_info);
}
+ wavpack_decode(decoder, wpc, true);
+
WavpackCloseFile(wpc);
}