Fix a couple more crashes with incorrect KDMs (#1000).
[dcpomatic.git] / src / lib / decoder.cc
index ee03a1579c59bfe399927fb76a85e316fba21edb..502273de1e49f5a551110674a5d8284572dbe180 100644 (file)
 using std::cout;
 using boost::optional;
 
+/** @return Earliest time of content that the next pass() will emit */
 ContentTime
 Decoder::position () const
 {
        optional<ContentTime> pos;
 
-       if (video && (!pos || video->position() < *pos)) {
+       if (video && !video->ignore() && (!pos || video->position() < *pos)) {
                pos = video->position();
        }
 
-       if (audio && (!pos || audio->position() < *pos)) {
+       if (audio && !audio->ignore() && (!pos || audio->position() < *pos)) {
                pos = audio->position();
        }
 
-       if (subtitle && (!pos || subtitle->position() < *pos)) {
+       if (subtitle && !subtitle->ignore() && (!pos || subtitle->position() < *pos)) {
                pos = subtitle->position();
        }
 
@@ -49,9 +50,15 @@ Decoder::position () const
 }
 
 void
-Decoder::seek (ContentTime time, bool accurate)
+Decoder::seek (ContentTime, bool)
 {
+       if (video) {
+               video->seek ();
+       }
        if (audio) {
                audio->seek ();
        }
+       if (subtitle) {
+               subtitle->seek ();
+       }
 }