summaryrefslogtreecommitdiff
path: root/src/lib/decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-02-21 21:42:44 +0000
committerCarl Hetherington <cth@carlh.net>2017-04-19 23:04:32 +0100
commit89aa9d4ba69e471949f791cdafe4ae20cea554d2 (patch)
treea8260555268d392292775a2851d8780e5612091b /src/lib/decoder.cc
parent7db99ef207c68910ee96a3e806c9832e8f90b219 (diff)
Various fixes to push audio vaguely in the right direction.
Diffstat (limited to 'src/lib/decoder.cc')
-rw-r--r--src/lib/decoder.cc29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc
index 785fb96f0..ee03a1579 100644
--- a/src/lib/decoder.cc
+++ b/src/lib/decoder.cc
@@ -22,23 +22,36 @@
#include "video_decoder.h"
#include "audio_decoder.h"
#include "subtitle_decoder.h"
+#include <boost/optional.hpp>
+#include <iostream>
+
+using std::cout;
+using boost::optional;
ContentTime
Decoder::position () const
{
- ContentTime pos;
+ optional<ContentTime> pos;
- if (video && video->position()) {
- pos = min (pos, video->position().get());
+ if (video && (!pos || video->position() < *pos)) {
+ pos = video->position();
}
- if (audio && audio->position()) {
- pos = min (pos, audio->position().get());
+ if (audio && (!pos || audio->position() < *pos)) {
+ pos = audio->position();
}
- if (subtitle && subtitle->position()) {
- pos = min (pos, subtitle->position().get());
+ if (subtitle && (!pos || subtitle->position() < *pos)) {
+ pos = subtitle->position();
}
- return pos;
+ return pos.get_value_or(ContentTime());
+}
+
+void
+Decoder::seek (ContentTime time, bool accurate)
+{
+ if (audio) {
+ audio->seek ();
+ }
}