/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <dcp/raw_convert.h>
#include "ffmpeg.h"
#include "ffmpeg_content.h"
+#include "ffmpeg_audio_stream.h"
#include "exceptions.h"
#include "util.h"
--- /dev/null
+/*
+ Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <libxml++/libxml++.h>
+#include <libcxml/cxml.h>
+#include <dcp/raw_convert.h>
+#include "ffmpeg_audio_stream.h"
+
+using std::string;
+using dcp::raw_convert;
+
+FFmpegAudioStream::FFmpegAudioStream (cxml::ConstNodePtr node, int version)
+ : FFmpegStream (node)
+ , mapping (node->node_child ("Mapping"), version)
+{
+ frame_rate = node->number_child<int> ("FrameRate");
+ channels = node->number_child<int64_t> ("Channels");
+ first_audio = node->optional_number_child<double> ("FirstAudio");
+}
+
+void
+FFmpegAudioStream::as_xml (xmlpp::Node* root) const
+{
+ FFmpegStream::as_xml (root);
+ root->add_child("FrameRate")->add_child_text (raw_convert<string> (frame_rate));
+ root->add_child("Channels")->add_child_text (raw_convert<string> (channels));
+ if (first_audio) {
+ root->add_child("FirstAudio")->add_child_text (raw_convert<string> (first_audio.get().get()));
+ }
+ mapping.as_xml (root->add_child("Mapping"));
+}
--- /dev/null
+/*
+ Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "ffmpeg_stream.h"
+#include "audio_mapping.h"
+#include "dcpomatic_time.h"
+
+class ffmpeg_pts_offset_test;
+
+class FFmpegAudioStream : public FFmpegStream
+{
+public:
+ FFmpegAudioStream (std::string n, int i, int f, int c)
+ : FFmpegStream (n, i)
+ , frame_rate (f)
+ , channels (c)
+ , mapping (c)
+ {
+ mapping.make_default ();
+ }
+
+ FFmpegAudioStream (cxml::ConstNodePtr, int);
+
+ void as_xml (xmlpp::Node *) const;
+
+ int frame_rate;
+ int channels;
+ AudioMapping mapping;
+ boost::optional<ContentTime> first_audio;
+
+private:
+ friend class ffmpeg_pts_offset_test;
+
+ /* Constructor for tests */
+ FFmpegAudioStream ()
+ : FFmpegStream ("", 0)
+ , frame_rate (0)
+ , channels (0)
+ , mapping (1)
+ {}
+};
#include <dcp/raw_convert.h>
#include "ffmpeg_content.h"
#include "ffmpeg_examiner.h"
+#include "ffmpeg_subtitle_stream.h"
+#include "ffmpeg_audio_stream.h"
#include "compose.hpp"
#include "job.h"
#include "util.h"
return a._id != b._id;
}
-FFmpegStream::FFmpegStream (cxml::ConstNodePtr node)
- : name (node->string_child ("Name"))
- , _id (node->number_child<int> ("Id"))
-{
-
-}
-
-void
-FFmpegStream::as_xml (xmlpp::Node* root) const
-{
- root->add_child("Name")->add_child_text (name);
- root->add_child("Id")->add_child_text (raw_convert<string> (_id));
-}
-
-FFmpegAudioStream::FFmpegAudioStream (cxml::ConstNodePtr node, int version)
- : FFmpegStream (node)
- , mapping (node->node_child ("Mapping"), version)
-{
- frame_rate = node->number_child<int> ("FrameRate");
- channels = node->number_child<int64_t> ("Channels");
- first_audio = node->optional_number_child<double> ("FirstAudio");
-}
-
-void
-FFmpegAudioStream::as_xml (xmlpp::Node* root) const
-{
- FFmpegStream::as_xml (root);
- root->add_child("FrameRate")->add_child_text (raw_convert<string> (frame_rate));
- root->add_child("Channels")->add_child_text (raw_convert<string> (channels));
- if (first_audio) {
- root->add_child("FirstAudio")->add_child_text (raw_convert<string> (first_audio.get().get()));
- }
- mapping.as_xml (root->add_child("Mapping"));
-}
-
-bool
-FFmpegStream::uses_index (AVFormatContext const * fc, int index) const
-{
- size_t i = 0;
- while (i < fc->nb_streams) {
- if (fc->streams[i]->id == _id) {
- return int (i) == index;
- }
- ++i;
- }
-
- return false;
-}
-
-AVStream *
-FFmpegStream::stream (AVFormatContext const * fc) const
-{
- size_t i = 0;
- while (i < fc->nb_streams) {
- if (fc->streams[i]->id == _id) {
- return fc->streams[i];
- }
- ++i;
- }
-
- assert (false);
- return 0;
-}
-
-/** Construct a SubtitleStream from a value returned from to_string().
- * @param t String returned from to_string().
- * @param v State file version.
- */
-FFmpegSubtitleStream::FFmpegSubtitleStream (cxml::ConstNodePtr node)
- : FFmpegStream (node)
-{
-
-}
-
-void
-FFmpegSubtitleStream::as_xml (xmlpp::Node* root) const
-{
- FFmpegStream::as_xml (root);
-}
-
DCPTime
FFmpegContent::full_length () const
{
struct AVStream;
class Filter;
+class FFmpegSubtitleStream;
+class FFmpegAudioStream;
class ffmpeg_pts_offset_test;
-class FFmpegStream
-{
-public:
- FFmpegStream (std::string n, int i)
- : name (n)
- , _id (i)
- {}
-
- FFmpegStream (cxml::ConstNodePtr);
-
- void as_xml (xmlpp::Node *) const;
-
- /** @param c An AVFormatContext.
- * @param index A stream index within the AVFormatContext.
- * @return true if this FFmpegStream uses the given stream index.
- */
- bool uses_index (AVFormatContext const * c, int index) const;
- AVStream* stream (AVFormatContext const * c) const;
-
- std::string technical_summary () const {
- return "id " + boost::lexical_cast<std::string> (_id);
- }
-
- std::string identifier () const {
- return boost::lexical_cast<std::string> (_id);
- }
-
- std::string name;
-
- friend bool operator== (FFmpegStream const & a, FFmpegStream const & b);
- friend bool operator!= (FFmpegStream const & a, FFmpegStream const & b);
-
-private:
- int _id;
-};
-
-class FFmpegAudioStream : public FFmpegStream
-{
-public:
- FFmpegAudioStream (std::string n, int i, int f, int c)
- : FFmpegStream (n, i)
- , frame_rate (f)
- , channels (c)
- , mapping (c)
- {
- mapping.make_default ();
- }
-
- FFmpegAudioStream (cxml::ConstNodePtr, int);
-
- void as_xml (xmlpp::Node *) const;
-
- int frame_rate;
- int channels;
- AudioMapping mapping;
- boost::optional<ContentTime> first_audio;
-
-private:
- friend class ffmpeg_pts_offset_test;
-
- /* Constructor for tests */
- FFmpegAudioStream ()
- : FFmpegStream ("", 0)
- , frame_rate (0)
- , channels (0)
- , mapping (1)
- {}
-};
-
-class FFmpegSubtitleStream : public FFmpegStream
-{
-public:
- FFmpegSubtitleStream (std::string n, int i)
- : FFmpegStream (n, i)
- {}
-
- FFmpegSubtitleStream (cxml::ConstNodePtr);
-
- void as_xml (xmlpp::Node *) const;
-};
-
class FFmpegContentProperty : public VideoContentProperty
{
public:
#include "util.h"
#include "log.h"
#include "ffmpeg_decoder.h"
+#include "ffmpeg_audio_stream.h"
+#include "ffmpeg_subtitle_stream.h"
#include "filter_graph.h"
#include "audio_buffers.h"
#include "ffmpeg_content.h"
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
}
#include "ffmpeg_examiner.h"
#include "ffmpeg_content.h"
+#include "ffmpeg_audio_stream.h"
+#include "ffmpeg_subtitle_stream.h"
#include "i18n.h"
--- /dev/null
+/*
+ Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+extern "C" {
+#include <libavformat/avformat.h>
+}
+#include <libxml++/libxml++.h>
+#include <dcp/raw_convert.h>
+#include "ffmpeg_stream.h"
+
+using std::string;
+using dcp::raw_convert;
+
+FFmpegStream::FFmpegStream (cxml::ConstNodePtr node)
+ : name (node->string_child ("Name"))
+ , _id (node->number_child<int> ("Id"))
+{
+
+}
+
+void
+FFmpegStream::as_xml (xmlpp::Node* root) const
+{
+ root->add_child("Name")->add_child_text (name);
+ root->add_child("Id")->add_child_text (raw_convert<string> (_id));
+}
+
+bool
+FFmpegStream::uses_index (AVFormatContext const * fc, int index) const
+{
+ size_t i = 0;
+ while (i < fc->nb_streams) {
+ if (fc->streams[i]->id == _id) {
+ return int (i) == index;
+ }
+ ++i;
+ }
+
+ return false;
+}
+
+AVStream *
+FFmpegStream::stream (AVFormatContext const * fc) const
+{
+ size_t i = 0;
+ while (i < fc->nb_streams) {
+ if (fc->streams[i]->id == _id) {
+ return fc->streams[i];
+ }
+ ++i;
+ }
+
+ assert (false);
+ return 0;
+}
--- /dev/null
+/*
+ Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef DCPOMATIC_FFMPEG_STREAM_H
+#define DCPOMATIC_FFMPEG_STREAM_H
+
+#include <boost/lexical_cast.hpp>
+#include <libcxml/cxml.h>
+
+struct AVFormatContext;
+struct AVStream;
+
+class FFmpegStream
+{
+public:
+ FFmpegStream (std::string n, int i)
+ : name (n)
+ , _id (i)
+ {}
+
+ FFmpegStream (cxml::ConstNodePtr);
+
+ void as_xml (xmlpp::Node *) const;
+
+ /** @param c An AVFormatContext.
+ * @param index A stream index within the AVFormatContext.
+ * @return true if this FFmpegStream uses the given stream index.
+ */
+ bool uses_index (AVFormatContext const * c, int index) const;
+ AVStream* stream (AVFormatContext const * c) const;
+
+ std::string technical_summary () const {
+ return "id " + boost::lexical_cast<std::string> (_id);
+ }
+
+ std::string identifier () const {
+ return boost::lexical_cast<std::string> (_id);
+ }
+
+ std::string name;
+
+ friend bool operator== (FFmpegStream const & a, FFmpegStream const & b);
+ friend bool operator!= (FFmpegStream const & a, FFmpegStream const & b);
+
+private:
+ int _id;
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "ffmpeg_subtitle_stream.h"
+
+/** Construct a SubtitleStream from a value returned from to_string().
+ * @param t String returned from to_string().
+ * @param v State file version.
+ */
+FFmpegSubtitleStream::FFmpegSubtitleStream (cxml::ConstNodePtr node)
+ : FFmpegStream (node)
+{
+
+}
+
+void
+FFmpegSubtitleStream::as_xml (xmlpp::Node* root) const
+{
+ FFmpegStream::as_xml (root);
+}
--- /dev/null
+/*
+ Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "dcpomatic_time.h"
+#include "ffmpeg_stream.h"
+
+class FFmpegSubtitleStream : public FFmpegStream
+{
+public:
+ FFmpegSubtitleStream (std::string n, int i)
+ : FFmpegStream (n, i)
+ {}
+
+ FFmpegSubtitleStream (cxml::ConstNodePtr);
+
+ void as_xml (xmlpp::Node *) const;
+};
+
file_group.cc
filter_graph.cc
ffmpeg.cc
+ ffmpeg_audio_stream.cc
ffmpeg_content.cc
ffmpeg_decoder.cc
ffmpeg_examiner.cc
+ ffmpeg_stream.cc
+ ffmpeg_subtitle_stream.cc
film.cc
filter.cc
frame_rate_change.cc
#include "lib/config.h"
#include "lib/sound_processor.h"
#include "lib/ffmpeg_content.h"
+#include "lib/ffmpeg_audio_stream.h"
#include "audio_dialog.h"
#include "audio_panel.h"
#include "audio_mapping_view.h"
#include <wx/spinctrl.h>
#include "lib/ffmpeg_content.h"
#include "lib/subrip_content.h"
+#include "lib/ffmpeg_subtitle_stream.h"
#include "subtitle_panel.h"
#include "film_editor.h"
#include "wx_util.h"
#include <boost/test/unit_test.hpp>
#include "lib/ffmpeg_examiner.h"
#include "lib/ffmpeg_content.h"
+#include "lib/ffmpeg_audio_stream.h"
#include "test.h"
using boost::shared_ptr;
#include "lib/film.h"
#include "lib/ffmpeg_decoder.h"
#include "lib/ffmpeg_content.h"
+#include "lib/ffmpeg_audio_stream.h"
#include "test.h"
using boost::shared_ptr;
#include "lib/config.h"
#include "lib/ffmpeg_content.h"
#include "lib/playlist.h"
+#include "lib/ffmpeg_audio_stream.h"
#include "test.h"
using boost::shared_ptr;
#include "lib/ratio.h"
#include "lib/dcp_content_type.h"
#include "lib/ffmpeg_decoder.h"
+#include "lib/ffmpeg_audio_stream.h"
#include "lib/content_video.h"
#include "test.h"
#include <libxml++/libxml++.h>
#include <libcxml/cxml.h>
#include "lib/ffmpeg_content.h"
+#include "lib/ffmpeg_audio_stream.h"
#include "lib/film.h"
using std::pair;