summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-01-01 14:08:56 +0100
committerCarl Hetherington <cth@carlh.net>2025-01-01 20:51:21 +0100
commitc90d68049f56110436927aa847da882ee4b4f67c (patch)
tree1a1b8ee748d40a76c6e99fdf12e3da3306df7c4e /src
parent68533f20f9f2e0ca9efc9360f20d047a79e4fd8a (diff)
Replace raw_convert<string> with direct calls to fmt.v1.10.3
Diffstat (limited to 'src')
-rw-r--r--src/asset_map.cc3
-rw-r--r--src/combine.cc3
-rw-r--r--src/cpl.cc17
-rw-r--r--src/interop_text_asset.cc3
-rw-r--r--src/pkl.cc3
-rw-r--r--src/raw_convert.cc148
-rw-r--r--src/raw_convert.h60
-rw-r--r--src/reel_asset.cc9
-rw-r--r--src/reel_markers_asset.cc3
-rw-r--r--src/reel_picture_asset.cc3
-rw-r--r--src/smpte_text_asset.cc5
-rw-r--r--src/text_asset_internal.cc31
-rw-r--r--src/types.cc3
-rw-r--r--src/verify.cc15
-rw-r--r--src/verify_j2k.cc19
15 files changed, 65 insertions, 260 deletions
diff --git a/src/asset_map.cc b/src/asset_map.cc
index 0ee4b486..2c2dd9f2 100644
--- a/src/asset_map.cc
+++ b/src/asset_map.cc
@@ -41,6 +41,7 @@
LIBDCP_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
LIBDCP_ENABLE_WARNINGS
+#include <fmt/format.h>
#include <boost/algorithm/string.hpp>
@@ -214,6 +215,6 @@ AssetMap::Asset::write_xml(xmlpp::Element* asset_list, boost::filesystem::path d
cxml::add_text_child(chunk, "Path", relative_path->generic_string());
cxml::add_text_child(chunk, "VolumeIndex", "1");
cxml::add_text_child(chunk, "Offset", "0");
- cxml::add_text_child(chunk, "Length", raw_convert<string>(filesystem::file_size(_path)));
+ cxml::add_text_child(chunk, "Length", fmt::to_string(filesystem::file_size(_path)));
}
diff --git a/src/combine.cc b/src/combine.cc
index 74456bfb..34cb0c25 100644
--- a/src/combine.cc
+++ b/src/combine.cc
@@ -47,6 +47,7 @@
#include "font_asset.h"
#include "interop_text_asset.h"
#include "raw_convert.h"
+#include <fmt/format.h>
#include <boost/filesystem.hpp>
#include <set>
#include <string>
@@ -70,7 +71,7 @@ make_unique (boost::filesystem::path path)
}
for (int i = 0; i < 10000; ++i) {
- boost::filesystem::path p = path.parent_path() / (path.stem().string() + dcp::raw_convert<string>(i) + path.extension().string());
+ boost::filesystem::path p = path.parent_path() / (path.stem().string() + fmt::to_string(i) + path.extension().string());
if (!dcp::filesystem::exists(p)) {
return p;
}
diff --git a/src/cpl.cc b/src/cpl.cc
index 79aedc4c..a701f4ba 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -62,6 +62,7 @@ LIBDCP_ENABLE_WARNINGS
LIBDCP_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
LIBDCP_ENABLE_WARNINGS
+#include <fmt/format.h>
#include <boost/algorithm/string.hpp>
@@ -448,7 +449,7 @@ CPL::write_mca_subdescriptors(xmlpp::Element* parent, shared_ptr<const SoundAsse
cxml::add_child(ch, "MCATagName", string("r1"))->add_child_text(buffer);
}
if (!channel->MCAChannelID.empty()) {
- cxml::add_child(ch, "MCAChannelID", string("r1"))->add_child_text(raw_convert<string>(channel->MCAChannelID.get()));
+ cxml::add_child(ch, "MCAChannelID", string("r1"))->add_child_text(fmt::to_string(channel->MCAChannelID.get()));
}
if (!channel->RFC5646SpokenLanguage.empty()) {
channel->RFC5646SpokenLanguage.get().EncodeString(buffer, sizeof(buffer));
@@ -487,7 +488,7 @@ CPL::maybe_write_composition_metadata_asset(xmlpp::Element* node, bool include_m
auto mp = _reels.front()->main_picture();
cxml::add_text_child(meta, "EditRate", mp->edit_rate().as_string());
- cxml::add_text_child(meta, "IntrinsicDuration", raw_convert<string>(mp->intrinsic_duration()));
+ cxml::add_text_child(meta, "IntrinsicDuration", fmt::to_string(mp->intrinsic_duration()));
auto fctt = cxml::add_child(meta, "FullContentTitleText", string("meta"));
if (_full_content_title_text && !_full_content_title_text->empty()) {
@@ -503,7 +504,7 @@ CPL::maybe_write_composition_metadata_asset(xmlpp::Element* node, bool include_m
if (_version_number) {
auto vn = cxml::add_child(meta, "VersionNumber", string("meta"));
- vn->add_child_text(raw_convert<string>(*_version_number));
+ vn->add_child_text(fmt::to_string(*_version_number));
if (_status) {
vn->set_attribute("status", status_to_string(*_status));
}
@@ -535,15 +536,15 @@ CPL::maybe_write_composition_metadata_asset(xmlpp::Element* node, bool include_m
if (_main_sound_configuration) {
cxml::add_child(meta, "MainSoundConfiguration", string("meta"))->add_child_text(_main_sound_configuration->to_string());
}
- cxml::add_child(meta, "MainSoundSampleRate", string("meta"))->add_child_text(raw_convert<string>(*_main_sound_sample_rate) + " 1");
+ cxml::add_child(meta, "MainSoundSampleRate", string("meta"))->add_child_text(fmt::to_string(*_main_sound_sample_rate) + " 1");
auto stored = cxml::add_child(meta, "MainPictureStoredArea", string("meta"));
- cxml::add_child(stored, "Width", string("meta"))->add_child_text(raw_convert<string>(_main_picture_stored_area->width));
- cxml::add_child(stored, "Height", string("meta"))->add_child_text(raw_convert<string>(_main_picture_stored_area->height));
+ cxml::add_child(stored, "Width", string("meta"))->add_child_text(fmt::to_string(_main_picture_stored_area->width));
+ cxml::add_child(stored, "Height", string("meta"))->add_child_text(fmt::to_string(_main_picture_stored_area->height));
auto active = cxml::add_child(meta, "MainPictureActiveArea", string("meta"));
- cxml::add_child(active, "Width", string("meta"))->add_child_text(raw_convert<string>(_main_picture_active_area->width));
- cxml::add_child(active, "Height", string("meta"))->add_child_text(raw_convert<string>(_main_picture_active_area->height));
+ cxml::add_child(active, "Width", string("meta"))->add_child_text(fmt::to_string(_main_picture_active_area->width));
+ cxml::add_child(active, "Height", string("meta"))->add_child_text(fmt::to_string(_main_picture_active_area->height));
optional<string> first_subtitle_language;
for (auto i: _reels) {
diff --git a/src/interop_text_asset.cc b/src/interop_text_asset.cc
index 01e0f89a..d7891946 100644
--- a/src/interop_text_asset.cc
+++ b/src/interop_text_asset.cc
@@ -54,6 +54,7 @@
LIBDCP_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
LIBDCP_ENABLE_WARNINGS
+#include <fmt/format.h>
#include <boost/weak_ptr.hpp>
#include <cmath>
#include <cstdio>
@@ -117,7 +118,7 @@ InteropTextAsset::xml_as_string() const
cxml::add_text_child(root, "SubtitleID", _id);
cxml::add_text_child(root, "MovieTitle", _movie_title);
- cxml::add_text_child(root, "ReelNumber", raw_convert<string> (_reel_number));
+ cxml::add_text_child(root, "ReelNumber", fmt::to_string(_reel_number));
cxml::add_text_child(root, "Language", _language);
for (auto i: _load_font_nodes) {
diff --git a/src/pkl.cc b/src/pkl.cc
index c77d8e64..67c9067c 100644
--- a/src/pkl.cc
+++ b/src/pkl.cc
@@ -48,6 +48,7 @@
LIBDCP_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
LIBDCP_ENABLE_WARNINGS
+#include <fmt/format.h>
#include <iostream>
@@ -137,7 +138,7 @@ PKL::write_xml (boost::filesystem::path file, shared_ptr<const CertificateChain>
cxml::add_text_child(asset, "AnnotationText", *i->annotation_text());
}
cxml::add_text_child(asset, "Hash", i->hash());
- cxml::add_text_child(asset, "Size", raw_convert<string>(i->size()));
+ cxml::add_text_child(asset, "Size", fmt::to_string(i->size()));
cxml::add_text_child(asset, "Type", i->type());
if (auto filename = i->original_filename()) {
cxml::add_text_child(asset, "OriginalFileName", *filename);
diff --git a/src/raw_convert.cc b/src/raw_convert.cc
index eeab0dad..7bb703fb 100644
--- a/src/raw_convert.cc
+++ b/src/raw_convert.cc
@@ -33,7 +33,6 @@
#include "raw_convert.h"
-#include <fmt/format.h>
#include <fast_float/fast_float.h>
#include <boost/algorithm/string.hpp>
@@ -42,153 +41,6 @@ using std::string;
using std::wstring;
-template <>
-string
-dcp::raw_convert(unsigned char v, int, bool)
-{
- return fmt::to_string(v);
-}
-
-
-template <>
-string
-dcp::raw_convert(unsigned short int v, int, bool)
-{
- return fmt::to_string(v);
-}
-
-
-template <>
-string
-dcp::raw_convert(int v, int, bool)
-{
- return fmt::to_string(v);
-}
-
-
-template <>
-string
-dcp::raw_convert(unsigned int v, int, bool)
-{
- return fmt::to_string(v);
-}
-
-
-template <>
-string
-dcp::raw_convert(long v, int, bool)
-{
- return fmt::to_string(v);
-}
-
-
-template <>
-string
-dcp::raw_convert(unsigned long v, int, bool)
-{
- return fmt::to_string(v);
-}
-
-
-template <>
-string
-dcp::raw_convert(long long v, int, bool)
-{
- return fmt::to_string(v);
-}
-
-
-template <>
-string
-dcp::raw_convert(unsigned long long v, int, bool)
-{
- return fmt::to_string(v);
-}
-
-
-static
-void
-make_format_string(char* buffer, int buffer_length, int precision, bool fixed)
-{
- if (fixed) {
- snprintf(buffer, buffer_length, "{:.%df}", precision);
- } else {
- snprintf(buffer, buffer_length, "{:.%d}", precision);
- }
-}
-
-
-template <>
-string
-dcp::raw_convert (float v, int precision, bool fixed)
-{
- if (precision < 16) {
- char format[16];
- make_format_string(format, 16, precision, fixed);
- return fmt::format(format, v);
- }
-
- return fmt::to_string(v);
-}
-
-
-template <>
-string
-dcp::raw_convert (double v, int precision, bool fixed)
-{
- if (precision < 16) {
- char format[16];
- make_format_string(format, 16, precision, fixed);
- return fmt::format(format, v);
- }
-
- return fmt::to_string(v);
-}
-
-
-template <>
-string
-dcp::raw_convert (char const * v, int, bool)
-{
- return v;
-}
-
-
-template <>
-string
-dcp::raw_convert (char* v, int, bool)
-{
- return v;
-}
-
-
-template <>
-string
-dcp::raw_convert (string v, int, bool)
-{
- return v;
-}
-
-
-template <>
-string
-dcp::raw_convert (char v, int, bool)
-{
- string s;
- s += v;
- return s;
-}
-
-
-template <>
-string
-dcp::raw_convert (wchar_t const * v, int, bool)
-{
- wstring w (v);
- return string (w.begin(), w.end());
-}
-
-
template <typename T>
T
convert_with_fast_float(string v)
diff --git a/src/raw_convert.h b/src/raw_convert.h
index 51f5fbb6..8dde240d 100644
--- a/src/raw_convert.h
+++ b/src/raw_convert.h
@@ -65,66 +65,6 @@ raw_convert (Q, int precision = 16, bool fixed = false)
}
template <>
-std::string
-raw_convert (unsigned char v, int, bool);
-
-template <>
-std::string
-raw_convert (unsigned short int v, int, bool);
-
-template <>
-std::string
-raw_convert (int v, int, bool);
-
-template <>
-std::string
-raw_convert (unsigned int v, int, bool);
-
-template <>
-std::string
-raw_convert (long v, int, bool);
-
-template <>
-std::string
-raw_convert (unsigned long v, int, bool);
-
-template <>
-std::string
-raw_convert (long long v, int, bool);
-
-template <>
-std::string
-raw_convert (unsigned long long v, int, bool);
-
-template <>
-std::string
-raw_convert (float v, int, bool);
-
-template <>
-std::string
-raw_convert (double v, int, bool);
-
-template <>
-std::string
-raw_convert (char const * v, int, bool);
-
-template <>
-std::string
-raw_convert (char* v, int, bool);
-
-template <>
-std::string
-raw_convert (std::string v, int, bool);
-
-template <>
-std::string
-raw_convert (wchar_t const * v, int, bool);
-
-template <>
-std::string
-raw_convert (char v, int, bool);
-
-template <>
unsigned char
raw_convert (std::string v, int, bool);
diff --git a/src/reel_asset.cc b/src/reel_asset.cc
index 1d3d1d1f..1b346da6 100644
--- a/src/reel_asset.cc
+++ b/src/reel_asset.cc
@@ -48,6 +48,7 @@
LIBDCP_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
LIBDCP_ENABLE_WARNINGS
+#include <fmt/format.h>
using std::make_pair;
@@ -102,12 +103,12 @@ ReelAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
cxml::add_text_child(a, "AnnotationText", *_annotation_text);
}
cxml::add_text_child(a, "EditRate", _edit_rate.as_string());
- cxml::add_text_child(a, "IntrinsicDuration", raw_convert<string>(_intrinsic_duration));
+ cxml::add_text_child(a, "IntrinsicDuration", fmt::to_string(_intrinsic_duration));
if (_entry_point) {
- cxml::add_text_child(a, "EntryPoint", raw_convert<string>(*_entry_point));
+ cxml::add_text_child(a, "EntryPoint", fmt::to_string(*_entry_point));
}
if (_duration) {
- cxml::add_text_child(a, "Duration", raw_convert<string>(*_duration));
+ cxml::add_text_child(a, "Duration", fmt::to_string(*_duration));
}
return a;
}
@@ -131,7 +132,7 @@ template <class T>
string
optional_to_string (optional<T> o)
{
- return o ? raw_convert<string>(*o) : "[none]";
+ return o ? fmt::to_string(*o) : "[none]";
}
diff --git a/src/reel_markers_asset.cc b/src/reel_markers_asset.cc
index ce3891f4..03507551 100644
--- a/src/reel_markers_asset.cc
+++ b/src/reel_markers_asset.cc
@@ -44,6 +44,7 @@
LIBDCP_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
LIBDCP_ENABLE_WARNINGS
+#include <fmt/format.h>
using std::string;
@@ -113,7 +114,7 @@ ReelMarkersAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
for (auto const& i: _markers) {
auto m = cxml::add_child(ml, "Marker");
cxml::add_text_child(m, "Label", marker_to_string(i.first));
- cxml::add_text_child(m, "Offset", raw_convert<string>(i.second.as_editable_units_ceil(tcr)));
+ cxml::add_text_child(m, "Offset", fmt::to_string(i.second.as_editable_units_ceil(tcr)));
}
return asset;
diff --git a/src/reel_picture_asset.cc b/src/reel_picture_asset.cc
index 37a6bfcc..9cb36957 100644
--- a/src/reel_picture_asset.cc
+++ b/src/reel_picture_asset.cc
@@ -47,6 +47,7 @@
LIBDCP_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
LIBDCP_ENABLE_WARNINGS
+#include <fmt/format.h>
#include <iomanip>
#include <cmath>
@@ -113,7 +114,7 @@ ReelPictureAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
}
}
- cxml::add_text_child(asset, "ScreenAspectRatio", raw_convert<string>(closest.get(), 2, true));
+ cxml::add_text_child(asset, "ScreenAspectRatio", fmt::format("{:.2f}", closest.get()));
} else {
cxml::add_text_child(
asset,
diff --git a/src/smpte_text_asset.cc b/src/smpte_text_asset.cc
index f92a091a..1e87474a 100644
--- a/src/smpte_text_asset.cc
+++ b/src/smpte_text_asset.cc
@@ -56,6 +56,7 @@ LIBDCP_DISABLE_WARNINGS
#include <asdcp/KM_log.h>
#include <libxml++/libxml++.h>
LIBDCP_ENABLE_WARNINGS
+#include <fmt/format.h>
#include <boost/algorithm/string.hpp>
@@ -379,13 +380,13 @@ SMPTETextAsset::xml_as_string() const
}
cxml::add_text_child(root, "IssueDate", _issue_date.as_string(false, false));
if (_reel_number) {
- cxml::add_text_child(root, "ReelNumber", raw_convert<string>(_reel_number.get()));
+ cxml::add_text_child(root, "ReelNumber", fmt::to_string(_reel_number.get()));
}
if (_language) {
cxml::add_text_child(root, "Language", _language.get());
}
cxml::add_text_child(root, "EditRate", _edit_rate.as_string());
- cxml::add_text_child(root, "TimeCodeRate", raw_convert<string>(_time_code_rate));
+ cxml::add_text_child(root, "TimeCodeRate", fmt::to_string(_time_code_rate));
if (_start_time) {
cxml::add_text_child(root, "StartTime", _start_time.get().as_string(Standard::SMPTE));
}
diff --git a/src/text_asset_internal.cc b/src/text_asset_internal.cc
index aba26edd..549bbec9 100644
--- a/src/text_asset_internal.cc
+++ b/src/text_asset_internal.cc
@@ -40,6 +40,7 @@
#include "text_asset_internal.h"
#include "text_string.h"
#include "compose.hpp"
+#include <fmt/format.h>
#include <cmath>
@@ -60,8 +61,8 @@ order::Font::Font(shared_ptr<TextString> s, Standard standard)
}
_values["Italic"] = s->italic() ? "yes" : "no";
_values["Color"] = s->colour().to_argb_string();
- _values["Size"] = raw_convert<string> (s->size());
- _values["AspectAdjust"] = raw_convert<string>(s->aspect_adjust(), 1, true);
+ _values["Size"] = fmt::to_string(s->size());
+ _values["AspectAdjust"] = fmt::format("{:.1f}", s->aspect_adjust());
_values["Effect"] = effect_to_string (s->effect());
_values["EffectColor"] = s->effect_colour().to_argb_string();
_values["Script"] = "normal";
@@ -138,7 +139,7 @@ order::String::as_xml (xmlpp::Element* parent, Context& context) const
{
if (fabs(_space_before) > SPACE_BEFORE_EPSILON) {
auto space = cxml::add_child(parent, "Space");
- auto size = raw_convert<string>(_space_before, 2);
+ auto size = fmt::format("{:.2}", _space_before);
if (context.standard == Standard::INTEROP) {
size += "em";
}
@@ -177,9 +178,9 @@ position_align (xmlpp::Element* e, order::Context& context, HAlign h_align, floa
if (fabs(h_position) > ALIGN_EPSILON) {
if (context.standard == Standard::SMPTE) {
- e->set_attribute ("Hposition", raw_convert<string> (h_position * 100, 6));
+ e->set_attribute("Hposition", fmt::format("{:.6}", h_position * 100));
} else {
- e->set_attribute ("HPosition", raw_convert<string> (h_position * 100, 6));
+ e->set_attribute("HPosition", fmt::format("{:.6}", h_position * 100));
}
}
@@ -191,9 +192,9 @@ position_align (xmlpp::Element* e, order::Context& context, HAlign h_align, floa
if (fabs(v_position) > ALIGN_EPSILON) {
if (context.standard == Standard::SMPTE) {
- e->set_attribute ("Vposition", raw_convert<string> (v_position * 100, 6));
+ e->set_attribute("Vposition", fmt::format("{:.6}", v_position * 100));
} else {
- e->set_attribute ("VPosition", raw_convert<string> (v_position * 100, 6));
+ e->set_attribute("VPosition", fmt::format("{:.6}", v_position * 100));
}
} else {
if (context.standard == Standard::SMPTE) {
@@ -204,7 +205,7 @@ position_align (xmlpp::Element* e, order::Context& context, HAlign h_align, floa
}
if (fabs(z_position) > ALIGN_EPSILON && context.standard == Standard::SMPTE) {
- e->set_attribute("Zposition", raw_convert<string>(z_position * 100, 6));
+ e->set_attribute("Zposition", fmt::format("{:.6}", z_position * 100));
}
}
@@ -228,11 +229,11 @@ order::Text::as_xml (xmlpp::Element* parent, Context& context) const
cxml::add_child(xml, "Rb")->add_child_text(ruby.base);
auto rt = cxml::add_child(xml, "Rt");
rt->add_child_text(ruby.annotation);
- rt->set_attribute("Size", dcp::raw_convert<string>(ruby.size, 6));
+ rt->set_attribute("Size", fmt::format("{:.6}", ruby.size));
rt->set_attribute("Position", ruby.position == RubyPosition::BEFORE ? "before" : "after");
- rt->set_attribute("Offset", dcp::raw_convert<string>(ruby.offset, 6));
- rt->set_attribute("Spacing", dcp::raw_convert<string>(ruby.spacing, 6));
- rt->set_attribute("AspectAdjust", dcp::raw_convert<string>(ruby.aspect_adjust, 6));
+ rt->set_attribute("Offset", fmt::format("{:.6}", ruby.offset));
+ rt->set_attribute("Spacing", fmt::format("{:.6}", ruby.spacing));
+ rt->set_attribute("AspectAdjust", fmt::format("{:.6}", ruby.aspect_adjust));
}
return e;
@@ -243,15 +244,15 @@ xmlpp::Element*
order::Subtitle::as_xml (xmlpp::Element* parent, Context& context) const
{
auto e = cxml::add_child(parent, "Subtitle");
- e->set_attribute ("SpotNumber", raw_convert<string> (context.spot_number++));
+ e->set_attribute("SpotNumber", fmt::to_string(context.spot_number++));
e->set_attribute ("TimeIn", _in.rebase(context.time_code_rate).as_string(context.standard));
e->set_attribute ("TimeOut", _out.rebase(context.time_code_rate).as_string(context.standard));
if (context.standard == Standard::SMPTE) {
e->set_attribute ("FadeUpTime", _fade_up.rebase(context.time_code_rate).as_string(context.standard));
e->set_attribute ("FadeDownTime", _fade_down.rebase(context.time_code_rate).as_string(context.standard));
} else {
- e->set_attribute ("FadeUpTime", raw_convert<string> (_fade_up.as_editable_units_ceil(context.time_code_rate)));
- e->set_attribute ("FadeDownTime", raw_convert<string> (_fade_down.as_editable_units_ceil(context.time_code_rate)));
+ e->set_attribute("FadeUpTime", fmt::to_string(_fade_up.as_editable_units_ceil(context.time_code_rate)));
+ e->set_attribute("FadeDownTime", fmt::to_string(_fade_down.as_editable_units_ceil(context.time_code_rate)));
}
return e;
}
diff --git a/src/types.cc b/src/types.cc
index 99b2f6c8..a17966b4 100644
--- a/src/types.cc
+++ b/src/types.cc
@@ -46,6 +46,7 @@
LIBDCP_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
LIBDCP_ENABLE_WARNINGS
+#include <fmt/format.h>
#include <boost/algorithm/string.hpp>
#include <string>
#include <vector>
@@ -355,7 +356,7 @@ Luminance::as_xml (xmlpp::Element* parent, string ns) const
{
auto lum = cxml::add_child(parent, "Luminance", ns);
lum->set_attribute("units", unit_to_string(_unit));
- lum->add_child_text(raw_convert<string>(_value, 3));
+ lum->add_child_text(fmt::format("{:.3}", _value));
}
diff --git a/src/verify.cc b/src/verify.cc
index 6a4dba7d..8775ab11 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -78,6 +78,7 @@
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/sax/HandlerBase.hpp>
#include <xercesc/util/PlatformUtils.hpp>
+#include <fmt/format.h>
#include <boost/algorithm/string.hpp>
#include <iostream>
#include <map>
@@ -639,10 +640,10 @@ verify_main_sound_asset(Context& context, shared_ptr<const ReelSoundAsset> reel_
verify_language_tag(context, *lang);
}
if (asset->sampling_rate() != 48000) {
- context.bv21_error(VerificationNote::Code::INVALID_SOUND_FRAME_RATE, raw_convert<string>(asset->sampling_rate()), file);
+ context.bv21_error(VerificationNote::Code::INVALID_SOUND_FRAME_RATE, fmt::to_string(asset->sampling_rate()), file);
}
if (asset->bit_depth() != 24) {
- context.error(VerificationNote::Code::INVALID_SOUND_BIT_DEPTH, raw_convert<string>(asset->bit_depth()), file);
+ context.error(VerificationNote::Code::INVALID_SOUND_BIT_DEPTH, fmt::to_string(asset->bit_depth()), file);
}
}
@@ -696,7 +697,7 @@ verify_smpte_timed_text_asset (
auto const size = filesystem::file_size(asset->file().get());
if (size > 115 * 1024 * 1024) {
- context.bv21_error(VerificationNote::Code::INVALID_TIMED_TEXT_SIZE_IN_BYTES, raw_convert<string>(size), *asset->file());
+ context.bv21_error(VerificationNote::Code::INVALID_TIMED_TEXT_SIZE_IN_BYTES, fmt::to_string(size), *asset->file());
}
/* XXX: I'm not sure what Bv2.1_7.2.1 means when it says "the font resource shall not be larger than 10MB"
@@ -708,7 +709,7 @@ verify_smpte_timed_text_asset (
total_size += i.second.size();
}
if (total_size > 10 * 1024 * 1024) {
- context.bv21_error(VerificationNote::Code::INVALID_TIMED_TEXT_FONT_SIZE_IN_BYTES, raw_convert<string>(total_size), asset->file().get());
+ context.bv21_error(VerificationNote::Code::INVALID_TIMED_TEXT_FONT_SIZE_IN_BYTES, fmt::to_string(total_size), asset->file().get());
}
if (asset->raw_xml()) {
@@ -844,7 +845,7 @@ verify_closed_caption_asset (
if (raw_xml) {
validate_xml(context, *raw_xml);
if (raw_xml->size() > 256 * 1024) {
- context.bv21_error(VerificationNote::Code::INVALID_CLOSED_CAPTION_XML_SIZE_IN_BYTES, raw_convert<string>(raw_xml->size()), *asset->file());
+ context.bv21_error(VerificationNote::Code::INVALID_CLOSED_CAPTION_XML_SIZE_IN_BYTES, fmt::to_string(raw_xml->size()), *asset->file());
}
} else {
context.warning(VerificationNote::Code::MISSED_CHECK_OF_ENCRYPTED);
@@ -1670,7 +1671,7 @@ verify_cpl(Context& context, shared_ptr<const CPL> cpl)
if (ffoc == markers_seen.end()) {
context.warning(VerificationNote::Code::MISSING_FFOC);
} else if (ffoc->second.e != 1) {
- context.warning(VerificationNote::Code::INCORRECT_FFOC, raw_convert<string>(ffoc->second.e));
+ context.warning(VerificationNote::Code::INCORRECT_FFOC, fmt::to_string(ffoc->second.e));
}
auto lfoc = markers_seen.find(Marker::LFOC);
@@ -1679,7 +1680,7 @@ verify_cpl(Context& context, shared_ptr<const CPL> cpl)
} else {
auto lfoc_time = lfoc->second.as_editable_units_ceil(lfoc->second.tcr);
if (lfoc_time != (cpl->reels().back()->duration() - 1)) {
- context.warning(VerificationNote::Code::INCORRECT_LFOC, raw_convert<string>(lfoc_time));
+ context.warning(VerificationNote::Code::INCORRECT_LFOC, fmt::to_string(lfoc_time));
}
}
diff --git a/src/verify_j2k.cc b/src/verify_j2k.cc
index f89ff840..f1bed1ed 100644
--- a/src/verify_j2k.cc
+++ b/src/verify_j2k.cc
@@ -42,6 +42,7 @@
#include "raw_convert.h"
#include "verify.h"
#include "verify_j2k.h"
+#include <fmt/format.h>
#include <memory>
#include <vector>
@@ -161,7 +162,7 @@ dcp::verify_j2k(shared_ptr<const Data> j2k, int start_index, int frame_index, in
require_marker ("SIZ");
auto L_siz = get_16();
if (L_siz != 47) {
- throw InvalidCodestream("unexpected SIZ size " + raw_convert<string>(L_siz));
+ throw InvalidCodestream("unexpected SIZ size " + fmt::to_string(L_siz));
}
get_16(); // CA: codestream capabilities
@@ -209,10 +210,10 @@ dcp::verify_j2k(shared_ptr<const Data> j2k, int start_index, int frame_index, in
auto const tile_part_index = get_8();
auto tile_parts = get_8();
if (!fourk && tile_parts != 3) {
- notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_TILE_PARTS_FOR_2K, raw_convert<string>(tile_parts) });
+ notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_TILE_PARTS_FOR_2K, fmt::to_string(tile_parts) });
}
if (fourk && tile_parts != 6) {
- notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_TILE_PARTS_FOR_4K, raw_convert<string>(tile_parts) });
+ notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_TILE_PARTS_FOR_4K, fmt::to_string(tile_parts) });
}
if (tile_part_length > max_tile_part_size) {
VerificationNote note{VerificationNote::Type::ERROR, VerificationNote::Code::INVALID_JPEG2000_TILE_PART_SIZE};
@@ -239,11 +240,11 @@ dcp::verify_j2k(shared_ptr<const Data> j2k, int start_index, int frame_index, in
require_8(fourk ? 6 : 5, "invalid number of transform levels %1");
auto log_code_block_width = get_8();
if (log_code_block_width != 3) {
- notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_CODE_BLOCK_WIDTH, raw_convert<string>(4 * (2 << log_code_block_width)) });
+ notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_CODE_BLOCK_WIDTH, fmt::to_string(4 * (2 << log_code_block_width)) });
}
auto log_code_block_height = get_8();
if (log_code_block_height != 3) {
- notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_CODE_BLOCK_HEIGHT, raw_convert<string>(4 * (2 << log_code_block_height)) });
+ notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_CODE_BLOCK_HEIGHT, fmt::to_string(4 * (2 << log_code_block_height)) });
}
require_8(0, "invalid mode variations");
require_8(0, "invalid wavelet transform type %1"); // 9/7 irreversible
@@ -262,10 +263,10 @@ dcp::verify_j2k(shared_ptr<const Data> j2k, int start_index, int frame_index, in
auto quantization_style = get_8();
int guard_bits = (quantization_style >> 5) & 7;
if (fourk && guard_bits != 2) {
- notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_4K, raw_convert<string>(guard_bits) });
+ notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_4K, fmt::to_string(guard_bits) });
}
if (!fourk && guard_bits != 1) {
- notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_2K, raw_convert<string>(guard_bits) });
+ notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_2K, fmt::to_string(guard_bits) });
}
ptr += L_qcd - 3;
} else if (*marker_name == "COC") {
@@ -344,10 +345,10 @@ dcp::verify_j2k(shared_ptr<const Data> j2k, int start_index, int frame_index, in
throw InvalidCodestream("more than one QCD marker found");
}
if (num_POC_in_main != 0 && !fourk) {
- notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_2K, raw_convert<string>(num_POC_in_main) });
+ notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_2K, fmt::to_string(num_POC_in_main) });
}
if (num_POC_in_main != 1 && fourk) {
- notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_4K, raw_convert<string>(num_POC_in_main) });
+ notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_4K, fmt::to_string(num_POC_in_main) });
}
if (num_POC_after_main != 0) {
notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_JPEG2000_POC_MARKER_LOCATION });