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)
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;
80 class FFmpegContent : public VideoContent, public AudioContent
83 FFmpegContent (boost::filesystem::path);
84 FFmpegContent (boost::shared_ptr<const cxml::Node>);
85 FFmpegContent (FFmpegContent const &);
87 boost::shared_ptr<FFmpegContent> shared_from_this () {
88 return boost::dynamic_pointer_cast<FFmpegContent> (Content::shared_from_this ());
91 void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>, bool);
92 std::string summary () const;
93 std::string information () const;
94 void as_xml (xmlpp::Node *) const;
95 boost::shared_ptr<Content> clone () const;
96 Time length (boost::shared_ptr<const Film>) const;
99 int audio_channels () const;
100 ContentAudioFrame audio_length () const;
101 int content_audio_frame_rate () const;
102 int output_audio_frame_rate (boost::shared_ptr<const Film>) const;
103 AudioMapping audio_mapping () const;
105 std::vector<boost::shared_ptr<FFmpegSubtitleStream> > subtitle_streams () const {
106 boost::mutex::scoped_lock lm (_mutex);
107 return _subtitle_streams;
110 boost::shared_ptr<FFmpegSubtitleStream> subtitle_stream () const {
111 boost::mutex::scoped_lock lm (_mutex);
112 return _subtitle_stream;
115 std::vector<boost::shared_ptr<FFmpegAudioStream> > audio_streams () const {
116 boost::mutex::scoped_lock lm (_mutex);
117 return _audio_streams;
120 boost::shared_ptr<FFmpegAudioStream> audio_stream () const {
121 boost::mutex::scoped_lock lm (_mutex);
122 return _audio_stream;
125 void set_subtitle_stream (boost::shared_ptr<FFmpegSubtitleStream>);
126 void set_audio_stream (boost::shared_ptr<FFmpegAudioStream>);
129 std::vector<boost::shared_ptr<FFmpegSubtitleStream> > _subtitle_streams;
130 boost::shared_ptr<FFmpegSubtitleStream> _subtitle_stream;
131 std::vector<boost::shared_ptr<FFmpegAudioStream> > _audio_streams;
132 boost::shared_ptr<FFmpegAudioStream> _audio_stream;