X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Freel_picture_asset.cc;h=6bac3bce5f47d21fe3563f8cd72a2d460f28a608;hb=4b0ece8d964961598ce4734ce25bb0aed66dbf7a;hp=673eb133fda7bd0c77944507be70cc54830a69a2;hpb=00e9647a9ede540f2d567c19025278c25a87c830;p=libdcp.git diff --git a/src/reel_picture_asset.cc b/src/reel_picture_asset.cc index 673eb133..6bac3bce 100644 --- a/src/reel_picture_asset.cc +++ b/src/reel_picture_asset.cc @@ -17,16 +17,23 @@ */ +/** @file src/reel_picture_asset.h + * @brief ReelPictureAsset class. + */ + #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 () @@ -36,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 { @@ -64,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(); @@ -72,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) { @@ -85,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, NoteHandler 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; +}