summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-08-23 11:19:06 +0100
committerCarl Hetherington <cth@carlh.net>2018-08-23 11:19:06 +0100
commit7962e6cfd5fbd97e1e44aebe3fc190c62da027e9 (patch)
tree39ceac432749a506fc3dc9ff52d3d8aff4a85df3 /src/lib
parent8855efa208776139bf9ce5a188db080e1e136e9b (diff)
Remove TextType from various places as (I believe) it can be inferred from the content.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/content_text.h16
-rw-r--r--src/lib/player.cc24
-rw-r--r--src/lib/player.h2
-rw-r--r--src/lib/text_decoder.cc6
-rw-r--r--src/lib/text_decoder.h2
5 files changed, 24 insertions, 26 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/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;