X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fsubtitle_analysis.cc;h=9b3ae86c065656ad71394e0b01575ed30f2af4e1;hp=e6e8f310f4993ab375df09f6e5494dac5264f400;hb=HEAD;hpb=2da4caba7871455c097c0ed940dd6f2332dbda5d diff --git a/src/lib/subtitle_analysis.cc b/src/lib/subtitle_analysis.cc index e6e8f310f..ff1969a3a 100644 --- a/src/lib/subtitle_analysis.cc +++ b/src/lib/subtitle_analysis.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2020 Carl Hetherington + Copyright (C) 2020-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,18 +18,23 @@ */ + #include "subtitle_analysis.h" #include "exceptions.h" -#include "warnings.h" #include +#include #include -DCPOMATIC_DISABLE_WARNINGS +#include +LIBDCP_DISABLE_WARNINGS #include -DCPOMATIC_ENABLE_WARNINGS +LIBDCP_ENABLE_WARNINGS + +using std::make_shared; +using std::shared_ptr; using std::string; using dcp::raw_convert; -using boost::shared_ptr; + int const SubtitleAnalysis::_current_state_version = 1; @@ -38,11 +43,11 @@ SubtitleAnalysis::SubtitleAnalysis (boost::filesystem::path path) { cxml::Document f ("SubtitleAnalysis"); - f.read_file (path); + f.read_file(dcp::filesystem::fix_long_path(path)); if (f.optional_number_child("Version").get_value_or(1) < _current_state_version) { /* Too old. Throw an exception so that this analysis is re-run. */ - throw OldFormatError ("Audio analysis file is too old"); + throw OldFormatError ("Subtitle analysis file is too old"); } cxml::NodePtr bounding_box = f.optional_node_child("BoundingBox"); @@ -62,13 +67,13 @@ SubtitleAnalysis::SubtitleAnalysis (boost::filesystem::path path) void SubtitleAnalysis::write (boost::filesystem::path path) const { - shared_ptr doc (new xmlpp::Document); + auto doc = make_shared(); xmlpp::Element* root = doc->create_root_node ("SubtitleAnalysis"); root->add_child("Version")->add_child_text (raw_convert(_current_state_version)); if (_bounding_box) { - xmlpp::Element* bounding_box = root->add_child("BoundingBox"); + auto bounding_box = root->add_child("BoundingBox"); bounding_box->add_child("X")->add_child_text(raw_convert(_bounding_box->x)); bounding_box->add_child("Y")->add_child_text(raw_convert(_bounding_box->y)); bounding_box->add_child("Width")->add_child_text(raw_convert(_bounding_box->width)); @@ -81,4 +86,3 @@ SubtitleAnalysis::write (boost::filesystem::path path) const doc->write_to_file_formatted (path.string()); } -