Various.
[libdcp.git] / src / cpl.cc
index 1eba666c4f92669e981ba305fc554c154c978516..99d5b411d901fb3477e093af22db2e3c98f75a46 100644 (file)
@@ -1,16 +1,81 @@
 #include "cpl.h"
 
+using namespace std;
+using namespace libdcp;
+
 CPL::CPL (string file)
+       : XMLFile (file, "CompositionPlaylist")
+{
+       id = string_node ("Id");
+       annotation_text = string_node ("AnnotationText");
+       issue_date = string_node ("IssueDate");
+       creator = string_node ("Creator");
+       content_title_text = string_node ("ContentTitleText");
+       content_kind = kind_node ("ContentKind");
+       content_version = sub_node<ContentVersion> ("ContentVersion");
+       ignore_node ("RatingList");
+       reel_list = sub_node<ReelList> ("ReelList");
+
+       done ();
+}
+
+ContentVersion::ContentVersion (xmlpp::Node const * node)
+       : XMLNode (node)
+{
+       id = string_node ("Id");
+       label_text = string_node ("LabelText");
+       done ();
+}
+
+ReelList::ReelList (xmlpp::Node const * node)
+       : XMLNode (node)
+{
+       reels = sub_nodes<Reel> ("Reel");
+       done ();
+}
+
+Reel::Reel (xmlpp::Node const * node)
+       : XMLNode (node)
+{
+       id = string_node ("Id");
+       asset_list = sub_node<CPLAssetList> ("AssetList");
+
+       done ();
+}
+
+CPLAssetList::CPLAssetList (xmlpp::Node const * node)
+       : XMLNode (node)
+{
+       main_picture = sub_node<MainPicture> ("MainPicture");
+       main_sound = optional_sub_node<MainSound> ("MainSound");
+
+       done ();
+}
+
+MainPicture::MainPicture (xmlpp::Node const * node)
+       : XMLNode (node)
+{
+       id = string_node ("Id");
+       annotation_text = string_node ("AnnotationText");
+       edit_rate = fraction_node ("EditRate");
+       intrinsic_duration = int_node ("IntrinsicDuration");
+       entry_point = int_node ("EntryPoint");
+       duration = int_node ("Duration");
+       frame_rate = fraction_node ("FrameRate");
+       screen_aspect_ratio = fraction_node ("ScreenAspectRatio");
+
+       done ();
+}
+
+MainSound::MainSound (xmlpp::Node const * node)
+       : XMLNode (node)
 {
-       file_is (file);
-
-       _id = string_tag ("Id");
-       _annotation_text = string_tag ("AnnotationText");
-       _issue_date = string_tag ("IssueDate");
-       _creator = string_tag ("Creator");
-       _content_title_text = string_tag ("ContentTitleText");
-       _content_kind = kind_tag ("ContentKind");
-       _content_version = sub (new ContentVersion, "ContentVersion");
-       ignore ("RatingList");
-       _reel_list = sub (new ReelList, "ReelList");
+       id = string_node ("Id");
+       annotation_text = string_node ("AnnotationText");
+       edit_rate = fraction_node ("EditRate");
+       intrinsic_duration = int_node ("IntrinsicDuration");
+       entry_point = int_node ("EntryPoint");
+       duration = int_node ("Duration");
+
+       done ();
 }