Rename ContentText and subclasses to PieceText... and pass subtitles through Piece.
[dcpomatic.git] / src / lib / piece.cc
index bf180bc84664b25583117d795af127de678fe63a..69469c02e2c3524ab63647127f0fadb0dfe59ce4 100644 (file)
 #include "piece_video.h"
 #include "player_video.h"
 #include "resampler.h"
+#include "text_content.h"
+#include "text_decoder.h"
 #include "video_content.h"
 #include "video_decoder.h"
 
 
 using std::dynamic_pointer_cast;
+using std::list;
 using std::make_shared;
 using std::shared_ptr;
 using std::vector;
@@ -65,6 +68,12 @@ Piece::Piece (weak_ptr<const Film> film, shared_ptr<Content> content, shared_ptr
                _decoder->audio->Data.connect (boost::bind(&Piece::audio, this, _1, _2, _3));
        }
 
+       for (auto i: _decoder->text) {
+               i->BitmapStart.connect (boost::bind(&Piece::bitmap_start, this, content, i->content(), _1, _2, _3));
+               i->StringStart.connect (boost::bind(&Piece::string_start, this, content, i->content(), _1, _2));
+               i->Stop.connect (boost::bind(&Piece::stop, this, content, i->content(), _1));
+       }
+
        _decoder->Flush.connect (boost::bind(&Piece::flush, this));
 }
 
@@ -122,6 +131,27 @@ Piece::audio (AudioStreamPtr stream, shared_ptr<const AudioBuffers> audio, Frame
 }
 
 
+void
+Piece::bitmap_start (weak_ptr<const Content> content, weak_ptr<const TextContent> text, dcpomatic::ContentTime time, shared_ptr<Image> image, dcpomatic::Rect<double> area)
+{
+       BitmapTextStart (PieceBitmapTextStart(content, text, time, image, area));
+}
+
+
+void
+Piece::string_start (weak_ptr<const Content> content, weak_ptr<const TextContent> text, dcpomatic::ContentTime time, list<dcp::SubtitleString> subs)
+{
+       StringTextStart (PieceStringTextStart(content, text, time, subs));
+}
+
+
+void
+Piece::stop (weak_ptr<const Content> content, weak_ptr<const TextContent> text, dcpomatic::ContentTime time)
+{
+       TextStop (PieceTextStop(content, text, time));
+}
+
+
 void
 Piece::update_pull_to (DCPTime& pull_to) const
 {