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)
{}
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)
{}
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;
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
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;
}
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));
}
}
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 (
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;
}
}
}
- PlainStart (ContentStringText (from, _content->type(), s));
+ PlainStart (ContentStringText (from, s));
_position = from;
}
void
TextDecoder::emit_stop (ContentTime to)
{
- Stop (to, _content->type());
+ Stop (to);
}
void
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;