Basic grunt-work, untested and unfinished, but it compiles.
[dcpomatic.git] / src / lib / decoder.cc
index 50356da788e84c018f175e6c611a6d5a6313f52b..785fb96f0c2ed4b0b7637abba296bcbb61ca40b1 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 */
 
 #include "decoder.h"
-#include <iostream>
+#include "video_decoder.h"
+#include "audio_decoder.h"
+#include "subtitle_decoder.h"
 
-using std::cout;
-using boost::optional;
-
-void
-Decoder::maybe_seek (optional<ContentTime>& position, ContentTime time, bool accurate)
+ContentTime
+Decoder::position () const
 {
-       if (!position) {
-               /* A seek has just happened */
-               return;
-       }
+       ContentTime pos;
 
-       if (time >= *position && time < (*position + ContentTime::from_seconds(1))) {
-               /* No need to seek: caller should just pass() */
-               return;
+       if (video && video->position()) {
+               pos = min (pos, video->position().get());
        }
 
-       position.reset ();
-       seek (time, accurate);
-}
-
-void
-Decoder::maybe_seek_video (ContentTime time, bool accurate)
-{
-       maybe_seek (_video_position, time, accurate);
-}
+       if (audio && audio->position()) {
+               pos = min (pos, audio->position().get());
+       }
 
-void
-Decoder::maybe_seek_audio (ContentTime time, bool accurate)
-{
-       maybe_seek (_audio_position, time, accurate);
-}
+       if (subtitle && subtitle->position()) {
+               pos = min (pos, subtitle->position().get());
+       }
 
-void
-Decoder::maybe_seek_subtitle (ContentTime time, bool accurate)
-{
-       maybe_seek (_subtitle_position, time, accurate);
+       return pos;
 }