Fix colour range in XYZ -> RGBA.
[libdcp.git] / src / reel_picture_asset.cc
index a989f72b1e92b80b7b35e20c811b910f91f5e028..096d3476d08608acfcbf4b4982d8ea41263426bc 100644 (file)
@@ -44,27 +44,29 @@ ReelPictureAsset::ReelPictureAsset ()
 }
 
 ReelPictureAsset::ReelPictureAsset (shared_ptr<PictureAsset> asset, int64_t entry_point)
-       : ReelEncryptableAsset (asset, asset->key_id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point)
+       : ReelAsset (asset, asset->edit_rate(), asset->intrinsic_duration(), entry_point)
+       , ReelMXF (asset->key_id())
        , _frame_rate (asset->frame_rate ())
        , _screen_aspect_ratio (asset->screen_aspect_ratio ())
 {
-       
+
 }
 
 ReelPictureAsset::ReelPictureAsset (shared_ptr<const cxml::Node> node)
-       : ReelEncryptableAsset (node)
+       : ReelAsset (node)
+       , ReelMXF (node)
 {
        _frame_rate = Fraction (node->string_child ("FrameRate"));
        try {
                _screen_aspect_ratio = Fraction (node->string_child ("ScreenAspectRatio"));
        } catch (XMLError& e) {
-               /* Maybe it's not a fraction */
-       }
-       try {
-               float f = node->number_child<float> ("ScreenAspectRatio");
-               _screen_aspect_ratio = Fraction (f * 1000, 1000);
-       } catch (bad_cast& e) {
+               /* It's not a fraction */
+               try {
+                       float f = node->number_child<float> ("ScreenAspectRatio");
+                       _screen_aspect_ratio = Fraction (f * 1000, 1000);
+               } catch (bad_cast& e) {
 
+               }
        }
 }
 
@@ -75,7 +77,7 @@ ReelPictureAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
 
        /* Find <MainPicture> */
        xmlpp::Node* mp = find_child (node, cpl_node_name ());
-       
+
        mp->add_child ("FrameRate")->add_child_text (String::compose ("%1 %2", _frame_rate.numerator, _frame_rate.denominator));
        if (standard == INTEROP) {
                stringstream s;
@@ -87,10 +89,10 @@ ReelPictureAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
                        );
        }
 
-        if (!key_id ().empty ()) {
+        if (key_id ()) {
                /* Find <Hash> */
                xmlpp::Node* hash = find_child (mp, "Hash");
-               mp->add_child_before (hash, "KeyId")->add_child_text ("urn:uuid:" + key_id ());
+               mp->add_child_before (hash, "KeyId")->add_child_text ("urn:uuid:" + key_id().get ());
         }
 }
 
@@ -106,7 +108,7 @@ ReelPictureAsset::equals (shared_ptr<const ReelAsset> other, EqualityOptions opt
        if (!ReelAsset::equals (other, opt, note)) {
                return false;
        }
-       
+
        shared_ptr<const ReelPictureAsset> rpa = dynamic_pointer_cast<const ReelPictureAsset> (other);
        if (!rpa) {
                return false;