2 Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic 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.
11 DCP-o-matic 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.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef DCPOMATIC_FFMPEG_CONTENT_H
22 #define DCPOMATIC_FFMPEG_CONTENT_H
24 #ifdef DCPOMATIC_VARIANT_SWAROOP
25 #include "encrypted_ecinema_kdm.h"
28 #include "audio_stream.h"
30 struct AVFormatContext;
34 class FFmpegSubtitleStream;
35 class FFmpegAudioStream;
37 struct ffmpeg_pts_offset_test;
38 struct audio_sampling_rate_test;
40 class FFmpegContentProperty
43 static int const SUBTITLE_STREAMS;
44 /** The chosen subtitle stream, or something about it */
45 static int const SUBTITLE_STREAM;
46 static int const FILTERS;
50 class FFmpegContent : public Content
53 FFmpegContent (boost::filesystem::path);
54 FFmpegContent (cxml::ConstNodePtr, int version, std::list<std::string> &);
55 FFmpegContent (std::vector<boost::shared_ptr<Content> >);
57 boost::shared_ptr<FFmpegContent> shared_from_this () {
58 return boost::dynamic_pointer_cast<FFmpegContent> (Content::shared_from_this ());
61 boost::shared_ptr<const FFmpegContent> shared_from_this () const {
62 return boost::dynamic_pointer_cast<const FFmpegContent> (Content::shared_from_this ());
65 void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job>);
66 void take_settings_from (boost::shared_ptr<const Content> c);
67 std::string summary () const;
68 std::string technical_summary () const;
69 void as_xml (xmlpp::Node *, bool with_paths) const;
70 dcpomatic::DCPTime full_length (boost::shared_ptr<const Film> film) const;
71 dcpomatic::DCPTime approximate_length () const;
73 std::string identifier () const;
75 void set_default_colour_conversion ();
77 void set_filters (std::vector<Filter const *> const &);
79 std::vector<boost::shared_ptr<FFmpegSubtitleStream> > subtitle_streams () const {
80 boost::mutex::scoped_lock lm (_mutex);
81 return _subtitle_streams;
84 boost::shared_ptr<FFmpegSubtitleStream> subtitle_stream () const {
85 boost::mutex::scoped_lock lm (_mutex);
86 return _subtitle_stream;
89 std::vector<boost::shared_ptr<FFmpegAudioStream> > ffmpeg_audio_streams () const;
91 std::vector<Filter const *> filters () const {
92 boost::mutex::scoped_lock lm (_mutex);
96 void set_subtitle_stream (boost::shared_ptr<FFmpegSubtitleStream>);
98 boost::optional<dcpomatic::ContentTime> first_video () const {
99 boost::mutex::scoped_lock lm (_mutex);
103 void signal_subtitle_stream_changed ();
105 #ifdef DCPOMATIC_VARIANT_SWAROOP
107 bool encrypted () const {
108 boost::mutex::scoped_lock lm (_mutex);
112 void add_kdm (EncryptedECinemaKDM kdm);
114 boost::optional<EncryptedECinemaKDM> kdm () const {
118 boost::optional<std::string> id () const {
122 bool kdm_timing_window_valid () const;
127 void add_properties (boost::shared_ptr<const Film> film, std::list<UserProperty> &) const;
129 friend struct ffmpeg_pts_offset_test;
130 friend struct audio_sampling_rate_test;
132 std::vector<boost::shared_ptr<FFmpegSubtitleStream> > _subtitle_streams;
133 boost::shared_ptr<FFmpegSubtitleStream> _subtitle_stream;
134 boost::optional<dcpomatic::ContentTime> _first_video;
135 /** Video filters that should be used when generating DCPs */
136 std::vector<Filter const *> _filters;
138 boost::optional<AVColorRange> _color_range;
139 boost::optional<AVColorPrimaries> _color_primaries;
140 boost::optional<AVColorTransferCharacteristic> _color_trc;
141 boost::optional<AVColorSpace> _colorspace;
142 boost::optional<int> _bits_per_pixel;
143 #ifdef DCPOMATIC_VARIANT_SWAROOP
145 boost::optional<EncryptedECinemaKDM> _kdm;
146 boost::optional<std::string> _id;