summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-08-28 23:34:56 +0100
committerCarl Hetherington <cth@carlh.net>2018-08-29 11:58:06 +0100
commit1db0293ad36605da9ca8daa8736ef581f4f6a34e (patch)
treefb613032d7f8a1712cf10f99ebbf6215e4145c5a /src
parentec97893127a2d59871d92c9e658b6b1ab3100b40 (diff)
Basics of splitting CCAP streams into different assets.
Diffstat (limited to 'src')
-rw-r--r--src/lib/butler.cc10
-rw-r--r--src/lib/butler.h4
-rw-r--r--src/lib/dcp_encoder.cc9
-rw-r--r--src/lib/dcp_encoder.h3
-rw-r--r--src/lib/dcp_text_track.cc10
-rw-r--r--src/lib/dcp_text_track.h2
-rw-r--r--src/lib/hints.cc4
-rw-r--r--src/lib/hints.h3
-rw-r--r--src/lib/player.cc2
-rw-r--r--src/lib/player.h2
-rw-r--r--src/lib/reel_writer.cc47
-rw-r--r--src/lib/reel_writer.h6
-rw-r--r--src/lib/text_ring_buffers.cc10
-rw-r--r--src/lib/text_ring_buffers.h26
-rw-r--r--src/lib/writer.cc33
-rw-r--r--src/lib/writer.h6
-rw-r--r--src/wx/closed_captions_dialog.cc12
-rw-r--r--src/wx/closed_captions_dialog.h3
18 files changed, 138 insertions, 54 deletions
diff --git a/src/lib/butler.cc b/src/lib/butler.cc
index de9ed4ed0..a127ee9bd 100644
--- a/src/lib/butler.cc
+++ b/src/lib/butler.cc
@@ -64,7 +64,7 @@ Butler::Butler (shared_ptr<Player> player, shared_ptr<Log> log, AudioMapping aud
{
_player_video_connection = _player->Video.connect (bind (&Butler::video, this, _1, _2));
_player_audio_connection = _player->Audio.connect (bind (&Butler::audio, this, _1, _2));
- _player_text_connection = _player->Text.connect (bind (&Butler::text, this, _1, _2, _3));
+ _player_text_connection = _player->Text.connect (bind (&Butler::text, this, _1, _2, _3, _4));
/* The butler must here about things first, otherwise it might not sort out suspensions in time for
get_video() to be called in response to this signal.
*/
@@ -208,7 +208,7 @@ Butler::get_video ()
return r;
}
-optional<pair<PlayerText, DCPTimePeriod> >
+optional<TextRingBuffers::Data>
Butler::get_closed_caption ()
{
boost::mutex::scoped_lock lm (_mutex);
@@ -349,12 +349,14 @@ Butler::player_change (ChangeType type, bool frequent)
}
void
-Butler::text (PlayerText pt, TextType type, DCPTimePeriod period)
+Butler::text (PlayerText pt, TextType type, optional<DCPTextTrack> track, DCPTimePeriod period)
{
if (type != TEXT_CLOSED_CAPTION) {
return;
}
+ DCPOMATIC_ASSERT (track);
+
boost::mutex::scoped_lock lm2 (_buffers_mutex);
- _closed_caption.put (make_pair(pt, period));
+ _closed_caption.put (pt, *track, period);
}
diff --git a/src/lib/butler.h b/src/lib/butler.h
index b10c93e79..4322c401d 100644
--- a/src/lib/butler.h
+++ b/src/lib/butler.h
@@ -43,7 +43,7 @@ public:
void seek (DCPTime position, bool accurate);
std::pair<boost::shared_ptr<PlayerVideo>, DCPTime> get_video ();
boost::optional<DCPTime> get_audio (float* out, Frame frames);
- boost::optional<std::pair<PlayerText, DCPTimePeriod> > get_closed_caption ();
+ boost::optional<TextRingBuffers::Data> get_closed_caption ();
void disable_audio ();
@@ -53,7 +53,7 @@ private:
void thread ();
void video (boost::shared_ptr<PlayerVideo> video, DCPTime time);
void audio (boost::shared_ptr<AudioBuffers> audio, DCPTime time);
- void text (PlayerText pt, TextType type, DCPTimePeriod period);
+ void text (PlayerText pt, TextType type, boost::optional<DCPTextTrack> track, DCPTimePeriod period);
bool should_run () const;
void prepare (boost::weak_ptr<PlayerVideo> video) const;
void player_change (ChangeType type, bool frequent);
diff --git a/src/lib/dcp_encoder.cc b/src/lib/dcp_encoder.cc
index 7fbbb2c63..50a8fd927 100644
--- a/src/lib/dcp_encoder.cc
+++ b/src/lib/dcp_encoder.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -49,6 +49,7 @@ using std::list;
using boost::shared_ptr;
using boost::weak_ptr;
using boost::dynamic_pointer_cast;
+using boost::optional;
/** Construct a DCP encoder.
* @param film Film that we are encoding.
@@ -61,7 +62,7 @@ DCPEncoder::DCPEncoder (shared_ptr<const Film> film, weak_ptr<Job> job)
{
_player_video_connection = _player->Video.connect (bind (&DCPEncoder::video, this, _1, _2));
_player_audio_connection = _player->Audio.connect (bind (&DCPEncoder::audio, this, _1, _2));
- _player_text_connection = _player->Text.connect (bind (&DCPEncoder::text, this, _1, _2, _3));
+ _player_text_connection = _player->Text.connect (bind (&DCPEncoder::text, this, _1, _2, _3, _4));
BOOST_FOREACH (shared_ptr<const Content> c, film->content ()) {
BOOST_FOREACH (shared_ptr<TextContent> i, c->text) {
@@ -143,10 +144,10 @@ DCPEncoder::audio (shared_ptr<AudioBuffers> data, DCPTime time)
}
void
-DCPEncoder::text (PlayerText data, TextType type, DCPTimePeriod period)
+DCPEncoder::text (PlayerText data, TextType type, optional<DCPTextTrack> track, DCPTimePeriod period)
{
if (type == TEXT_CLOSED_CAPTION || _non_burnt_subtitles) {
- _writer->write (data, type, period);
+ _writer->write (data, type, track, period);
}
}
diff --git a/src/lib/dcp_encoder.h b/src/lib/dcp_encoder.h
index 8a2ad947d..3ccd5695e 100644
--- a/src/lib/dcp_encoder.h
+++ b/src/lib/dcp_encoder.h
@@ -20,6 +20,7 @@
#include "types.h"
#include "player_text.h"
+#include "dcp_text_track.h"
#include "encoder.h"
#include <boost/weak_ptr.hpp>
@@ -52,7 +53,7 @@ private:
void video (boost::shared_ptr<PlayerVideo>, DCPTime);
void audio (boost::shared_ptr<AudioBuffers>, DCPTime);
- void text (PlayerText, TextType, DCPTimePeriod);
+ void text (PlayerText, TextType, boost::optional<DCPTextTrack>, DCPTimePeriod);
boost::shared_ptr<Writer> _writer;
boost::shared_ptr<J2KEncoder> _j2k_encoder;
diff --git a/src/lib/dcp_text_track.cc b/src/lib/dcp_text_track.cc
index 2d3d9fe10..1c73870aa 100644
--- a/src/lib/dcp_text_track.cc
+++ b/src/lib/dcp_text_track.cc
@@ -61,3 +61,13 @@ operator!= (DCPTextTrack const & a, DCPTextTrack const & b)
{
return !(a == b);
}
+
+bool
+operator< (DCPTextTrack const & a, DCPTextTrack const & b)
+{
+ if (a.name != b.name) {
+ return a.name < b.name;
+ }
+
+ return a.language < b.language;
+}
diff --git a/src/lib/dcp_text_track.h b/src/lib/dcp_text_track.h
index d69e6dae9..913e77fa5 100644
--- a/src/lib/dcp_text_track.h
+++ b/src/lib/dcp_text_track.h
@@ -27,6 +27,7 @@
class DCPTextTrack
{
public:
+ DCPTextTrack () {}
DCPTextTrack (cxml::ConstNodePtr node);
DCPTextTrack (std::string name_, std::string language_);
@@ -39,5 +40,6 @@ public:
bool operator== (DCPTextTrack const & a, DCPTextTrack const & b);
bool operator!= (DCPTextTrack const & a, DCPTextTrack const & b);
+bool operator< (DCPTextTrack const & a, DCPTextTrack const & b);
#endif
diff --git a/src/lib/hints.cc b/src/lib/hints.cc
index 8979b6b4c..f2e13f503 100644
--- a/src/lib/hints.cc
+++ b/src/lib/hints.cc
@@ -266,7 +266,7 @@ Hints::thread ()
shared_ptr<Player> player (new Player (film, film->playlist ()));
player->set_ignore_video ();
player->set_ignore_audio ();
- player->Text.connect (bind(&Hints::text, this, _1, _2, _3));
+ player->Text.connect (bind(&Hints::text, this, _1, _2, _3, _4));
while (!player->pass ()) {
bind (boost::ref(Pulse));
}
@@ -281,7 +281,7 @@ Hints::hint (string h)
}
void
-Hints::text (PlayerText text, TextType type, DCPTimePeriod period)
+Hints::text (PlayerText text, TextType type, optional<DCPTextTrack> track, DCPTimePeriod period)
{
if (type != TEXT_CLOSED_CAPTION) {
return;
diff --git a/src/lib/hints.h b/src/lib/hints.h
index 67cada89f..9da061286 100644
--- a/src/lib/hints.h
+++ b/src/lib/hints.h
@@ -21,6 +21,7 @@
#include "signaller.h"
#include "player_text.h"
#include "types.h"
+#include "dcp_text_track.h"
#include "dcpomatic_time.h"
#include <boost/weak_ptr.hpp>
#include <boost/signals2.hpp>
@@ -46,7 +47,7 @@ private:
void thread ();
void stop_thread ();
void hint (std::string h);
- void text (PlayerText text, TextType type, DCPTimePeriod period);
+ void text (PlayerText text, TextType type, boost::optional<DCPTextTrack> track, DCPTimePeriod period);
boost::weak_ptr<const Film> _film;
boost::thread* _thread;
diff --git a/src/lib/player.cc b/src/lib/player.cc
index cf9bc2e63..5202bbbe0 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -991,7 +991,7 @@ Player::subtitle_stop (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, Conte
bool const always = (text->type() == TEXT_OPEN_SUBTITLE && _always_burn_open_subtitles);
if (text->use() && !always && !text->burn()) {
- Text (from.first, text->type(), DCPTimePeriod (from.second, dcp_to));
+ Text (from.first, text->type(), text->dcp_track().get_value_or(DCPTextTrack()), DCPTimePeriod (from.second, dcp_to));
}
}
diff --git a/src/lib/player.h b/src/lib/player.h
index b4f41f6da..70a2e4ae3 100644
--- a/src/lib/player.h
+++ b/src/lib/player.h
@@ -99,7 +99,7 @@ public:
/** Emitted when a text is ready. This signal may be emitted considerably
* after the corresponding Video.
*/
- boost::signals2::signal<void (PlayerText, TextType, DCPTimePeriod)> Text;
+ boost::signals2::signal<void (PlayerText, TextType, boost::optional<DCPTextTrack>, DCPTimePeriod)> Text;
private:
friend class PlayerWrapper;
diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc
index 3d5264060..7b0233d21 100644
--- a/src/lib/reel_writer.cc
+++ b/src/lib/reel_writer.cc
@@ -57,6 +57,7 @@
using std::list;
using std::string;
using std::cout;
+using std::map;
using boost::shared_ptr;
using boost::optional;
using boost::dynamic_pointer_cast;
@@ -350,7 +351,6 @@ maybe_add_text (
shared_ptr<T> reel_asset;
if (asset) {
-
boost::filesystem::path liberation_normal;
try {
liberation_normal = shared_path() / "LiberationSans-Regular.ttf";
@@ -376,7 +376,6 @@ maybe_add_text (
boost::filesystem::create_directories (directory);
asset->write (directory / ("sub_" + asset->id() + ".xml"));
} else {
-
/* All our assets should be the same length; use the picture asset length here
as a reference to set the subtitle one. We'll use the duration rather than
the intrinsic duration; we don't care if the picture asset has been trimmed, we're
@@ -508,8 +507,10 @@ ReelWriter::create_reel (list<ReferencedReelAsset> const & refs, list<shared_ptr
}
reel->add (reel_sound_asset);
- 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);
+ maybe_add_text<dcp::ReelSubtitleAsset> (_subtitle_asset, reel_picture_asset->duration(), reel, refs, fonts, _film, _period);
+ for (map<DCPTextTrack, shared_ptr<dcp::SubtitleAsset> >::const_iterator i = _closed_caption_assets.begin(); i != _closed_caption_assets.end(); ++i) {
+ maybe_add_text<dcp::ReelClosedCaptionAsset> (i->second, reel_picture_asset->duration(), reel, refs, fonts, _film, _period);
+ }
return reel;
}
@@ -545,9 +546,23 @@ ReelWriter::write (shared_ptr<const AudioBuffers> audio)
}
void
-ReelWriter::write (PlayerText subs, TextType type, DCPTimePeriod period)
+ReelWriter::write (PlayerText subs, TextType type, optional<DCPTextTrack> track, DCPTimePeriod period)
{
- if (!_text_asset[type]) {
+ shared_ptr<dcp::SubtitleAsset> asset;
+
+ switch (type) {
+ case TEXT_OPEN_SUBTITLE:
+ asset = _subtitle_asset;
+ break;
+ case TEXT_CLOSED_CAPTION:
+ DCPOMATIC_ASSERT (track);
+ asset = _closed_caption_assets[*track];
+ break;
+ default:
+ DCPOMATIC_ASSERT (false);
+ }
+
+ if (!asset) {
string lang = _film->subtitle_language ();
if (lang.empty ()) {
lang = "Unknown";
@@ -557,7 +572,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));
- _text_asset[type] = s;
+ asset = s;
} else {
shared_ptr<dcp::SMPTESubtitleAsset> s (new dcp::SMPTESubtitleAsset ());
s->set_content_title_text (_film->name ());
@@ -569,19 +584,31 @@ ReelWriter::write (PlayerText subs, TextType type, DCPTimePeriod period)
if (_film->encrypted ()) {
s->set_key (_film->key ());
}
- _text_asset[type] = s;
+ asset = s;
}
}
+ switch (type) {
+ case TEXT_OPEN_SUBTITLE:
+ _subtitle_asset = asset;
+ break;
+ case TEXT_CLOSED_CAPTION:
+ DCPOMATIC_ASSERT (track);
+ _closed_caption_assets[*track] = asset;
+ break;
+ default:
+ DCPOMATIC_ASSERT (false);
+ }
+
BOOST_FOREACH (StringText i, subs.string) {
/* 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));
- _text_asset[type]->add (shared_ptr<dcp::Subtitle>(new dcp::SubtitleString(i)));
+ asset->add (shared_ptr<dcp::Subtitle>(new dcp::SubtitleString(i)));
}
BOOST_FOREACH (BitmapText i, subs.bitmap) {
- _text_asset[type]->add (
+ asset->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 2e5ad8975..ae64c3ac7 100644
--- a/src/lib/reel_writer.h
+++ b/src/lib/reel_writer.h
@@ -22,6 +22,7 @@
#include "dcpomatic_time.h"
#include "referenced_reel_asset.h"
#include "player_text.h"
+#include "dcp_text_track.h"
#include <dcp/picture_asset_writer.h>
#include <boost/shared_ptr.hpp>
@@ -60,7 +61,7 @@ public:
void fake_write (Frame frame, Eyes eyes, int size);
void repeat_write (Frame frame, Eyes eyes);
void write (boost::shared_ptr<const AudioBuffers> audio);
- void write (PlayerText text, TextType type, DCPTimePeriod period);
+ void write (PlayerText text, TextType type, boost::optional<DCPTextTrack> track, DCPTimePeriod period);
void finish ();
boost::shared_ptr<dcp::Reel> create_reel (std::list<ReferencedReelAsset> const & refs, std::list<boost::shared_ptr<Font> > const & fonts);
@@ -113,7 +114,8 @@ 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> _text_asset[TEXT_COUNT];
+ boost::shared_ptr<dcp::SubtitleAsset> _subtitle_asset;
+ std::map<DCPTextTrack, boost::shared_ptr<dcp::SubtitleAsset> > _closed_caption_assets;
static int const _info_size;
};
diff --git a/src/lib/text_ring_buffers.cc b/src/lib/text_ring_buffers.cc
index 3586ab648..cc5357804 100644
--- a/src/lib/text_ring_buffers.cc
+++ b/src/lib/text_ring_buffers.cc
@@ -24,21 +24,21 @@ using std::pair;
using boost::optional;
void
-TextRingBuffers::put (pair<PlayerText, DCPTimePeriod> text)
+TextRingBuffers::put (PlayerText text, DCPTextTrack track, DCPTimePeriod period)
{
boost::mutex::scoped_lock lm (_mutex);
- _data.push_back (text);
+ _data.push_back (Data(text, track, period));
}
-optional<pair<PlayerText, DCPTimePeriod> >
+optional<TextRingBuffers::Data>
TextRingBuffers::get ()
{
boost::mutex::scoped_lock lm (_mutex);
if (_data.empty ()) {
- return pair<PlayerText, DCPTimePeriod>();
+ return optional<Data>();
}
- pair<PlayerText, DCPTimePeriod> r = _data.front ();
+ Data r = _data.front ();
_data.pop_front ();
return r;
}
diff --git a/src/lib/text_ring_buffers.h b/src/lib/text_ring_buffers.h
index e33d9be3b..289a38149 100644
--- a/src/lib/text_ring_buffers.h
+++ b/src/lib/text_ring_buffers.h
@@ -18,18 +18,38 @@
*/
+#ifndef DCPOMATIC_TEXT_RING_BUFFERS_H
+#define DCPOMATIC_TEXT_RING_BUFFERS_H
+
#include "player_text.h"
+#include "dcp_text_track.h"
#include <boost/thread.hpp>
#include <utility>
class TextRingBuffers
{
public:
- void put (std::pair<PlayerText, DCPTimePeriod> text);
- boost::optional<std::pair<PlayerText, DCPTimePeriod> > get ();
+ void put (PlayerText text, DCPTextTrack track, DCPTimePeriod period);
+
+ struct Data {
+ Data (PlayerText text_, DCPTextTrack track_, DCPTimePeriod period_)
+ : text (text_)
+ , track (track_)
+ , period (period_)
+ {}
+
+ PlayerText text;
+ DCPTextTrack track;
+ DCPTimePeriod period;
+ };
+
+ boost::optional<Data> get ();
void clear ();
private:
boost::mutex _mutex;
- std::list<std::pair<PlayerText, DCPTimePeriod> > _data;
+
+ std::list<Data> _data;
};
+
+#endif
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index 4b5c5a102..8e2079aeb 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -63,9 +63,11 @@ using std::cout;
using std::map;
using std::min;
using std::max;
+using std::vector;
using boost::shared_ptr;
using boost::weak_ptr;
using boost::dynamic_pointer_cast;
+using boost::optional;
using dcp::Data;
Writer::Writer (shared_ptr<const Film> film, weak_ptr<Job> j)
@@ -95,8 +97,9 @@ Writer::Writer (shared_ptr<const Film> film, weak_ptr<Job> j)
and captions arrive to the Writer in sequence. This is not so for video.
*/
_audio_reel = _reels.begin ();
- for (int i = 0; i < TEXT_COUNT; ++i) {
- _text_reel[i] = _reels.begin ();
+ _subtitle_reel = _reels.begin ();
+ BOOST_FOREACH (DCPTextTrack i, _film->closed_caption_tracks()) {
+ _caption_reels[i] = _reels.begin ();
}
/* Check that the signer is OK if we need one */
@@ -664,17 +667,29 @@ Writer::can_fake_write (Frame frame) const
return (frame != 0 && frame < reel.first_nonexistant_frame());
}
+/** @param track Closed caption track if type == TEXT_CLOSED_CAPTION */
void
-Writer::write (PlayerText text, TextType type, DCPTimePeriod period)
+Writer::write (PlayerText text, TextType type, optional<DCPTextTrack> track, DCPTimePeriod period)
{
- while (_text_reel[type]->period().to <= period.from) {
- ++_text_reel[type];
- DCPOMATIC_ASSERT (_text_reel[type] != _reels.end());
+ vector<ReelWriter>::iterator* reel = 0;
+
+ switch (type) {
+ case TEXT_OPEN_SUBTITLE:
+ reel = &_subtitle_reel;
+ break;
+ case TEXT_CLOSED_CAPTION:
+ reel = &_caption_reels[*track];
+ break;
+ default:
+ DCPOMATIC_ASSERT (false);
}
- DCPOMATIC_ASSERT (_text_reel[type] != _reels.end());
+ while ((*reel)->period().to <= period.from) {
+ ++(*reel);
+ DCPOMATIC_ASSERT (*reel != _reels.end());
+ }
- _text_reel[type]->write (text, type, period);
+ (*reel)->write (text, type, track, period);
}
void
diff --git a/src/lib/writer.h b/src/lib/writer.h
index 484ca1285..e08e9f28d 100644
--- a/src/lib/writer.h
+++ b/src/lib/writer.h
@@ -25,6 +25,7 @@
#include "types.h"
#include "player_text.h"
#include "exception_store.h"
+#include "dcp_text_track.h"
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/thread.hpp>
@@ -104,7 +105,7 @@ public:
bool can_repeat (Frame) const;
void repeat (Frame, Eyes);
void write (boost::shared_ptr<const AudioBuffers>, DCPTime time);
- void write (PlayerText text, TextType type, DCPTimePeriod period);
+ void write (PlayerText text, TextType type, boost::optional<DCPTextTrack>, DCPTimePeriod period);
void write (std::list<boost::shared_ptr<Font> > fonts);
void write (ReferencedReelAsset asset);
void finish ();
@@ -124,7 +125,8 @@ private:
boost::weak_ptr<Job> _job;
std::vector<ReelWriter> _reels;
std::vector<ReelWriter>::iterator _audio_reel;
- std::vector<ReelWriter>::iterator _text_reel[TEXT_COUNT];
+ std::vector<ReelWriter>::iterator _subtitle_reel;
+ std::map<DCPTextTrack, std::vector<ReelWriter>::iterator> _caption_reels;
/** our thread, or 0 */
boost::thread* _thread;
diff --git a/src/wx/closed_captions_dialog.cc b/src/wx/closed_captions_dialog.cc
index 3f444f9a4..b81414bed 100644
--- a/src/wx/closed_captions_dialog.cc
+++ b/src/wx/closed_captions_dialog.cc
@@ -104,18 +104,18 @@ private:
void
ClosedCaptionsDialog::update (DCPTime time)
{
- if (_current_in_lines && _current->second.to > time) {
+ if (_current_in_lines && _current->period.to > time) {
/* Current one is fine */
return;
}
- if (_current && _current->second.to < time) {
+ if (_current && _current->period.to < time) {
/* Current one has finished; clear out */
for (int j = 0; j < CLOSED_CAPTION_LINES; ++j) {
_lines[j] = "";
}
Refresh ();
- _current = optional<pair<PlayerText, DCPTimePeriod> >();
+ _current = optional<TextRingBuffers::Data>();
}
if (!_current) {
@@ -126,10 +126,10 @@ ClosedCaptionsDialog::update (DCPTime time)
_current_in_lines = false;
}
- if (_current && _current->second.contains(time)) {
+ if (_current && _current->period.contains(time)) {
/* We need to set this new one up */
- list<StringText> to_show = _current->first.string;
+ list<StringText> to_show = _current->text.string;
for (int j = 0; j < CLOSED_CAPTION_LINES; ++j) {
_lines[j] = "";
@@ -153,7 +153,7 @@ ClosedCaptionsDialog::update (DCPTime time)
void
ClosedCaptionsDialog::clear ()
{
- _current = optional<pair<PlayerText, DCPTimePeriod> >();
+ _current = optional<TextRingBuffers::Data>();
_current_in_lines = false;
Refresh ();
}
diff --git a/src/wx/closed_captions_dialog.h b/src/wx/closed_captions_dialog.h
index 3da7f6522..3818e3812 100644
--- a/src/wx/closed_captions_dialog.h
+++ b/src/wx/closed_captions_dialog.h
@@ -20,6 +20,7 @@
#include "lib/dcpomatic_time.h"
#include "lib/player.h"
+#include "lib/text_ring_buffers.h"
#include <wx/wx.h>
class Butler;
@@ -36,7 +37,7 @@ public:
private:
void paint ();
- boost::optional<std::pair<PlayerText, DCPTimePeriod> > _current;
+ boost::optional<TextRingBuffers::Data> _current;
bool _current_in_lines;
std::vector<wxString> _lines;
boost::weak_ptr<Butler> _butler;