summaryrefslogtreecommitdiff
path: root/src/lib/decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-11-19 00:31:37 +0000
committerCarl Hetherington <cth@carlh.net>2016-11-19 00:51:05 +0000
commit24e890682b3f2aa211277ad8b6b3591f2026d4be (patch)
treeb3b8b23c295e1efc1846c0a37088773da97606f8 /src/lib/decoder.cc
parent5d6e2ffca8e4b0d587eff8723716003a6d81be47 (diff)
Cope with offsets between video/audio/subtitle data in a muxed file.
Diffstat (limited to 'src/lib/decoder.cc')
-rw-r--r--src/lib/decoder.cc30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc
index cba674d04..50356da78 100644
--- a/src/lib/decoder.cc
+++ b/src/lib/decoder.cc
@@ -19,20 +19,42 @@
*/
#include "decoder.h"
+#include <iostream>
+
+using std::cout;
+using boost::optional;
void
-Decoder::maybe_seek (ContentTime time, bool accurate)
+Decoder::maybe_seek (optional<ContentTime>& position, ContentTime time, bool accurate)
{
- if (!_position) {
+ if (!position) {
/* A seek has just happened */
return;
}
- if (time >= *_position && time < (*_position + ContentTime::from_seconds(1))) {
+ if (time >= *position && time < (*position + ContentTime::from_seconds(1))) {
/* No need to seek: caller should just pass() */
return;
}
- _position.reset ();
+ position.reset ();
seek (time, accurate);
}
+
+void
+Decoder::maybe_seek_video (ContentTime time, bool accurate)
+{
+ maybe_seek (_video_position, time, accurate);
+}
+
+void
+Decoder::maybe_seek_audio (ContentTime time, bool accurate)
+{
+ maybe_seek (_audio_position, time, accurate);
+}
+
+void
+Decoder::maybe_seek_subtitle (ContentTime time, bool accurate)
+{
+ maybe_seek (_subtitle_position, time, accurate);
+}