diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-12-21 01:50:07 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-12-21 01:50:07 +0000 |
| commit | 4e5c1b91ff04bebc692e52115a741948037dda54 (patch) | |
| tree | 1476add54c5a79261c84d04d56a48d98587457a1 /src/lib/subrip_decoder.cc | |
| parent | d20f2d026f441ad855a26bcf2e53bc8ef4c3faf7 (diff) | |
Update xml_subtitle_test result now that subtitles are being compared; improve placement in SubRip decoder.
Diffstat (limited to 'src/lib/subrip_decoder.cc')
| -rw-r--r-- | src/lib/subrip_decoder.cc | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/lib/subrip_decoder.cc b/src/lib/subrip_decoder.cc index ea8997e31..ed154ebf5 100644 --- a/src/lib/subrip_decoder.cc +++ b/src/lib/subrip_decoder.cc @@ -53,22 +53,34 @@ SubRipDecoder::pass () return true; } - /* XXX: we are ignoring positioning specified in the file */ - list<dcp::SubtitleString> out; for (list<sub::Line>::const_iterator i = _subtitles[_next].lines.begin(); i != _subtitles[_next].lines.end(); ++i) { for (list<sub::Block>::const_iterator j = i->blocks.begin(); j != i->blocks.end(); ++j) { + + dcp::VAlign va = dcp::TOP; + if (i->vertical_position.reference) { + switch (i->vertical_position.reference.get ()) { + case sub::TOP_OF_SCREEN: + va = dcp::TOP; + break; + case sub::CENTRE_OF_SCREEN: + va = dcp::CENTER; + break; + case sub::BOTTOM_OF_SCREEN: + va = dcp::BOTTOM; + } + } + out.push_back ( dcp::SubtitleString ( SubRipContent::font_id, j->italic, dcp::Color (255, 255, 255), - /* .srt files don't specify size, so this is an arbitrary value */ - 48, + j->font_size, dcp::Time (rint (_subtitles[_next].from.metric().get().all_as_milliseconds() / 4)), dcp::Time (rint (_subtitles[_next].to.metric().get().all_as_milliseconds() / 4)), i->vertical_position.line.get() * (1.5 / 22) + 0.8, - dcp::TOP, + va, j->text, dcp::NONE, dcp::Color (255, 255, 255), |
