diff options
author | Max Kellermann <max@duempel.org> | 2009-12-25 19:47:33 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-12-26 03:01:43 +0100 |
commit | bad350bc18ab81661253bf42245b9e3fa175d026 (patch) | |
tree | 47a1dd5d4b81520eb9ae1ce407d2fea84d71736f /src/decoder/mpcdec_plugin.c | |
parent | 870436a592b081c4630b9ecc36ff8daecf6496cc (diff) | |
download | mpd-bad350bc18ab81661253bf42245b9e3fa175d026.tar.gz mpd-bad350bc18ab81661253bf42245b9e3fa175d026.tar.xz mpd-bad350bc18ab81661253bf42245b9e3fa175d026.zip |
decoder_api: added function decoder_timestamp()
Remove the data_time parameter from decoder_data(). This patch
eliminates the timestamp counting in most decoder plugins, because the
MPD core will do it automatically by default.
Diffstat (limited to 'src/decoder/mpcdec_plugin.c')
-rw-r--r-- | src/decoder/mpcdec_plugin.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/decoder/mpcdec_plugin.c b/src/decoder/mpcdec_plugin.c index bf27ec314..a186bc368 100644 --- a/src/decoder/mpcdec_plugin.c +++ b/src/decoder/mpcdec_plugin.c @@ -152,10 +152,8 @@ mpcdec_decode(struct decoder *mpd_decoder, struct input_stream *is) mpc_uint32_t ret; int32_t chunk[G_N_ELEMENTS(sample_buffer)]; long bit_rate = 0; - unsigned long sample_pos = 0; mpc_uint32_t vbr_update_acc; mpc_uint32_t vbr_update_bits; - float total_time; struct replay_gain_info *replay_gain_info = NULL; enum decoder_command cmd = DECODE_COMMAND_NONE; @@ -219,16 +217,14 @@ mpcdec_decode(struct decoder *mpd_decoder, struct input_stream *is) do { if (cmd == DECODE_COMMAND_SEEK) { - bool success; - - sample_pos = decoder_seek_where(mpd_decoder) * + mpc_int64_t where = decoder_seek_where(mpd_decoder) * audio_format.sample_rate; + bool success; #ifdef MPC_IS_OLD_API - success = mpc_decoder_seek_sample(&decoder, - sample_pos); + success = mpc_decoder_seek_sample(&decoder, where); #else - success = mpc_demux_seek_sample(demux, sample_pos) + success = mpc_demux_seek_sample(demux, where) == MPC_STATUS_OK; #endif if (success) @@ -259,19 +255,15 @@ mpcdec_decode(struct decoder *mpd_decoder, struct input_stream *is) ret = frame.samples; #endif - sample_pos += ret; - ret *= info.channels; mpc_to_mpd_buffer(chunk, sample_buffer, ret); - total_time = ((float)sample_pos) / audio_format.sample_rate; bit_rate = vbr_update_bits * audio_format.sample_rate / 1152 / 1000; cmd = decoder_data(mpd_decoder, is, chunk, ret * sizeof(chunk[0]), - total_time, bit_rate, replay_gain_info); } while (cmd != DECODE_COMMAND_STOP); |