Improve OpenFileError so that it doesn't say "opening for read"
[dcpomatic.git] / src / lib / text_decoder.cc
index 2423fc73864fd1bcdde8af7f49648814ce18ed09..4eaaf37af7cbd50b86ad2fdce8bfbc17253c88c3 100644 (file)
@@ -36,14 +36,14 @@ using std::min;
 using boost::shared_ptr;
 using boost::optional;
 using boost::function;
+using namespace dcpomatic;
 
 TextDecoder::TextDecoder (
        Decoder* parent,
        shared_ptr<const TextContent> c,
-       shared_ptr<Log> log,
        ContentTime first
        )
-       : DecoderPart (parent, log)
+       : DecoderPart (parent)
        , _content (c)
        , _position (first)
 {
@@ -60,7 +60,7 @@ TextDecoder::TextDecoder (
 void
 TextDecoder::emit_bitmap_start (ContentTime from, shared_ptr<Image> image, dcpomatic::Rect<double> rect)
 {
-       BitmapStart (ContentBitmapText (from, _content->type(), image, rect));
+       BitmapStart (ContentBitmapText (from, image, rect));
        _position = from;
 }
 
@@ -94,7 +94,7 @@ TextDecoder::emit_plain_start (ContentTime from, list<dcp::SubtitleString> s)
                }
        }
 
-       PlainStart (ContentPlainText (from, _content->type(), s));
+       PlainStart (ContentStringText (from, s));
        _position = from;
 }
 
@@ -233,7 +233,7 @@ TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & subtitle)
 void
 TextDecoder::emit_stop (ContentTime to)
 {
-       Stop (to, _content->type());
+       Stop (to);
 }
 
 void
@@ -250,6 +250,17 @@ TextDecoder::emit_plain (ContentTimePeriod period, sub::Subtitle const & s)
        emit_stop (period.to);
 }
 
+/*  @param rect Area expressed as a fraction of the video frame that this subtitle
+ *  is for (e.g. a width of 0.5 means the width of the subtitle is half the width
+ *  of the video frame)
+ */
+void
+TextDecoder::emit_bitmap (ContentTimePeriod period, shared_ptr<Image> image, dcpomatic::Rect<double> rect)
+{
+       emit_bitmap_start (period.from, image, rect);
+       emit_stop (period.to);
+}
+
 void
 TextDecoder::seek ()
 {