* is minutes and S is seconds).
*/
string
-seconds_to_hms (int s)
+seconds_to_hms(int s)
{
int m = s / 60;
s -= (m * 60);
m -= (h * 60);
char buffer[64];
- snprintf (buffer, sizeof(buffer), "%d:%02d:%02d", h, m, s);
+ snprintf(buffer, sizeof(buffer), "%d:%02d:%02d", h, m, s);
return buffer;
}
string
-time_to_hmsf (DCPTime time, Frame rate)
+time_to_hmsf(DCPTime time, Frame rate)
{
- Frame f = time.frames_round (rate);
+ Frame f = time.frames_round(rate);
int s = f / rate;
f -= (s * rate);
int m = s / 60;
m -= h * 60;
char buffer[64];
- snprintf (buffer, sizeof(buffer), "%d:%02d:%02d.%d", h, m, s, static_cast<int>(f));
+ snprintf(buffer, sizeof(buffer), "%d:%02d:%02d.%d", h, m, s, static_cast<int>(f));
return buffer;
}
* @return String containing an approximate description of s (e.g. "about 2 hours")
*/
string
-seconds_to_approximate_hms (int s)
+seconds_to_approximate_hms(int s)
{
int m = s / 60;
s -= (m * 60);
}
double
-seconds (struct timeval t)
+seconds(struct timeval t)
{
- return t.tv_sec + (double (t.tv_usec) / 1e6);
+ return t.tv_sec + (double(t.tv_usec) / 1e6);
}
#ifdef DCPOMATIC_WINDOWS
/** Resolve symbol name and source location given the path to the executable */
int
-addr2line (void const * const addr)
+addr2line(void const * const addr)
{
char addr2line_cmd[512] = { 0 };
- sprintf (addr2line_cmd, "addr2line -f -p -e %.256s %p > %s", program_name.c_str(), addr, backtrace_file.string().c_str());
+ sprintf(addr2line_cmd, "addr2line -f -p -e %.256s %p > %s", program_name.c_str(), addr, backtrace_file.string().c_str());
std::cout << addr2line_cmd << "\n";
return system(addr2line_cmd);
}
if (info->ExceptionRecord->ExceptionCode != EXCEPTION_STACK_OVERFLOW) {
CONTEXT* context = info->ContextRecord;
- SymInitialize (GetCurrentProcess (), 0, true);
+ SymInitialize(GetCurrentProcess(), 0, true);
STACKFRAME frame = { 0 };
frame.AddrFrame.Mode = AddrModeFlat;
while (
- StackWalk (
+ StackWalk(
IMAGE_FILE_MACHINE_I386,
- GetCurrentProcess (),
- GetCurrentThread (),
+ GetCurrentProcess(),
+ GetCurrentThread(),
&frame,
context,
0,
}
} else {
#ifdef _WIN64
- addr2line ((void *) info->ContextRecord->Rip);
+ addr2line((void *) info->ContextRecord->Rip);
#else
- addr2line ((void *) info->ContextRecord->Eip);
+ addr2line((void *) info->ContextRecord->Eip);
#endif
}
#endif
void
-set_backtrace_file (boost::filesystem::path p)
+set_backtrace_file(boost::filesystem::path p)
{
backtrace_file = p;
}
* cope with that.
*/
void
-terminate ()
+terminate()
{
try {
static bool tried_throw = false;
}
void
-dcpomatic_setup_path_encoding ()
+dcpomatic_setup_path_encoding()
{
#ifdef DCPOMATIC_WINDOWS
/* Dark voodoo which, I think, gets boost::filesystem::path to
This is all Windows-only. AFAICT Linux/OS X use UTF-8 everywhere,
so things are much simpler.
*/
- std::locale::global (boost::locale::generator().generate (""));
- boost::filesystem::path::imbue (std::locale ());
+ std::locale::global(boost::locale::generator().generate(""));
+ boost::filesystem::path::imbue(std::locale());
#endif
}
class LogSink : public Kumu::ILogSink
{
public:
- LogSink () {}
- LogSink (LogSink const&) = delete;
- LogSink& operator= (LogSink const&) = delete;
+ LogSink() {}
+ LogSink(LogSink const&) = delete;
+ LogSink& operator=(LogSink const&) = delete;
void WriteEntry(const Kumu::LogEntry& entry) override {
Kumu::AutoMutex L(m_lock);
void
-capture_asdcp_logs ()
+capture_asdcp_logs()
{
static LogSink log_sink;
Kumu::SetDefaultLogSink(&log_sink);
char line[1024];
static int prefix = 0;
- av_log_format_line(ptr, level, fmt, vl, line, sizeof (line), &prefix);
+ av_log_format_line(ptr, level, fmt, vl, line, sizeof(line), &prefix);
string str(line);
boost::algorithm::trim(str);
dcpomatic_log->log(String::compose("FFmpeg: %1", str), LogEntry::TYPE_GENERAL);
* Must be called from the UI thread, if there is one.
*/
void
-dcpomatic_setup ()
+dcpomatic_setup()
{
#ifdef DCPOMATIC_WINDOWS
- boost::filesystem::path p = g_get_user_config_dir ();
+ boost::filesystem::path p = g_get_user_config_dir();
p /= "backtrace.txt";
- set_backtrace_file (p);
+ set_backtrace_file(p);
SetUnhandledExceptionFilter(exception_handler);
#endif
#ifdef DCPOMATIC_HAVE_AVREGISTER
LIBDCP_DISABLE_WARNINGS
- av_register_all ();
- avfilter_register_all ();
+ av_register_all();
+ avfilter_register_all();
LIBDCP_ENABLE_WARNINGS
#endif
*/
auto lib = directory_containing_executable().parent_path();
lib /= "Frameworks";
- setenv ("LTDL_LIBRARY_PATH", lib.c_str (), 1);
+ setenv("LTDL_LIBRARY_PATH", lib.c_str(), 1);
#endif
- set_terminate (terminate);
+ set_terminate(terminate);
#ifdef DCPOMATIC_WINDOWS
- putenv ("PANGOCAIRO_BACKEND=fontconfig");
+ putenv("PANGOCAIRO_BACKEND=fontconfig");
if (dcp::filesystem::exists(resources_path() / "fonts.conf")) {
/* The actual application after installation */
putenv(String::compose("FONTCONFIG_PATH=%1", resources_path().string()).c_str());
#endif
#ifdef DCPOMATIC_OSX
- setenv ("PANGOCAIRO_BACKEND", "fontconfig", 1);
- setenv ("FONTCONFIG_PATH", resources_path().string().c_str(), 1);
+ setenv("PANGOCAIRO_BACKEND", "fontconfig", 1);
+ setenv("FONTCONFIG_PATH", resources_path().string().c_str(), 1);
#endif
- Pango::init ();
- dcp::init (libdcp_resources_path());
+ Pango::init();
+ dcp::init(libdcp_resources_path());
#if defined(DCPOMATIC_WINDOWS) || defined(DCPOMATIC_OSX)
/* Render something to fontconfig to create its cache */
"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);
+ render_text(subs, dcp::Size(640, 480), DCPTime(), 24);
#endif
#ifdef DCPOMATIC_WINDOWS
setenv("OPENSSL_ENABLE_SHA1_SIGNATURES", "1", 1);
#endif
- Ratio::setup_ratios ();
- PresetColourConversion::setup_colour_conversion_presets ();
- DCPContentType::setup_dcp_content_types ();
- Filter::setup_filters ();
- CinemaSoundProcessor::setup_cinema_sound_processors ();
- AudioProcessor::setup_audio_processors ();
+ Ratio::setup_ratios();
+ PresetColourConversion::setup_colour_conversion_presets();
+ DCPContentType::setup_dcp_content_types();
+ Filter::setup_filters();
+ CinemaSoundProcessor::setup_cinema_sound_processors();
+ AudioProcessor::setup_audio_processors();
- curl_global_init (CURL_GLOBAL_ALL);
+ curl_global_init(CURL_GLOBAL_ALL);
- ui_thread = boost::this_thread::get_id ();
+ ui_thread = boost::this_thread::get_id();
- capture_asdcp_logs ();
+ capture_asdcp_logs();
capture_ffmpeg_logs();
}
#ifdef DCPOMATIC_WINDOWS
boost::filesystem::path
-mo_path ()
+mo_path()
{
wchar_t buffer[512];
- GetModuleFileName (0, buffer, 512 * sizeof(wchar_t));
- boost::filesystem::path p (buffer);
- p = p.parent_path ();
- p = p.parent_path ();
+ GetModuleFileName(0, buffer, 512 * sizeof(wchar_t));
+ boost::filesystem::path p(buffer);
+ p = p.parent_path();
+ p = p.parent_path();
p /= "locale";
return p;
}
#ifdef DCPOMATIC_OSX
boost::filesystem::path
-mo_path ()
+mo_path()
{
return variant::dcpomatic_app() + "/Contents/Resources";
}
#endif
void
-dcpomatic_setup_gettext_i18n (string lang)
+dcpomatic_setup_gettext_i18n(string lang)
{
#ifdef DCPOMATIC_LINUX
lang += ".UTF8";
#endif
- if (!lang.empty ()) {
+ if (!lang.empty()) {
/* Override our environment language. Note that the caller must not
free the string passed into putenv().
*/
- string s = String::compose ("LANGUAGE=%1", lang);
- putenv (strdup (s.c_str ()));
- s = String::compose ("LANG=%1", lang);
- putenv (strdup (s.c_str ()));
- s = String::compose ("LC_ALL=%1", lang);
- putenv (strdup (s.c_str ()));
+ string s = String::compose("LANGUAGE=%1", lang);
+ putenv(strdup(s.c_str()));
+ s = String::compose("LANG=%1", lang);
+ putenv(strdup(s.c_str()));
+ s = String::compose("LC_ALL=%1", lang);
+ putenv(strdup(s.c_str()));
}
- setlocale (LC_ALL, "");
- textdomain ("libdcpomatic2");
+ setlocale(LC_ALL, "");
+ textdomain("libdcpomatic2");
#if defined(DCPOMATIC_WINDOWS) || defined(DCPOMATIC_OSX)
- bindtextdomain ("libdcpomatic2", mo_path().string().c_str());
- bind_textdomain_codeset ("libdcpomatic2", "UTF8");
+ bindtextdomain("libdcpomatic2", mo_path().string().c_str());
+ bind_textdomain_codeset("libdcpomatic2", "UTF8");
#endif
#ifdef DCPOMATIC_LINUX
- bindtextdomain ("libdcpomatic2", LINUX_LOCALE_PREFIX);
+ bindtextdomain("libdcpomatic2", LINUX_LOCALE_PREFIX);
#endif
}
/** Compute a digest of the first and last `size' bytes of a set of files. */
string
-digest_head_tail (vector<boost::filesystem::path> files, boost::uintmax_t size)
+digest_head_tail(vector<boost::filesystem::path> files, boost::uintmax_t size)
{
- boost::scoped_array<char> buffer (new char[size]);
+ boost::scoped_array<char> buffer(new char[size]);
Digester digester;
/* Head */
boost::uintmax_t to_do = size;
- char* p = buffer.get ();
+ char* p = buffer.get();
int i = 0;
- while (i < int64_t (files.size()) && to_do > 0) {
+ while (i < int64_t(files.size()) && to_do > 0) {
dcp::File f(files[i], "rb");
if (!f) {
throw OpenFileError(files[i].string(), f.open_error(), OpenFileError::READ);
++i;
}
- digester.add (buffer.get(), size - to_do);
+ digester.add(buffer.get(), size - to_do);
/* Tail */
to_do = size;
- p = buffer.get ();
+ p = buffer.get();
i = files.size() - 1;
while (i >= 0 && to_do > 0) {
dcp::File f(files[i], "rb");
--i;
}
- digester.add (buffer.get(), size - to_do);
+ digester.add(buffer.get(), size - to_do);
- return digester.get ();
+ return digester.get();
}
string
-simple_digest (vector<boost::filesystem::path> paths)
+simple_digest(vector<boost::filesystem::path> paths)
{
DCP_ASSERT(!paths.empty());
return digest_head_tail(paths, 1000000) + fmt::to_string(dcp::filesystem::file_size(paths.front()));
/** Trip an assert if the caller is not in the UI thread */
void
-ensure_ui_thread ()
+ensure_ui_thread()
{
- DCPOMATIC_ASSERT (boost::this_thread::get_id() == ui_thread);
+ DCPOMATIC_ASSERT(boost::this_thread::get_id() == ui_thread);
}
string
-audio_channel_name (int c)
+audio_channel_name(int c)
{
- DCPOMATIC_ASSERT (MAX_DCP_AUDIO_CHANNELS == 16);
+ DCPOMATIC_ASSERT(MAX_DCP_AUDIO_CHANNELS == 16);
/// TRANSLATORS: these are the names of audio channels; Lfe (sub) is the low-frequency
/// enhancement channel (sub-woofer).
}
string
-short_audio_channel_name (int c)
+short_audio_channel_name(int c)
{
- DCPOMATIC_ASSERT (MAX_DCP_AUDIO_CHANNELS == 16);
+ DCPOMATIC_ASSERT(MAX_DCP_AUDIO_CHANNELS == 16);
/// TRANSLATORS: these are short names of audio channels; Lfe is the low-frequency
/// enhancement channel (sub-woofer). HI is the hearing-impaired audio track and
bool
-valid_image_file (boost::filesystem::path f)
+valid_image_file(boost::filesystem::path f)
{
if (boost::starts_with(f.filename().string(), "._")) {
return false;
}
auto ext = f.extension().string();
- transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
+ transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
return (
ext == ".tif" || ext == ".tiff" || ext == ".jpg" || ext == ".jpeg" ||
ext == ".png" || ext == ".bmp" || ext == ".tga" || ext == ".dpx" ||
}
bool
-valid_sound_file (boost::filesystem::path f)
+valid_sound_file(boost::filesystem::path f)
{
if (boost::starts_with(f.filename().string(), "._")) {
return false;
}
auto ext = f.extension().string();
- transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
+ transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
return (ext == ".wav" || ext == ".mp3" || ext == ".aif" || ext == ".aiff");
}
bool
-valid_j2k_file (boost::filesystem::path f)
+valid_j2k_file(boost::filesystem::path f)
{
auto ext = f.extension().string();
- transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
+ transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
return (ext == ".j2k" || ext == ".j2c" || ext == ".jp2");
}
string
-tidy_for_filename (string f)
+tidy_for_filename(string f)
{
- boost::replace_if (f, boost::is_any_of ("\\/:"), '_');
+ boost::replace_if(f, boost::is_any_of("\\/:"), '_');
return f;
}
dcp::Size
-fit_ratio_within (float ratio, dcp::Size full_frame)
+fit_ratio_within(float ratio, dcp::Size full_frame)
{
- if (ratio < full_frame.ratio ()) {
- return dcp::Size (lrintf (full_frame.height * ratio), full_frame.height);
+ if (ratio < full_frame.ratio()) {
+ return dcp::Size(lrintf(full_frame.height * ratio), full_frame.height);
}
- return dcp::Size (full_frame.width, lrintf (full_frame.width / ratio));
+ return dcp::Size(full_frame.width, lrintf(full_frame.width / ratio));
}
static
string
-asset_filename (shared_ptr<dcp::Asset> asset, string type, int reel_index, int reel_count, optional<string> summary, string extension)
+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'] = type;
string
-audio_asset_filename (shared_ptr<dcp::SoundAsset> asset, int reel_index, int reel_count, optional<string> summary)
+audio_asset_filename(shared_ptr<dcp::SoundAsset> asset, int reel_index, int reel_count, optional<string> summary)
{
return asset_filename(asset, "pcm", reel_index, reel_count, summary, ".mxf");
}
string
-subtitle_asset_filename (shared_ptr<dcp::TextAsset> asset, int reel_index, int reel_count, optional<string> summary, string extension)
+subtitle_asset_filename(shared_ptr<dcp::TextAsset> 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)
+atmos_asset_filename(shared_ptr<dcp::AtmosAsset> asset, int reel_index, int reel_count, optional<string> summary)
{
return asset_filename(asset, "atmos", reel_index, reel_count, summary, ".mxf");
}
* @return First: number of non-LFE soundtrack channels (L/R/C/Ls/Rs/Lc/Rc/Bsl/Bsr), second: number of LFE channels.
*/
pair<int, int>
-audio_channel_types (list<int> mapped, int channels)
+audio_channel_types(list<int> mapped, int channels)
{
int non_lfe = 0;
int lfe = 0;
}
}
- return make_pair (non_lfe, lfe);
+ return make_pair(non_lfe, lfe);
}
shared_ptr<AudioBuffers>
-remap (shared_ptr<const AudioBuffers> input, int output_channels, AudioMapping map)
+remap(shared_ptr<const AudioBuffers> input, int output_channels, AudioMapping map)
{
auto mapped = make_shared<AudioBuffers>(output_channels, input->frames());
- mapped->make_silent ();
+ mapped->make_silent();
- int to_do = min (map.input_channels(), input->channels());
+ int to_do = min(map.input_channels(), input->channels());
for (int i = 0; i < to_do; ++i) {
for (int j = 0; j < mapped->channels(); ++j) {
size_t
-utf8_strlen (string s)
+utf8_strlen(string s)
{
- size_t const len = s.length ();
+ size_t const len = s.length();
int N = 0;
for (size_t i = 0; i < len; ++i) {
unsigned char c = s[i];
emit_subtitle_image(ContentTimePeriod period, dcp::TextImage sub, dcp::Size size, shared_ptr<TextDecoder> decoder)
{
/* XXX: this is rather inefficient; decoding the image just to get its size */
- FFmpegImageProxy proxy (sub.png_image());
+ FFmpegImageProxy proxy(sub.png_image());
auto image = proxy.image(Image::Alignment::PADDED).image;
/* set up rect with height and width */
dcpomatic::Rect<double> rect(0, 0, image->size().width / double(size.width), image->size().height / double(size.height));
break;
}
- decoder->emit_bitmap (period, image, rect);
+ decoder->emit_bitmap(period, image, rect);
}
/** XXX: could use mmap? */
void
-copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)> progress)
+copy_in_bits(boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)> progress)
{
dcp::File f(from, "rb");
if (!f) {
boost::uintmax_t remaining = total;
while (remaining) {
- boost::uintmax_t this_time = min (chunk, remaining);
+ boost::uintmax_t this_time = min(chunk, remaining);
size_t N = f.read(buffer.data(), 1, chunk);
if (N < this_time) {
- throw ReadFileError (from, errno);
+ throw ReadFileError(from, errno);
}
N = t.write(buffer.data(), 1, this_time);
if (N < this_time) {
- throw WriteFileError (to, errno);
+ throw WriteFileError(to, errno);
}
- progress (1 - float(remaining) / total);
+ progress(1 - float(remaining) / total);
remaining -= this_time;
}
}
dcp::Size
-scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container, PixelQuanta quanta)
+scale_for_display(dcp::Size s, dcp::Size display_container, dcp::Size film_container, PixelQuanta quanta)
{
/* Now scale it down if the display container is smaller than the film container */
if (display_container != film_container) {
- float const scale = min (
- float (display_container.width) / film_container.width,
- float (display_container.height) / film_container.height
+ float const scale = min(
+ float(display_container.width) / film_container.width,
+ float(display_container.height) / film_container.height
);
- s.width = lrintf (s.width * scale);
- s.height = lrintf (s.height * scale);
- s = quanta.round (s);
+ s.width = lrintf(s.width * scale);
+ s.height = lrintf(s.height * scale);
+ s = quanta.round(s);
}
return s;
dcp::DecryptedKDM
-decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm)
+decrypt_kdm_with_helpful_error(dcp::EncryptedKDM kdm)
{
try {
- return dcp::DecryptedKDM (kdm, Config::instance()->decryption_chain()->key().get());
+ return dcp::DecryptedKDM(kdm, Config::instance()->decryption_chain()->key().get());
} catch (dcp::KDMDecryptionError& e) {
/* Try to flesh out the error a bit */
auto const kdm_subject_name = kdm.recipient_x509_subject_name();
boost::filesystem::path
-default_font_file ()
+default_font_file()
{
boost::filesystem::path liberation_normal;
try {
#if DCPOMATIC_DEBUG_THREADS
void
-start_of_thread (string name)
+start_of_thread(string name)
{
std::cout << "THREAD:" << name << ":" << std::hex << pthread_self() << "\n";
}
#else
void
-start_of_thread (string)
+start_of_thread(string)
{
}
string
rfc_2822_date(time_t time)
{
- auto const utc_now = boost::posix_time::second_clock::universal_time ();
- auto const local_now = boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local (utc_now);
+ auto const utc_now = boost::posix_time::second_clock::universal_time();
+ auto const local_now = boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local(utc_now);
auto const offset = local_now - utc_now;
auto const hours = int(abs(offset.hours()));
class AudioBuffers;
class TextDecoder;
-extern std::string seconds_to_hms (int);
-extern std::string time_to_hmsf (dcpomatic::DCPTime time, Frame rate);
-extern std::string seconds_to_approximate_hms (int);
-extern double seconds (struct timeval);
-extern void dcpomatic_setup ();
-extern void dcpomatic_setup_path_encoding ();
-extern void dcpomatic_setup_gettext_i18n (std::string);
-extern std::string digest_head_tail (std::vector<boost::filesystem::path>, boost::uintmax_t size);
-extern std::string simple_digest (std::vector<boost::filesystem::path> paths);
-extern void ensure_ui_thread ();
-extern std::string audio_channel_name (int);
-extern std::string short_audio_channel_name (int);
-extern bool valid_image_file (boost::filesystem::path);
-extern bool valid_sound_file (boost::filesystem::path);
-extern bool valid_j2k_file (boost::filesystem::path);
+extern std::string seconds_to_hms(int);
+extern std::string time_to_hmsf(dcpomatic::DCPTime time, Frame rate);
+extern std::string seconds_to_approximate_hms(int);
+extern double seconds(struct timeval);
+extern void dcpomatic_setup();
+extern void dcpomatic_setup_path_encoding();
+extern void dcpomatic_setup_gettext_i18n(std::string);
+extern std::string digest_head_tail(std::vector<boost::filesystem::path>, boost::uintmax_t size);
+extern std::string simple_digest(std::vector<boost::filesystem::path> paths);
+extern void ensure_ui_thread();
+extern std::string audio_channel_name(int);
+extern std::string short_audio_channel_name(int);
+extern bool valid_image_file(boost::filesystem::path);
+extern bool valid_sound_file(boost::filesystem::path);
+extern bool valid_j2k_file(boost::filesystem::path);
#ifdef DCPOMATIC_WINDOWS
-extern boost::filesystem::path mo_path ();
+extern boost::filesystem::path mo_path();
#endif
-extern std::string tidy_for_filename (std::string);
-extern dcp::Size fit_ratio_within (float ratio, dcp::Size);
-extern void set_backtrace_file (boost::filesystem::path);
-extern std::string video_asset_filename (std::shared_ptr<dcp::PictureAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary);
-extern std::string audio_asset_filename (std::shared_ptr<dcp::SoundAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary);
-extern std::string subtitle_asset_filename (std::shared_ptr<dcp::TextAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary, std::string extension);
-extern std::string atmos_asset_filename (std::shared_ptr<dcp::AtmosAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary);
+extern std::string tidy_for_filename(std::string);
+extern dcp::Size fit_ratio_within(float ratio, dcp::Size);
+extern void set_backtrace_file(boost::filesystem::path);
+extern std::string video_asset_filename(std::shared_ptr<dcp::PictureAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary);
+extern std::string audio_asset_filename(std::shared_ptr<dcp::SoundAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary);
+extern std::string subtitle_asset_filename(std::shared_ptr<dcp::TextAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary, std::string extension);
+extern std::string atmos_asset_filename(std::shared_ptr<dcp::AtmosAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary);
extern std::string careful_string_filter(std::string s, std::wstring allowed = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.+");
-extern std::pair<int, int> audio_channel_types (std::list<int> mapped, int channels);
-extern std::shared_ptr<AudioBuffers> remap (std::shared_ptr<const AudioBuffers> input, int output_channels, AudioMapping map);
-extern size_t utf8_strlen (std::string s);
-extern void emit_subtitle_image (dcpomatic::ContentTimePeriod period, dcp::TextImage sub, dcp::Size size, std::shared_ptr<TextDecoder> decoder);
-extern void copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)>);
-extern dcp::Size scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container, PixelQuanta quanta);
-extern dcp::DecryptedKDM decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm);
-extern boost::filesystem::path default_font_file ();
-extern void start_of_thread (std::string name);
+extern std::pair<int, int> audio_channel_types(std::list<int> mapped, int channels);
+extern std::shared_ptr<AudioBuffers> remap(std::shared_ptr<const AudioBuffers> input, int output_channels, AudioMapping map);
+extern size_t utf8_strlen(std::string s);
+extern void emit_subtitle_image(dcpomatic::ContentTimePeriod period, dcp::TextImage sub, dcp::Size size, std::shared_ptr<TextDecoder> decoder);
+extern void copy_in_bits(boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)>);
+extern dcp::Size scale_for_display(dcp::Size s, dcp::Size display_container, dcp::Size film_container, PixelQuanta quanta);
+extern dcp::DecryptedKDM decrypt_kdm_with_helpful_error(dcp::EncryptedKDM kdm);
+extern boost::filesystem::path default_font_file();
+extern void start_of_thread(std::string name);
extern std::string error_details(boost::system::error_code ec);
extern bool contains_assetmap(boost::filesystem::path dir);
extern std::string word_wrap(std::string input, int columns);