#include "cross.h"
#include "crypto.h"
#include "dcp_content_type.h"
+#include "dcpomatic_log.h"
#include "digester.h"
#include "exceptions.h"
#include "ffmpeg_image_proxy.h"
optional<string>(), false, false, false, dcp::Colour(), 42, 1, dcp::Time(), dcp::Time(), 0, dcp::HAlign::CENTER, 0, dcp::VAlign::CENTER, dcp::Direction::LTR,
"Hello dolly", dcp::Effect::NONE, dcp::Colour(), dcp::Time(), dcp::Time(), 0
);
- subs.push_back (StringText(ss, 0));
- render_text (subs, list<shared_ptr<Font>>(), dcp::Size(640, 480), DCPTime(), 24);
+ subs.push_back (StringText(ss, 0, {}, dcp::Standard::SMPTE));
+ render_text (subs, dcp::Size(640, 480), DCPTime(), 24);
#endif
Ratio::setup_ratios ();
curl_global_init (CURL_GLOBAL_ALL);
ui_thread = boost::this_thread::get_id ();
+
+ capture_asdcp_logs ();
}
#ifdef DCPOMATIC_WINDOWS
_("Rs"),
_("HI"),
_("VI"),
- _("Lc"),
- _("Rc"),
+ _("9"),
+ _("10"),
_("BsL"),
_("BsR"),
_("DBP"),
_("DBS"),
_("Sign"),
- ""
+ _("16")
};
return channels[c];
return r;
}
+
+static
string
-video_asset_filename (shared_ptr<dcp::PictureAsset> asset, int reel_index, int reel_count, optional<string> summary)
+asset_filename (shared_ptr<dcp::Asset> asset, string type, int reel_index, int reel_count, optional<string> summary, string extension)
{
dcp::NameFormat::Map values;
- values['t'] = "j2c";
- values['r'] = raw_convert<string> (reel_index + 1);
- values['n'] = raw_convert<string> (reel_count);
+ values['t'] = type;
+ values['r'] = raw_convert<string>(reel_index + 1);
+ values['n'] = raw_convert<string>(reel_count);
if (summary) {
- values['c'] = careful_string_filter (summary.get());
+ values['c'] = careful_string_filter(summary.get());
}
- return Config::instance()->dcp_asset_filename_format().get(values, "_" + asset->id() + ".mxf");
+ return Config::instance()->dcp_asset_filename_format().get(values, "_" + asset->id() + extension);
+}
+
+
+string
+video_asset_filename (shared_ptr<dcp::PictureAsset> asset, int reel_index, int reel_count, optional<string> summary)
+{
+ return asset_filename(asset, "j2c", reel_index, reel_count, summary, ".mxf");
}
+
string
audio_asset_filename (shared_ptr<dcp::SoundAsset> asset, int reel_index, int reel_count, optional<string> summary)
{
- dcp::NameFormat::Map values;
- values['t'] = "pcm";
- values['r'] = raw_convert<string> (reel_index + 1);
- values['n'] = raw_convert<string> (reel_count);
- if (summary) {
- values['c'] = careful_string_filter (summary.get());
- }
- return Config::instance()->dcp_asset_filename_format().get(values, "_" + asset->id() + ".mxf");
+ return asset_filename(asset, "pcm", reel_index, reel_count, summary, ".mxf");
+}
+
+
+string
+subtitle_asset_filename (shared_ptr<dcp::SubtitleAsset> asset, int reel_index, int reel_count, optional<string> summary, string extension)
+{
+ return asset_filename(asset, "sub", reel_index, reel_count, summary, extension);
}
string
atmos_asset_filename (shared_ptr<dcp::AtmosAsset> asset, int reel_index, int reel_count, optional<string> summary)
{
- dcp::NameFormat::Map values;
- values['t'] = "atmos";
- values['r'] = raw_convert<string> (reel_index + 1);
- values['n'] = raw_convert<string> (reel_count);
- if (summary) {
- values['c'] = careful_string_filter (summary.get());
- }
- return Config::instance()->dcp_asset_filename_format().get(values, "_" + asset->id() + ".mxf");
+ return asset_filename(asset, "atmos", reel_index, reel_count, summary, ".mxf");
}
/* Then remove anything that's not in a very limited character set */
wstring out;
wstring const allowed = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_%.+";
- for (size_t i = 0; i < transliterated_more.length(); ++i) {
+ for (int i = 0; i < transliterated_more.length(); ++i) {
wchar_t c = transliterated_more[i];
if (allowed.find(c) != string::npos) {
out += c;
if (!boost::filesystem::exists(liberation_normal)) {
liberation_normal = "/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf";
}
+ if (!boost::filesystem::exists(liberation_normal)) {
+ liberation_normal = "/usr/share/fonts/liberation-sans/LiberationSans-Regular.ttf";
+ }
return liberation_normal;
}
}
#endif
+
+class LogSink : public Kumu::ILogSink
+{
+public:
+ LogSink () {}
+ LogSink (LogSink const&) = delete;
+ LogSink& operator= (LogSink const&) = delete;
+
+ void WriteEntry(const Kumu::LogEntry& entry) override {
+ Kumu::AutoMutex L(m_lock);
+ WriteEntryToListeners(entry);
+ if (entry.TestFilter(m_filter)) {
+ string buffer;
+ entry.CreateStringWithOptions(buffer, m_options);
+ LOG_GENERAL("asdcplib: %1", buffer);
+ }
+ }
+};
+
+
+void
+capture_asdcp_logs ()
+{
+ static LogSink log_sink;
+ Kumu::SetDefaultLogSink(&log_sink);
+}
+
+
+string
+error_details(boost::system::error_code ec)
+{
+ return String::compose("%1:%2:%3", ec.category().name(), ec.value(), ec.message());
+}