8d7546fac384dfa8b24ab2374ea76994970acf08
[libdcp.git] / src / reel.h
1 /*
2     Copyright (C) 2012-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 #ifndef LIBDCP_REEL_H
21 #define LIBDCP_REEL_H
22
23 #include "key.h"
24 #include "types.h"
25 #include "ref.h"
26 #include <boost/shared_ptr.hpp>
27 #include <boost/function.hpp>
28 #include <list>
29
30 namespace cxml {
31         class Node;
32 }
33
34 namespace xmlpp {
35         class Element;
36 }
37
38 namespace dcp {
39
40 class DecryptedKDM;
41 class ReelAsset;
42 class ReelPictureAsset;
43 class ReelSoundAsset;
44 class ReelSubtitleAsset;
45 class Content;
46
47 /** @brief A reel within a DCP; the part which actually refers to picture, sound and subtitle data */
48 class Reel : public Object
49 {
50 public:
51         Reel () {}
52
53         Reel (
54                 boost::shared_ptr<ReelPictureAsset> picture,
55                 boost::shared_ptr<ReelSoundAsset> sound,
56                 boost::shared_ptr<ReelSubtitleAsset> subtitle
57                 )
58                 : _main_picture (picture)
59                 , _main_sound (sound)
60                 , _main_subtitle (subtitle)
61         {}
62
63         Reel (boost::shared_ptr<const cxml::Node>);
64
65         boost::shared_ptr<ReelPictureAsset> main_picture () const {
66                 return _main_picture;
67         }
68
69         boost::shared_ptr<ReelSoundAsset> main_sound () const {
70                 return _main_sound;
71         }
72
73         boost::shared_ptr<ReelSubtitleAsset> main_subtitle () const {
74                 return _main_subtitle;
75         }
76
77         int64_t duration () const;
78
79         void add (boost::shared_ptr<ReelAsset> asset);
80
81         void write_to_cpl (xmlpp::Element* node, Standard standard) const;
82
83         bool encrypted () const;
84
85         bool equals (boost::shared_ptr<const Reel> other, EqualityOptions opt, NoteHandler notes) const;
86
87         void add (DecryptedKDM const &);
88
89         void resolve_refs (std::list<boost::shared_ptr<Asset> >);
90
91 private:
92         boost::shared_ptr<ReelPictureAsset> _main_picture;
93         boost::shared_ptr<ReelSoundAsset> _main_sound;
94         boost::shared_ptr<ReelSubtitleAsset> _main_subtitle;
95 };
96
97 }
98
99 #endif