Comment tweaks.
[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 class Picture : public XMLNode
31 {
32 public:
33         Picture () {}
34         Picture (xmlpp::Node const * node);
35
36         std::string id;
37         std::string annotation_text;
38         Fraction edit_rate;
39         int64_t intrinsic_duration;
40         int64_t entry_point;
41         int64_t duration;
42         Fraction frame_rate;
43         Fraction screen_aspect_ratio;
44 };
45
46
47 /** CPL MainPicture node */
48 class MainPicture : public Picture
49 {
50 public:
51         MainPicture () {}
52         MainPicture (xmlpp::Node const * node);
53 };
54
55 /** CPL MainStereoscopicPicture node */
56 class MainStereoscopicPicture : public Picture
57 {
58 public:
59         MainStereoscopicPicture () {}
60         MainStereoscopicPicture (xmlpp::Node const * node);
61 };
62
63 /** CPL MainSound node */       
64 class MainSound : public XMLNode
65 {
66 public:
67         MainSound () {}
68         MainSound (xmlpp::Node const * node);
69
70         std::string id;
71         std::string annotation_text;
72         Fraction edit_rate;
73         int64_t intrinsic_duration;
74         int64_t entry_point;
75         int64_t duration;
76 };
77
78 /** CPL MainSubtitle node */    
79 class MainSubtitle : public XMLNode
80 {
81 public:
82         MainSubtitle () {}
83         MainSubtitle (xmlpp::Node const * node);
84
85         std::string id;
86         std::string annotation_text;
87         Fraction edit_rate;
88         int64_t intrinsic_duration;
89         int64_t entry_point;
90         int64_t duration;
91 };
92
93 /** CPL AssetList node */       
94 class CPLAssetList : public XMLNode
95 {
96 public:
97         CPLAssetList () {}
98         CPLAssetList (xmlpp::Node const * node);
99
100         boost::shared_ptr<MainPicture> main_picture;
101         boost::shared_ptr<MainStereoscopicPicture> main_stereoscopic_picture;
102         boost::shared_ptr<MainSound> main_sound;
103         boost::shared_ptr<MainSubtitle> main_subtitle;
104 };
105
106 /** CPL Reel node */    
107 class CPLReel : public XMLNode
108 {
109 public:
110         CPLReel () {}
111         CPLReel (xmlpp::Node const * node);
112
113         std::string id;
114         boost::shared_ptr<CPLAssetList> asset_list;
115 };
116
117 /** CPL ContentVersion node */  
118 class ContentVersion : public XMLNode
119 {
120 public:
121         ContentVersion () {}
122         ContentVersion (xmlpp::Node const * node);
123
124         std::string id;
125         std::string label_text;
126 };
127
128 /** @class CPL
129  *  @brief Class to parse a CPL
130  *
131  *  This class is used to parse XML CPL files.  It is rarely necessary
132  *  for the caller to use it outside libdcp.
133  */
134 class CPL : public XMLFile
135 {
136 public:
137         /** Parse a CPL XML file into our member variables */
138         CPL (std::string file);
139
140         std::string id;
141         std::string annotation_text;
142         std::string issue_date;
143         std::string creator;
144         std::string content_title_text;
145         ContentKind content_kind;
146         boost::shared_ptr<ContentVersion> content_version;
147         std::list<boost::shared_ptr<CPLReel> > reels;
148 };
149
150 }
151