Various fixes to incorrect Atmos read/write wrt XML namespaces.
authorCarl Hetherington <cth@carlh.net>
Tue, 13 Sep 2016 09:33:27 +0000 (10:33 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 13 Sep 2016 09:33:27 +0000 (10:33 +0100)
src/reel.cc
src/reel_asset.cc
src/reel_asset.h
src/reel_atmos_asset.cc
src/reel_atmos_asset.h
test/dcp_test.cc
test/ref/DCP/dcp_test5/ASSETMAP.xml
test/ref/DCP/dcp_test5/cpl_330161f5-434e-424a-a701-3d3f26700c52.xml
test/ref/DCP/dcp_test5/pkl_a0488650-63ea-4b53-92a3-00a2c4e516fe.xml

index 50c780f47ed247814130914f3bca93912480e1b8..b94197d0c569de827201ecc4fc3a9c4bb3fb9ebd 100644 (file)
@@ -82,7 +82,7 @@ Reel::Reel (boost::shared_ptr<const cxml::Node> node)
                _main_subtitle.reset (new ReelSubtitleAsset (main_subtitle));
        }
 
-       shared_ptr<cxml::Node> atmos = asset_list->optional_node_child ("axd:AuxData");
+       shared_ptr<cxml::Node> atmos = asset_list->optional_node_child ("AuxData");
        if (atmos) {
                _atmos.reset (new ReelAtmosAsset (atmos));
        }
index 60c3242cdd2c5695aadd1614438457711104508b..bed05dfa1520ee1a92e7db1de41ade704754ad32 100644 (file)
@@ -95,11 +95,15 @@ ReelAsset::ReelAsset (shared_ptr<const cxml::Node> node)
 void
 ReelAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
 {
-        pair<string, string> const attr = cpl_node_attribute (standard);
         xmlpp::Element* a = node->add_child (cpl_node_name ());
+        pair<string, string> const attr = cpl_node_attribute (standard);
         if (!attr.first.empty ()) {
                 a->set_attribute (attr.first, attr.second);
         }
+        pair<string, string> const ns = cpl_node_namespace ();
+        if (!ns.first.empty ()) {
+                a->set_namespace_declaration (ns.first, ns.second);
+        }
         a->add_child("Id")->add_child_text ("urn:uuid:" + _id);
         a->add_child("AnnotationText")->add_child_text (_annotation_text);
         a->add_child("EditRate")->add_child_text (String::compose ("%1 %2", _edit_rate.numerator, _edit_rate.denominator));
@@ -117,6 +121,12 @@ ReelAsset::cpl_node_attribute (Standard) const
        return make_pair ("", "");
 }
 
+pair<string, string>
+ReelAsset::cpl_node_namespace () const
+{
+       return make_pair ("", "");
+}
+
 bool
 ReelAsset::equals (shared_ptr<const ReelAsset> other, EqualityOptions opt, NoteHandler note) const
 {
index c7c9f73eef349813fa0304cd62cfe774662120a3..1e826a33fadde659d5db7e31bc313cc743b05625 100644 (file)
@@ -122,11 +122,12 @@ protected:
         */
        virtual std::string cpl_node_name () const = 0;
 
-       /** @return Any attribute that should be used on the asset's node in the
-        *  CPL.
-        */
+       /** @return Any attribute that should be used on the asset's node in the CPL */
        virtual std::pair<std::string, std::string> cpl_node_attribute (Standard) const;
 
+       /** @return Any namespace that should be used on the asset's node in the CPL */
+       virtual std::pair<std::string, std::string> cpl_node_namespace () const;
+
        /** Reference to the asset (MXF or XML file) that this reel entry
         *  applies to.
         */
index f1f7d7f672e39631ad18aec98b42cc7989f2f154..8726b39c68dc0cb532112a0a62582e930d23d5c4 100644 (file)
@@ -41,6 +41,8 @@
 #include <libxml++/libxml++.h>
 
 using std::string;
+using std::pair;
+using std::make_pair;
 using boost::shared_ptr;
 using namespace dcp;
 
@@ -53,6 +55,7 @@ ReelAtmosAsset::ReelAtmosAsset (boost::shared_ptr<AtmosAsset> asset, int64_t ent
 ReelAtmosAsset::ReelAtmosAsset (boost::shared_ptr<const cxml::Node> node)
        : ReelAsset (node)
 {
+       node->ignore_child ("DataType");
        node->done ();
 }
 
@@ -62,6 +65,12 @@ ReelAtmosAsset::cpl_node_name () const
        return "axd:AuxData";
 }
 
+pair<string, string>
+ReelAtmosAsset::cpl_node_namespace () const
+{
+       return make_pair ("http://www.dolby.com/schemas/2012/AD", "axd");
+}
+
 string
 ReelAtmosAsset::key_type () const
 {
index 75e50e8d1c206cfb1666164a632eac8c5d5690b8..e7ea51aad4c6021149c4d87c30c454e8adb702af 100644 (file)
@@ -64,6 +64,7 @@ public:
 private:
        std::string key_type () const;
        std::string cpl_node_name () const;
+       std::pair<std::string, std::string> cpl_node_namespace () const;
 };
 
 }
index ce10ee28b137b32622e2ec661042bbb526499ff1..0d7cea2d7f55a4c5d871dcee1e0531b4734fe56a 100644 (file)
@@ -278,3 +278,17 @@ BOOST_AUTO_TEST_CASE (dcp_test5)
 
        /* build/test/DCP/dcp_test5 is checked against test/ref/DCP/dcp_test5 by run/tests */
 }
+
+/** Basic tests of reading a 2D DCP with an Atmos track */
+BOOST_AUTO_TEST_CASE (dcp_test6)
+{
+       dcp::DCP dcp ("test/ref/DCP/dcp_test5");
+       dcp.read ();
+
+       BOOST_REQUIRE_EQUAL (dcp.cpls().size(), 1);
+       BOOST_REQUIRE_EQUAL (dcp.cpls().front()->reels().size(), 1);
+       BOOST_CHECK (dcp.cpls().front()->reels().front()->main_picture());
+       BOOST_CHECK (dcp.cpls().front()->reels().front()->main_sound());
+       BOOST_CHECK (!dcp.cpls().front()->reels().front()->main_subtitle());
+       BOOST_CHECK (dcp.cpls().front()->reels().front()->atmos());
+}
index ebe88a8ef974b9627114444f453a7f9710b163c9..9bda0c4d9a658dfa044faa84dba0476789e51ed0 100644 (file)
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<AssetMap xmlns="http://www.smpte-ra.org/schemas/429-9/2007/AM"><Id>urn:uuid:7c247206-50b3-487d-96ed-29b19512a4bb</Id><AnnotationText>Created by OpenDCP 0.0.25</AnnotationText><Creator>OpenDCP 0.0.25</Creator><VolumeCount>1</VolumeCount><IssueDate>2012-07-17T04:45:18+00:00</IssueDate><Issuer>OpenDCP 0.0.25</Issuer><AssetList><Asset><Id>urn:uuid:a0488650-63ea-4b53-92a3-00a2c4e516fe</Id><PackingList>true</PackingList><ChunkList><Chunk><Path>pkl_a0488650-63ea-4b53-92a3-00a2c4e516fe.xml</Path><VolumeIndex>1</VolumeIndex><Offset>0</Offset><Length>1022</Length></Chunk></ChunkList></Asset><Asset><Id>urn:uuid:330161f5-434e-424a-a701-3d3f26700c52</Id><ChunkList><Chunk><Path>cpl_330161f5-434e-424a-a701-3d3f26700c52.xml</Path><VolumeIndex>1</VolumeIndex><Offset>0</Offset><Length>1768</Length></Chunk></ChunkList></Asset><Asset><Id>urn:uuid:402c5a88-2512-4465-9c0b-cfa687dbc5d0</Id><ChunkList><Chunk><Path>video.mxf</Path><VolumeIndex>1</VolumeIndex><Offset>0</Offset><Length>26080</Length></Chunk></ChunkList></Asset><Asset><Id>urn:uuid:78f4f085-0901-4a0f-96f9-e21987072a51</Id><ChunkList><Chunk><Path>audio.mxf</Path><VolumeIndex>1</VolumeIndex><Offset>0</Offset><Length>161326</Length></Chunk></ChunkList></Asset></AssetList></AssetMap>
+<AssetMap xmlns="http://www.smpte-ra.org/schemas/429-9/2007/AM"><Id>urn:uuid:7c247206-50b3-487d-96ed-29b19512a4bb</Id><AnnotationText>Created by OpenDCP 0.0.25</AnnotationText><Creator>OpenDCP 0.0.25</Creator><VolumeCount>1</VolumeCount><IssueDate>2012-07-17T04:45:18+00:00</IssueDate><Issuer>OpenDCP 0.0.25</Issuer><AssetList><Asset><Id>urn:uuid:a0488650-63ea-4b53-92a3-00a2c4e516fe</Id><PackingList>true</PackingList><ChunkList><Chunk><Path>pkl_a0488650-63ea-4b53-92a3-00a2c4e516fe.xml</Path><VolumeIndex>1</VolumeIndex><Offset>0</Offset><Length>1022</Length></Chunk></ChunkList></Asset><Asset><Id>urn:uuid:330161f5-434e-424a-a701-3d3f26700c52</Id><ChunkList><Chunk><Path>cpl_330161f5-434e-424a-a701-3d3f26700c52.xml</Path><VolumeIndex>1</VolumeIndex><Offset>0</Offset><Length>1817</Length></Chunk></ChunkList></Asset><Asset><Id>urn:uuid:402c5a88-2512-4465-9c0b-cfa687dbc5d0</Id><ChunkList><Chunk><Path>video.mxf</Path><VolumeIndex>1</VolumeIndex><Offset>0</Offset><Length>26080</Length></Chunk></ChunkList></Asset><Asset><Id>urn:uuid:78f4f085-0901-4a0f-96f9-e21987072a51</Id><ChunkList><Chunk><Path>audio.mxf</Path><VolumeIndex>1</VolumeIndex><Offset>0</Offset><Length>161326</Length></Chunk></ChunkList></Asset></AssetList></AssetMap>
index 7a5849572e58a62c799962611ef50e0b6dce63be..45587f5a8f34e6db4bdfbcbcea0200f38d7e7b2b 100644 (file)
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<CompositionPlaylist xmlns="http://www.smpte-ra.org/schemas/429-7/2006/CPL"><Id>urn:uuid:330161f5-434e-424a-a701-3d3f26700c52</Id><AnnotationText>A Test DCP</AnnotationText><IssueDate>2012-07-17T04:45:18+00:00</IssueDate><Issuer>OpenDCP 0.0.25</Issuer><Creator>OpenDCP 0.0.25</Creator><ContentTitleText>A Test DCP</ContentTitleText><ContentKind>feature</ContentKind><ContentVersion><Id>urn:uri:81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00</Id><LabelText>81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00</LabelText></ContentVersion><RatingList/><ReelList><Reel><Id>urn:uuid:4be406ed-9b7d-4746-bf35-e73598ef1e64</Id><AssetList><MainPicture><Id>urn:uuid:402c5a88-2512-4465-9c0b-cfa687dbc5d0</Id><AnnotationText>video.mxf</AnnotationText><EditRate>24 1</EditRate><IntrinsicDuration>24</IntrinsicDuration><EntryPoint>0</EntryPoint><Duration>24</Duration><Hash>eiqr9sUevuwoy7pprmgU6r0zBD8=</Hash><FrameRate>24 1</FrameRate><ScreenAspectRatio>32 32</ScreenAspectRatio></MainPicture><MainSound><Id>urn:uuid:78f4f085-0901-4a0f-96f9-e21987072a51</Id><AnnotationText>audio.mxf</AnnotationText><EditRate>24 1</EditRate><IntrinsicDuration>24</IntrinsicDuration><EntryPoint>0</EntryPoint><Duration>24</Duration><Hash>iTTXhr9BviLgys5ldPFRzPXP2GM=</Hash></MainSound><axd:AuxData><Id>urn:uuid:73f2a92b-f963-47cc-a3d7-c7ca2fd10a64</Id><AnnotationText>20160218_NameOfFilm_FTR_OV_EN_A_dcs_r01.mxf</AnnotationText><EditRate>24 1</EditRate><IntrinsicDuration>1489</IntrinsicDuration><EntryPoint>0</EntryPoint><Duration>1489</Duration><Hash>jo8pQSebhScPN4EVvvpIUWRrDeM=</Hash><axd:DataType>urn:smpte:ul:060e2b34.04010105.0e090604.00000000</axd:DataType></axd:AuxData></AssetList></Reel></ReelList></CompositionPlaylist>
+<CompositionPlaylist xmlns="http://www.smpte-ra.org/schemas/429-7/2006/CPL"><Id>urn:uuid:330161f5-434e-424a-a701-3d3f26700c52</Id><AnnotationText>A Test DCP</AnnotationText><IssueDate>2012-07-17T04:45:18+00:00</IssueDate><Issuer>OpenDCP 0.0.25</Issuer><Creator>OpenDCP 0.0.25</Creator><ContentTitleText>A Test DCP</ContentTitleText><ContentKind>feature</ContentKind><ContentVersion><Id>urn:uri:81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00</Id><LabelText>81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00</LabelText></ContentVersion><RatingList/><ReelList><Reel><Id>urn:uuid:4be406ed-9b7d-4746-bf35-e73598ef1e64</Id><AssetList><MainPicture><Id>urn:uuid:402c5a88-2512-4465-9c0b-cfa687dbc5d0</Id><AnnotationText>video.mxf</AnnotationText><EditRate>24 1</EditRate><IntrinsicDuration>24</IntrinsicDuration><EntryPoint>0</EntryPoint><Duration>24</Duration><Hash>eiqr9sUevuwoy7pprmgU6r0zBD8=</Hash><FrameRate>24 1</FrameRate><ScreenAspectRatio>32 32</ScreenAspectRatio></MainPicture><MainSound><Id>urn:uuid:78f4f085-0901-4a0f-96f9-e21987072a51</Id><AnnotationText>audio.mxf</AnnotationText><EditRate>24 1</EditRate><IntrinsicDuration>24</IntrinsicDuration><EntryPoint>0</EntryPoint><Duration>24</Duration><Hash>iTTXhr9BviLgys5ldPFRzPXP2GM=</Hash></MainSound><axd:AuxData xmlns:axd="http://www.dolby.com/schemas/2012/AD"><Id>urn:uuid:73f2a92b-f963-47cc-a3d7-c7ca2fd10a64</Id><AnnotationText>20160218_NameOfFilm_FTR_OV_EN_A_dcs_r01.mxf</AnnotationText><EditRate>24 1</EditRate><IntrinsicDuration>1489</IntrinsicDuration><EntryPoint>0</EntryPoint><Duration>1489</Duration><Hash>jo8pQSebhScPN4EVvvpIUWRrDeM=</Hash><axd:DataType>urn:smpte:ul:060e2b34.04010105.0e090604.00000000</axd:DataType></axd:AuxData></AssetList></Reel></ReelList></CompositionPlaylist>
index 537dd15bfd21fe718b1d9bc8e4697d15a6ea3b9e..b9411549455b893b8d4a06daccda9b484db4f970 100644 (file)
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<PackingList xmlns="http://www.smpte-ra.org/schemas/429-8/2007/PKL"><Id>urn:uuid:a0488650-63ea-4b53-92a3-00a2c4e516fe</Id><AnnotationText>A Test DCP</AnnotationText><IssueDate>2012-07-17T04:45:18+00:00</IssueDate><Issuer>OpenDCP 0.0.25</Issuer><Creator>OpenDCP 0.0.25</Creator><AssetList><Asset><Id>urn:uuid:330161f5-434e-424a-a701-3d3f26700c52</Id><AnnotationText>330161f5-434e-424a-a701-3d3f26700c52</AnnotationText><Hash>xLrvmvHjV78RTv9EMZlcR6LMusY=</Hash><Size>1768</Size><Type>text/xml</Type></Asset><Asset><Id>urn:uuid:402c5a88-2512-4465-9c0b-cfa687dbc5d0</Id><AnnotationText>402c5a88-2512-4465-9c0b-cfa687dbc5d0</AnnotationText><Hash>eiqr9sUevuwoy7pprmgU6r0zBD8=</Hash><Size>26080</Size><Type>application/mxf</Type></Asset><Asset><Id>urn:uuid:78f4f085-0901-4a0f-96f9-e21987072a51</Id><AnnotationText>78f4f085-0901-4a0f-96f9-e21987072a51</AnnotationText><Hash>iTTXhr9BviLgys5ldPFRzPXP2GM=</Hash><Size>161326</Size><Type>application/mxf</Type></Asset></AssetList></PackingList>
+<PackingList xmlns="http://www.smpte-ra.org/schemas/429-8/2007/PKL"><Id>urn:uuid:a0488650-63ea-4b53-92a3-00a2c4e516fe</Id><AnnotationText>A Test DCP</AnnotationText><IssueDate>2012-07-17T04:45:18+00:00</IssueDate><Issuer>OpenDCP 0.0.25</Issuer><Creator>OpenDCP 0.0.25</Creator><AssetList><Asset><Id>urn:uuid:330161f5-434e-424a-a701-3d3f26700c52</Id><AnnotationText>330161f5-434e-424a-a701-3d3f26700c52</AnnotationText><Hash>1k7O7TxEnXk811VbcQz/cVYF0lI=</Hash><Size>1817</Size><Type>text/xml</Type></Asset><Asset><Id>urn:uuid:402c5a88-2512-4465-9c0b-cfa687dbc5d0</Id><AnnotationText>402c5a88-2512-4465-9c0b-cfa687dbc5d0</AnnotationText><Hash>eiqr9sUevuwoy7pprmgU6r0zBD8=</Hash><Size>26080</Size><Type>application/mxf</Type></Asset><Asset><Id>urn:uuid:78f4f085-0901-4a0f-96f9-e21987072a51</Id><AnnotationText>78f4f085-0901-4a0f-96f9-e21987072a51</AnnotationText><Hash>iTTXhr9BviLgys5ldPFRzPXP2GM=</Hash><Size>161326</Size><Type>application/mxf</Type></Asset></AssetList></PackingList>