2 Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
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.
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.
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.
20 #ifndef DCPOMATIC_FFMPEG_CONTENT_H
21 #define DCPOMATIC_FFMPEG_CONTENT_H
23 #include <boost/enable_shared_from_this.hpp>
24 #include "video_content.h"
25 #include "audio_content.h"
29 class FFmpegAudioStream
32 FFmpegAudioStream (std::string n, int i, int f, int c)
40 FFmpegAudioStream (boost::shared_ptr<const cxml::Node>);
42 void as_xml (xmlpp::Node *) const;
51 extern bool operator== (FFmpegAudioStream const & a, FFmpegAudioStream const & b);
53 class FFmpegSubtitleStream
56 FFmpegSubtitleStream (std::string n, int i)
61 FFmpegSubtitleStream (boost::shared_ptr<const cxml::Node>);
63 void as_xml (xmlpp::Node *) const;
69 extern bool operator== (FFmpegSubtitleStream const & a, FFmpegSubtitleStream const & b);
71 class FFmpegContentProperty : public VideoContentProperty
74 static int const SUBTITLE_STREAMS;
75 static int const SUBTITLE_STREAM;
76 static int const AUDIO_STREAMS;
77 static int const AUDIO_STREAM;
78 static int const FILTERS;
81 class FFmpegContent : public VideoContent, public AudioContent
84 FFmpegContent (boost::shared_ptr<const Film>, boost::filesystem::path);
85 FFmpegContent (boost::shared_ptr<const Film>, boost::shared_ptr<const cxml::Node>);
86 FFmpegContent (FFmpegContent const &);
88 boost::shared_ptr<FFmpegContent> shared_from_this () {
89 return boost::dynamic_pointer_cast<FFmpegContent> (Content::shared_from_this ());
92 void examine (boost::shared_ptr<Job>);
93 std::string summary () const;
94 std::string information () const;
95 void as_xml (xmlpp::Node *) const;
96 boost::shared_ptr<Content> clone () const;
100 int audio_channels () const;
101 ContentAudioFrame audio_length () const;
102 int content_audio_frame_rate () const;
103 int output_audio_frame_rate () const;
104 AudioMapping audio_mapping () const;
105 void set_audio_mapping (AudioMapping);
107 void set_filters (std::vector<Filter const *> const &);
109 std::vector<boost::shared_ptr<FFmpegSubtitleStream> > subtitle_streams () const {
110 boost::mutex::scoped_lock lm (_mutex);
111 return _subtitle_streams;
114 boost::shared_ptr<FFmpegSubtitleStream> subtitle_stream () const {
115 boost::mutex::scoped_lock lm (_mutex);
116 return _subtitle_stream;
119 std::vector<boost::shared_ptr<FFmpegAudioStream> > audio_streams () const {
120 boost::mutex::scoped_lock lm (_mutex);
121 return _audio_streams;
124 boost::shared_ptr<FFmpegAudioStream> audio_stream () const {
125 boost::mutex::scoped_lock lm (_mutex);
126 return _audio_stream;
129 std::vector<Filter const *> filters () const {
130 boost::mutex::scoped_lock lm (_mutex);
134 void set_subtitle_stream (boost::shared_ptr<FFmpegSubtitleStream>);
135 void set_audio_stream (boost::shared_ptr<FFmpegAudioStream>);
138 std::vector<boost::shared_ptr<FFmpegSubtitleStream> > _subtitle_streams;
139 boost::shared_ptr<FFmpegSubtitleStream> _subtitle_stream;
140 std::vector<boost::shared_ptr<FFmpegAudioStream> > _audio_streams;
141 boost::shared_ptr<FFmpegAudioStream> _audio_stream;
142 /** Video filters that should be used when generating DCPs */
143 std::vector<Filter const *> _filters;