Merge branch 'master' into 1.0
[libdcp.git] / src / reel.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 #ifndef LIBDCP_REEL_H
21 #define LIBDCP_REEL_H
22
23 #include <list>
24 #include <boost/shared_ptr.hpp>
25 #include <boost/function.hpp>
26 #include <libxml++/libxml++.h>
27 #include "key.h"
28 #include "types.h"
29
30 namespace xmlpp {
31         class Node;
32 }
33
34 namespace dcp {
35
36 class PictureMXF;
37 class SoundMXF;
38 class SubtitleAsset;
39 class KDM;      
40
41 /** @brief A reel within a DCP; the part which actually contains picture, sound and subtitle data */    
42 class Reel
43 {
44 public:
45         Reel (
46                 boost::shared_ptr<PictureMXF> picture,
47                 boost::shared_ptr<SoundMXF> sound,
48                 boost::shared_ptr<SubtitleAsset> subtitle
49                 )
50                 : _main_picture (picture)
51                 , _main_sound (sound)
52                 , _main_subtitle (subtitle)
53         {}
54         
55         boost::shared_ptr<const PictureMXF> main_picture () const {
56                 return _main_picture;
57         }
58
59         boost::shared_ptr<const SoundMXF> main_sound () const {
60                 return _main_sound;
61         }
62         
63         boost::shared_ptr<const SubtitleAsset> main_subtitle () const {
64                 return _main_subtitle;
65         }
66
67         void write_to_cpl (xmlpp::Element *) const;
68
69         bool encrypted () const;
70
71         void set_mxf_keys (dcp::Key);
72         
73         bool equals (boost::shared_ptr<const Reel> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> notes) const;
74
75         void add_kdm (KDM const &);
76
77 private:
78         boost::shared_ptr<PictureMXF> _main_picture;
79         boost::shared_ptr<SoundMXF> _main_sound;
80         boost::shared_ptr<SubtitleAsset> _main_subtitle;
81 };
82
83 }
84
85 #endif