diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/content_text.h | 16 | ||||
| -rw-r--r-- | src/lib/player.cc | 24 | ||||
| -rw-r--r-- | src/lib/player.h | 2 | ||||
| -rw-r--r-- | src/lib/reel_writer.cc | 16 | ||||
| -rw-r--r-- | src/lib/reel_writer.h | 2 | ||||
| -rw-r--r-- | src/lib/text_decoder.cc | 6 | ||||
| -rw-r--r-- | src/lib/text_decoder.h | 2 | ||||
| -rw-r--r-- | src/lib/writer.cc | 12 | ||||
| -rw-r--r-- | src/lib/writer.h | 2 |
9 files changed, 40 insertions, 42 deletions
diff --git a/src/lib/content_text.h b/src/lib/content_text.h index 3ef011f61..2d8910577 100644 --- a/src/lib/content_text.h +++ b/src/lib/content_text.h @@ -33,29 +33,23 @@ class Image; class ContentText { public: - explicit ContentText (ContentTime f, TextType t) + explicit ContentText (ContentTime f) : _from (f) - , _type (t) {} ContentTime from () const { return _from; } - TextType type () const { - return _type; - } - private: ContentTime _from; - TextType _type; }; class ContentBitmapText : public ContentText { public: - ContentBitmapText (ContentTime f, TextType type, boost::shared_ptr<Image> im, dcpomatic::Rect<double> r) - : ContentText (f, type) + ContentBitmapText (ContentTime f, boost::shared_ptr<Image> im, dcpomatic::Rect<double> r) + : ContentText (f) , sub (im, r) {} @@ -70,8 +64,8 @@ public: class ContentStringText : public ContentText { public: - ContentStringText (ContentTime f, TextType type, std::list<dcp::SubtitleString> s) - : ContentText (f, type) + ContentStringText (ContentTime f, std::list<dcp::SubtitleString> s) + : ContentText (f) , subs (s) {} diff --git a/src/lib/player.cc b/src/lib/player.cc index 5dfc4e66d..cf9bc2e63 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -199,7 +199,7 @@ Player::setup_pieces_unlocked () bind(&Player::plain_text_start, this, weak_ptr<Piece>(piece), weak_ptr<const TextContent>((*j)->content()), _1) ); (*j)->Stop.connect ( - bind(&Player::subtitle_stop, this, weak_ptr<Piece>(piece), weak_ptr<const TextContent>((*j)->content()), _1, _2) + bind(&Player::subtitle_stop, this, weak_ptr<Piece>(piece), weak_ptr<const TextContent>((*j)->content()), _1) ); ++j; @@ -917,7 +917,7 @@ Player::bitmap_text_start (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, C ps.bitmap.push_back (subtitle.sub); DCPTime from (content_time_to_dcp (piece, subtitle.from())); - _active_texts[subtitle.type()].add_from (wc, ps, from); + _active_texts[text->type()].add_from (wc, ps, from); } void @@ -961,19 +961,23 @@ Player::plain_text_start (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, Co ps.add_fonts (text->fonts ()); } - _active_texts[subtitle.type()].add_from (wc, ps, from); + _active_texts[text->type()].add_from (wc, ps, from); } void -Player::subtitle_stop (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, ContentTime to, TextType type) +Player::subtitle_stop (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, ContentTime to) { - if (!_active_texts[type].have (wc)) { + shared_ptr<const TextContent> text = wc.lock (); + if (!text) { + return; + } + + if (!_active_texts[text->type()].have(wc)) { return; } shared_ptr<Piece> piece = wp.lock (); - shared_ptr<const TextContent> text = wc.lock (); - if (!piece || !text) { + if (!piece) { return; } @@ -983,11 +987,11 @@ Player::subtitle_stop (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, Conte return; } - pair<PlayerText, DCPTime> from = _active_texts[type].add_to (wc, dcp_to); + pair<PlayerText, DCPTime> from = _active_texts[text->type()].add_to (wc, dcp_to); - bool const always = (type == TEXT_OPEN_SUBTITLE && _always_burn_open_subtitles); + bool const always = (text->type() == TEXT_OPEN_SUBTITLE && _always_burn_open_subtitles); if (text->use() && !always && !text->burn()) { - Text (from.first, type, DCPTimePeriod (from.second, dcp_to)); + Text (from.first, text->type(), DCPTimePeriod (from.second, dcp_to)); } } diff --git a/src/lib/player.h b/src/lib/player.h index e17456cf2..b4f41f6da 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -127,7 +127,7 @@ private: void audio (boost::weak_ptr<Piece>, AudioStreamPtr, ContentAudio); void bitmap_text_start (boost::weak_ptr<Piece>, boost::weak_ptr<const TextContent>, ContentBitmapText); void plain_text_start (boost::weak_ptr<Piece>, boost::weak_ptr<const TextContent>, ContentStringText); - void subtitle_stop (boost::weak_ptr<Piece>, boost::weak_ptr<const TextContent>, ContentTime, TextType); + void subtitle_stop (boost::weak_ptr<Piece>, boost::weak_ptr<const TextContent>, ContentTime); DCPTime one_video_frame () const; void fill_audio (DCPTimePeriod period); std::pair<boost::shared_ptr<AudioBuffers>, DCPTime> discard_audio ( diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 12e45849b..3d5264060 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -335,7 +335,7 @@ ReelWriter::finish () template <class T> void -maybe_add_captions ( +maybe_add_text ( shared_ptr<dcp::SubtitleAsset> asset, int64_t picture_duration, shared_ptr<dcp::Reel> reel, @@ -508,8 +508,8 @@ ReelWriter::create_reel (list<ReferencedReelAsset> const & refs, list<shared_ptr } reel->add (reel_sound_asset); - maybe_add_captions<dcp::ReelSubtitleAsset> (_caption_asset[TEXT_OPEN_SUBTITLE], reel_picture_asset->duration(), reel, refs, fonts, _film, _period); - maybe_add_captions<dcp::ReelClosedCaptionAsset> (_caption_asset[TEXT_CLOSED_CAPTION], reel_picture_asset->duration(), reel, refs, fonts, _film, _period); + maybe_add_text<dcp::ReelSubtitleAsset> (_text_asset[TEXT_OPEN_SUBTITLE], reel_picture_asset->duration(), reel, refs, fonts, _film, _period); + maybe_add_text<dcp::ReelClosedCaptionAsset> (_text_asset[TEXT_CLOSED_CAPTION], reel_picture_asset->duration(), reel, refs, fonts, _film, _period); return reel; } @@ -547,7 +547,7 @@ ReelWriter::write (shared_ptr<const AudioBuffers> audio) void ReelWriter::write (PlayerText subs, TextType type, DCPTimePeriod period) { - if (!_caption_asset[type]) { + if (!_text_asset[type]) { string lang = _film->subtitle_language (); if (lang.empty ()) { lang = "Unknown"; @@ -557,7 +557,7 @@ ReelWriter::write (PlayerText subs, TextType type, DCPTimePeriod period) s->set_movie_title (_film->name ()); s->set_language (lang); s->set_reel_number (raw_convert<string> (_reel_index + 1)); - _caption_asset[type] = s; + _text_asset[type] = s; } else { shared_ptr<dcp::SMPTESubtitleAsset> s (new dcp::SMPTESubtitleAsset ()); s->set_content_title_text (_film->name ()); @@ -569,7 +569,7 @@ ReelWriter::write (PlayerText subs, TextType type, DCPTimePeriod period) if (_film->encrypted ()) { s->set_key (_film->key ()); } - _caption_asset[type] = s; + _text_asset[type] = s; } } @@ -577,11 +577,11 @@ ReelWriter::write (PlayerText subs, TextType type, DCPTimePeriod period) /* XXX: couldn't / shouldn't we use period here rather than getting time from the subtitle? */ i.set_in (i.in() - dcp::Time (_period.from.seconds(), i.in().tcr)); i.set_out (i.out() - dcp::Time (_period.from.seconds(), i.out().tcr)); - _caption_asset[type]->add (shared_ptr<dcp::Subtitle>(new dcp::SubtitleString(i))); + _text_asset[type]->add (shared_ptr<dcp::Subtitle>(new dcp::SubtitleString(i))); } BOOST_FOREACH (BitmapText i, subs.bitmap) { - _caption_asset[type]->add ( + _text_asset[type]->add ( shared_ptr<dcp::Subtitle>( new dcp::SubtitleImage( i.image->as_png(), diff --git a/src/lib/reel_writer.h b/src/lib/reel_writer.h index a46c3efa7..2e5ad8975 100644 --- a/src/lib/reel_writer.h +++ b/src/lib/reel_writer.h @@ -113,7 +113,7 @@ private: boost::shared_ptr<dcp::PictureAssetWriter> _picture_asset_writer; boost::shared_ptr<dcp::SoundAsset> _sound_asset; boost::shared_ptr<dcp::SoundAssetWriter> _sound_asset_writer; - boost::shared_ptr<dcp::SubtitleAsset> _caption_asset[TEXT_COUNT]; + boost::shared_ptr<dcp::SubtitleAsset> _text_asset[TEXT_COUNT]; static int const _info_size; }; diff --git a/src/lib/text_decoder.cc b/src/lib/text_decoder.cc index 3b6a06ea1..00d58af86 100644 --- a/src/lib/text_decoder.cc +++ b/src/lib/text_decoder.cc @@ -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 (ContentStringText (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 diff --git a/src/lib/text_decoder.h b/src/lib/text_decoder.h index 25125e701..d8a64157e 100644 --- a/src/lib/text_decoder.h +++ b/src/lib/text_decoder.h @@ -64,7 +64,7 @@ public: boost::signals2::signal<void (ContentBitmapText)> BitmapStart; boost::signals2::signal<void (ContentStringText)> PlainStart; - boost::signals2::signal<void (ContentTime, TextType)> Stop; + boost::signals2::signal<void (ContentTime)> Stop; private: boost::shared_ptr<const TextContent> _content; diff --git a/src/lib/writer.cc b/src/lib/writer.cc index a7e3218b5..4b5c5a102 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -96,7 +96,7 @@ Writer::Writer (shared_ptr<const Film> film, weak_ptr<Job> j) */ _audio_reel = _reels.begin (); for (int i = 0; i < TEXT_COUNT; ++i) { - _caption_reel[i] = _reels.begin (); + _text_reel[i] = _reels.begin (); } /* Check that the signer is OK if we need one */ @@ -667,14 +667,14 @@ Writer::can_fake_write (Frame frame) const void Writer::write (PlayerText text, TextType type, DCPTimePeriod period) { - while (_caption_reel[type]->period().to <= period.from) { - ++_caption_reel[type]; - DCPOMATIC_ASSERT (_caption_reel[type] != _reels.end()); + while (_text_reel[type]->period().to <= period.from) { + ++_text_reel[type]; + DCPOMATIC_ASSERT (_text_reel[type] != _reels.end()); } - DCPOMATIC_ASSERT (_caption_reel[type] != _reels.end()); + DCPOMATIC_ASSERT (_text_reel[type] != _reels.end()); - _caption_reel[type]->write (text, type, period); + _text_reel[type]->write (text, type, period); } void diff --git a/src/lib/writer.h b/src/lib/writer.h index 8fc0ce29e..484ca1285 100644 --- a/src/lib/writer.h +++ b/src/lib/writer.h @@ -124,7 +124,7 @@ private: boost::weak_ptr<Job> _job; std::vector<ReelWriter> _reels; std::vector<ReelWriter>::iterator _audio_reel; - std::vector<ReelWriter>::iterator _caption_reel[TEXT_COUNT]; + std::vector<ReelWriter>::iterator _text_reel[TEXT_COUNT]; /** our thread, or 0 */ boost::thread* _thread; |
