diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-02-26 21:06:27 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-02-26 21:06:27 +0000 |
| commit | cef07676fb15c9f1c3c3073d22f06ffe95d9c2ce (patch) | |
| tree | ad67d2991961429c52dda4d7adc1ded37ce71c0a /src/lib/ffmpeg_subtitle_stream.cc | |
| parent | 2b54b284e2c2ffcaa082b1c201abecf25edc21c9 (diff) | |
Allow changes to colours of FFmpeg subtitles (#795).
Diffstat (limited to 'src/lib/ffmpeg_subtitle_stream.cc')
| -rw-r--r-- | src/lib/ffmpeg_subtitle_stream.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/ffmpeg_subtitle_stream.cc b/src/lib/ffmpeg_subtitle_stream.cc index 33759d86e..eca3fda6f 100644 --- a/src/lib/ffmpeg_subtitle_stream.cc +++ b/src/lib/ffmpeg_subtitle_stream.cc @@ -27,6 +27,7 @@ using std::string; using std::map; using std::list; using std::cout; +using std::make_pair; /** Construct a SubtitleStream from a value returned from to_string(). * @param t String returned from to_string(). @@ -82,6 +83,10 @@ FFmpegSubtitleStream::FFmpegSubtitleStream (cxml::ConstNodePtr node, int version ) ); } + + BOOST_FOREACH (cxml::NodePtr i, node->node_children ("Colour")) { + _colours[RGBA(i->node_child("From"))] = RGBA (i->node_child("To")); + } } } @@ -92,6 +97,12 @@ FFmpegSubtitleStream::as_xml (xmlpp::Node* root) const as_xml (root, _image_subtitles, "ImageSubtitle"); as_xml (root, _text_subtitles, "TextSubtitle"); + + for (map<RGBA, RGBA>::const_iterator i = _colours.begin(); i != _colours.end(); ++i) { + xmlpp::Node* node = root->add_child("Colour"); + i->first.as_xml (node->add_child("From")); + i->second.as_xml (node->add_child("To")); + } } void @@ -173,3 +184,15 @@ FFmpegSubtitleStream::add_offset (ContentTime offset) i->second.to += offset; } } + +map<RGBA, RGBA> +FFmpegSubtitleStream::colours () const +{ + return _colours; +} + +void +FFmpegSubtitleStream::set_colour (RGBA from, RGBA to) +{ + _colours[from] = to; +} |
