X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fwriter.cc;h=3ab1cc5b9e014aa08ce9519acd0f9d983c32dc05;hp=cd5b6d7e06d36da2fa7b5e1a41f311dcd10f7913;hb=df17bbd25da69fc38eb2dcd8b4a2531cf0bab0bc;hpb=576b7e8eee6c17a5a7f0f4c3bfb1787768f4f276 diff --git a/src/lib/writer.cc b/src/lib/writer.cc index cd5b6d7e0..3ab1cc5b9 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -91,11 +91,13 @@ Writer::Writer (shared_ptr film, weak_ptr j) _reels.push_back (ReelWriter (film, p, job, reel_index++, reels.size(), _film->content_summary(p))); } - /* We can keep track of the current audio and subtitle reels easily because audio - and subs arrive to the Writer in sequence. This is not so for video. + /* We can keep track of the current audio, subtitle and closed caption reels easily because audio + and captions arrive to the Writer in sequence. This is not so for video. */ _audio_reel = _reels.begin (); - _subtitle_reel = _reels.begin (); + for (int i = 0; i < CAPTION_COUNT; ++i) { + _caption_reel[i] = _reels.begin (); + } /* Check that the signer is OK if we need one */ string reason; @@ -663,20 +665,16 @@ Writer::can_fake_write (Frame frame) const } void -Writer::write (PlayerSubtitles subs, DCPTimePeriod period) +Writer::write (PlayerText text, TextType type, DCPTimePeriod period) { - if (subs.text.empty ()) { - return; - } - - while (_subtitle_reel->period().to <= period.from) { - ++_subtitle_reel; - DCPOMATIC_ASSERT (_subtitle_reel != _reels.end()); + while (_caption_reel[type]->period().to <= period.from) { + ++_caption_reel[type]; + DCPOMATIC_ASSERT (_caption_reel[type] != _reels.end()); } - DCPOMATIC_ASSERT (_subtitle_reel != _reels.end()); + DCPOMATIC_ASSERT (_caption_reel[type] != _reels.end()); - _subtitle_reel->write (subs); + _caption_reel[type]->write (text, type, period); } void