libdcp
reel_asset.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
3 
4  This file is part of libdcp.
5 
6  libdcp is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  libdcp is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with libdcp. If not, see <http://www.gnu.org/licenses/>.
18 
19  In addition, as a special exception, the copyright holders give
20  permission to link the code of portions of this program with the
21  OpenSSL library under certain conditions as described in each
22  individual source file, and distribute linked combinations
23  including the two.
24 
25  You must obey the GNU General Public License in all respects
26  for all of the code used other than OpenSSL. If you modify
27  file(s) with this exception, you may extend this exception to your
28  version of the file(s), but you are not obligated to do so. If you
29  do not wish to do so, delete this exception statement from your
30  version. If you delete this exception statement from all source
31  files in the program, then also delete it here.
32 */
33 
34 
40 #ifndef LIBDCP_REEL_ASSET_H
41 #define LIBDCP_REEL_ASSET_H
42 
43 
44 #include "object.h"
45 #include "util.h"
46 #include "ref.h"
47 #include <memory>
48 
49 
50 namespace cxml {
51  class Node;
52 }
53 
54 
55 namespace xmlpp {
56  class Node;
57 }
58 
59 
60 namespace dcp {
61 
62 
63 class Asset;
64 
65 
73 class ReelAsset : public Object
74 {
75 public:
82  ReelAsset (std::string id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
83 
84  explicit ReelAsset (std::shared_ptr<const cxml::Node>);
85 
86  virtual xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const;
87 
88  virtual bool encryptable () const {
89  return false;
90  }
91 
92  Fraction edit_rate () const {
93  return _edit_rate;
94  }
95 
96  int64_t intrinsic_duration () const {
97  return _intrinsic_duration;
98  }
99 
100  void set_entry_point (int64_t e) {
101  _entry_point = e;
102  }
103 
104  void unset_entry_point () {
105  _entry_point = boost::none;
106  }
107 
108  boost::optional<int64_t> entry_point () const {
109  return _entry_point;
110  }
111 
112  void set_duration (int64_t d) {
113  _duration = d;
114  }
115 
116  boost::optional<int64_t> duration () const {
117  return _duration;
118  }
119 
121  int64_t actual_duration () const;
122 
123  boost::optional<std::string> annotation_text () const {
124  return _annotation_text;
125  }
126 
127  void set_annotation_text (std::string at) {
128  _annotation_text = at;
129  }
130 
131  void unset_annotation_text () {
132  _annotation_text = boost::none;
133  }
134 
135  bool asset_equals (std::shared_ptr<const ReelAsset>, EqualityOptions, NoteHandler) const;
136 
137 protected:
138 
142  virtual std::string cpl_node_name (Standard) const = 0;
143 
145  virtual std::pair<std::string, std::string> cpl_node_attribute (Standard) const;
146 
148  virtual std::pair<std::string, std::string> cpl_node_namespace () const;
149 
150  int64_t _intrinsic_duration = 0;
151  boost::optional<int64_t> _duration;
152 
153 private:
154  boost::optional<std::string> _annotation_text;
156  boost::optional<int64_t> _entry_point;
157 };
158 
159 
160 }
161 
162 
163 #endif
A fraction (i.e. a thing with an integer numerator and an integer denominator).
Definition: types.h:214
Some part of a DCP that has a UUID.
Definition: object.h:63
An entry in a <Reel> which refers to a use of a piece of content.
Definition: reel_asset.h:74
virtual std::pair< std::string, std::string > cpl_node_attribute(Standard) const
Definition: reel_asset.cc:113
virtual std::string cpl_node_name(Standard) const =0
boost::optional< int64_t > _entry_point
The <EntryPoint> from the reel's entry for this asset.
Definition: reel_asset.h:156
ReelAsset(std::string id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
Definition: reel_asset.cc:60
virtual std::pair< std::string, std::string > cpl_node_namespace() const
Definition: reel_asset.cc:120
Fraction _edit_rate
The <EditRate> from the reel's entry for this asset.
Definition: reel_asset.h:155
boost::optional< std::string > _annotation_text
The <AnnotationText> from the reel's entry for this asset.
Definition: reel_asset.h:154
int64_t actual_duration() const
Definition: reel_asset.cc:164
int64_t _intrinsic_duration
The <IntrinsicDuration> from the reel's entry for this asset.
Definition: reel_asset.h:150
boost::optional< int64_t > _duration
The <Duration> from the reel's entry for this asset, if present.
Definition: reel_asset.h:151
Namespace for everything in libdcp.
Definition: array_data.h:50
Object class.
Ref class.
A class to describe what "equality" means for a particular test.
Definition: types.h:249
Utility methods and classes.