summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-11-23 20:24:51 +0000
committerCarl Hetherington <cth@carlh.net>2013-11-23 20:24:51 +0000
commitc3da7c64f01420447dbab7f5c2ea42ff1b911cc5 (patch)
tree77832e3b515987132ce8fe64ee82eaa2e87b8bd0 /src/lib/ffmpeg_content.cc
parentbab2a1cf99c58dcb598fed383015b1937d3ea07f (diff)
Basics of joining.
Diffstat (limited to 'src/lib/ffmpeg_content.cc')
-rw-r--r--src/lib/ffmpeg_content.cc41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index 4ca2ddc29..e843e1e16 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -26,6 +26,7 @@
#include "filter.h"
#include "film.h"
#include "log.h"
+#include "exceptions.h"
#include "i18n.h"
@@ -37,6 +38,7 @@ using std::cout;
using std::pair;
using boost::shared_ptr;
using boost::lexical_cast;
+using boost::dynamic_pointer_cast;
int const FFmpegContentProperty::SUBTITLE_STREAMS = 100;
int const FFmpegContentProperty::SUBTITLE_STREAM = 101;
@@ -83,6 +85,33 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> f, shared_ptr<const cxml::N
_first_video = node->optional_number_child<double> ("FirstVideo");
}
+FFmpegContent::FFmpegContent (shared_ptr<const Film> f, vector<boost::shared_ptr<Content> > c)
+ : Content (f, c)
+ , VideoContent (f, c)
+ , AudioContent (f, c)
+ , SubtitleContent (f, c)
+{
+ shared_ptr<FFmpegContent> ref = dynamic_pointer_cast<FFmpegContent> (c[0]);
+ assert (ref);
+
+ for (size_t i = 0; i < c.size(); ++i) {
+ shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c[i]);
+ if (*(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) {
+ throw JoinError (_("Content to be joined must use the same subtitle stream."));
+ }
+
+ if (*(fc->_audio_stream.get()) != *(ref->_audio_stream.get())) {
+ throw JoinError (_("Content to be joined must use the same audio stream."));
+ }
+ }
+
+ _subtitle_streams = ref->subtitle_streams ();
+ _subtitle_stream = ref->subtitle_stream ();
+ _audio_streams = ref->audio_streams ();
+ _audio_stream = ref->audio_stream ();
+ _first_video = ref->_first_video;
+}
+
void
FFmpegContent::as_xml (xmlpp::Node* node) const
{
@@ -300,11 +329,23 @@ operator== (FFmpegSubtitleStream const & a, FFmpegSubtitleStream const & b)
}
bool
+operator!= (FFmpegSubtitleStream const & a, FFmpegSubtitleStream const & b)
+{
+ return a.id != b.id;
+}
+
+bool
operator== (FFmpegAudioStream const & a, FFmpegAudioStream const & b)
{
return a.id == b.id;
}
+bool
+operator!= (FFmpegAudioStream const & a, FFmpegAudioStream const & b)
+{
+ return a.id != b.id;
+}
+
FFmpegAudioStream::FFmpegAudioStream (shared_ptr<const cxml::Node> node)
: mapping (node->node_child ("Mapping"))
{