#include "ratio.h"
#include "rect.h"
#include "render_text.h"
-#include "scope_guard.h"
#include "string_text.h"
#include "text_decoder.h"
#include "util.h"
#include <dcp/locale_convert.h>
#include <dcp/picture_asset.h>
#include <dcp/raw_convert.h>
+#include <dcp/scope_guard.h>
#include <dcp/sound_asset.h>
#include <dcp/subtitle_asset.h>
#include <dcp/util.h>
vector<StringText> subs;
dcp::SubtitleString ss(
optional<string>(), false, false, false, dcp::Colour(), 42, 1, dcp::Time(), dcp::Time(), 0, dcp::HAlign::CENTER, 0, dcp::VAlign::CENTER, 0, dcp::Direction::LTR,
- "Hello dolly", dcp::Effect::NONE, dcp::Colour(), dcp::Time(), dcp::Time(), 0
+ "Hello dolly", dcp::Effect::NONE, dcp::Colour(), dcp::Time(), dcp::Time(), 0, std::vector<dcp::Ruby>()
);
subs.push_back(StringText(ss, 0, make_shared<dcpomatic::Font>("foo"), dcp::SubtitleStandard::SMPTE_2014));
render_text (subs, dcp::Size(640, 480), DCPTime(), 24);
string
simple_digest (vector<boost::filesystem::path> paths)
{
+ DCP_ASSERT(!paths.empty());
return digest_head_tail(paths, 1000000) + raw_convert<string>(dcp::filesystem::file_size(paths.front()));
}
bool
valid_image_file (boost::filesystem::path f)
{
- if (boost::starts_with (f.leaf().string(), "._")) {
+ if (boost::starts_with(f.filename().string(), "._")) {
return false;
}
bool
valid_sound_file (boost::filesystem::path f)
{
- if (boost::starts_with (f.leaf().string(), "._")) {
+ if (boost::starts_with(f.filename().string(), "._")) {
return false;
}
icu::Locale locale;
UErrorCode status = U_ZERO_ERROR;
auto iter = icu::BreakIterator::createLineInstance(locale, status);
- ScopeGuard sg = [iter]() { delete iter; };
+ dcp::ScopeGuard sg = [iter]() { delete iter; };
if (U_FAILURE(status)) {
return input;
}
return output;
}
+
+string
+screen_names_to_string(vector<string> names)
+{
+ if (names.empty()) {
+ return {};
+ }
+
+ auto number = [](string const& s) {
+ return s.find_first_not_of("0123456789") == string::npos;
+ };
+
+ if (std::find_if(names.begin(), names.end(), [number](string const& s) { return !number(s); }) == names.end()) {
+ std::sort(names.begin(), names.end(), [](string const& a, string const& b) {
+ return dcp::raw_convert<int>(a) < dcp::raw_convert<int>(b);
+ });
+ } else {
+ std::sort(names.begin(), names.end());
+ }
+
+ string result;
+ for (auto const& name: names) {
+ result += name + ", ";
+ }
+
+ return result.substr(0, result.length() - 2);
+}
+