summaryrefslogtreecommitdiff
path: root/src/lib/decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-07-21 15:16:18 +0100
committerCarl Hetherington <cth@carlh.net>2018-07-21 15:16:18 +0100
commitcbd4450197a083bf58bda510e626f73ba583cb66 (patch)
tree2be308772512539570beab36beab02bde72d6d4b /src/lib/decoder.cc
parent1013175d5f6adfa0e6a7442e4c9aebb893787748 (diff)
Basics of multiple captions per content so that DCPContent can
hold subs and closed captions.
Diffstat (limited to 'src/lib/decoder.cc')
-rw-r--r--src/lib/decoder.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc
index 70eb5b61a..2fddddc91 100644
--- a/src/lib/decoder.cc
+++ b/src/lib/decoder.cc
@@ -27,6 +27,7 @@
using std::cout;
using boost::optional;
+using boost::shared_ptr;
/** @return Earliest time of content that the next pass() will emit */
ContentTime
@@ -42,8 +43,10 @@ Decoder::position () const
pos = audio->position();
}
- if (caption && !caption->ignore() && (!pos || caption->position() < *pos)) {
- pos = caption->position();
+ BOOST_FOREACH (shared_ptr<CaptionDecoder> i, caption) {
+ if (!i->ignore() && (!pos || i->position() < *pos)) {
+ pos = i->position();
+ }
}
return pos.get_value_or(ContentTime());
@@ -58,7 +61,17 @@ Decoder::seek (ContentTime, bool)
if (audio) {
audio->seek ();
}
- if (caption) {
- caption->seek ();
+ BOOST_FOREACH (shared_ptr<CaptionDecoder> i, caption) {
+ i->seek ();
}
}
+
+shared_ptr<CaptionDecoder>
+Decoder::only_caption () const
+{
+ DCPOMATIC_ASSERT (caption.size() < 2);
+ if (caption.empty ()) {
+ return shared_ptr<CaptionDecoder> ();
+ }
+ return caption.front ();
+}