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/>.
22 #ifndef DCPOMATIC_FFMPEG_CONTENT_H
23 #define DCPOMATIC_FFMPEG_CONTENT_H
26 #include "audio_stream.h"
31 struct AVFormatContext;
35 class FFmpegAudioStream;
36 class FFmpegSubtitleStream;
39 struct ffmpeg_pts_offset_test;
40 struct audio_sampling_rate_test;
43 class FFmpegContentProperty
46 static int const SUBTITLE_STREAMS;
47 /** The chosen subtitle stream, or something about it */
48 static int const SUBTITLE_STREAM;
49 static int const FILTERS;
54 class FFmpegContent : public Content
57 FFmpegContent (boost::filesystem::path);
58 FFmpegContent (cxml::ConstNodePtr, int version, std::list<std::string> &);
59 FFmpegContent (std::vector<std::shared_ptr<Content>>);
61 std::shared_ptr<FFmpegContent> shared_from_this () {
62 return std::dynamic_pointer_cast<FFmpegContent> (Content::shared_from_this ());
65 std::shared_ptr<const FFmpegContent> shared_from_this () const {
66 return std::dynamic_pointer_cast<const FFmpegContent> (Content::shared_from_this ());
69 void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job>) override;
70 void take_settings_from (std::shared_ptr<const Content> c) override;
71 std::string summary () const override;
72 std::string technical_summary () const override;
73 void as_xml (xmlpp::Node *, bool with_paths) const override;
74 dcpomatic::DCPTime full_length (std::shared_ptr<const Film> film) const override;
75 dcpomatic::DCPTime approximate_length () const override;
77 std::string identifier () const override;
79 void set_default_colour_conversion ();
81 void set_filters(std::vector<Filter> const&);
83 std::vector<std::shared_ptr<FFmpegSubtitleStream>> subtitle_streams () const {
84 boost::mutex::scoped_lock lm (_mutex);
85 return _subtitle_streams;
88 std::shared_ptr<FFmpegSubtitleStream> subtitle_stream () const {
89 boost::mutex::scoped_lock lm (_mutex);
90 return _subtitle_stream;
93 std::vector<std::shared_ptr<FFmpegAudioStream>> ffmpeg_audio_streams () const;
95 std::vector<Filter> filters() const {
96 boost::mutex::scoped_lock lm (_mutex);
100 void set_subtitle_stream (std::shared_ptr<FFmpegSubtitleStream>);
102 boost::optional<dcpomatic::ContentTime> first_video () const {
103 boost::mutex::scoped_lock lm (_mutex);
107 void signal_subtitle_stream_changed ();
110 void add_properties (std::shared_ptr<const Film> film, std::list<UserProperty> &) const override;
112 friend struct ffmpeg_pts_offset_test;
113 friend struct audio_sampling_rate_test;
115 std::vector<std::shared_ptr<FFmpegSubtitleStream>> _subtitle_streams;
116 std::shared_ptr<FFmpegSubtitleStream> _subtitle_stream;
117 boost::optional<dcpomatic::ContentTime> _first_video;
118 /** Video filters that should be used when generating DCPs */
119 std::vector<Filter> _filters;
121 boost::optional<AVColorRange> _color_range;
122 boost::optional<AVColorPrimaries> _color_primaries;
123 boost::optional<AVColorTransferCharacteristic> _color_trc;
124 boost::optional<AVColorSpace> _colorspace;
125 boost::optional<int> _bits_per_pixel;