From b03f2277a205ff7e7cdaa12c6e52322ea474a7af Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 30 Dec 2024 15:43:14 +0100 Subject: Bump libdcp for raw_convert changes. raw_convert is gone, so here we use fmt::{to_string,format} instead. Other raw_converts now use fast_float. --- cscript | 2 +- src/lib/analytics.cc | 7 ++--- src/lib/atmos_content.cc | 4 +-- src/lib/audio_analysis.cc | 21 +++++++------- src/lib/audio_content.cc | 11 ++++---- src/lib/audio_mapping.cc | 11 ++++---- src/lib/audio_point.cc | 7 ++--- src/lib/colour_conversion.cc | 35 +++++++++++------------ src/lib/config.cc | 45 +++++++++++++++--------------- src/lib/content.cc | 13 ++++----- src/lib/create_cli.cc | 20 ++++++++++++++ src/lib/crop.cc | 11 ++++---- src/lib/cross_common.cc | 4 +-- src/lib/cross_unix.cc | 4 +-- src/lib/cross_windows.cc | 4 +-- src/lib/dcp_content.cc | 11 ++++---- src/lib/dcp_subtitle_content.cc | 5 ++-- src/lib/dcp_video.cc | 15 +++++----- src/lib/disk_writer_messages.cc | 7 +++-- src/lib/encode_server.cc | 7 ++--- src/lib/encode_server_finder.cc | 5 ++-- src/lib/export_config.cc | 4 +-- src/lib/fcpxml_content.cc | 4 +-- src/lib/ffmpeg_audio_stream.cc | 11 ++++---- src/lib/ffmpeg_content.cc | 15 +++++----- src/lib/ffmpeg_image_proxy.cc | 7 ++--- src/lib/ffmpeg_stream.cc | 10 ++++--- src/lib/film.cc | 37 +++++++++++++------------ src/lib/hints.cc | 4 +-- src/lib/j2k_image_proxy.cc | 11 ++++---- src/lib/json_server.cc | 7 ++--- src/lib/pixel_quanta.cc | 6 ++-- src/lib/player_video.cc | 27 +++++++++--------- src/lib/raw_image_proxy.cc | 9 +++--- src/lib/reel_writer.cc | 5 ++-- src/lib/remembered_asset.cc | 6 ++-- src/lib/render_text.cc | 8 +++--- src/lib/rough_duration.cc | 3 +- src/lib/string_text_file_content.cc | 5 ++-- src/lib/subtitle_analysis.cc | 17 ++++++------ src/lib/subtitle_film_encoder.cc | 7 ++--- src/lib/text_content.cc | 55 ++++++++++++++++++------------------- src/lib/util.cc | 7 +++-- src/lib/video_content.cc | 21 +++++++------- src/tools/dcpomatic.cc | 5 ++-- src/wx/config_dialog.cc | 4 +-- src/wx/timecode.h | 17 ++++++------ src/wx/verify_dcp_result_panel.cc | 10 +++---- test/j2k_video_bit_rate_test.cc | 4 +-- test/socket_test.cc | 8 +++--- test/subtitle_reel_number_test.cc | 4 +-- wscript | 7 +++-- 52 files changed, 303 insertions(+), 291 deletions(-) diff --git a/cscript b/cscript index ffcec3656..6e6239270 100644 --- a/cscript +++ b/cscript @@ -531,7 +531,7 @@ def make_spec(filename, version, target, options, requires=None): print('/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :', file=f) def dependencies(target, options): - deps = [('libdcp', 'v1.10.2', {'c++17': target.platform.startswith('osx')})] + deps = [('libdcp', 'v1.10.3', {'c++17': target.platform.startswith('osx')})] deps.append(('libsub', 'v1.6.52')) deps.append(('leqm-nrt', '30dcaea1373ac62fba050e02ce5b0c1085797a23')) deps.append(('rtaudio', 'f619b76')) diff --git a/src/lib/analytics.cc b/src/lib/analytics.cc index 9dcfdcd31..b3c44202a 100644 --- a/src/lib/analytics.cc +++ b/src/lib/analytics.cc @@ -24,12 +24,12 @@ #include "exceptions.h" #include "variant.h" #include -#include #include #include LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include #include #include @@ -37,7 +37,6 @@ LIBDCP_ENABLE_WARNINGS using std::string; -using dcp::raw_convert; using boost::algorithm::trim; @@ -101,8 +100,8 @@ Analytics::write () const xmlpp::Document doc; auto root = doc.create_root_node ("Analytics"); - cxml::add_text_child(root, "Version", raw_convert(_current_version)); - cxml::add_text_child(root, "SuccessfulDCPEncodes", raw_convert(_successful_dcp_encodes)); + cxml::add_text_child(root, "Version", fmt::to_string(_current_version)); + cxml::add_text_child(root, "SuccessfulDCPEncodes", fmt::to_string(_successful_dcp_encodes)); try { doc.write_to_file_formatted(write_path("analytics.xml").string()); diff --git a/src/lib/atmos_content.cc b/src/lib/atmos_content.cc index 22bd431a2..c83b259cc 100644 --- a/src/lib/atmos_content.cc +++ b/src/lib/atmos_content.cc @@ -20,11 +20,11 @@ #include "atmos_content.h" -#include #include LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include using std::make_shared; @@ -65,7 +65,7 @@ AtmosContent::from_xml (Content* parent, cxml::ConstNodePtr node) void AtmosContent::as_xml(xmlpp::Element* element) const { - cxml::add_text_child(element, "AtmosLength", dcp::raw_convert(_length)); + cxml::add_text_child(element, "AtmosLength", fmt::to_string(_length)); cxml::add_text_child(element, "AtmosEditRate", _edit_rate.as_string()); } diff --git a/src/lib/audio_analysis.cc b/src/lib/audio_analysis.cc index ac990ee18..8375ae770 100644 --- a/src/lib/audio_analysis.cc +++ b/src/lib/audio_analysis.cc @@ -29,6 +29,7 @@ LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include #include #include #include @@ -140,7 +141,7 @@ AudioAnalysis::write (boost::filesystem::path filename) auto doc = make_shared(); auto root = doc->create_root_node("AudioAnalysis"); - cxml::add_text_child(root, "Version", raw_convert(_current_state_version)); + cxml::add_text_child(root, "Version", fmt::to_string(_current_state_version)); for (auto& i: _data) { auto channel = cxml::add_child(root, "Channel"); @@ -151,31 +152,31 @@ AudioAnalysis::write (boost::filesystem::path filename) for (size_t i = 0; i < _sample_peak.size(); ++i) { auto n = cxml::add_child(root, "SamplePeak"); - n->add_child_text (raw_convert (_sample_peak[i].peak)); - n->set_attribute("time", raw_convert (_sample_peak[i].time.get())); + n->add_child_text(fmt::to_string(_sample_peak[i].peak)); + n->set_attribute("time", fmt::to_string(_sample_peak[i].time.get())); } for (auto i: _true_peak) { - cxml::add_text_child(root, "TruePeak", raw_convert(i)); + cxml::add_text_child(root, "TruePeak", fmt::to_string(i)); } if (_integrated_loudness) { - cxml::add_text_child(root, "IntegratedLoudness", raw_convert(_integrated_loudness.get())); + cxml::add_text_child(root, "IntegratedLoudness", fmt::to_string(_integrated_loudness.get())); } if (_loudness_range) { - cxml::add_text_child(root, "LoudnessRange", raw_convert(_loudness_range.get())); + cxml::add_text_child(root, "LoudnessRange", fmt::to_string(_loudness_range.get())); } if (_analysis_gain) { - cxml::add_text_child(root, "AnalysisGain", raw_convert(_analysis_gain.get())); + cxml::add_text_child(root, "AnalysisGain", fmt::to_string(_analysis_gain.get())); } - cxml::add_text_child(root, "SamplesPerPoint", raw_convert(_samples_per_point)); - cxml::add_text_child(root, "SampleRate", raw_convert(_sample_rate)); + cxml::add_text_child(root, "SamplesPerPoint", fmt::to_string(_samples_per_point)); + cxml::add_text_child(root, "SampleRate", fmt::to_string(_sample_rate)); if (_leqm) { - cxml::add_text_child(root, "Leqm", raw_convert(*_leqm)); + cxml::add_text_child(root, "Leqm", fmt::to_string(*_leqm)); } doc->write_to_file_formatted (filename.string ()); diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index 2569e1cf0..bda0230ca 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -28,9 +28,9 @@ #include "frame_rate_change.h" #include "maths_util.h" #include "video_content.h" -#include #include #include +#include #include #include "i18n.h" @@ -47,7 +47,6 @@ using std::shared_ptr; using std::string; using std::vector; using boost::optional; -using dcp::raw_convert; using namespace dcpomatic; @@ -127,10 +126,10 @@ void AudioContent::as_xml(xmlpp::Element* element) const { boost::mutex::scoped_lock lm (_mutex); - cxml::add_text_child(element, "AudioGain", raw_convert(_gain)); - cxml::add_text_child(element, "AudioDelay", raw_convert(_delay)); - cxml::add_text_child(element, "AudioFadeIn", raw_convert(_fade_in.get())); - cxml::add_text_child(element, "AudioFadeOut", raw_convert(_fade_out.get())); + cxml::add_text_child(element, "AudioGain", fmt::to_string(_gain)); + cxml::add_text_child(element, "AudioDelay", fmt::to_string(_delay)); + cxml::add_text_child(element, "AudioFadeIn", fmt::to_string(_fade_in.get())); + cxml::add_text_child(element, "AudioFadeOut", fmt::to_string(_fade_out.get())); cxml::add_text_child(element, "AudioUseSameFadesAsVideo", _use_same_fades_as_video ? "1" : "0"); } diff --git a/src/lib/audio_mapping.cc b/src/lib/audio_mapping.cc index 37929001d..939a03414 100644 --- a/src/lib/audio_mapping.cc +++ b/src/lib/audio_mapping.cc @@ -31,6 +31,7 @@ LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include #include #include @@ -225,15 +226,15 @@ AudioMapping::as_xml(xmlpp::Element* element) const auto const input = input_channels(); auto const output = output_channels(); - cxml::add_text_child(element, "InputChannels", raw_convert(input)); - cxml::add_text_child(element, "OutputChannels", raw_convert(output)); + cxml::add_text_child(element, "InputChannels", fmt::to_string(input)); + cxml::add_text_child(element, "OutputChannels", fmt::to_string(output)); for (int c = 0; c < input; ++c) { for (int d = 0; d < output; ++d) { auto t = cxml::add_child(element, "Gain"); - t->set_attribute("input", raw_convert(c)); - t->set_attribute("output", raw_convert(d)); - t->add_child_text (raw_convert (get (c, d))); + t->set_attribute("input", fmt::to_string(c)); + t->set_attribute("output", fmt::to_string(d)); + t->add_child_text(fmt::to_string(get(c, d))); } } } diff --git a/src/lib/audio_point.cc b/src/lib/audio_point.cc index 036904520..efd342dd1 100644 --- a/src/lib/audio_point.cc +++ b/src/lib/audio_point.cc @@ -20,15 +20,14 @@ #include "audio_point.h" -#include #include LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include using std::string; -using dcp::raw_convert; AudioPoint::AudioPoint () @@ -72,6 +71,6 @@ AudioPoint::operator= (AudioPoint const & other) void AudioPoint::as_xml (xmlpp::Element* parent) const { - cxml::add_text_child(parent, "Peak", raw_convert(_data[PEAK])); - cxml::add_text_child(parent, "RMS", raw_convert(_data[RMS])); + cxml::add_text_child(parent, "Peak", fmt::to_string(_data[PEAK])); + cxml::add_text_child(parent, "RMS", fmt::to_string(_data[RMS])); } diff --git a/src/lib/colour_conversion.cc b/src/lib/colour_conversion.cc index f1e625812..447382a1e 100644 --- a/src/lib/colour_conversion.cc +++ b/src/lib/colour_conversion.cc @@ -34,6 +34,7 @@ LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include #include #include "i18n.h" @@ -157,34 +158,34 @@ ColourConversion::as_xml(xmlpp::Element* element) const if (dynamic_pointer_cast (_in)) { auto tf = dynamic_pointer_cast (_in); cxml::add_text_child(in_node, "Type", "Gamma"); - cxml::add_text_child(in_node, "Gamma", raw_convert(tf->gamma())); + cxml::add_text_child(in_node, "Gamma", fmt::to_string(tf->gamma())); } else if (dynamic_pointer_cast (_in)) { auto tf = dynamic_pointer_cast (_in); cxml::add_text_child(in_node, "Type", "ModifiedGamma"); - cxml::add_text_child(in_node, "Power", raw_convert(tf->power ())); - cxml::add_text_child(in_node, "Threshold", raw_convert(tf->threshold ())); - cxml::add_text_child(in_node, "A", raw_convert(tf->A())); - cxml::add_text_child(in_node, "B", raw_convert(tf->B())); + cxml::add_text_child(in_node, "Power", fmt::to_string(tf->power())); + cxml::add_text_child(in_node, "Threshold", fmt::to_string(tf->threshold())); + cxml::add_text_child(in_node, "A", fmt::to_string(tf->A())); + cxml::add_text_child(in_node, "B", fmt::to_string(tf->B())); } else if (dynamic_pointer_cast(_in)) { cxml::add_text_child(in_node, "Type", "SGamut3"); } - cxml::add_text_child(element, "YUVToRGB", raw_convert(static_cast(_yuv_to_rgb))); - cxml::add_text_child(element, "RedX", raw_convert(_red.x)); - cxml::add_text_child(element, "RedY", raw_convert(_red.y)); - cxml::add_text_child(element, "GreenX", raw_convert(_green.x)); - cxml::add_text_child(element, "GreenY", raw_convert(_green.y)); - cxml::add_text_child(element, "BlueX", raw_convert(_blue.x)); - cxml::add_text_child(element, "BlueY", raw_convert(_blue.y)); - cxml::add_text_child(element, "WhiteX", raw_convert(_white.x)); - cxml::add_text_child(element, "WhiteY", raw_convert(_white.y)); + cxml::add_text_child(element, "YUVToRGB", fmt::to_string(static_cast(_yuv_to_rgb))); + cxml::add_text_child(element, "RedX", fmt::to_string(_red.x)); + cxml::add_text_child(element, "RedY", fmt::to_string(_red.y)); + cxml::add_text_child(element, "GreenX", fmt::to_string(_green.x)); + cxml::add_text_child(element, "GreenY", fmt::to_string(_green.y)); + cxml::add_text_child(element, "BlueX", fmt::to_string(_blue.x)); + cxml::add_text_child(element, "BlueY", fmt::to_string(_blue.y)); + cxml::add_text_child(element, "WhiteX", fmt::to_string(_white.x)); + cxml::add_text_child(element, "WhiteY", fmt::to_string(_white.y)); if (_adjusted_white) { - cxml::add_text_child(element, "AdjustedWhiteX", raw_convert(_adjusted_white.get().x)); - cxml::add_text_child(element, "AdjustedWhiteY", raw_convert(_adjusted_white.get().y)); + cxml::add_text_child(element, "AdjustedWhiteX", fmt::to_string(_adjusted_white.get().x)); + cxml::add_text_child(element, "AdjustedWhiteY", fmt::to_string(_adjusted_white.get().y)); } if (auto gf = dynamic_pointer_cast(_out)) { - cxml::add_text_child(element, "OutputGamma", raw_convert(gf->gamma())); + cxml::add_text_child(element, "OutputGamma", fmt::to_string(gf->gamma())); } } diff --git a/src/lib/config.cc b/src/lib/config.cc index 0cbf1fcb6..aa7c79bbe 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -737,11 +738,11 @@ Config::write_config () const auto root = doc.create_root_node ("Config"); /* [XML] Version The version number of the configuration file format. */ - cxml::add_text_child(root, "Version", raw_convert(_current_version)); + cxml::add_text_child(root, "Version", fmt::to_string(_current_version)); /* [XML] MasterEncodingThreads Number of encoding threads to use when running as master. */ - cxml::add_text_child(root, "MasterEncodingThreads", raw_convert(_master_encoding_threads)); + cxml::add_text_child(root, "MasterEncodingThreads", fmt::to_string(_master_encoding_threads)); /* [XML] ServerEncodingThreads Number of encoding threads to use when running as server. */ - cxml::add_text_child(root, "ServerEncodingThreads", raw_convert(_server_encoding_threads)); + cxml::add_text_child(root, "ServerEncodingThreads", fmt::to_string(_server_encoding_threads)); if (_default_directory) { /* [XML:opt] DefaultDirectory Default directory when creating a new film in the GUI. */ cxml::add_text_child(root, "DefaultDirectory", _default_directory->string()); @@ -750,7 +751,7 @@ Config::write_config () const ServerPortBase + 2 are used for querying servers. ServerPortBase + 3 is used by the batch converter to listen for job requests. */ - cxml::add_text_child(root, "ServerPortBase", raw_convert(_server_port_base)); + cxml::add_text_child(root, "ServerPortBase", fmt::to_string(_server_port_base)); /* [XML] UseAnyServers 1 to broadcast to look for encoding servers to use, 0 to use only those configured. */ cxml::add_text_child(root, "UseAnyServers", _use_any_servers ? "1" : "0"); @@ -766,7 +767,7 @@ Config::write_config () const */ cxml::add_text_child(root, "OnlyServersEncode", _only_servers_encode ? "1" : "0"); /* [XML] TMSProtocol Protocol to use to copy files to a TMS; 0 to use SCP, 1 for FTP. */ - cxml::add_text_child(root, "TMSProtocol", raw_convert(static_cast(_tms_protocol))); + cxml::add_text_child(root, "TMSProtocol", fmt::to_string(static_cast(_tms_protocol))); /* [XML] TMSPassive True to use PASV mode with TMS FTP connections. */ cxml::add_text_child(root, "TMSPassive", _tms_passive ? "1" : "0"); /* [XML] TMSIP IP address of TMS. */ @@ -797,9 +798,9 @@ Config::write_config () const cxml::add_text_child(root, "UploadAfterMakeDCP", _upload_after_make_dcp ? "1" : "0"); /* [XML] DefaultStillLength Default length (in seconds) for still images in new films. */ - cxml::add_text_child(root, "DefaultStillLength", raw_convert(_default_still_length)); + cxml::add_text_child(root, "DefaultStillLength", fmt::to_string(_default_still_length)); /* [XML] DefaultAudioDelay Default delay to apply to audio (positive moves audio later) in milliseconds. */ - cxml::add_text_child(root, "DefaultAudioDelay", raw_convert(_default_audio_delay)); + cxml::add_text_child(root, "DefaultAudioDelay", fmt::to_string(_default_audio_delay)); if (_default_audio_language) { /* [XML] DefaultAudioLanguage Default audio language to use for new films */ cxml::add_text_child(root, "DefaultAudioLanguage", _default_audio_language->to_string()); @@ -812,7 +813,7 @@ Config::write_config () const /* [XML] MailServer Hostname of SMTP server to use. */ cxml::add_text_child(root, "MailServer", _mail_server); /* [XML] MailPort Port number to use on SMTP server. */ - cxml::add_text_child(root, "MailPort", raw_convert(_mail_port)); + cxml::add_text_child(root, "MailPort", fmt::to_string(_mail_port)); /* [XML] MailProtocol Protocol to use on SMTP server (Auto, Plain, STARTTLS or SSL) */ switch (_mail_protocol) { case EmailProtocol::AUTO: @@ -867,9 +868,9 @@ Config::write_config () const cxml::add_text_child(root, "CheckForTestUpdates", _check_for_test_updates ? "1" : "0"); /* [XML] MaximumJ2KVideoBitRate Maximum video bit rate (in bits per second) that can be specified in the GUI for JPEG2000 encodes. */ - cxml::add_text_child(root, "MaximumJ2KVideoBitRate", raw_convert(_maximum_video_bit_rate[VideoEncoding::JPEG2000])); + cxml::add_text_child(root, "MaximumJ2KVideoBitRate", fmt::to_string(_maximum_video_bit_rate[VideoEncoding::JPEG2000])); /* [XML] MaximumMPEG2VideoBitRate Maximum video bit rate (in bits per second) that can be specified in the GUI for MPEG2 encodes. */ - cxml::add_text_child(root, "MaximumMPEG2VideoBitRate", raw_convert(_maximum_video_bit_rate[VideoEncoding::MPEG2])); + cxml::add_text_child(root, "MaximumMPEG2VideoBitRate", fmt::to_string(_maximum_video_bit_rate[VideoEncoding::MPEG2])); /* [XML] AllowAnyDCPFrameRate 1 to allow users to specify any frame rate when creating DCPs, 0 to limit the GUI to standard rates. */ cxml::add_text_child(root, "AllowAnyDCPFrameRate", _allow_any_dcp_frame_rate ? "1" : "0"); /* [XML] AllowAnyContainer 1 to allow users to user any container ratio for their DCP, 0 to limit the GUI to DCI Flat/Scope */ @@ -885,7 +886,7 @@ Config::write_config () const to sending email, 128 debug information related to the video view, 256 information about disk writing, 512 debug information related to the player, 1024 debug information related to audio analyses. */ - cxml::add_text_child(root, "LogTypes", raw_convert (_log_types)); + cxml::add_text_child(root, "LogTypes", fmt::to_string(_log_types)); /* [XML] AnalyseEBUR128 1 to do EBUR128 analyses when analysing audio, otherwise 0. */ cxml::add_text_child(root, "AnalyseEBUR128", _analyse_ebur128 ? "1" : "0"); /* [XML] AutomaticAudioAnalysis 1 to run audio analysis automatically when audio content is added to the film, otherwise 0. */ @@ -961,7 +962,7 @@ Config::write_config () const /* [XML] Nagged 1 if a particular nag screen has been shown and should not be shown again, otherwise 0. */ for (int i = 0; i < NAG_COUNT; ++i) { auto e = cxml::add_child(root, "Nagged"); - e->set_attribute("id", raw_convert(i)); + e->set_attribute("id", fmt::to_string(i)); e->add_child_text (_nagged[i] ? "1" : "0"); } /* [XML] PreviewSound 1 to use sound in the GUI preview and player, otherwise 0. */ @@ -1003,11 +1004,11 @@ Config::write_config () const /* [XML] FramesInMemoryMultiplier value to multiply the encoding threads count by to get the maximum number of frames to be held in memory at once. */ - cxml::add_text_child(root, "FramesInMemoryMultiplier", raw_convert(_frames_in_memory_multiplier)); + cxml::add_text_child(root, "FramesInMemoryMultiplier", fmt::to_string(_frames_in_memory_multiplier)); /* [XML] DecodeReduction power of 2 to reduce DCP images by before decoding in the player. */ if (_decode_reduction) { - cxml::add_text_child(root, "DecodeReduction", raw_convert(_decode_reduction.get())); + cxml::add_text_child(root, "DecodeReduction", fmt::to_string(_decode_reduction.get())); } /* [XML] DefaultNotify 1 to default jobs to notify when complete, otherwise 0. */ @@ -1016,7 +1017,7 @@ Config::write_config () const /* [XML] Notification 1 if a notification type is enabled, otherwise 0. */ for (int i = 0; i < NOTIFICATION_COUNT; ++i) { auto e = cxml::add_child(root, "Notification"); - e->set_attribute ("id", raw_convert(i)); + e->set_attribute("id", fmt::to_string(i)); e->add_child_text (_notification[i] ? "1" : "0"); } @@ -1071,7 +1072,7 @@ Config::write_config () const } /* [XML] ImageDisplay Screen number to put image on in dual-screen player mode. */ - cxml::add_text_child(root, "ImageDisplay", raw_convert(_image_display)); + cxml::add_text_child(root, "ImageDisplay", fmt::to_string(_image_display)); switch (_video_view_type) { case VIDEO_VIEW_SIMPLE: cxml::add_text_child(root, "VideoViewType", "simple"); @@ -1113,15 +1114,15 @@ Config::write_config () const cxml::add_text_child(root, "WriteKDMsToDisk", _write_kdms_to_disk ? "1" : "0"); cxml::add_text_child(root, "EmailKDMs", _email_kdms ? "1" : "0"); cxml::add_text_child(root, "DefaultKDMType", dcp::formulation_to_string(_default_kdm_type)); - cxml::add_text_child(root, "AutoCropThreshold", raw_convert(_auto_crop_threshold)); + cxml::add_text_child(root, "AutoCropThreshold", fmt::to_string(_auto_crop_threshold)); if (_last_release_notes_version) { cxml::add_text_child(root, "LastReleaseNotesVersion", *_last_release_notes_version); } if (_main_divider_sash_position) { - cxml::add_text_child(root, "MainDividerSashPosition", raw_convert(*_main_divider_sash_position)); + cxml::add_text_child(root, "MainDividerSashPosition", fmt::to_string(*_main_divider_sash_position)); } if (_main_content_divider_sash_position) { - cxml::add_text_child(root, "MainContentDividerSashPosition", raw_convert(*_main_content_divider_sash_position)); + cxml::add_text_child(root, "MainContentDividerSashPosition", fmt::to_string(*_main_content_divider_sash_position)); } cxml::add_text_child(root, "DefaultAddFileLocation", @@ -1131,11 +1132,11 @@ Config::write_config () const /* [XML] AllowSMPTEBv20 1 to allow the user to choose SMPTE (Bv2.0 only) as a standard, otherwise 0 */ cxml::add_text_child(root, "AllowSMPTEBv20", _allow_smpte_bv20 ? "1" : "0"); /* [XML] ISDCFNamePartLength Maximum length of the "name" part of an ISDCF name, which should be 14 according to the standard */ - cxml::add_text_child(root, "ISDCFNamePartLength", raw_convert(_isdcf_name_part_length)); + cxml::add_text_child(root, "ISDCFNamePartLength", fmt::to_string(_isdcf_name_part_length)); /* [XML] EnablePlayerHTTPServer 1 to enable a HTTP server to control the player, otherwise 0 */ cxml::add_text_child(root, "EnablePlayerHTTPServer", _enable_player_http_server ? "1" : "0"); /* [XML] PlayerHTTPServerPort Port to use for player HTTP server (if enabled) */ - cxml::add_text_child(root, "PlayerHTTPServerPort", raw_convert(_player_http_server_port)); + cxml::add_text_child(root, "PlayerHTTPServerPort", fmt::to_string(_player_http_server_port)); /* [XML] RelativePaths 1 to write relative paths to project metadata files, 0 to use absolute paths */ cxml::add_text_child(root, "RelativePaths", _relative_paths ? "1" : "0"); @@ -1769,7 +1770,7 @@ Config::Grok::as_xml(xmlpp::Element* node) const { node->add_child("BinaryLocation")->add_child_text(binary_location.string()); node->add_child("Enable")->add_child_text((enable ? "1" : "0")); - node->add_child("Selected")->add_child_text(raw_convert(selected)); + node->add_child("Selected")->add_child_text(fmt::to_string(selected)); node->add_child("LicenceServer")->add_child_text(licence_server); node->add_child("Licence")->add_child_text(licence); } diff --git a/src/lib/content.cc b/src/lib/content.cc index be30ccf43..5c44cb47a 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -36,9 +36,9 @@ #include "util.h" #include "video_content.h" #include -#include #include #include +#include #include #include @@ -53,7 +53,6 @@ using std::string; using std::vector; using boost::optional; using dcp::locale_convert; -using dcp::raw_convert; using namespace dcpomatic; @@ -157,15 +156,15 @@ Content::as_xml(xmlpp::Element* element, bool with_paths, PathBehaviour path_beh } auto p = cxml::add_child(element, "Path"); p->add_child_text(path.string()); - p->set_attribute ("mtime", raw_convert(_last_write_times[i])); + p->set_attribute ("mtime", fmt::to_string(_last_write_times[i])); } } cxml::add_text_child(element, "Digest", _digest); - cxml::add_text_child(element, "Position", raw_convert(_position.get())); - cxml::add_text_child(element, "TrimStart", raw_convert(_trim_start.get())); - cxml::add_text_child(element, "TrimEnd", raw_convert(_trim_end.get())); + cxml::add_text_child(element, "Position", fmt::to_string(_position.get())); + cxml::add_text_child(element, "TrimStart", fmt::to_string(_trim_start.get())); + cxml::add_text_child(element, "TrimEnd", fmt::to_string(_trim_end.get())); if (_video_frame_rate) { - cxml::add_text_child(element, "VideoFrameRate", raw_convert(_video_frame_rate.get())); + cxml::add_text_child(element, "VideoFrameRate", fmt::to_string(_video_frame_rate.get())); } } diff --git a/src/lib/create_cli.cc b/src/lib/create_cli.cc index 3fb978f7c..10196199a 100644 --- a/src/lib/create_cli.cc +++ b/src/lib/create_cli.cc @@ -28,6 +28,7 @@ #include "ratio.h" #include "variant.h" #include +#include #include #include @@ -88,6 +89,25 @@ argument_option (int& n, int argc, char* argv[], string short_name, string long_ } +template <> +void +argument_option(int& n, int argc, char* argv[], string short_name, string long_name, bool* claimed, optional* error, string* out) +{ + string const a = argv[n]; + if (a != short_name && a != long_name) { + return; + } + + if ((n + 1) >= argc) { + **error = String::compose("%1: option %2 requires an argument", argv[0], long_name); + return; + } + + *out = string(argv[++n]); + *claimed = true; +} + + template void argument_option ( diff --git a/src/lib/crop.cc b/src/lib/crop.cc index a6f7d4bac..210d7362d 100644 --- a/src/lib/crop.cc +++ b/src/lib/crop.cc @@ -20,16 +20,15 @@ #include "crop.h" -#include #include LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include using std::shared_ptr; using std::string; -using dcp::raw_convert; Crop::Crop(shared_ptr node) @@ -44,10 +43,10 @@ Crop::Crop(shared_ptr node) void Crop::as_xml(xmlpp::Element* element) const { - cxml::add_text_child(element, "LeftCrop", raw_convert(left)); - cxml::add_text_child(element, "RightCrop", raw_convert(right)); - cxml::add_text_child(element, "TopCrop", raw_convert(top)); - cxml::add_text_child(element, "BottomCrop", raw_convert(bottom)); + cxml::add_text_child(element, "LeftCrop", fmt::to_string(left)); + cxml::add_text_child(element, "RightCrop", fmt::to_string(right)); + cxml::add_text_child(element, "TopCrop", fmt::to_string(top)); + cxml::add_text_child(element, "BottomCrop", fmt::to_string(bottom)); } diff --git a/src/lib/cross_common.cc b/src/lib/cross_common.cc index 1e145c8fc..2e6f5c414 100644 --- a/src/lib/cross_common.cc +++ b/src/lib/cross_common.cc @@ -23,11 +23,11 @@ #include "compose.hpp" #include "dcpomatic_assert.h" #include "dcpomatic_log.h" -#include #include LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include #include #include @@ -63,7 +63,7 @@ Drive::as_xml () const for (auto i: _mount_points) { cxml::add_text_child(root, "MountPoint", i.string()); } - cxml::add_text_child(root, "Size", dcp::raw_convert(_size)); + cxml::add_text_child(root, "Size", fmt::to_string(_size)); if (_vendor) { cxml::add_text_child(root, "Vendor", *_vendor); } diff --git a/src/lib/cross_unix.cc b/src/lib/cross_unix.cc index 743c11980..0327c8136 100644 --- a/src/lib/cross_unix.cc +++ b/src/lib/cross_unix.cc @@ -20,13 +20,13 @@ #include "cross.h" -#include #include LIBDCP_DISABLE_WARNINGS extern "C" { #include } LIBDCP_ENABLE_WARNINGS +#include using std::string; @@ -80,7 +80,7 @@ running_32_on_64 () string dcpomatic::get_process_id () { - return dcp::raw_convert(getpid()); + return fmt::to_string(getpid()); } diff --git a/src/lib/cross_windows.cc b/src/lib/cross_windows.cc index 9181b6c8a..13d52ee3b 100644 --- a/src/lib/cross_windows.cc +++ b/src/lib/cross_windows.cc @@ -31,11 +31,11 @@ #include "util.h" #include #include -#include #include extern "C" { #include } +#include #include #include #include @@ -660,7 +660,7 @@ disk_write_finished () string dcpomatic::get_process_id () { - return dcp::raw_convert(GetCurrentProcessId()); + return fmt::to_string(GetCurrentProcessId()); } diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 6a6ed0b0c..5b4f163e1 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -388,8 +389,8 @@ DCPContent::as_xml(xmlpp::Element* element, bool with_paths, PathBehaviour path_ if (audio) { audio->as_xml(element); - cxml::add_text_child(element, "AudioFrameRate", raw_convert(audio->stream()->frame_rate())); - cxml::add_text_child(element, "AudioLength", raw_convert(audio->stream()->length())); + cxml::add_text_child(element, "AudioFrameRate", fmt::to_string(audio->stream()->frame_rate())); + cxml::add_text_child(element, "AudioLength", fmt::to_string(audio->stream()->length())); audio->stream()->mapping().as_xml(cxml::add_child(element, "AudioMapping")); } @@ -435,13 +436,13 @@ DCPContent::as_xml(xmlpp::Element* element, bool with_paths, PathBehaviour path_ cxml::add_text_child(element, "CPL", _cpl.get()); } for (auto i: _reel_lengths) { - cxml::add_text_child(element, "ReelLength", raw_convert(i)); + cxml::add_text_child(element, "ReelLength", fmt::to_string(i)); } for (auto const& i: _markers) { auto marker = cxml::add_child(element, "Marker"); marker->set_attribute("type", dcp::marker_to_string(i.first)); - marker->add_child_text(raw_convert(i.second.get())); + marker->add_child_text(fmt::to_string(i.second.get())); } for (auto i: _ratings) { @@ -454,7 +455,7 @@ DCPContent::as_xml(xmlpp::Element* element, bool with_paths, PathBehaviour path_ } if (_active_audio_channels) { - cxml::add_text_child(element, "ActiveAudioChannels", raw_convert(*_active_audio_channels)); + cxml::add_text_child(element, "ActiveAudioChannels", fmt::to_string(*_active_audio_channels)); } for (auto i = 0; i < static_cast(TextType::COUNT); ++i) { diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc index b18d14318..21c1b4de9 100644 --- a/src/lib/dcp_subtitle_content.cc +++ b/src/lib/dcp_subtitle_content.cc @@ -26,9 +26,9 @@ #include "text_content.h" #include #include -#include #include #include +#include #include "i18n.h" @@ -39,7 +39,6 @@ using std::make_shared; using std::shared_ptr; using std::string; using boost::optional; -using dcp::raw_convert; using namespace dcpomatic; @@ -150,5 +149,5 @@ DCPSubtitleContent::as_xml(xmlpp::Element* element, bool with_paths, PathBehavio only_text()->as_xml(element); } - cxml::add_text_child(element, "Length", raw_convert(_length.get())); + cxml::add_text_child(element, "Length", fmt::to_string(_length.get())); } diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc index ec88888dd..f250d4505 100644 --- a/src/lib/dcp_video.cc +++ b/src/lib/dcp_video.cc @@ -43,7 +43,6 @@ #include "player_video.h" #include "rng.h" #include -#include #include #include #include @@ -51,6 +50,7 @@ LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include #include #include #include @@ -65,7 +65,6 @@ using std::make_shared; using std::shared_ptr; using std::string; using dcp::ArrayData; -using dcp::raw_convert; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; #endif @@ -228,7 +227,7 @@ DCPVideo::encode_remotely (EncodeServerDescription serv, int timeout) const { boost::asio::io_service io_service; boost::asio::ip::tcp::resolver resolver (io_service); - boost::asio::ip::tcp::resolver::query query (serv.host_name(), raw_convert (ENCODE_FRAME_PORT)); + boost::asio::ip::tcp::resolver::query query(serv.host_name(), fmt::to_string(ENCODE_FRAME_PORT)); boost::asio::ip::tcp::resolver::iterator endpoint_iterator = resolver.resolve (query); auto socket = make_shared(timeout); @@ -239,7 +238,7 @@ DCPVideo::encode_remotely (EncodeServerDescription serv, int timeout) const /* Collect all XML metadata */ xmlpp::Document doc; auto root = doc.create_root_node ("EncodingRequest"); - cxml::add_text_child(root, "Version", raw_convert(SERVER_LINK_VERSION)); + cxml::add_text_child(root, "Version", fmt::to_string(SERVER_LINK_VERSION)); add_metadata (root); LOG_DEBUG_ENCODE (N_("Sending frame %1 to remote"), _index); @@ -278,10 +277,10 @@ DCPVideo::encode_remotely (EncodeServerDescription serv, int timeout) const void DCPVideo::add_metadata (xmlpp::Element* el) const { - cxml::add_text_child(el, "Index", raw_convert(_index)); - cxml::add_text_child(el, "FramesPerSecond", raw_convert(_frames_per_second)); - cxml::add_text_child(el, "VideoBitRate", raw_convert(_video_bit_rate)); - cxml::add_text_child(el, "Resolution", raw_convert(int(_resolution))); + cxml::add_text_child(el, "Index", fmt::to_string(_index)); + cxml::add_text_child(el, "FramesPerSecond", fmt::to_string(_frames_per_second)); + cxml::add_text_child(el, "VideoBitRate", fmt::to_string(_video_bit_rate)); + cxml::add_text_child(el, "Resolution", fmt::to_string(int(_resolution))); _frame->add_metadata (el); } diff --git a/src/lib/disk_writer_messages.cc b/src/lib/disk_writer_messages.cc index 7bccdd9fc..0a11ce618 100644 --- a/src/lib/disk_writer_messages.cc +++ b/src/lib/disk_writer_messages.cc @@ -23,6 +23,7 @@ #include "disk_writer_messages.h" #include "nanomsg.h" #include +#include using std::string; @@ -81,15 +82,15 @@ DiskWriterBackEndResponse::write_to_nanomsg(Nanomsg& nanomsg, int timeout) const break; case Type::FORMAT_PROGRESS: message = String::compose("%1\n", DISK_WRITER_FORMAT_PROGRESS); - message += dcp::raw_convert(_progress) + "\n"; + message += fmt::to_string(_progress) + "\n"; break; case Type::COPY_PROGRESS: message = String::compose("%1\n", DISK_WRITER_COPY_PROGRESS); - message += dcp::raw_convert(_progress) + "\n"; + message += fmt::to_string(_progress) + "\n"; break; case Type::VERIFY_PROGRESS: message = String::compose("%1\n", DISK_WRITER_VERIFY_PROGRESS); - message += dcp::raw_convert(_progress) + "\n"; + message += fmt::to_string(_progress) + "\n"; break; } diff --git a/src/lib/encode_server.cc b/src/lib/encode_server.cc index 8d1759986..08e661eac 100644 --- a/src/lib/encode_server.cc +++ b/src/lib/encode_server.cc @@ -40,12 +40,12 @@ #include "util.h" #include "variant.h" #include "version.h" -#include #include #include LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include #include #include #ifdef HAVE_VALGRIND_H @@ -72,7 +72,6 @@ using boost::scoped_array; using boost::optional; using dcp::ArrayData; using dcp::Size; -using dcp::raw_convert; EncodeServer::EncodeServer (bool verbose, int num_threads) @@ -300,8 +299,8 @@ EncodeServer::broadcast_received () /* Reply to the client saying what we can do */ xmlpp::Document doc; auto root = doc.create_root_node ("ServerAvailable"); - cxml::add_text_child(root, "Threads", raw_convert(_worker_threads.size())); - cxml::add_text_child(root, "Version", raw_convert(SERVER_LINK_VERSION)); + cxml::add_text_child(root, "Threads", fmt::to_string(_worker_threads.size())); + cxml::add_text_child(root, "Version", fmt::to_string(SERVER_LINK_VERSION)); auto xml = doc.write_to_string ("UTF-8"); if (_verbose) { diff --git a/src/lib/encode_server_finder.cc b/src/lib/encode_server_finder.cc index 143569e16..22c1d37dd 100644 --- a/src/lib/encode_server_finder.cc +++ b/src/lib/encode_server_finder.cc @@ -28,8 +28,8 @@ #include "exceptions.h" #include "util.h" #include "variant.h" -#include #include +#include #include #include #include @@ -49,7 +49,6 @@ using boost::scoped_array; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; #endif -using dcp::raw_convert; EncodeServerFinder* EncodeServerFinder::_instance = 0; @@ -137,7 +136,7 @@ try for (auto const& i: Config::instance()->servers()) { try { boost::asio::ip::udp::resolver resolver (io_service); - boost::asio::ip::udp::resolver::query query (i, raw_convert(HELLO_PORT)); + boost::asio::ip::udp::resolver::query query(i, fmt::to_string(HELLO_PORT)); boost::asio::ip::udp::endpoint end_point (*resolver.resolve(query)); socket.send_to (boost::asio::buffer(data.c_str(), data.size() + 1), end_point); } catch (...) { diff --git a/src/lib/export_config.cc b/src/lib/export_config.cc index 79042e59c..fc91c8676 100644 --- a/src/lib/export_config.cc +++ b/src/lib/export_config.cc @@ -21,11 +21,11 @@ #include "config.h" #include "export_config.h" -#include #include LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include using std::string; @@ -106,7 +106,7 @@ ExportConfig::write(xmlpp::Element* element) const cxml::add_text_child(element, "MixdownToStereo", _mixdown_to_stereo ? "1" : "0"); cxml::add_text_child(element, "SplitReels", _split_reels ? "1" : "0"); cxml::add_text_child(element, "SplitStreams", _split_streams ? "1" : "0"); - cxml::add_text_child(element, "X264CRF", dcp::raw_convert(_x264_crf)); + cxml::add_text_child(element, "X264CRF", fmt::to_string(_x264_crf)); } diff --git a/src/lib/fcpxml_content.cc b/src/lib/fcpxml_content.cc index 94d1197df..cac3305ef 100644 --- a/src/lib/fcpxml_content.cc +++ b/src/lib/fcpxml_content.cc @@ -22,7 +22,7 @@ #include "fcpxml.h" #include "fcpxml_content.h" #include "text_content.h" -#include +#include #include "i18n.h" @@ -103,6 +103,6 @@ FCPXMLContent::as_xml(xmlpp::Element* element, bool with_paths, PathBehaviour pa only_text()->as_xml(element); } - cxml::add_child(element, "Length", dcp::raw_convert(_length.get())); + cxml::add_child(element, "Length", fmt::to_string(_length.get())); } diff --git a/src/lib/ffmpeg_audio_stream.cc b/src/lib/ffmpeg_audio_stream.cc index 24f96b889..e0da3a22d 100644 --- a/src/lib/ffmpeg_audio_stream.cc +++ b/src/lib/ffmpeg_audio_stream.cc @@ -20,17 +20,16 @@ #include "ffmpeg_audio_stream.h" -#include #include LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS #include +#include using std::string; using boost::optional; -using dcp::raw_convert; using namespace dcpomatic; @@ -55,16 +54,16 @@ void FFmpegAudioStream::as_xml(xmlpp::Element* root) const { FFmpegStream::as_xml (root); - cxml::add_text_child(root, "FrameRate", raw_convert(frame_rate())); - cxml::add_text_child(root, "Length", raw_convert(length())); + cxml::add_text_child(root, "FrameRate", fmt::to_string(frame_rate())); + cxml::add_text_child(root, "Length", fmt::to_string(length())); mapping().as_xml(cxml::add_child(root, "Mapping")); if (first_audio) { - cxml::add_text_child(root, "FirstAudio", raw_convert(first_audio.get().get())); + cxml::add_text_child(root, "FirstAudio", fmt::to_string(first_audio.get().get())); } if (codec_name) { cxml::add_text_child(root, "CodecName", codec_name.get()); } if (bit_depth()) { - cxml::add_text_child(root, "BitDepth", raw_convert(bit_depth().get())); + cxml::add_text_child(root, "BitDepth", fmt::to_string(bit_depth().get())); } } diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 5a99ecaa5..49e4933a6 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -36,13 +36,13 @@ #include "text_content.h" #include "variant.h" #include "video_content.h" -#include #include extern "C" { #include #include } #include +#include #include #include "i18n.h" @@ -59,7 +59,6 @@ using std::make_shared; using std::shared_ptr; using std::dynamic_pointer_cast; using boost::optional; -using dcp::raw_convert; using namespace dcpomatic; @@ -236,23 +235,23 @@ FFmpegContent::as_xml(xmlpp::Element* element, bool with_paths, PathBehaviour pa } if (_first_video) { - cxml::add_text_child(element, "FirstVideo", raw_convert(_first_video.get().get())); + cxml::add_text_child(element, "FirstVideo", fmt::to_string(_first_video.get().get())); } if (_color_range) { - cxml::add_text_child(element, "ColorRange", raw_convert(static_cast(*_color_range))); + cxml::add_text_child(element, "ColorRange", fmt::to_string(static_cast(*_color_range))); } if (_color_primaries) { - cxml::add_text_child(element, "ColorPrimaries", raw_convert(static_cast(*_color_primaries))); + cxml::add_text_child(element, "ColorPrimaries", fmt::to_string(static_cast(*_color_primaries))); } if (_color_trc) { - cxml::add_text_child(element, "ColorTransferCharacteristic", raw_convert(static_cast(*_color_trc))); + cxml::add_text_child(element, "ColorTransferCharacteristic", fmt::to_string(static_cast(*_color_trc))); } if (_colorspace) { - cxml::add_text_child(element, "Colorspace", raw_convert(static_cast(*_colorspace))); + cxml::add_text_child(element, "Colorspace", fmt::to_string(static_cast(*_colorspace))); } if (_bits_per_pixel) { - cxml::add_text_child(element, "BitsPerPixel", raw_convert(*_bits_per_pixel)); + cxml::add_text_child(element, "BitsPerPixel", fmt::to_string(*_bits_per_pixel)); } } diff --git a/src/lib/ffmpeg_image_proxy.cc b/src/lib/ffmpeg_image_proxy.cc index 0ee41deab..c9fcd0413 100644 --- a/src/lib/ffmpeg_image_proxy.cc +++ b/src/lib/ffmpeg_image_proxy.cc @@ -28,7 +28,6 @@ #include "image.h" #include "memory_util.h" #include "video_filter_graph.h" -#include #include LIBDCP_DISABLE_WARNINGS extern "C" { @@ -38,6 +37,7 @@ extern "C" { } #include LIBDCP_ENABLE_WARNINGS +#include #include #include "i18n.h" @@ -52,7 +52,6 @@ using std::shared_ptr; using std::string; using boost::optional; using std::dynamic_pointer_cast; -using dcp::raw_convert; FFmpegImageProxy::FFmpegImageProxy (boost::filesystem::path path) @@ -143,8 +142,8 @@ FFmpegImageProxy::image (Image::Alignment alignment, optional) const /* These durations are in microseconds, and represent how far into the content file we will look for streams. */ - av_dict_set (&options, "analyzeduration", raw_convert(5 * 60 * 1000000).c_str(), 0); - av_dict_set (&options, "probesize", raw_convert(5 * 60 * 1000000).c_str(), 0); + av_dict_set(&options, "analyzeduration", fmt::to_string(5 * 60 * 1000000).c_str(), 0); + av_dict_set(&options, "probesize", fmt::to_string(5 * 60 * 1000000).c_str(), 0); int e = avformat_open_input (&format_context, 0, 0, &options); if ((e < 0 && e == AVERROR_INVALIDDATA) || (e >= 0 && format_context->probe_score <= 25)) { diff --git a/src/lib/ffmpeg_stream.cc b/src/lib/ffmpeg_stream.cc index 800c45eb6..0a53b1b3c 100644 --- a/src/lib/ffmpeg_stream.cc +++ b/src/lib/ffmpeg_stream.cc @@ -18,9 +18,9 @@ */ -#include "ffmpeg_stream.h" + #include "dcpomatic_assert.h" -#include +#include "ffmpeg_stream.h" #include LIBDCP_DISABLE_WARNINGS #include @@ -28,9 +28,11 @@ extern "C" { #include } LIBDCP_ENABLE_WARNINGS +#include + using std::string; -using dcp::raw_convert; + FFmpegStream::FFmpegStream (cxml::ConstNodePtr node) : name (node->string_child ("Name")) @@ -43,7 +45,7 @@ void FFmpegStream::as_xml(xmlpp::Element* root) const { cxml::add_text_child(root, "Name", name); - cxml::add_text_child(root, "Id", raw_convert(_id)); + cxml::add_text_child(root, "Id", fmt::to_string(_id)); } bool diff --git a/src/lib/film.cc b/src/lib/film.cc index ebbdfe013..cf04ac0da 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -71,6 +71,7 @@ #include #include #include +#include #include #include #include @@ -249,8 +250,8 @@ Film::video_identifier () const string s = container()->id() + "_" + resolution_to_string (_resolution) + "_" + _playlist->video_identifier() - + "_" + raw_convert(_video_frame_rate) - + "_" + raw_convert(video_bit_rate(video_encoding())); + + "_" + fmt::to_string(_video_frame_rate) + + "_" + fmt::to_string(video_bit_rate(video_encoding())); if (encrypted ()) { /* This is insecure but hey, the key is in plaintext in metadata.xml */ @@ -290,7 +291,7 @@ Film::info_file (DCPTimePeriod period) const { boost::filesystem::path p; p /= "info"; - p /= video_identifier () + "_" + raw_convert (period.from.get()) + "_" + raw_convert (period.to.get()); + p /= video_identifier () + "_" + fmt::to_string(period.from.get()) + "_" + fmt::to_string(period.to.get()); return file (p); } @@ -390,7 +391,7 @@ Film::metadata (bool with_content_paths) const auto doc = make_shared(); auto root = doc->create_root_node ("Metadata"); - cxml::add_text_child(root, "Version", raw_convert(current_state_version)); + cxml::add_text_child(root, "Version", fmt::to_string(current_state_version)); auto last_write = cxml::add_child(root, "LastWrittenBy"); last_write->add_child_text (dcpomatic_version); last_write->set_attribute("git", dcpomatic_git_commit); @@ -406,12 +407,12 @@ Film::metadata (bool with_content_paths) const } cxml::add_text_child(root, "Resolution", resolution_to_string(_resolution)); - cxml::add_text_child(root, "J2KVideoBitRate", raw_convert(_video_bit_rate[VideoEncoding::JPEG2000])); - cxml::add_text_child(root, "MPEG2VideoBitRate", raw_convert(_video_bit_rate[VideoEncoding::MPEG2])); - cxml::add_text_child(root, "VideoFrameRate", raw_convert(_video_frame_rate)); - cxml::add_text_child(root, "AudioFrameRate", raw_convert(_audio_frame_rate)); + cxml::add_text_child(root, "J2KVideoBitRate", fmt::to_string(_video_bit_rate[VideoEncoding::JPEG2000])); + cxml::add_text_child(root, "MPEG2VideoBitRate", fmt::to_string(_video_bit_rate[VideoEncoding::MPEG2])); + cxml::add_text_child(root, "VideoFrameRate", fmt::to_string(_video_frame_rate)); + cxml::add_text_child(root, "AudioFrameRate", fmt::to_string(_audio_frame_rate)); cxml::add_text_child(root, "ISDCFDate", boost::gregorian::to_iso_string(_isdcf_date)); - cxml::add_text_child(root, "AudioChannels", raw_convert(_audio_channels)); + cxml::add_text_child(root, "AudioChannels", fmt::to_string(_audio_channels)); cxml::add_text_child(root, "ThreeD", _three_d ? "1" : "0"); cxml::add_text_child(root, "Sequence", _sequence ? "1" : "0"); cxml::add_text_child(root, "Interop", _interop ? "1" : "0"); @@ -423,17 +424,17 @@ Film::metadata (bool with_content_paths) const if (_audio_processor) { cxml::add_text_child(root, "AudioProcessor", _audio_processor->id()); } - cxml::add_text_child(root, "ReelType", raw_convert(static_cast (_reel_type))); - cxml::add_text_child(root, "ReelLength", raw_convert(_reel_length)); + cxml::add_text_child(root, "ReelType", fmt::to_string(static_cast(_reel_type))); + cxml::add_text_child(root, "ReelLength", fmt::to_string(_reel_length)); for (auto boundary: _custom_reel_boundaries) { - cxml::add_text_child(root, "CustomReelBoundary", raw_convert(boundary.get())); + cxml::add_text_child(root, "CustomReelBoundary", fmt::to_string(boundary.get())); } cxml::add_text_child(root, "ReencodeJ2K", _reencode_j2k ? "1" : "0"); cxml::add_text_child(root, "UserExplicitVideoFrameRate", _user_explicit_video_frame_rate ? "1" : "0"); for (auto const& marker: _markers) { auto m = cxml::add_child(root, "Marker"); m->set_attribute("type", dcp::marker_to_string(marker.first)); - m->add_child_text(raw_convert(marker.second.get())); + m->add_child_text(fmt::to_string(marker.second.get())); } for (auto i: _ratings) { i.as_xml(cxml::add_child(root, "Rating")); @@ -449,7 +450,7 @@ Film::metadata (bool with_content_paths) const if (_sign_language_video_language) { cxml::add_text_child(root, "SignLanguageVideoLanguage", _sign_language_video_language->to_string()); } - cxml::add_text_child(root, "VersionNumber", raw_convert(_version_number)); + cxml::add_text_child(root, "VersionNumber", fmt::to_string(_version_number)); cxml::add_text_child(root, "Status", dcp::status_to_string(_status)); if (_chain) { cxml::add_text_child(root, "Chain", *_chain); @@ -468,7 +469,7 @@ Film::metadata (bool with_content_paths) const cxml::add_text_child(root, "RedBand", _red_band ? "1" : "0"); cxml::add_text_child(root, "TwoDVersionOfThreeD", _two_d_version_of_three_d ? "1" : "0"); if (_luminance) { - cxml::add_text_child(root, "LuminanceValue", raw_convert(_luminance->value())); + cxml::add_text_child(root, "LuminanceValue", fmt::to_string(_luminance->value())); cxml::add_text_child(root, "LuminanceUnit", dcp::Luminance::unit_to_string(_luminance->unit())); } cxml::add_text_child(root, "UserExplicitContainer", _user_explicit_container ? "1" : "0"); @@ -933,7 +934,7 @@ Film::isdcf_name (bool if_created_now) const } } } else { - version = dcp::raw_convert(_version_number); + version = fmt::to_string(_version_number); } isdcf_name += "-" + version; } @@ -970,7 +971,7 @@ Film::isdcf_name (bool if_created_now) const } if (video_frame_rate() != 24) { - isdcf_name += "-" + raw_convert(video_frame_rate()); + isdcf_name += "-" + fmt::to_string(video_frame_rate()); } if (container()) { @@ -989,7 +990,7 @@ Film::isdcf_name (bool if_created_now) const auto first_ratio = lrintf(scaled_size->ratio() * 100); auto container_ratio = lrintf(container()->ratio() * 100); if (first_ratio != container_ratio) { - isdcf_name += "-" + dcp::raw_convert(first_ratio); + isdcf_name += "-" + fmt::to_string(first_ratio); } } } diff --git a/src/lib/hints.cc b/src/lib/hints.cc index 4a13f77a0..b929a3746 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -40,9 +40,9 @@ #include "writer.h" #include #include -#include #include #include +#include #include #include @@ -346,7 +346,7 @@ Hints::check_loudness () float const peak = max (sample_peak[i].peak, true_peak.empty() ? 0 : true_peak[i]); float const peak_dB = linear_to_db(peak) + an->gain_correction(film()->playlist()); if (peak_dB > -3) { - ch += dcp::raw_convert(short_audio_channel_name(i)) + ", "; + ch += fmt::to_string(short_audio_channel_name(i)) + ", "; } } diff --git a/src/lib/j2k_image_proxy.cc b/src/lib/j2k_image_proxy.cc index 023723c8b..8fb387158 100644 --- a/src/lib/j2k_image_proxy.cc +++ b/src/lib/j2k_image_proxy.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -35,6 +34,7 @@ LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include #include #include "i18n.h" @@ -48,7 +48,6 @@ using std::shared_ptr; using std::string; using boost::optional; using dcp::ArrayData; -using dcp::raw_convert; /** Construct a J2KImageProxy from a JPEG2000 file */ @@ -195,12 +194,12 @@ void J2KImageProxy::add_metadata(xmlpp::Element* element) const { cxml::add_text_child(element, "Type", N_("J2K")); - cxml::add_text_child(element, "Width", raw_convert(_size.width)); - cxml::add_text_child(element, "Height", raw_convert(_size.height)); + cxml::add_text_child(element, "Width", fmt::to_string(_size.width)); + cxml::add_text_child(element, "Height", fmt::to_string(_size.height)); if (_eye) { - cxml::add_text_child(element, "Eye", raw_convert(static_cast(_eye.get()))); + cxml::add_text_child(element, "Eye", fmt::to_string(static_cast(_eye.get()))); } - cxml::add_text_child(element, "Size", raw_convert(_data->size())); + cxml::add_text_child(element, "Size", fmt::to_string(_data->size())); } diff --git a/src/lib/json_server.cc b/src/lib/json_server.cc index 92d5c1171..bed563f5a 100644 --- a/src/lib/json_server.cc +++ b/src/lib/json_server.cc @@ -24,7 +24,7 @@ #include "job_manager.h" #include "json_server.h" #include "transcode_job.h" -#include +#include #include #include #include @@ -40,7 +40,6 @@ using std::shared_ptr; using std::string; using boost::asio::ip::tcp; using boost::thread; -using dcp::raw_convert; #define MAX_LENGTH 512 @@ -228,7 +227,7 @@ JSONServer::request (string url, shared_ptr socket) json += "\"name\": \"" + (*i)->json_name() + "\", "; if ((*i)->progress()) { - json += "\"progress\": " + raw_convert((*i)->progress().get()) + ", "; + json += "\"progress\": " + fmt::to_string((*i)->progress().get()) + ", "; } else { json += "\"progress\": unknown, "; } @@ -245,7 +244,7 @@ JSONServer::request (string url, shared_ptr socket) } string reply = "HTTP/1.1 200 OK\r\n" - "Content-Length: " + raw_convert(json.length()) + "\r\n" + "Content-Length: " + fmt::to_string(json.length()) + "\r\n" "Content-Type: application/json\r\n" "\r\n" + json + "\r\n"; diff --git a/src/lib/pixel_quanta.cc b/src/lib/pixel_quanta.cc index 07690f3ac..91602e12c 100644 --- a/src/lib/pixel_quanta.cc +++ b/src/lib/pixel_quanta.cc @@ -20,7 +20,7 @@ #include "pixel_quanta.h" -#include +#include PixelQuanta::PixelQuanta (cxml::ConstNodePtr node) @@ -34,8 +34,8 @@ PixelQuanta::PixelQuanta (cxml::ConstNodePtr node) void PixelQuanta::as_xml (xmlpp::Element* node) const { - cxml::add_text_child(node, "X", dcp::raw_convert(x)); - cxml::add_text_child(node, "Y", dcp::raw_convert(y)); + cxml::add_text_child(node, "X", fmt::to_string(x)); + cxml::add_text_child(node, "Y", fmt::to_string(y)); } diff --git a/src/lib/player_video.cc b/src/lib/player_video.cc index 247301d58..b2da6c33b 100644 --- a/src/lib/player_video.cc +++ b/src/lib/player_video.cc @@ -27,11 +27,11 @@ #include "player.h" #include "player_video.h" #include "video_content.h" -#include extern "C" { #include } #include +#include #include @@ -44,7 +44,6 @@ using std::string; using std::weak_ptr; using boost::optional; using dcp::Data; -using dcp::raw_convert; using namespace dcpomatic; @@ -204,25 +203,25 @@ PlayerVideo::add_metadata(xmlpp::Element* element) const { _crop.as_xml(element); if (_fade) { - cxml::add_text_child(element, "Fade", raw_convert(_fade.get())); + cxml::add_text_child(element, "Fade", fmt::to_string(_fade.get())); } _in->add_metadata(cxml::add_child(element, "In")); - cxml::add_text_child(element, "InterWidth", raw_convert(_inter_size.width)); - cxml::add_text_child(element, "InterHeight", raw_convert(_inter_size.height)); - cxml::add_text_child(element, "OutWidth", raw_convert(_out_size.width)); - cxml::add_text_child(element, "OutHeight", raw_convert(_out_size.height)); - cxml::add_text_child(element, "Eyes", raw_convert(static_cast(_eyes))); - cxml::add_text_child(element, "Part", raw_convert(static_cast(_part))); - cxml::add_text_child(element, "VideoRange", raw_convert(static_cast(_video_range))); + cxml::add_text_child(element, "InterWidth", fmt::to_string(_inter_size.width)); + cxml::add_text_child(element, "InterHeight", fmt::to_string(_inter_size.height)); + cxml::add_text_child(element, "OutWidth", fmt::to_string(_out_size.width)); + cxml::add_text_child(element, "OutHeight", fmt::to_string(_out_size.height)); + cxml::add_text_child(element, "Eyes", fmt::to_string(static_cast(_eyes))); + cxml::add_text_child(element, "Part", fmt::to_string(static_cast(_part))); + cxml::add_text_child(element, "VideoRange", fmt::to_string(static_cast(_video_range))); cxml::add_text_child(element, "Error", _error ? "1" : "0"); if (_colour_conversion) { _colour_conversion.get().as_xml(element); } if (_text) { - cxml::add_text_child(element, "SubtitleWidth", raw_convert(_text->image->size().width)); - cxml::add_text_child(element, "SubtitleHeight", raw_convert(_text->image->size().height)); - cxml::add_text_child(element, "SubtitleX", raw_convert(_text->position.x)); - cxml::add_text_child(element, "SubtitleY", raw_convert(_text->position.y)); + cxml::add_text_child(element, "SubtitleWidth", fmt::to_string(_text->image->size().width)); + cxml::add_text_child(element, "SubtitleHeight", fmt::to_string(_text->image->size().height)); + cxml::add_text_child(element, "SubtitleX", fmt::to_string(_text->position.x)); + cxml::add_text_child(element, "SubtitleY", fmt::to_string(_text->position.y)); } } diff --git a/src/lib/raw_image_proxy.cc b/src/lib/raw_image_proxy.cc index 1ad78827c..9e819140b 100644 --- a/src/lib/raw_image_proxy.cc +++ b/src/lib/raw_image_proxy.cc @@ -21,7 +21,6 @@ #include "raw_image_proxy.h" #include "image.h" -#include #include #include #include @@ -31,6 +30,7 @@ extern "C" { LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include #include "i18n.h" @@ -42,7 +42,6 @@ using std::pair; using std::shared_ptr; using std::string; using boost::optional; -using dcp::raw_convert; RawImageProxy::RawImageProxy(shared_ptr image) @@ -76,9 +75,9 @@ void RawImageProxy::add_metadata(xmlpp::Element* element) const { cxml::add_text_child(element, "Type", N_("Raw")); - cxml::add_text_child(element, "Width", raw_convert(_image->size().width)); - cxml::add_text_child(element, "Height", raw_convert(_image->size().height)); - cxml::add_text_child(element, "PixelFormat", raw_convert(static_cast(_image->pixel_format()))); + cxml::add_text_child(element, "Width", fmt::to_string(_image->size().width)); + cxml::add_text_child(element, "Height", fmt::to_string(_image->size().height)); + cxml::add_text_child(element, "PixelFormat", fmt::to_string(static_cast(_image->pixel_format()))); } diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index c0796e714..a66ac00a7 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -57,6 +56,7 @@ #include #include #include +#include #include "i18n.h" @@ -77,7 +77,6 @@ using namespace boost::placeholders; #endif using dcp::ArrayData; using dcp::Data; -using dcp::raw_convert; using namespace dcpomatic; @@ -806,7 +805,7 @@ ReelWriter::empty_text_asset (TextType type, optional track, bool } else if (track->language) { s->set_language (track->language->to_string()); } - s->set_reel_number (raw_convert (_reel_index + 1)); + s->set_reel_number(fmt::to_string(_reel_index + 1)); asset = s; } else { auto s = make_shared(); diff --git a/src/lib/remembered_asset.cc b/src/lib/remembered_asset.cc index 20b65970c..dfe0917c5 100644 --- a/src/lib/remembered_asset.cc +++ b/src/lib/remembered_asset.cc @@ -22,11 +22,11 @@ #include "dcpomatic_assert.h" #include "remembered_asset.h" #include -#include #include LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include using std::string; @@ -53,8 +53,8 @@ RememberedAsset::as_xml(xmlpp::Element* parent) const { cxml::add_text_child(parent, "Filename", _filename.string()); auto period_node = cxml::add_child(parent, "Period"); - cxml::add_text_child(period_node, "From", dcp::raw_convert(_period.from.get())); - cxml::add_text_child(period_node, "To", dcp::raw_convert(_period.to.get())); + cxml::add_text_child(period_node, "From", fmt::to_string(_period.from.get())); + cxml::add_text_child(period_node, "To", fmt::to_string(_period.to.get())); cxml::add_text_child(parent, "Identifier", _identifier); } diff --git a/src/lib/render_text.cc b/src/lib/render_text.cc index 3c3d4eed7..80161c940 100644 --- a/src/lib/render_text.cc +++ b/src/lib/render_text.cc @@ -26,7 +26,6 @@ #include "image.h" #include "render_text.h" #include "util.h" -#include #include #include LIBDCP_DISABLE_WARNINGS @@ -34,6 +33,7 @@ LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS #include +#include #include #include @@ -116,9 +116,9 @@ marked_up(vector subtitles, int target_height, float fade_factor, st if (subtitle.underline()) { span += "underline=\"single\" "; } - span += "size=\"" + dcp::raw_convert(lrintf(subtitle.size_in_pixels(target_height) * pixels_to_1024ths_point)) + "\" "; + span += "size=\"" + fmt::to_string(lrintf(subtitle.size_in_pixels(target_height) * pixels_to_1024ths_point)) + "\" "; /* Between 1-65535 inclusive, apparently... */ - span += "alpha=\"" + dcp::raw_convert(int(floor(fade_factor * 65534)) + 1) + "\" "; + span += "alpha=\"" + fmt::to_string(int(floor(fade_factor * 65534)) + 1) + "\" "; span += "color=\"#" + subtitle.colour().to_rgb_string() + "\""; if (!extra_attribute.empty()) { span += " " + extra_attribute; @@ -148,7 +148,7 @@ marked_up(vector subtitles, int target_height, float fade_factor, st int dummy; layout->get_pixel_size(space_width, dummy); auto spacing = ((i.space_before() * i.size_in_pixels(target_height) - space_width) / 2) * pixels_to_1024ths_point; - out += make_span(i, " ", "letter_spacing=\"" + dcp::raw_convert(std::round(spacing)) + "\""); + out += make_span(i, " ", "letter_spacing=\"" + fmt::to_string(std::round(spacing)) + "\""); } out += make_span(i, i.text(), {}); diff --git a/src/lib/rough_duration.cc b/src/lib/rough_duration.cc index e6c03126c..f22e54ac8 100644 --- a/src/lib/rough_duration.cc +++ b/src/lib/rough_duration.cc @@ -26,6 +26,7 @@ LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include using std::string; @@ -52,7 +53,7 @@ RoughDuration::RoughDuration (cxml::ConstNodePtr node) void RoughDuration::as_xml (xmlpp::Element* node) const { - node->add_child_text(dcp::raw_convert(duration)); + node->add_child_text(fmt::to_string(duration)); switch (unit) { case Unit::DAYS: diff --git a/src/lib/string_text_file_content.cc b/src/lib/string_text_file_content.cc index 4f7fbb241..6b5492af9 100644 --- a/src/lib/string_text_file_content.cc +++ b/src/lib/string_text_file_content.cc @@ -26,9 +26,9 @@ #include "string_text_file_content.h" #include "text_content.h" #include "util.h" -#include #include #include +#include #include @@ -41,7 +41,6 @@ using std::make_shared; using std::shared_ptr; using std::string; using boost::optional; -using dcp::raw_convert; using namespace dcpomatic; @@ -131,7 +130,7 @@ StringTextFileContent::as_xml(xmlpp::Element* element, bool with_paths, PathBeha only_text()->as_xml(element); } - cxml::add_text_child(element, "Length", raw_convert(_length.get())); + cxml::add_text_child(element, "Length", fmt::to_string(_length.get())); } diff --git a/src/lib/subtitle_analysis.cc b/src/lib/subtitle_analysis.cc index 2968416c6..5f7da6e02 100644 --- a/src/lib/subtitle_analysis.cc +++ b/src/lib/subtitle_analysis.cc @@ -23,17 +23,16 @@ #include "exceptions.h" #include #include -#include #include LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include using std::make_shared; using std::shared_ptr; using std::string; -using dcp::raw_convert; int const SubtitleAnalysis::_current_state_version = 1; @@ -70,18 +69,18 @@ SubtitleAnalysis::write (boost::filesystem::path path) const auto doc = make_shared(); xmlpp::Element* root = doc->create_root_node ("SubtitleAnalysis"); - cxml::add_text_child(root, "Version", raw_convert(_current_state_version)); + cxml::add_text_child(root, "Version", fmt::to_string(_current_state_version)); if (_bounding_box) { auto bounding_box = cxml::add_child(root, "BoundingBox"); - cxml::add_text_child(bounding_box, "X", raw_convert(_bounding_box->x)); - cxml::add_text_child(bounding_box, "Y", raw_convert(_bounding_box->y)); - cxml::add_text_child(bounding_box, "Width", raw_convert(_bounding_box->width)); - cxml::add_text_child(bounding_box, "Height", raw_convert(_bounding_box->height)); + cxml::add_text_child(bounding_box, "X", fmt::to_string(_bounding_box->x)); + cxml::add_text_child(bounding_box, "Y", fmt::to_string(_bounding_box->y)); + cxml::add_text_child(bounding_box, "Width", fmt::to_string(_bounding_box->width)); + cxml::add_text_child(bounding_box, "Height", fmt::to_string(_bounding_box->height)); } - cxml::add_text_child(root, "AnalysisXOffset", raw_convert(_analysis_x_offset)); - cxml::add_text_child(root, "AnalysisYOffset", raw_convert(_analysis_y_offset)); + cxml::add_text_child(root, "AnalysisXOffset", fmt::to_string(_analysis_x_offset)); + cxml::add_text_child(root, "AnalysisYOffset", fmt::to_string(_analysis_y_offset)); doc->write_to_file_formatted (path.string()); } diff --git a/src/lib/subtitle_film_encoder.cc b/src/lib/subtitle_film_encoder.cc index 8356433a8..c9520bf0b 100644 --- a/src/lib/subtitle_film_encoder.cc +++ b/src/lib/subtitle_film_encoder.cc @@ -26,8 +26,8 @@ #include "subtitle_film_encoder.h" #include #include -#include #include +#include #include #include @@ -44,7 +44,6 @@ using boost::optional; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; #endif -using dcp::raw_convert; /** @param output Directory, if there will be multiple output files, or a filename. @@ -110,7 +109,7 @@ SubtitleFilmEncoder::go() if (_film->interop()) { auto s = make_shared(); s->set_movie_title (_film->name()); - s->set_reel_number (raw_convert(reel + 1)); + s->set_reel_number(fmt::to_string(reel + 1)); i.first = s; } else { auto s = make_shared(); @@ -148,7 +147,7 @@ SubtitleFilmEncoder::text(PlayerText subs, TextType type, optional if (lang.first) { s->set_language (lang.first->to_string()); } - s->set_reel_number (raw_convert(_reel_index + 1)); + s->set_reel_number(fmt::to_string(_reel_index + 1)); _assets[_reel_index].first = s; } else { auto s = make_shared(); diff --git a/src/lib/text_content.cc b/src/lib/text_content.cc index 03336f15d..4a333bb76 100644 --- a/src/lib/text_content.cc +++ b/src/lib/text_content.cc @@ -25,9 +25,9 @@ #include "text_content.h" #include "util.h" #include "variant.h" -#include #include #include +#include #include #include "i18n.h" @@ -41,7 +41,6 @@ using std::shared_ptr; using std::string; using std::vector; using boost::optional; -using dcp::raw_convert; using namespace dcpomatic; @@ -365,14 +364,14 @@ TextContent::as_xml(xmlpp::Element* root) const cxml::add_text_child(text, "Use", _use ? "1" : "0"); cxml::add_text_child(text, "Burn", _burn ? "1" : "0"); - cxml::add_text_child(text, "XOffset", raw_convert(_x_offset)); - cxml::add_text_child(text, "YOffset", raw_convert(_y_offset)); - cxml::add_text_child(text, "XScale", raw_convert(_x_scale)); - cxml::add_text_child(text, "YScale", raw_convert(_y_scale)); + cxml::add_text_child(text, "XOffset", fmt::to_string(_x_offset)); + cxml::add_text_child(text, "YOffset", fmt::to_string(_y_offset)); + cxml::add_text_child(text, "XScale", fmt::to_string(_x_scale)); + cxml::add_text_child(text, "YScale", fmt::to_string(_y_scale)); if (_colour) { - cxml::add_text_child(text, "Red", raw_convert(_colour->r)); - cxml::add_text_child(text, "Green", raw_convert(_colour->g)); - cxml::add_text_child(text, "Blue", raw_convert(_colour->b)); + cxml::add_text_child(text, "Red", fmt::to_string(_colour->r)); + cxml::add_text_child(text, "Green", fmt::to_string(_colour->g)); + cxml::add_text_child(text, "Blue", fmt::to_string(_colour->b)); } if (_effect) { switch (*_effect) { @@ -388,18 +387,18 @@ TextContent::as_xml(xmlpp::Element* root) const } } if (_effect_colour) { - cxml::add_text_child(text, "EffectRed", raw_convert(_effect_colour->r)); - cxml::add_text_child(text, "EffectGreen", raw_convert(_effect_colour->g)); - cxml::add_text_child(text, "EffectBlue", raw_convert(_effect_colour->b)); + cxml::add_text_child(text, "EffectRed", fmt::to_string(_effect_colour->r)); + cxml::add_text_child(text, "EffectGreen", fmt::to_string(_effect_colour->g)); + cxml::add_text_child(text, "EffectBlue", fmt::to_string(_effect_colour->b)); } - cxml::add_text_child(text, "LineSpacing", raw_convert(_line_spacing)); + cxml::add_text_child(text, "LineSpacing", fmt::to_string(_line_spacing)); if (_fade_in) { - cxml::add_text_child(text, "FadeIn", raw_convert(_fade_in->get())); + cxml::add_text_child(text, "FadeIn", fmt::to_string(_fade_in->get())); } if (_fade_out) { - cxml::add_text_child(text, "FadeOut", raw_convert(_fade_out->get())); + cxml::add_text_child(text, "FadeOut", fmt::to_string(_fade_out->get())); } - cxml::add_text_child(text, "OutlineWidth", raw_convert(_outline_width)); + cxml::add_text_child(text, "OutlineWidth", fmt::to_string(_outline_width)); for (auto i: _fonts) { i->as_xml(cxml::add_child(text, "Font")); @@ -420,18 +419,18 @@ TextContent::as_xml(xmlpp::Element* root) const string TextContent::identifier () const { - auto s = raw_convert (x_scale()) - + "_" + raw_convert (y_scale()) - + "_" + raw_convert (x_offset()) - + "_" + raw_convert (y_offset()) - + "_" + raw_convert (line_spacing()) - + "_" + raw_convert (fade_in().get_value_or(ContentTime()).get()) - + "_" + raw_convert (fade_out().get_value_or(ContentTime()).get()) - + "_" + raw_convert (outline_width()) - + "_" + raw_convert (colour().get_value_or(dcp::Colour(255, 255, 255)).to_argb_string()) - + "_" + raw_convert (dcp::effect_to_string(effect().get_value_or(dcp::Effect::NONE))) - + "_" + raw_convert (effect_colour().get_value_or(dcp::Colour(0, 0, 0)).to_argb_string()) - + "_" + raw_convert (_parent->video_frame_rate().get_value_or(0)); + auto s = fmt::to_string(x_scale()) + + "_" + fmt::to_string(y_scale()) + + "_" + fmt::to_string(x_offset()) + + "_" + fmt::to_string(y_offset()) + + "_" + fmt::to_string(line_spacing()) + + "_" + fmt::to_string(fade_in().get_value_or(ContentTime()).get()) + + "_" + fmt::to_string(fade_out().get_value_or(ContentTime()).get()) + + "_" + fmt::to_string(outline_width()) + + "_" + fmt::to_string(colour().get_value_or(dcp::Colour(255, 255, 255)).to_argb_string()) + + "_" + fmt::to_string(dcp::effect_to_string(effect().get_value_or(dcp::Effect::NONE))) + + "_" + fmt::to_string(effect_colour().get_value_or(dcp::Colour(0, 0, 0)).to_argb_string()) + + "_" + fmt::to_string(_parent->video_frame_rate().get_value_or(0)); /* XXX: I suppose really _fonts shouldn't be in here, since not all types of subtitle content involve fonts. diff --git a/src/lib/util.cc b/src/lib/util.cc index fde4ce15e..14839d80d 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -78,6 +78,7 @@ LIBDCP_ENABLE_WARNINGS #include #include #include +#include #include #include #include @@ -612,7 +613,7 @@ string simple_digest (vector paths) { DCP_ASSERT(!paths.empty()); - return digest_head_tail(paths, 1000000) + raw_convert(dcp::filesystem::file_size(paths.front())); + return digest_head_tail(paths, 1000000) + fmt::to_string(dcp::filesystem::file_size(paths.front())); } @@ -744,8 +745,8 @@ asset_filename (shared_ptr asset, string type, int reel_index, int r { dcp::NameFormat::Map values; values['t'] = type; - values['r'] = raw_convert(reel_index + 1); - values['n'] = raw_convert(reel_count); + values['r'] = fmt::to_string(reel_index + 1); + values['n'] = fmt::to_string(reel_count); if (summary) { values['c'] = summary.get(); } diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 058bb4ea2..6177ba7fe 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -32,9 +32,9 @@ #include "util.h" #include "video_content.h" #include "video_examiner.h" -#include #include #include +#include #include #include @@ -68,7 +68,6 @@ using std::shared_ptr; using std::string; using std::vector; using boost::optional; -using dcp::raw_convert; using namespace dcpomatic; @@ -279,29 +278,29 @@ VideoContent::as_xml(xmlpp::Element* element) const { boost::mutex::scoped_lock lm (_mutex); cxml::add_text_child(element, "Use", _use ? "1" : "0"); - cxml::add_text_child(element, "VideoLength", raw_convert(_length)); + cxml::add_text_child(element, "VideoLength", fmt::to_string(_length)); if (_size) { - cxml::add_text_child(element, "VideoWidth", raw_convert(_size->width)); - cxml::add_text_child(element, "VideoHeight", raw_convert(_size->height)); + cxml::add_text_child(element, "VideoWidth", fmt::to_string(_size->width)); + cxml::add_text_child(element, "VideoHeight", fmt::to_string(_size->height)); } cxml::add_text_child(element, "VideoFrameType", video_frame_type_to_string(_frame_type)); if (_sample_aspect_ratio) { - cxml::add_text_child(element, "SampleAspectRatio", raw_convert (_sample_aspect_ratio.get ())); + cxml::add_text_child(element, "SampleAspectRatio", fmt::to_string(_sample_aspect_ratio.get())); } _crop.as_xml(element); if (_custom_ratio) { - cxml::add_text_child(element, "CustomRatio", raw_convert(*_custom_ratio)); + cxml::add_text_child(element, "CustomRatio", fmt::to_string(*_custom_ratio)); } if (_custom_size) { - cxml::add_text_child(element, "CustomWidth", raw_convert(_custom_size->width)); - cxml::add_text_child(element, "CustomHeight", raw_convert(_custom_size->height)); + cxml::add_text_child(element, "CustomWidth", fmt::to_string(_custom_size->width)); + cxml::add_text_child(element, "CustomHeight", fmt::to_string(_custom_size->height)); } if (_colour_conversion) { _colour_conversion.get().as_xml(cxml::add_child(element, "ColourConversion")); } cxml::add_text_child(element, "YUV", _yuv ? "1" : "0"); - cxml::add_text_child(element, "VideoFadeIn", raw_convert(_fade_in)); - cxml::add_text_child(element, "VideoFadeOut", raw_convert(_fade_out)); + cxml::add_text_child(element, "VideoFadeIn", fmt::to_string(_fade_in)); + cxml::add_text_child(element, "VideoFadeOut", fmt::to_string(_fade_out)); cxml::add_text_child(element, "Range", _range == VideoRange::FULL ? "full" : "video"); _pixel_quanta.as_xml(cxml::add_child(element, "PixelQuanta")); if (_burnt_subtitle_language) { diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index e80bfc333..3d9d571af 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -100,7 +100,6 @@ #include "lib/video_content.h" #include #include -#include #include #include LIBDCP_DISABLE_WARNINGS @@ -117,6 +116,7 @@ LIBDCP_ENABLE_WARNINGS #ifdef __WXMSW__ #include #endif +#include #include #include #include @@ -147,7 +147,6 @@ using boost::algorithm::find; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; #endif -using dcp::raw_convert; class FilmChangedClosingDialog @@ -902,7 +901,7 @@ private: try { boost::asio::io_service io_service; boost::asio::ip::tcp::resolver resolver (io_service); - boost::asio::ip::tcp::resolver::query query ("127.0.0.1", raw_convert (port)); + boost::asio::ip::tcp::resolver::query query("127.0.0.1", fmt::to_string(port)); boost::asio::ip::tcp::resolver::iterator endpoint_iterator = resolver.resolve (query); Socket socket (5); socket.connect (*endpoint_iterator); diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 19d23c6cc..17ee0fb21 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -31,7 +31,7 @@ #include "lib/util.h" #include #include -#include +#include using std::function; @@ -982,7 +982,7 @@ SoundPage::config_changed () vector output; for (int i = 0; i < channels; ++i) { - output.push_back (NamedChannel(dcp::raw_convert(i), i)); + output.push_back(NamedChannel(fmt::to_string(i), i)); } _map->set_output_channels (output); diff --git a/src/wx/timecode.h b/src/wx/timecode.h index 22899ddc9..1116e9d87 100644 --- a/src/wx/timecode.h +++ b/src/wx/timecode.h @@ -30,6 +30,7 @@ LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS +#include #include @@ -79,10 +80,10 @@ public: { auto const hmsf = t.split (fps); - checked_set (_hours, dcp::raw_convert(hmsf.h)); - checked_set (_minutes, dcp::raw_convert(hmsf.m)); - checked_set (_seconds, dcp::raw_convert(hmsf.s)); - checked_set (_frames, dcp::raw_convert(hmsf.f)); + checked_set(_hours, fmt::to_string(hmsf.h)); + checked_set(_minutes, fmt::to_string(hmsf.m)); + checked_set(_seconds, fmt::to_string(hmsf.s)); + checked_set(_frames, fmt::to_string(hmsf.f)); checked_set (_fixed, t.timecode (fps)); } @@ -91,10 +92,10 @@ public: { auto hmsf = t.split (fps); - _hours->SetHint (std_to_wx(dcp::raw_convert(hmsf.h))); - _minutes->SetHint (std_to_wx(dcp::raw_convert(hmsf.m))); - _seconds->SetHint (std_to_wx(dcp::raw_convert(hmsf.s))); - _frames->SetHint (std_to_wx(dcp::raw_convert(hmsf.f))); + _hours->SetHint(std_to_wx(fmt::to_string(hmsf.h))); + _minutes->SetHint(std_to_wx(fmt::to_string(hmsf.m))); + _seconds->SetHint(std_to_wx(fmt::to_string(hmsf.s))); + _frames->SetHint(std_to_wx(fmt::to_string(hmsf.f))); } void set_maximum(dcpomatic::HMSF maximum) diff --git a/src/wx/verify_dcp_result_panel.cc b/src/wx/verify_dcp_result_panel.cc index d6232f984..36905bf13 100644 --- a/src/wx/verify_dcp_result_panel.cc +++ b/src/wx/verify_dcp_result_panel.cc @@ -24,7 +24,6 @@ #include "verify_dcp_result_panel.h" #include "wx_util.h" #include "lib/verify_dcp_job.h" -#include #include #include #include @@ -32,6 +31,7 @@ LIBDCP_DISABLE_WARNINGS #include #include LIBDCP_ENABLE_WARNINGS +#include #include @@ -111,7 +111,7 @@ VerifyDCPResultPanel::fill(shared_ptr job) message.Replace(char_to_wx("%calculated_hash"), std_to_wx(note.calculated_hash().get())); } if (note.frame()) { - message.Replace(char_to_wx("%frame"), std_to_wx(dcp::raw_convert(note.frame().get()))); + message.Replace(char_to_wx("%frame"), std_to_wx(fmt::to_string(note.frame().get()))); message.Replace( char_to_wx("%timecode"), std_to_wx( @@ -125,13 +125,13 @@ VerifyDCPResultPanel::fill(shared_ptr job) message.Replace(char_to_wx("%f"), std_to_wx(note.file()->filename().string())); } if (note.line()) { - message.Replace(char_to_wx("%l"), std_to_wx(dcp::raw_convert(note.line().get()))); + message.Replace(char_to_wx("%l"), std_to_wx(fmt::to_string(note.line().get()))); } if (note.component()) { - message.Replace(char_to_wx("%component"), std_to_wx(dcp::raw_convert(note.component().get()))); + message.Replace(char_to_wx("%component"), std_to_wx(fmt::to_string(note.component().get()))); } if (note.size()) { - message.Replace(char_to_wx("%size"), std_to_wx(dcp::raw_convert(note.size().get()))); + message.Replace(char_to_wx("%size"), std_to_wx(fmt::to_string(note.size().get()))); } if (note.id()) { message.Replace(char_to_wx("%id"), std_to_wx(note.id().get())); diff --git a/test/j2k_video_bit_rate_test.cc b/test/j2k_video_bit_rate_test.cc index b3eccd98a..5ab1880bf 100644 --- a/test/j2k_video_bit_rate_test.cc +++ b/test/j2k_video_bit_rate_test.cc @@ -30,8 +30,8 @@ #include "lib/film.h" #include "lib/image_content.h" #include "lib/video_content.h" -#include #include +#include using std::make_shared; @@ -45,7 +45,7 @@ check (int target_bits_per_second) int const duration = 10; - string const name = "bandwidth_test_" + dcp::raw_convert (target_bits_per_second); + string const name = "bandwidth_test_" + fmt::to_string(target_bits_per_second); auto content = make_shared(TestPaths::private_data() / "prophet_frame.tiff"); auto film = new_test_film(name, { content }, &cl); film->set_video_bit_rate(VideoEncoding::JPEG2000, target_bits_per_second); diff --git a/test/socket_test.cc b/test/socket_test.cc index bcdbcd724..395e5f720 100644 --- a/test/socket_test.cc +++ b/test/socket_test.cc @@ -21,7 +21,7 @@ #include "lib/dcpomatic_socket.h" #include "lib/server.h" -#include +#include #include #include #include @@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE (socket_basic_test) boost::asio::io_service io_service; tcp::resolver resolver (io_service); - tcp::resolver::query query ("127.0.0.1", dcp::raw_convert(TEST_SERVER_PORT)); + tcp::resolver::query query("127.0.0.1", fmt::to_string(TEST_SERVER_PORT)); tcp::resolver::iterator endpoint_iterator = resolver.resolve (query); auto socket = make_shared(); @@ -149,7 +149,7 @@ BOOST_AUTO_TEST_CASE (socket_digest_test1) boost::asio::io_service io_service; tcp::resolver resolver (io_service); - tcp::resolver::query query ("127.0.0.1", dcp::raw_convert(TEST_SERVER_PORT)); + tcp::resolver::query query("127.0.0.1", fmt::to_string(TEST_SERVER_PORT)); tcp::resolver::iterator endpoint_iterator = resolver.resolve (query); shared_ptr socket(new Socket); @@ -178,7 +178,7 @@ BOOST_AUTO_TEST_CASE (socket_digest_test2) boost::asio::io_service io_service; tcp::resolver resolver (io_service); - tcp::resolver::query query ("127.0.0.1", dcp::raw_convert(TEST_SERVER_PORT)); + tcp::resolver::query query("127.0.0.1", fmt::to_string(TEST_SERVER_PORT)); tcp::resolver::iterator endpoint_iterator = resolver.resolve (query); shared_ptr socket(new Socket); diff --git a/test/subtitle_reel_number_test.cc b/test/subtitle_reel_number_test.cc index a74cc097d..caa3cb2fe 100644 --- a/test/subtitle_reel_number_test.cc +++ b/test/subtitle_reel_number_test.cc @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include @@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE (subtitle_reel_number_test) if (i->main_subtitle()) { auto ass = dynamic_pointer_cast(i->main_subtitle()->asset()); BOOST_REQUIRE (ass); - BOOST_CHECK_EQUAL (ass->reel_number(), dcp::raw_convert(n)); + BOOST_CHECK_EQUAL (ass->reel_number(), fmt::to_string(n)); ++n; } } diff --git a/wscript b/wscript index 09c93897e..448f390fc 100644 --- a/wscript +++ b/wscript @@ -129,7 +129,7 @@ def configure(conf): # getMessengerLogger() in the grok code triggers these warnings '-Wno-nonnull', '-Wno-error=deprecated', - # I tried and failed to ignore these with _Pragma + # I tried and failed to ignore this with _Pragma '-Wno-ignored-qualifiers', '-D_FILE_OFFSET_BITS=64', '-std=c++' + cpp_std]) @@ -165,6 +165,9 @@ def configure(conf): # gcc 7.5.0 on Ubuntu 18.04 and gcc 8.3.0 on Debian 10 do, but # I didn't manage to turn it back off again with a pragma conf.env.append_value('CXXFLAGS', ['-Wsuggest-override']) + # This comes from fmt due to (apparently) a GCC bug + # I also tried to turn this off with a _Pragma, but failed + conf.env.append_value('CXXFLAGS', ['-Wno-stringop-overflow']) if conf.options.enable_debug: conf.env.append_value('CXXFLAGS', ['-g', '-DDCPOMATIC_DEBUG', '-fno-omit-frame-pointer']) @@ -389,7 +392,7 @@ def configure(conf): check_via_pkg_config(conf, 'libdcp-1.0', 'DCP', mandatory=True, static=True, minimum_version=libdcp_version) conf.env.DEFINES_DCP = [f.replace('\\', '') for f in conf.env.DEFINES_DCP] conf.env.STLIB_DCP = ['dcp-1.0', 'asdcp-dcpomatic', 'kumu-dcpomatic', 'openjp2'] - conf.env.LIB_DCP = ['glibmm-2.4', 'ssl', 'crypto', 'bz2', 'xslt', 'xerces-c'] + conf.env.LIB_DCP = ['glibmm-2.4', 'ssl', 'crypto', 'bz2', 'xslt', 'xerces-c', 'fmt'] else: check_via_pkg_config(conf, 'libdcp-1.0', 'DCP', mandatory=True, static=False, minimum_version=libdcp_version) conf.env.DEFINES_DCP = [f.replace('\\', '') for f in conf.env.DEFINES_DCP] -- cgit v1.2.3