projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Support debian 11.
[dcpomatic.git]
/
src
/
lib
/
text_decoder.cc
diff --git
a/src/lib/text_decoder.cc
b/src/lib/text_decoder.cc
index 099e3ee74e34af098188c8e3c8b6b51111c03f74..6ee6ed079879e014c33df5c2c4bc36e79b336881 100644
(file)
--- a/
src/lib/text_decoder.cc
+++ b/
src/lib/text_decoder.cc
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2013-20
17
Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-20
21
Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
This file is part of DCP-o-matic.
@@
-18,6
+18,7
@@
*/
*/
+
#include "text_decoder.h"
#include "text_content.h"
#include "util.h"
#include "text_decoder.h"
#include "text_content.h"
#include "util.h"
@@
-27,6
+28,7
@@
#include <boost/algorithm/string.hpp>
#include <iostream>
#include <boost/algorithm/string.hpp>
#include <iostream>
+
using std::list;
using std::cout;
using std::string;
using std::list;
using std::cout;
using std::string;
@@
-34,9
+36,10
@@
using std::min;
using std::max;
using std::shared_ptr;
using boost::optional;
using std::max;
using std::shared_ptr;
using boost::optional;
-using
boost
::function;
+using
std
::function;
using namespace dcpomatic;
using namespace dcpomatic;
+
TextDecoder::TextDecoder (
Decoder* parent,
shared_ptr<const TextContent> c,
TextDecoder::TextDecoder (
Decoder* parent,
shared_ptr<const TextContent> c,
@@
-49,6
+52,7
@@
TextDecoder::TextDecoder (
}
}
+
/** Called by subclasses when an image subtitle is starting.
* @param from From time of the subtitle.
* @param image Subtitle image.
/** Called by subclasses when an image subtitle is starting.
* @param from From time of the subtitle.
* @param image Subtitle image.
@@
-63,14
+67,16
@@
TextDecoder::emit_bitmap_start (ContentTime from, shared_ptr<Image> image, dcpom
_position = from;
}
_position = from;
}
+
void
TextDecoder::emit_plain_start (ContentTime from, list<dcp::SubtitleString> s)
{
for (auto& i: s) {
void
TextDecoder::emit_plain_start (ContentTime from, list<dcp::SubtitleString> s)
{
for (auto& i: s) {
- /* We must escape
< and > in str
ings, otherwise they might confuse our subtitle
- renderer (which uses some HTML-esque markup to do bold/italic etc.)
+ /* We must escape
some th
ings, otherwise they might confuse our subtitle
+ renderer (which uses
entities and
some HTML-esque markup to do bold/italic etc.)
*/
string t = i.text ();
*/
string t = i.text ();
+ boost::algorithm::replace_all (t, "&", "&");
boost::algorithm::replace_all (t, "<", "<");
boost::algorithm::replace_all (t, ">", ">");
i.set_text (t);
boost::algorithm::replace_all (t, "<", "<");
boost::algorithm::replace_all (t, ">", ">");
i.set_text (t);
@@
-97,6
+103,7
@@
TextDecoder::emit_plain_start (ContentTime from, list<dcp::SubtitleString> s)
_position = from;
}
_position = from;
}
+
void
TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & subtitle)
{
void
TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & subtitle)
{
@@
-250,12
+257,14
@@
TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & subtitle)
emit_plain_start (from, out);
}
emit_plain_start (from, out);
}
+
void
TextDecoder::emit_stop (ContentTime to)
{
Stop (to);
}
void
TextDecoder::emit_stop (ContentTime to)
{
Stop (to);
}
+
void
TextDecoder::emit_plain (ContentTimePeriod period, list<dcp::SubtitleString> s)
{
void
TextDecoder::emit_plain (ContentTimePeriod period, list<dcp::SubtitleString> s)
{
@@
-263,6
+272,7
@@
TextDecoder::emit_plain (ContentTimePeriod period, list<dcp::SubtitleString> s)
emit_stop (period.to);
}
emit_stop (period.to);
}
+
void
TextDecoder::emit_plain (ContentTimePeriod period, sub::Subtitle const & s)
{
void
TextDecoder::emit_plain (ContentTimePeriod period, sub::Subtitle const & s)
{
@@
-270,6
+280,7
@@
TextDecoder::emit_plain (ContentTimePeriod period, sub::Subtitle const & s)
emit_stop (period.to);
}
emit_stop (period.to);
}
+
/* @param rect Area expressed as a fraction of the video frame that this subtitle
* is for (e.g. a width of 0.5 means the width of the subtitle is half the width
* of the video frame)
/* @param rect Area expressed as a fraction of the video frame that this subtitle
* is for (e.g. a width of 0.5 means the width of the subtitle is half the width
* of the video frame)
@@
-281,6
+292,7
@@
TextDecoder::emit_bitmap (ContentTimePeriod period, shared_ptr<Image> image, dcp
emit_stop (period.to);
}
emit_stop (period.to);
}
+
void
TextDecoder::seek ()
{
void
TextDecoder::seek ()
{