diff options
author | Max Kellermann <max@duempel.org> | 2014-08-26 11:20:15 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-08-26 11:20:15 +0200 |
commit | 23199719d957320e467ec958e03c4544ffefa773 (patch) | |
tree | eecd4907560e2e3900642b72d7e5be9c21a2511c | |
parent | a606ef070013fa9752849b4f935e78f676168c4e (diff) | |
download | mpd-23199719d957320e467ec958e03c4544ffefa773.tar.gz mpd-23199719d957320e467ec958e03c4544ffefa773.tar.xz mpd-23199719d957320e467ec958e03c4544ffefa773.zip |
decoder/mp4v2: use integer seek times
Diffstat (limited to '')
-rw-r--r-- | src/decoder/plugins/Mp4v2DecoderPlugin.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/decoder/plugins/Mp4v2DecoderPlugin.cxx b/src/decoder/plugins/Mp4v2DecoderPlugin.cxx index 36d02c81d..e968be20b 100644 --- a/src/decoder/plugins/Mp4v2DecoderPlugin.cxx +++ b/src/decoder/plugins/Mp4v2DecoderPlugin.cxx @@ -148,7 +148,7 @@ mp4_file_decode(Decoder &mpd_decoder, Path path_fs) /* initialize the MPD core */ - const uint32_t scale = MP4GetTrackTimeScale(handle, track); + const MP4Timestamp scale = MP4GetTrackTimeScale(handle, track); const float duration = ((float)MP4GetTrackDuration(handle, track)) / scale + 0.5f; const MP4SampleId num_samples = MP4GetTrackNumberOfSamples(handle, track); @@ -165,9 +165,12 @@ mp4_file_decode(Decoder &mpd_decoder, Path path_fs) unsigned int data_length = 0; if (cmd == DecoderCommand::SEEK) { - const double offset = decoder_seek_where(mpd_decoder); - sample = MP4GetSampleIdFromTime(handle, track, - (MP4Timestamp)(offset * (double)scale), 0); + const unsigned offset_ms = + decoder_seek_where_ms(mpd_decoder); + const MP4Timestamp offset = (offset_ms * scale) / 1000; + + sample = MP4GetSampleIdFromTime(handle, track, offset, + false); decoder_command_finished(mpd_decoder); } |