No-op: whitespace.
[libdcp.git] / src / cpl.h
1 /*
2     Copyright (C) 2014 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 CPL class.
22  */
23
24 #ifndef LIBDCP_CPL_H
25 #define LIBDCP_CPL_H
26
27 #include "types.h"
28 #include "certificates.h"
29 #include "key.h"
30 #include "asset.h"
31 #include "metadata.h"
32 #include <libxml++/libxml++.h>
33 #include <boost/shared_ptr.hpp>
34 #include <boost/function.hpp>
35 #include <boost/optional.hpp>
36 #include <boost/filesystem.hpp>
37 #include <list>
38
39 namespace dcp {
40
41 class ReelAsset;
42 class Reel;
43 class XMLMetadata;
44 class MXFMetadata;
45 class Signer;
46 class DecryptedKDM;
47
48 /** @class CPL
49  *  @brief A Composition Playlist.
50  */
51 class CPL : public Asset
52 {
53 public:
54         CPL (std::string annotation_text, ContentKind content_kind);
55         CPL (boost::filesystem::path file);
56
57         bool equals (
58                 boost::shared_ptr<const Asset> other,
59                 EqualityOptions options,
60                 NoteHandler note
61                 ) const;
62
63         void add (boost::shared_ptr<Reel> reel);
64         void add (DecryptedKDM const &);
65
66         /** @return contents of the &lt;AnnotationText&gt; node */
67         std::string annotation_text () const {
68                 return _annotation_text;
69         }
70
71         /** @return contents of the &lt;ContentTitleText&gt; node */
72         std::string content_title_text () const {
73                 return _content_title_text;
74         }
75
76         /** @return contents of the &lt;Id&gt; node within &lt;ContentVersion&gt; */
77         void set_content_version_id (std::string id) {
78                 _content_version_id = id;
79         }
80
81         /** @return contents of the &lt;LabelText&gt; node within &lt;ContentVersion&gt; */
82         void set_content_version_label_text (std::string text) {
83                 _content_version_label_text = text;
84         }
85
86         /** @return the type of the content, used by media servers
87          *  to categorise things (e.g. feature, trailer, etc.)
88          */
89         ContentKind content_kind () const {
90                 return _content_kind;
91         }
92
93         /** @return the reels in this CPL */
94         std::list<boost::shared_ptr<Reel> > reels () const {
95                 return _reels;
96         }
97
98         /** @return the ReelAssets in this CPL in all reels.
99          */
100         std::list<boost::shared_ptr<const ReelAsset> > reel_assets () const;
101
102         bool encrypted () const;
103
104         void set_metadata (XMLMetadata m) {
105                 _metadata = m;
106         }
107
108         void write_xml (
109                 boost::filesystem::path file,
110                 Standard standard,
111                 boost::shared_ptr<const Signer>
112                 ) const;
113
114         void resolve_refs (std::list<boost::shared_ptr<Object> >);
115
116 protected:
117         /** @return type string for PKLs for this asset */
118         std::string pkl_type (Standard standard) const;
119
120 private:
121         std::string _annotation_text;               ///< &lt;AnnotationText&gt;
122         /** &lt;Issuer&gt;, &lt;Creator&gt; and &lt;IssueDate&gt;.  These are grouped
123          *  because they occur together in a few places.
124          */
125         XMLMetadata _metadata;
126         std::string _content_title_text;            ///< &lt;ContentTitleText&gt;
127         ContentKind _content_kind;                  ///< &lt;ContentKind&gt;
128         std::string _content_version_id;            ///< &lt;Id&gt; in &lt;ContentVersion&gt;
129         std::string _content_version_label_text;    ///< &lt;LabelText&gt; in &lt;ContentVersion&gt;
130         std::list<boost::shared_ptr<Reel> > _reels;
131 };
132
133 }
134
135 #endif