aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/DecoderAPI.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-26 11:27:41 +0200
committerMax Kellermann <max@duempel.org>2014-08-26 11:27:41 +0200
commit8561c9c5a6e43c40fe9ee6a450ff94ecffe82d69 (patch)
tree5ab3126c112638bc446fb3049b7d4bf1b4946c75 /src/decoder/DecoderAPI.cxx
parent23199719d957320e467ec958e03c4544ffefa773 (diff)
downloadmpd-8561c9c5a6e43c40fe9ee6a450ff94ecffe82d69.tar.gz
mpd-8561c9c5a6e43c40fe9ee6a450ff94ecffe82d69.tar.xz
mpd-8561c9c5a6e43c40fe9ee6a450ff94ecffe82d69.zip
DecoderAPI: add decoder_seek_where_frame()
Diffstat (limited to 'src/decoder/DecoderAPI.cxx')
-rw-r--r--src/decoder/DecoderAPI.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/decoder/DecoderAPI.cxx b/src/decoder/DecoderAPI.cxx
index 926a3955e..7349b00db 100644
--- a/src/decoder/DecoderAPI.cxx
+++ b/src/decoder/DecoderAPI.cxx
@@ -237,6 +237,24 @@ decoder_seek_where_ms(Decoder &decoder)
return unsigned(dc.seek_where * 1000);
}
+uint64_t
+decoder_seek_where_frame(Decoder &decoder)
+{
+ const DecoderControl &dc = decoder.dc;
+
+ assert(dc.pipe != nullptr);
+
+ if (decoder.initial_seek_running)
+ return uint64_t(dc.start_ms) * dc.in_audio_format.sample_rate
+ / 1000;
+
+ assert(dc.command == DecoderCommand::SEEK);
+
+ decoder.seeking = true;
+
+ return uint64_t(dc.seek_where * dc.in_audio_format.sample_rate);
+}
+
void decoder_seek_error(Decoder & decoder)
{
DecoderControl &dc = decoder.dc;