/** @file src/asset.cc
- * @brief Asset class.
+ * @brief Asset class
*/
files in the program, then also delete it here.
*/
+
+/** @file src/asset_factory.cc
+ * @brief asset_factory() method
+ */
+
+
#include "mono_picture_asset.h"
#include "stereo_picture_asset.h"
#include "sound_asset.h"
#include "asset_factory.h"
#include <memory>
+
using std::shared_ptr;
using std::make_shared;
using namespace dcp;
+
shared_ptr<Asset>
dcp::asset_factory (boost::filesystem::path path, bool ignore_incorrect_picture_mxf_type)
{
files in the program, then also delete it here.
*/
+
+/** @file src/asset_factory.h
+ * @brief asset_factory() method
+ */
+
+
namespace dcp {
+
std::shared_ptr<Asset> asset_factory (boost::filesystem::path path, bool ignore_incorrect_picture_mxf_type);
+
}
/*
- Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
/*
- Copyright (C) 2015-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
/*
- Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
/** @file src/key.cc
- * @brief Key class.
+ * @brief Key class
*/
/*
- Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
}
+
#endif
/** @file src/locale_convert.cc
- * @brief Methods to convert to/from string using the current locale.
+ * @brief Methods to convert to/from string using the current locale
*/
/*
- Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
std::string cpl_node_name () const;
};
+
}
+
#endif
/** @file src/openjpeg_image.cc
- * @brief OpenJPEGImage class.
+ * @brief OpenJPEGImage class
*/
/*
- Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
boost::optional<int64_t> _entry_point; ///< The <EntryPoint> from the reel's entry for this asset
};
+
}
+
#endif
*/
+/** @file src/reel_markers_asset.cc
+ * @brief ReelMarkersAsset class
+ */
+
+
#include "reel_markers_asset.h"
#include "raw_convert.h"
#include "dcp_assert.h"
optional<Time>
ReelMarkersAsset::get (Marker m) const
{
- map<Marker, Time>::const_iterator i = _markers.find (m);
+ auto i = _markers.find (m);
if (i == _markers.end ()) {
- return optional<Time>();
+ return {};
}
return i->second;
}
*/
+/** @file src/reel_markers_asset.cc
+ * @brief ReelMarkersAsset class
+ */
+
+
#include "reel_asset.h"
#include "dcp_time.h"
#include <map>
*/
+/** @file rgb_xyz.cc
+ * @brief Conversion between RGB and XYZ
+ */
+
+
#include "colour_conversion.h"
#include "compose.hpp"
#include "dcp_assert.h"
double const * lut_in = conversion.out()->lut (12, false);
double const * lut_out = conversion.in()->lut (16, true);
- boost::numeric::ublas::matrix<double> const matrix = conversion.xyz_to_rgb ();
+ auto const matrix = conversion.xyz_to_rgb ();
double fast_matrix[9] = {
matrix (0, 0), matrix (0, 1), matrix (0, 2),
int const width = xyz_image->size().width;
for (int y = 0; y < height; ++y) {
- uint16_t* rgb_line = reinterpret_cast<uint16_t*> (rgb + y * stride);
+ auto rgb_line = reinterpret_cast<uint16_t*> (rgb + y * stride);
for (int x = 0; x < width; ++x) {
int cx = *xyz_x++;
void
dcp::combined_rgb_to_xyz (ColourConversion const & conversion, double* matrix)
{
- boost::numeric::ublas::matrix<double> const rgb_to_xyz = conversion.rgb_to_xyz ();
- boost::numeric::ublas::matrix<double> const bradford = conversion.bradford ();
+ auto const rgb_to_xyz = conversion.rgb_to_xyz ();
+ auto const bradford = conversion.bradford ();
matrix[0] = (bradford (0, 0) * rgb_to_xyz (0, 0) + bradford (0, 1) * rgb_to_xyz (1, 0) + bradford (0, 2) * rgb_to_xyz (2, 0))
* DCI_COEFFICIENT * 65535;
*/
+/** @file rgb_xyz.h
+ * @brief Conversion between RGB and XYZ
+ */
+
+
#include "types.h"
#include <memory>
#include <boost/optional.hpp>
/** @file src/smpte_load_font_node.h
- * @brief SMPTELoadFontNode class.
+ * @brief SMPTELoadFontNode class
*/
*/
+/** @file src/stereo_picture_frame.cc
+ * @brief StereoPictureFrame class
+ */
+
+
#include "stereo_picture_frame.h"
#include "exceptions.h"
#include "util.h"
*/
-#ifndef LIBDCP_SUBTITLE_H
-#define LIBDCP_SUBTITLE_H
-
-
/** @file src/subtitle.h
* @brief Subtitle class
*/
+#ifndef LIBDCP_SUBTITLE_H
+#define LIBDCP_SUBTITLE_H
+
+
#include "dcp_time.h"
/*
- Copyright (C) 2018-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
files in the program, then also delete it here.
*/
+
+/** @file src/subtitle_image.cc
+ * @brief SubtitleImage class
+ */
+
+
#include "subtitle_image.h"
#include "util.h"
+
using std::ostream;
using std::string;
using std::shared_ptr;
using namespace dcp;
+
SubtitleImage::SubtitleImage (
ArrayData png_image,
Time in,
}
+
SubtitleImage::SubtitleImage (
ArrayData png_image,
string id,
}
+
void
SubtitleImage::read_png_file (boost::filesystem::path file)
{
_png_image = ArrayData (file);
}
+
void
SubtitleImage::write_png_file (boost::filesystem::path file) const
{
png_image().write (file);
}
+
bool
dcp::operator== (SubtitleImage const & a, SubtitleImage const & b)
{
);
}
+
bool
dcp::operator!= (SubtitleImage const & a, SubtitleImage const & b)
{
return !(a == b);
}
+
bool
SubtitleImage::equals (shared_ptr<SubtitleImage> other, EqualityOptions options, NoteHandler note)
{
return true;
}
+
ostream&
dcp::operator<< (ostream& s, SubtitleImage const & sub)
{
/*
- Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
files in the program, then also delete it here.
*/
+
/** @file src/subtitle_image.h
- * @brief SubtitleImage class.
+ * @brief SubtitleImage class
*/
+
#ifndef LIBDCP_SUBTITLE_IMAGE_H
#define LIBDCP_SUBTITLE_IMAGE_H
#include <boost/optional.hpp>
#include <string>
+
namespace dcp {
+
/** @class SubtitleImage
- * @brief A bitmap subtitle with all the associated attributes.
+ * @brief A bitmap subtitle with all the associated attributes
*/
class SubtitleImage : public Subtitle
{
mutable boost::optional<boost::filesystem::path> _file;
};
+
bool operator== (SubtitleImage const & a, SubtitleImage const & b);
bool operator!= (SubtitleImage const & a, SubtitleImage const & b);
std::ostream& operator<< (std::ostream& s, SubtitleImage const & sub);
+
}
+
#endif
/*
- Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
files in the program, then also delete it here.
*/
+
+/** @file src/subtitle_string.cc
+ * @brief SubtitleString class
+ */
+
+
#include "subtitle_string.h"
#include "xml.h"
#include <cmath>
-using std::string;
+
+using std::max;
+using std::min;
using std::ostream;
+using std::string;
using boost::optional;
using namespace dcp;
-/** @param v_position Vertical position as a fraction of the screen height (between 0 and 1) from v_align */
+
SubtitleString::SubtitleString (
optional<string> font,
bool italic,
, _effect (effect)
, _effect_colour (effect_colour)
{
-
+ _aspect_adjust = max(min(_aspect_adjust, 4.0), 0.25);
}
+
int
SubtitleString::size_in_pixels (int screen_height) const
{
return _size * screen_height / (11 * 72);
}
+
bool
dcp::operator== (SubtitleString const & a, SubtitleString const & b)
{
);
}
+
bool
dcp::operator!= (SubtitleString const & a, SubtitleString const & b)
{
return !(a == b);
}
+
ostream&
dcp::operator<< (ostream& s, SubtitleString const & sub)
{
/*
- Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
files in the program, then also delete it here.
*/
+
/** @file src/subtitle_string.h
- * @brief SubtitleString class.
+ * @brief SubtitleString class
*/
+
#ifndef LIBDCP_SUBTITLE_STRING_H
#define LIBDCP_SUBTITLE_STRING_H
+
#include "types.h"
#include "subtitle.h"
#include "dcp_time.h"
#include <boost/optional.hpp>
#include <string>
+
namespace dcp {
+
/** @class SubtitleString
* @brief A single line of subtitle text with all the associated attributes.
*/
class SubtitleString : public Subtitle
{
public:
+ /** @param font Font ID, or empty to use the default
+ * @param italic true for italic text
+ * @param bold true for bold text
+ * @param underline true for underlined text
+ * @param colour Colour of the text
+ * @param size Size in points as if the screen height is 11 inches, so a 72pt font would be 1/11th of the screen height
+ * @param aspect_adjust greater than 1 to stretch text to be wider, less than 1 to shrink text to be narrower (must be between 0.25 and 4)
+ * @param in start time
+ * @param out finish time
+ * @param h_position Horizontal position as a fraction of the screen width (between 0 and 1) from h_align
+ * @param h_align Horizontal alignment point
+ * @param v_position Vertical position as a fraction of the screen height (between 0 and 1) from v_align
+ * @param v_align Vertical alignment point
+ * @param direction Direction of text
+ * @param text The text to display
+ * @param effect Effect to use
+ * @param effect_colour Colour of the effect
+ * @param fade_up_time Time to fade the text in
+ * @param fade_down_time Time to fade the text out
+ */
SubtitleString (
boost::optional<std::string> font,
bool italic,
bool operator!= (SubtitleString const & a, SubtitleString const & b);
std::ostream& operator<< (std::ostream& s, SubtitleString const & sub);
+
}
+
#endif
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
files in the program, then also delete it here.
*/
+
+/* @file src/transfer_function.cc
+ * @brief TransferFunction
+ */
+
+
#include "transfer_function.h"
#include <cmath>
+
using std::pow;
using std::map;
using std::pair;
using std::shared_ptr;
using namespace dcp;
+
TransferFunction::~TransferFunction ()
{
boost::mutex::scoped_lock lm (_mutex);
- for (map<pair<int, bool>, double*>::const_iterator i = _luts.begin(); i != _luts.end(); ++i) {
- delete[] i->second;
+ for (auto const& i: _luts) {
+ delete[] i.second;
}
_luts.clear ();
}
+
double const *
TransferFunction::lut (int bit_depth, bool inverse) const
{
boost::mutex::scoped_lock lm (_mutex);
- map<pair<int, bool>, double*>::const_iterator i = _luts.find (make_pair (bit_depth, inverse));
+ auto i = _luts.find (make_pair (bit_depth, inverse));
if (i != _luts.end ()) {
return i->second;
}
/** @file src/transfer_function.h
- * @brief TransferFunction class.
+ * @brief TransferFunction class
*/
/*
- Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
files in the program, then also delete it here.
*/
+
+/** @file src/types.cc
+ * @brief Miscellaneous types
+ */
+
+
#include "raw_convert.h"
#include "types.h"
#include "exceptions.h"
#include <cstdio>
#include <iomanip>
+
using std::string;
using std::ostream;
using std::vector;
using namespace dcp;
using namespace boost;
+
bool dcp::operator== (dcp::Size const & a, dcp::Size const & b)
{
return (a.width == b.width && a.height == b.height);
}
+
bool dcp::operator!= (dcp::Size const & a, dcp::Size const & b)
{
return !(a == b);
vector<string> b;
split (b, s, is_any_of (" "));
if (b.size() != 2) {
- boost::throw_exception (XMLError ("malformed fraction " + s + " in XML node"));
+ boost::throw_exception (XMLError("malformed fraction " + s + " in XML node"));
}
numerator = raw_convert<int> (b[0]);
denominator = raw_convert<int> (b[1]);
}
+
string
Fraction::as_string () const
{
return String::compose ("%1 %2", numerator, denominator);
}
+
bool
dcp::operator== (Fraction const & a, Fraction const & b)
{
return (a.numerator == b.numerator && a.denominator == b.denominator);
}
+
bool
dcp::operator!= (Fraction const & a, Fraction const & b)
{
}
-/** Construct a Colour, initialising it to black. */
Colour::Colour ()
- : r (0)
- , g (0)
- , b (0)
{
}
-/** Construct a Colour from R, G and B. The values run between
- * 0 and 255.
- */
+
Colour::Colour (int r_, int g_, int b_)
: r (r_)
, g (g_)
}
-/** Construct a Colour from an ARGB hex string; the alpha value is ignored.
- * @param argb_hex A string of the form AARRGGBB, where e.g. RR is a two-character
- * hex value.
- */
+
Colour::Colour (string argb_hex)
{
int alpha;
}
}
-/** @return An ARGB string of the form AARRGGBB, where e.g. RR is a two-character
- * hex value. The alpha value will always be FF (ie 255; maximum alpha).
- */
+
string
Colour::to_argb_string () const
{
return buffer;
}
-/** @return An RGB string of the form RRGGBB, where e.g. RR is a two-character
- * hex value.
- */
+
string
Colour::to_rgb_string () const
{
return buffer;
}
-/** operator== for Colours.
- * @param a First colour to compare.
- * @param b Second colour to compare.
- */
+
bool
dcp::operator== (Colour const & a, Colour const & b)
{
return (a.r == b.r && a.g == b.g && a.b == b.b);
}
-/** operator!= for Colours.
- * @param a First colour to compare.
- * @param b Second colour to compare.
- */
+
bool
dcp::operator!= (Colour const & a, Colour const & b)
{
return "shadow";
}
- boost::throw_exception (MiscError ("unknown effect type"));
+ boost::throw_exception (MiscError("unknown effect type"));
}
+
Effect
dcp::string_to_effect (string s)
{
return Effect::SHADOW;
}
- boost::throw_exception (ReadError ("unknown subtitle effect type"));
+ boost::throw_exception (ReadError("unknown subtitle effect type"));
}
return "right";
}
- boost::throw_exception (MiscError ("unknown subtitle halign type"));
+ boost::throw_exception (MiscError("unknown subtitle halign type"));
}
+
HAlign
dcp::string_to_halign (string s)
{
return HAlign::RIGHT;
}
- boost::throw_exception (ReadError ("unknown subtitle halign type"));
+ boost::throw_exception (ReadError("unknown subtitle halign type"));
}
+
string
dcp::valign_to_string (VAlign v)
{
return "bottom";
}
- boost::throw_exception (MiscError ("unknown subtitle valign type"));
+ boost::throw_exception (MiscError("unknown subtitle valign type"));
}
+
VAlign
dcp::string_to_valign (string s)
{
return VAlign::BOTTOM;
}
- boost::throw_exception (ReadError ("unknown subtitle valign type"));
+ boost::throw_exception (ReadError("unknown subtitle valign type"));
}
+
string
dcp::direction_to_string (Direction v)
{
return "btt";
}
- boost::throw_exception (MiscError ("unknown subtitle direction type"));
+ boost::throw_exception (MiscError("unknown subtitle direction type"));
}
+
Direction
dcp::string_to_direction (string s)
{
return Direction::BTT;
}
- boost::throw_exception (ReadError ("unknown subtitle direction type"));
+ boost::throw_exception (ReadError("unknown subtitle direction type"));
}
+
/** Convert a content kind to a string which can be used in a
- * <ContentKind> node.
- * @param kind ContentKind.
- * @return string.
+ * <ContentKind> node
+ * @param kind ContentKind
+ * @return string
*/
string
dcp::content_kind_to_string (ContentKind kind)
DCP_ASSERT (false);
}
+
/** Convert a string from a <ContentKind> node to a libdcp ContentKind.
- * Reasonably tolerant about varying case.
- * @param kind Content kind string.
- * @return libdcp ContentKind.
+ * Reasonably tolerant about varying case
+ * @param kind Content kind string
+ * @return libdcp ContentKind
*/
dcp::ContentKind
dcp::content_kind_from_string (string kind)
DCP_ASSERT (false);
}
+
dcp::Marker
dcp::marker_from_string (string s)
{
DCP_ASSERT (false);
}
+
Rating::Rating (cxml::ConstNodePtr node)
+ : agency(node->string_child("Agency"))
+ , label(node->string_child("Label"))
{
- agency = node->string_child("Agency");
- label = node->string_child("Label");
node->done ();
}
+
void
Rating::as_xml (xmlpp::Element* parent) const
{
parent->add_child("Label")->add_child_text(label);
}
+
bool
dcp::operator== (Rating const & a, Rating const & b)
{
return a.agency == b.agency && a.label == b.label;
}
+
ContentVersion::ContentVersion ()
: id ("urn:uuid:" + make_uuid())
{
ContentVersion::ContentVersion (cxml::ConstNodePtr node)
+ : id(node->string_child("Id"))
+ , label_text(node->string_child("LabelText"))
{
- id = node->string_child("Id");
- label_text = node->string_child("LabelText");
+
}
void
ContentVersion::as_xml (xmlpp::Element* parent) const
{
- xmlpp::Node* cv = parent->add_child("ContentVersion");
+ auto cv = parent->add_child("ContentVersion");
cv->add_child("Id")->add_child_text(id);
cv->add_child("LabelText")->add_child_text(label_text);
}
Luminance::Luminance (cxml::ConstNodePtr node)
+ : _unit(string_to_unit(node->string_attribute("units")))
+ , _value(raw_convert<float>(node->content()))
{
- _unit = string_to_unit (node->string_attribute("units"));
- _value = raw_convert<float> (node->content());
+
}
void
Luminance::as_xml (xmlpp::Element* parent, string ns) const
{
- xmlpp::Element* lum = parent->add_child("Luminance", ns);
+ auto lum = parent->add_child("Luminance", ns);
lum->set_attribute("units", unit_to_string(_unit));
lum->add_child_text(raw_convert<string>(_value, 3));
}
DCP_ASSERT (false);
}
- return "";
+ return {};
}
default:
DCP_ASSERT (false);
}
-
}
/*
- Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
files in the program, then also delete it here.
*/
+
/** @file src/types.h
- * @brief Miscellaneous types.
+ * @brief Miscellaneous types
*/
+
#ifndef LIBDCP_TYPES_H
#define LIBDCP_TYPES_H
+
#include <libcxml/cxml.h>
#include <asdcp/KLV.h>
#include <memory>
class Element;
}
+
namespace dcp
{
+
/** @struct Size
* @brief The integer, two-dimensional size of something.
*/
int height;
};
+
extern bool operator== (Size const & a, Size const & b);
extern bool operator!= (Size const & a, Size const & b);
+
/** Identifier for a sound channel */
enum class Channel {
LEFT = 0, ///< left
CHANNEL_COUNT = 16
};
+
std::vector<dcp::Channel> used_audio_channels ();
PROMO
};
+
extern std::string content_kind_to_string (ContentKind kind);
extern ContentKind content_kind_from_string (std::string kind);
+
enum class Effect
{
NONE,
SHADOW
};
+
extern std::string effect_to_string (Effect e);
extern Effect string_to_effect (std::string s);
+
enum class HAlign
{
LEFT, ///< horizontal position is distance from left of screen to left of subtitle
RIGHT, ///< horizontal position is distance from right of screen to right of subtitle
};
+
extern std::string halign_to_string (HAlign a);
extern HAlign string_to_halign (std::string s);
+
enum class VAlign
{
TOP, ///< vertical position is distance from top of screen to top of subtitle
BOTTOM ///< vertical position is distance from bottom of screen to bottom of subtitle
};
+
extern std::string valign_to_string (VAlign a);
extern VAlign string_to_valign (std::string s);
+
/** Direction for subtitle test */
enum class Direction
{
BTT ///< bottom-to-top
};
+
extern std::string direction_to_string (Direction a);
extern Direction string_to_direction (std::string s);
+
enum class Eye
{
LEFT,
RIGHT
};
+
/** @class Fraction
* @brief A fraction (i.e. a thing with an integer numerator and an integer denominator).
*/
{
public:
/** Construct a fraction of 0/0 */
- Fraction () : numerator (0), denominator (0) {}
+ Fraction () {}
explicit Fraction (std::string s);
/** Construct a fraction with a specified numerator and denominator.
* @param n Numerator.
std::string as_string () const;
- int numerator;
- int denominator;
+ int numerator = 0;
+ int denominator = 0;
};
+
extern bool operator== (Fraction const & a, Fraction const & b);
extern bool operator!= (Fraction const & a, Fraction const & b);
+
/** @struct EqualityOptions
* @brief A class to describe what "equality" means for a particular test.
*
struct EqualityOptions
{
/** Construct an EqualityOptions where nothing at all can differ */
- EqualityOptions ()
- : max_mean_pixel_error (0)
- , max_std_dev_pixel_error (0)
- , max_audio_sample_error (0)
- , cpl_annotation_texts_can_differ (false)
- , reel_annotation_texts_can_differ (false)
- , reel_hashes_can_differ (false)
- , issue_dates_can_differ (false)
- , load_font_nodes_can_differ (false)
- , keep_going (false)
- , export_differing_subtitles (false)
- {}
+ EqualityOptions () {}
/** The maximum allowable mean difference in pixel value between two images */
- double max_mean_pixel_error;
+ double max_mean_pixel_error = 0;
/** The maximum standard deviation of the differences in pixel value between two images */
- double max_std_dev_pixel_error;
+ double max_std_dev_pixel_error = 0;
/** The maximum difference in audio sample value between two soundtracks */
- int max_audio_sample_error;
+ int max_audio_sample_error = 0;
/** true if the <AnnotationText> nodes of CPLs are allowed to differ */
- bool cpl_annotation_texts_can_differ;
+ bool cpl_annotation_texts_can_differ = false;
/** true if the <AnnotationText> nodes of Reels are allowed to differ */
- bool reel_annotation_texts_can_differ;
+ bool reel_annotation_texts_can_differ = false;
/** true if <Hash>es in Reels can differ */
- bool reel_hashes_can_differ;
+ bool reel_hashes_can_differ = false;
/** true if IssueDate nodes can differ */
- bool issue_dates_can_differ;
- bool load_font_nodes_can_differ;
- bool keep_going;
+ bool issue_dates_can_differ = false;
+ bool load_font_nodes_can_differ = false;
+ bool keep_going = false;
/** true to save the first pair of differeng image subtitles to the current working directory */
- bool export_differing_subtitles;
+ bool export_differing_subtitles = false;
};
MODIFIED_TRANSITIONAL_TEST
};
+
/** @class Colour
- * @brief An RGB colour.
+ * @brief An RGB colour
*/
class Colour
{
public:
+ /** Construct a Colour, initialising it to black */
Colour ();
+
+ /** Construct a Colour from R, G and B. The values run between
+ * 0 and 255.
+ */
Colour (int r_, int g_, int b_);
+
+ /** Construct a Colour from an ARGB hex string; the alpha value is ignored.
+ * @param argb_hex A string of the form AARRGGBB, where e.g. RR is a two-character
+ * hex value.
+ */
explicit Colour (std::string argb_hex);
- int r; ///< red component, from 0 to 255
- int g; ///< green component, from 0 to 255
- int b; ///< blue component, from 0 to 255
+ int r = 0; ///< red component, from 0 to 255
+ int g = 0; ///< green component, from 0 to 255
+ int b = 0; ///< blue component, from 0 to 255
+ /** @return An RGB string of the form RRGGBB, where e.g. RR is a two-character
+ * hex value.
+ */
std::string to_rgb_string () const;
+
+ /** @return An ARGB string of the form AARRGGBB, where e.g. RR is a two-character
+ * hex value. The alpha value will always be FF (ie 255; maximum alpha).
+ */
std::string to_argb_string () const;
};
+
extern bool operator== (Colour const & a, Colour const & b);
extern bool operator!= (Colour const & a, Colour const & b);
+
typedef boost::function<void (NoteType, std::string)> NoteHandler;
+
/** Maximum absolute difference between dcp::SubtitleString::aspect_adjust values that
- * are considered equal.
+ * are considered equal
*/
-const float ASPECT_ADJUST_EPSILON = 1e-3;
+constexpr float ASPECT_ADJUST_EPSILON = 1e-3;
+
/** Maximum absolute difference between dcp::SubtitleString alignment values that
* are considered equal.
*/
-const float ALIGN_EPSILON = 1e-3;
+constexpr float ALIGN_EPSILON = 1e-3;
+
enum class Marker {
FFOC, ///< first frame of composition
LFMC ///< last frame of moving credits
};
+
std::string marker_to_string (Marker);
Marker marker_from_string (std::string);
+
class Rating
{
public:
std::string label;
};
+
extern bool operator== (Rating const & a, Rating const & b);
Unit _unit;
};
+
bool operator== (Luminance const& a, Luminance const& b);
}
+
#endif
/*
- Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
}
+
#endif
files in the program, then also delete it here.
*/
+
+/** @file src/verify.cc
+ * @brief dcp::verify() method and associated code
+ */
+
+
#include "verify.h"
#include "dcp.h"
#include "cpl.h"
#include <vector>
#include <iostream>
+
using std::list;
using std::vector;
using std::string;
using boost::function;
using std::dynamic_pointer_cast;
+
using namespace dcp;
using namespace xercesc;
+
static
string
xml_ch_to_string (XMLCh const * a)
return o;
}
+
class XMLValidationError
{
public:
list<XMLValidationError> _errors;
};
+
class StringToXMLCh
{
public:
XMLCh* _buffer;
};
+
class LocalFileResolver : public EntityResolver
{
public:
return notes;
}
+
string
dcp::note_to_string (VerificationNote note)
{
return a.type() == b.type() && a.code() == b.code() && a.note() == b.note() && a.file() == b.file() && a.line() == b.line();
}
+
std::ostream&
dcp::operator<< (std::ostream& s, dcp::VerificationNote const& note)
{
files in the program, then also delete it here.
*/
+
+/** @file src/verify.h
+ * @brief dcp::verify() method and associated code
+ */
+
+
#ifndef LIBDCP_VERIFY_H
#define LIBDCP_VERIFY_H
+
#include <boost/filesystem.hpp>
#include <boost/function.hpp>
#include <boost/optional.hpp>
#include <string>
#include <vector>
+
/* Something in windows.h defines this */
#undef ERROR
+
namespace dcp {
+
class VerificationNote
{
public:
boost::optional<uint64_t> _line;
};
+
std::vector<VerificationNote> verify (
std::vector<boost::filesystem::path> directories,
boost::function<void (std::string, boost::optional<boost::filesystem::path>)> stage,
std::ostream& operator<<(std::ostream& s, dcp::VerificationNote const& note);
+
}
+
#endif