X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Freel_picture_asset.cc;h=5cf2b858716a928129a248d2833899bb05235966;hb=ea81a192a65a03b664dac61de21e06cea7aa97a2;hp=d1910bb3d2028e8304fdd7d513b8472c1fa4e6e2;hpb=bfb33feb40c5b014e9eae3958b1ecb8161f1d090;p=libdcp.git diff --git a/src/reel_picture_asset.cc b/src/reel_picture_asset.cc index d1910bb3..5cf2b858 100644 --- a/src/reel_picture_asset.cc +++ b/src/reel_picture_asset.cc @@ -24,13 +24,16 @@ #include "content.h" #include "reel_picture_asset.h" #include "picture_mxf.h" +#include "dcp_assert.h" #include "compose.hpp" #include +#include using std::bad_cast; using std::string; using std::stringstream; using boost::shared_ptr; +using boost::dynamic_pointer_cast; using namespace dcp; ReelPictureAsset::ReelPictureAsset () @@ -40,16 +43,16 @@ ReelPictureAsset::ReelPictureAsset () } -ReelPictureAsset::ReelPictureAsset (boost::shared_ptr content, int64_t entry_point) - : ReelAsset (content, entry_point) +ReelPictureAsset::ReelPictureAsset (shared_ptr content, int64_t entry_point) + : ReelMXFAsset (content, content->edit_rate(), content->intrinsic_duration(), entry_point) , _frame_rate (content->frame_rate ()) , _screen_aspect_ratio (content->screen_aspect_ratio ()) { } -ReelPictureAsset::ReelPictureAsset (boost::shared_ptr node) - : ReelAsset (node) +ReelPictureAsset::ReelPictureAsset (shared_ptr node) + : ReelMXFAsset (node) { _frame_rate = Fraction (node->string_child ("FrameRate")); try { @@ -68,7 +71,7 @@ ReelPictureAsset::ReelPictureAsset (boost::shared_ptr node) void ReelPictureAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const { - ReelAsset::write_to_cpl (node, standard); + ReelMXFAsset::write_to_cpl (node, standard); xmlpp::Node::NodeList c = node->get_children (); xmlpp::Node::NodeList::iterator i = c.begin(); @@ -76,7 +79,7 @@ ReelPictureAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const ++i; } - assert (i != c.end ()); + DCP_ASSERT (i != c.end ()); (*i)->add_child ("FrameRate")->add_child_text (String::compose ("%1 %2", _frame_rate.numerator, _frame_rate.denominator)); if (standard == INTEROP) { @@ -89,3 +92,34 @@ ReelPictureAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const ); } } + +string +ReelPictureAsset::key_type () const +{ + return "MDIK"; +} + +bool +ReelPictureAsset::equals (shared_ptr other, EqualityOptions opt, boost::function note) const +{ + if (!ReelAsset::equals (other, opt, note)) { + return false; + } + + shared_ptr rpa = dynamic_pointer_cast (other); + if (!rpa) { + return false; + } + + if (_frame_rate != rpa->_frame_rate) { + note (DCP_ERROR, "frame rates differ in reel"); + return false; + } + + if (_screen_aspect_ratio != rpa->_screen_aspect_ratio) { + note (DCP_ERROR, "screen aspect ratios differ in reel"); + return false; + } + + return true; +}