1 /* -*- c-basic-offset: 8; default-tab-width: 8; -*- */
4 Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
6 This program 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 This program 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 this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef DCPOMATIC_FFMPEG_CONTENT_H
23 #define DCPOMATIC_FFMPEG_CONTENT_H
25 #include <boost/enable_shared_from_this.hpp>
26 #include "video_content.h"
27 #include "audio_content.h"
29 class FFmpegAudioStream
32 FFmpegAudioStream (std::string n, int i, int f, int c)
39 FFmpegAudioStream (boost::shared_ptr<const cxml::Node>);
41 void as_xml (xmlpp::Node *) const;
49 extern bool operator== (FFmpegAudioStream const & a, FFmpegAudioStream const & b);
51 class FFmpegSubtitleStream
54 FFmpegSubtitleStream (std::string n, int i)
59 FFmpegSubtitleStream (boost::shared_ptr<const cxml::Node>);
61 void as_xml (xmlpp::Node *) const;
67 extern bool operator== (FFmpegSubtitleStream const & a, FFmpegSubtitleStream const & b);
69 class FFmpegContentProperty : public VideoContentProperty
72 static int const SUBTITLE_STREAMS;
73 static int const SUBTITLE_STREAM;
74 static int const AUDIO_STREAMS;
75 static int const AUDIO_STREAM;
78 class FFmpegContent : public VideoContent, public AudioContent
81 FFmpegContent (boost::filesystem::path);
82 FFmpegContent (boost::shared_ptr<const cxml::Node>);
83 FFmpegContent (FFmpegContent const &);
85 boost::shared_ptr<FFmpegContent> shared_from_this () {
86 return boost::dynamic_pointer_cast<FFmpegContent> (Content::shared_from_this ());
89 void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>, bool);
90 std::string summary () const;
91 std::string information () const;
92 void as_xml (xmlpp::Node *) const;
93 boost::shared_ptr<Content> clone () const;
94 Time length (boost::shared_ptr<const Film>) const;
97 int audio_channels () const;
98 ContentAudioFrame audio_length () const;
99 int content_audio_frame_rate () const;
100 int output_audio_frame_rate (boost::shared_ptr<const Film>) const;
102 std::vector<FFmpegSubtitleStream> subtitle_streams () const {
103 boost::mutex::scoped_lock lm (_mutex);
104 return _subtitle_streams;
107 boost::optional<FFmpegSubtitleStream> subtitle_stream () const {
108 boost::mutex::scoped_lock lm (_mutex);
109 return _subtitle_stream;
112 std::vector<FFmpegAudioStream> audio_streams () const {
113 boost::mutex::scoped_lock lm (_mutex);
114 return _audio_streams;
117 boost::optional<FFmpegAudioStream> audio_stream () const {
118 boost::mutex::scoped_lock lm (_mutex);
119 return _audio_stream;
122 void set_subtitle_stream (FFmpegSubtitleStream);
123 void set_audio_stream (FFmpegAudioStream);
126 std::vector<FFmpegSubtitleStream> _subtitle_streams;
127 boost::optional<FFmpegSubtitleStream> _subtitle_stream;
128 std::vector<FFmpegAudioStream> _audio_streams;
129 boost::optional<FFmpegAudioStream> _audio_stream;