Asset::equals (boost::shared_ptr<const Asset> other, EqualityOptions, function<void (NoteType, string)> note) const
{
if (_hash != other->_hash) {
- note (ERROR, "Asset hashes differ");
+ note (DCP_ERROR, "Asset hashes differ");
return false;
}
#include <boost/function.hpp>
#include <iostream>
-/* We need this here for the #undef ERROR for Windows */
-#include "types.h"
-
using namespace std;
using namespace boost;
using namespace dcp;
}
if (_edit_rate != other->_edit_rate) {
- note (ERROR, "content edit rates differ");
+ note (DCP_ERROR, "content edit rates differ");
return false;
}
if (_intrinsic_duration != other->_intrinsic_duration) {
- note (ERROR, "asset intrinsic durations differ");
+ note (DCP_ERROR, "asset intrinsic durations differ");
return false;
}
if (_annotation_text != other._annotation_text && !opt.cpl_annotation_texts_can_differ) {
stringstream s;
s << "annotation texts differ: " << _annotation_text << " vs " << other._annotation_text << "\n";
- note (ERROR, s.str ());
+ note (DCP_ERROR, s.str ());
return false;
}
if (_content_kind != other._content_kind) {
- note (ERROR, "content kinds differ");
+ note (DCP_ERROR, "content kinds differ");
return false;
}
if (_reels.size() != other._reels.size()) {
- note (ERROR, String::compose ("reel counts differ (%1 vs %2)", _reels.size(), other._reels.size()));
+ note (DCP_ERROR, String::compose ("reel counts differ (%1 vs %2)", _reels.size(), other._reels.size()));
return false;
}
DCP::equals (DCP const & other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
{
if (_assets.size() != other._assets.size()) {
- note (ERROR, String::compose ("Asset counts differ: %1 vs %2", _assets.size(), other._assets.size()));
+ note (DCP_ERROR, String::compose ("Asset counts differ: %1 vs %2", _assets.size(), other._assets.size()));
return false;
}
return false;
}
- note (PROGRESS, String::compose ("Comparing video frame %1 of %2", i, _intrinsic_duration));
+ note (DCP_PROGRESS, String::compose ("Comparing video frame %1 of %2", i, _intrinsic_duration));
shared_ptr<const MonoPictureFrame> frame_A = get_frame (i);
shared_ptr<const MonoPictureFrame> frame_B = other_picture->get_frame (i);
shared_ptr<const MXF> other_mxf = dynamic_pointer_cast<const MXF> (other);
if (!other_mxf) {
- note (ERROR, "comparing an MXF asset with a non-MXF asset");
+ note (DCP_ERROR, "comparing an MXF asset with a non-MXF asset");
return false;
}
if (_file != other_mxf->file ()) {
- note (ERROR, "MXF names differ");
+ note (DCP_ERROR, "MXF names differ");
if (!opt.mxf_names_can_differ) {
return false;
}
// a.QuantizationDefault != b.QuantizationDefault
) {
- note (ERROR, "video MXF picture descriptors differ");
+ note (DCP_ERROR, "video MXF picture descriptors differ");
return false;
}
if (a.ContainerDuration != b.ContainerDuration) {
- note (ERROR, "video container durations differ");
+ note (DCP_ERROR, "video container durations differ");
}
// for (unsigned int j = 0; j < ASDCP::JP2K::MaxComponents; ++j) {
) const
{
if (size_A == size_B && memcmp (data_A, data_B, size_A) == 0) {
- note (NOTE, "J2K identical");
+ note (DCP_NOTE, "J2K identical");
/* Easy result; the J2K data is identical */
return true;
}
for (int c = 0; c < 3; ++c) {
if (image_A->size() != image_B->size()) {
- note (ERROR, String::compose ("image sizes for frame %1 differ", frame));
+ note (DCP_ERROR, String::compose ("image sizes for frame %1 differ", frame));
return false;
}
double const std_dev = sqrt (double (total_squared_deviation) / abs_diffs.size());
- note (NOTE, String::compose ("mean difference %1, deviation %2", mean, std_dev));
+ note (DCP_NOTE, String::compose ("mean difference %1, deviation %2", mean, std_dev));
if (mean > opt.max_mean_pixel_error) {
note (
- ERROR,
+ DCP_ERROR,
String::compose ("mean %1 out of range %2 in frame %3", mean, opt.max_mean_pixel_error, frame)
);
if (std_dev > opt.max_std_dev_pixel_error) {
note (
- ERROR,
+ DCP_ERROR,
String::compose ("standard deviation %1 out of range %2 in frame %3", std_dev, opt.max_std_dev_pixel_error, frame)
);
Reel::equals (boost::shared_ptr<const Reel> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
{
if ((_main_picture && !other->_main_picture) || (!_main_picture && other->_main_picture)) {
- note (ERROR, "reel has different assets");
+ note (DCP_ERROR, "reel has different assets");
return false;
}
}
if ((_main_sound && !other->_main_sound) || (!_main_sound && other->_main_sound)) {
- note (ERROR, "reel has different assets");
+ note (DCP_ERROR, "reel has different assets");
return false;
}
}
if ((_main_subtitle && !other->_main_subtitle) || (!_main_subtitle && other->_main_subtitle)) {
- note (ERROR, "reel has different assets");
+ note (DCP_ERROR, "reel has different assets");
return false;
}
// desc_A.ChannelFormat != desc_B.ChannelFormat ||
) {
- note (ERROR, "audio MXF picture descriptors differ");
+ note (DCP_ERROR, "audio MXF picture descriptors differ");
return false;
}
}
if (buffer_A.Size() != buffer_B.Size()) {
- note (ERROR, String::compose ("sizes of audio data for frame %1 differ", i));
+ note (DCP_ERROR, String::compose ("sizes of audio data for frame %1 differ", i));
return false;
}
for (uint32_t i = 0; i < buffer_A.Size(); ++i) {
int const d = abs (buffer_A.RoData()[i] - buffer_B.RoData()[i]);
if (d > opt.max_audio_sample_error) {
- note (ERROR, String::compose ("PCM data difference of %1", d));
+ note (DCP_ERROR, String::compose ("PCM data difference of %1", d));
return false;
}
}
boost::function<void (NoteType, std::string)> note
) const {
/* XXX */
- note (ERROR, "subtitle content not compared yet");
+ note (DCP_ERROR, "subtitle content not compared yet");
return true;
}
bool mxf_names_can_differ;
};
-/* Win32 defines this */
-#undef ERROR
-
+/* I've been unable to make mingw happy with ERROR as a symbol, so
+ I'm using a DCP_ prefix here.
+*/
enum NoteType {
- PROGRESS,
- ERROR,
- NOTE
+ DCP_PROGRESS,
+ DCP_ERROR,
+ DCP_NOTE
};
enum Standard {
void
note (NoteType t, string n)
{
- if (t == ERROR || verbose) {
+ if (t == DCP_ERROR || verbose) {
cout << " " << n << "\n";
}
}