diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-07-20 19:55:22 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-07-20 19:55:22 +0100 |
| commit | ad70feebe3a9a89865185b05e084b326637ff81e (patch) | |
| tree | d440c1c5ab27cb5cde4333943654d57a40793684 /src/lib/player_video.cc | |
| parent | f82bdaa6ffe1a9e62a010de405f8bbb7ea392f00 (diff) | |
Untested; allow viewing of subtitles or closed captions in the preview.
Diffstat (limited to 'src/lib/player_video.cc')
| -rw-r--r-- | src/lib/player_video.cc | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/lib/player_video.cc b/src/lib/player_video.cc index a50b196a2..c8fb044aa 100644 --- a/src/lib/player_video.cc +++ b/src/lib/player_video.cc @@ -92,14 +92,14 @@ PlayerVideo::PlayerVideo (shared_ptr<cxml::Node> node, shared_ptr<Socket> socket image->read_from_socket (socket); - _subtitle = PositionImage (image, Position<int> (node->number_child<int> ("SubtitleX"), node->number_child<int> ("SubtitleY"))); + _caption = PositionImage (image, Position<int> (node->number_child<int> ("SubtitleX"), node->number_child<int> ("SubtitleY"))); } } void -PlayerVideo::set_subtitle (PositionImage image) +PlayerVideo::set_caption (PositionImage image) { - _subtitle = image; + _caption = image; } /** Create an image for this frame. @@ -153,8 +153,8 @@ PlayerVideo::image (dcp::NoteHandler note, function<AVPixelFormat (AVPixelFormat total_crop, _inter_size, _out_size, yuv_to_rgb, pixel_format (_in->pixel_format()), aligned, fast ); - if (_subtitle) { - out->alpha_blend (Image::ensure_aligned (_subtitle->image), _subtitle->position); + if (_caption) { + out->alpha_blend (Image::ensure_aligned (_caption->image), _caption->position); } if (_fade) { @@ -181,11 +181,11 @@ PlayerVideo::add_metadata (xmlpp::Node* node) const if (_colour_conversion) { _colour_conversion.get().as_xml (node); } - if (_subtitle) { - node->add_child ("SubtitleWidth")->add_child_text (raw_convert<string> (_subtitle->image->size().width)); - node->add_child ("SubtitleHeight")->add_child_text (raw_convert<string> (_subtitle->image->size().height)); - node->add_child ("SubtitleX")->add_child_text (raw_convert<string> (_subtitle->position.x)); - node->add_child ("SubtitleY")->add_child_text (raw_convert<string> (_subtitle->position.y)); + if (_caption) { + node->add_child ("SubtitleWidth")->add_child_text (raw_convert<string> (_caption->image->size().width)); + node->add_child ("SubtitleHeight")->add_child_text (raw_convert<string> (_caption->image->size().height)); + node->add_child ("SubtitleX")->add_child_text (raw_convert<string> (_caption->position.x)); + node->add_child ("SubtitleY")->add_child_text (raw_convert<string> (_caption->position.y)); } } @@ -193,8 +193,8 @@ void PlayerVideo::send_binary (shared_ptr<Socket> socket) const { _in->send_binary (socket); - if (_subtitle) { - _subtitle->image->write_to_socket (socket); + if (_caption) { + _caption->image->write_to_socket (socket); } } @@ -208,7 +208,7 @@ PlayerVideo::has_j2k () const return false; } - return _crop == Crop () && _out_size == j2k->size() && !_subtitle && !_fade && !_colour_conversion; + return _crop == Crop () && _out_size == j2k->size() && !_caption && !_fade && !_colour_conversion; } Data @@ -239,13 +239,13 @@ PlayerVideo::same (shared_ptr<const PlayerVideo> other) const return false; } - if ((!_subtitle && other->_subtitle) || (_subtitle && !other->_subtitle)) { - /* One has a subtitle and the other doesn't */ + if ((!_caption && other->_caption) || (_caption && !other->_caption)) { + /* One has a caption and the other doesn't */ return false; } - if (_subtitle && other->_subtitle && !_subtitle->same (other->_subtitle.get ())) { - /* They both have subtitles but they are different */ + if (_caption && other->_caption && !_caption->same (other->_caption.get ())) { + /* They both have captions but they are different */ return false; } @@ -278,7 +278,7 @@ PlayerVideo::memory_used () const return _in->memory_used(); } -/** @return Shallow copy of this; _in and _subtitle are shared between the original and the copy */ +/** @return Shallow copy of this; _in and _caption are shared between the original and the copy */ shared_ptr<PlayerVideo> PlayerVideo::shallow_copy () const { |
