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
25 #include "audio_stream.h"
27 struct AVFormatContext;
31 class FFmpegSubtitleStream;
32 class FFmpegAudioStream;
34 struct ffmpeg_pts_offset_test;
35 struct audio_sampling_rate_test;
37 class FFmpegContentProperty
40 static int const SUBTITLE_STREAMS;
41 /** The chosen subtitle stream, or something about it */
42 static int const SUBTITLE_STREAM;
43 static int const FILTERS;
47 class FFmpegContent : public Content
50 FFmpegContent (boost::filesystem::path);
51 FFmpegContent (cxml::ConstNodePtr, int version, std::list<std::string> &);
52 FFmpegContent (std::vector<std::shared_ptr<Content> >);
54 std::shared_ptr<FFmpegContent> shared_from_this () {
55 return std::dynamic_pointer_cast<FFmpegContent> (Content::shared_from_this ());
58 std::shared_ptr<const FFmpegContent> shared_from_this () const {
59 return std::dynamic_pointer_cast<const FFmpegContent> (Content::shared_from_this ());
62 void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job>);
63 void take_settings_from (std::shared_ptr<const Content> c);
64 std::string summary () const;
65 std::string technical_summary () const;
66 void as_xml (xmlpp::Node *, bool with_paths) const;
67 dcpomatic::DCPTime full_length (std::shared_ptr<const Film> film) const;
68 dcpomatic::DCPTime approximate_length () const;
70 std::string identifier () const;
72 void set_default_colour_conversion ();
74 void set_filters (std::vector<Filter const *> const &);
76 std::vector<std::shared_ptr<FFmpegSubtitleStream> > subtitle_streams () const {
77 boost::mutex::scoped_lock lm (_mutex);
78 return _subtitle_streams;
81 std::shared_ptr<FFmpegSubtitleStream> subtitle_stream () const {
82 boost::mutex::scoped_lock lm (_mutex);
83 return _subtitle_stream;
86 std::vector<std::shared_ptr<FFmpegAudioStream> > ffmpeg_audio_streams () const;
88 std::vector<Filter const *> filters () const {
89 boost::mutex::scoped_lock lm (_mutex);
93 void set_subtitle_stream (std::shared_ptr<FFmpegSubtitleStream>);
95 boost::optional<dcpomatic::ContentTime> first_video () const {
96 boost::mutex::scoped_lock lm (_mutex);
100 void signal_subtitle_stream_changed ();
103 void add_properties (std::shared_ptr<const Film> film, std::list<UserProperty> &) const;
105 friend struct ffmpeg_pts_offset_test;
106 friend struct audio_sampling_rate_test;
108 std::vector<std::shared_ptr<FFmpegSubtitleStream> > _subtitle_streams;
109 std::shared_ptr<FFmpegSubtitleStream> _subtitle_stream;
110 boost::optional<dcpomatic::ContentTime> _first_video;
111 /** Video filters that should be used when generating DCPs */
112 std::vector<Filter const *> _filters;
114 boost::optional<AVColorRange> _color_range;
115 boost::optional<AVColorPrimaries> _color_primaries;
116 boost::optional<AVColorTransferCharacteristic> _color_trc;
117 boost::optional<AVColorSpace> _colorspace;
118 boost::optional<int> _bits_per_pixel;