GPL boilerplate and a few comments.
[libdcp.git] / src / cpl.h
1 /*
2     Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 /** @file  src/cpl.h
21  *  @brief Classes used to parse a CPL.
22  */
23
24 #include <stdint.h>
25 #include <boost/shared_ptr.hpp>
26 #include "xml.h"
27
28 namespace libdcp {
29
30 /** CPL MainPicture node */     
31 class MainPicture : public XMLNode
32 {
33 public:
34         MainPicture () {}
35         MainPicture (xmlpp::Node const * node);
36
37         std::string id;
38         std::string annotation_text;
39         Fraction edit_rate;
40         int64_t intrinsic_duration;
41         int64_t entry_point;
42         int64_t duration;
43         Fraction frame_rate;
44         Fraction screen_aspect_ratio;
45 };
46
47 /** CPL MainSound node */       
48 class MainSound : public XMLNode
49 {
50 public:
51         MainSound () {}
52         MainSound (xmlpp::Node const * node);
53
54         std::string id;
55         std::string annotation_text;
56         Fraction edit_rate;
57         int64_t intrinsic_duration;
58         int64_t entry_point;
59         int64_t duration;
60 };
61
62 /** CPL MainSubtitle node */    
63 class MainSubtitle : public XMLNode
64 {
65 public:
66         MainSubtitle () {}
67         MainSubtitle (xmlpp::Node const * node);
68
69         std::string id;
70         std::string annotation_text;
71         Fraction edit_rate;
72         int64_t intrinsic_duration;
73         int64_t entry_point;
74         int64_t duration;
75 };
76
77 /** CPL AssetList node */       
78 class CPLAssetList : public XMLNode
79 {
80 public:
81         CPLAssetList () {}
82         CPLAssetList (xmlpp::Node const * node);
83
84         boost::shared_ptr<MainPicture> main_picture;
85         boost::shared_ptr<MainSound> main_sound;
86         boost::shared_ptr<MainSubtitle> main_subtitle;
87 };
88
89 /** CPL Reel node */    
90 class Reel : public XMLNode
91 {
92 public:
93         Reel () {}
94         Reel (xmlpp::Node const * node);
95
96         std::string id;
97         boost::shared_ptr<CPLAssetList> asset_list;
98 };
99
100 /** CPL ContentVersion node */  
101 class ContentVersion : public XMLNode
102 {
103 public:
104         ContentVersion () {}
105         ContentVersion (xmlpp::Node const * node);
106
107         std::string id;
108         std::string label_text;
109 };
110
111 /** Class to parse a CPL */
112 class CPL : public XMLFile
113 {
114 public:
115         /** Parse a CPL XML file into our member variables */
116         CPL (std::string file);
117
118         std::string id;
119         std::string annotation_text;
120         std::string issue_date;
121         std::string creator;
122         std::string content_title_text;
123         ContentKind content_kind;
124         boost::shared_ptr<ContentVersion> content_version;
125         std::list<boost::shared_ptr<Reel> > reels;
126 };
127
128 }
129