X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdecoder.cc;h=6078141dcfab4d0f84fff1026154106ff389595d;hb=9a27d60ea7888d300a5a2414a477091428589b82;hp=ee03a1579c59bfe399927fb76a85e316fba21edb;hpb=89aa9d4ba69e471949f791cdafe4ae20cea554d2;p=dcpomatic.git diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc index ee03a1579..6078141dc 100644 --- a/src/lib/decoder.cc +++ b/src/lib/decoder.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -21,37 +21,57 @@ #include "decoder.h" #include "video_decoder.h" #include "audio_decoder.h" -#include "subtitle_decoder.h" +#include "text_decoder.h" #include #include using std::cout; using boost::optional; +using boost::shared_ptr; +/** @return Earliest time of content that the next pass() will emit */ ContentTime Decoder::position () const { optional 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)) { - pos = subtitle->position(); + BOOST_FOREACH (shared_ptr i, text) { + if (!i->ignore() && (!pos || i->position() < *pos)) { + pos = i->position(); + } } return pos.get_value_or(ContentTime()); } void -Decoder::seek (ContentTime time, bool accurate) +Decoder::seek (ContentTime, bool) { + if (video) { + video->seek (); + } if (audio) { audio->seek (); } + BOOST_FOREACH (shared_ptr i, text) { + i->seek (); + } +} + +shared_ptr +Decoder::only_text () const +{ + DCPOMATIC_ASSERT (text.size() < 2); + if (text.empty ()) { + return shared_ptr (); + } + return text.front (); }