diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-07-20 21:28:29 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-07-20 21:28:29 +0100 |
| commit | bd5e8b83a3a18787241982efdae809d4db21f65d (patch) | |
| tree | 7aeabb1f4c3094107713f0f2b068c242a76c6469 /src/lib | |
| parent | cb9183ee1165802bf81c2d6c8ced860c4da718f9 (diff) | |
Remove join function; the code is long and I don't think anybody
uses it.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/audio_content.cc | 21 | ||||
| -rw-r--r-- | src/lib/audio_content.h | 1 | ||||
| -rw-r--r-- | src/lib/caption_content.cc | 77 | ||||
| -rw-r--r-- | src/lib/caption_content.h | 1 | ||||
| -rw-r--r-- | src/lib/content.cc | 34 | ||||
| -rw-r--r-- | src/lib/content.h | 1 | ||||
| -rw-r--r-- | src/lib/exceptions.h | 8 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 61 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.h | 1 | ||||
| -rw-r--r-- | src/lib/video_content.cc | 52 | ||||
| -rw-r--r-- | src/lib/video_content.h | 3 |
11 files changed, 2 insertions, 258 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index a252e4b5a..d4ce6c243 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -91,27 +91,6 @@ AudioContent::AudioContent (Content* parent, cxml::ConstNodePtr node) } } -AudioContent::AudioContent (Content* parent, vector<shared_ptr<Content> > c) - : ContentPart (parent) -{ - shared_ptr<AudioContent> ref = c[0]->audio; - DCPOMATIC_ASSERT (ref); - - for (size_t i = 1; i < c.size(); ++i) { - if (c[i]->audio->gain() != ref->gain()) { - throw JoinError (_("Content to be joined must have the same audio gain.")); - } - - if (c[i]->audio->delay() != ref->delay()) { - throw JoinError (_("Content to be joined must have the same audio delay.")); - } - } - - _gain = ref->gain (); - _delay = ref->delay (); - _streams = ref->streams (); -} - void AudioContent::as_xml (xmlpp::Node* node) const { diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h index a1f5ba8a0..d73c73735 100644 --- a/src/lib/audio_content.h +++ b/src/lib/audio_content.h @@ -44,7 +44,6 @@ class AudioContent : public ContentPart { public: explicit AudioContent (Content* parent); - AudioContent (Content* parent, std::vector<boost::shared_ptr<Content> >); void as_xml (xmlpp::Node *) const; std::string technical_summary () const; diff --git a/src/lib/caption_content.cc b/src/lib/caption_content.cc index 33e21bc4a..e3f6551fd 100644 --- a/src/lib/caption_content.cc +++ b/src/lib/caption_content.cc @@ -186,83 +186,6 @@ CaptionContent::CaptionContent (Content* parent, cxml::ConstNodePtr node, int ve _type = string_to_caption_type (node->optional_string_child("CaptionType").get_value_or("open")); } -CaptionContent::CaptionContent (Content* parent, vector<shared_ptr<Content> > c) - : ContentPart (parent) -{ - shared_ptr<CaptionContent> ref = c[0]->caption; - DCPOMATIC_ASSERT (ref); - list<shared_ptr<Font> > ref_fonts = ref->fonts (); - - for (size_t i = 1; i < c.size(); ++i) { - - if (c[i]->caption->use() != ref->use()) { - throw JoinError (_("Content to be joined must have the same 'use subtitles' setting.")); - } - - if (c[i]->caption->burn() != ref->burn()) { - throw JoinError (_("Content to be joined must have the same 'burn subtitles' setting.")); - } - - if (c[i]->caption->x_offset() != ref->x_offset()) { - throw JoinError (_("Content to be joined must have the same subtitle X offset.")); - } - - if (c[i]->caption->y_offset() != ref->y_offset()) { - throw JoinError (_("Content to be joined must have the same subtitle Y offset.")); - } - - if (c[i]->caption->x_scale() != ref->x_scale()) { - throw JoinError (_("Content to be joined must have the same subtitle X scale.")); - } - - if (c[i]->caption->y_scale() != ref->y_scale()) { - throw JoinError (_("Content to be joined must have the same subtitle Y scale.")); - } - - if (c[i]->caption->line_spacing() != ref->line_spacing()) { - throw JoinError (_("Content to be joined must have the same subtitle line spacing.")); - } - - if ((c[i]->caption->fade_in() != ref->fade_in()) || (c[i]->caption->fade_out() != ref->fade_out())) { - throw JoinError (_("Content to be joined must have the same subtitle fades.")); - } - - if ((c[i]->caption->outline_width() != ref->outline_width())) { - throw JoinError (_("Content to be joined must have the same outline width.")); - } - - list<shared_ptr<Font> > fonts = c[i]->caption->fonts (); - if (fonts.size() != ref_fonts.size()) { - throw JoinError (_("Content to be joined must use the same fonts.")); - } - - list<shared_ptr<Font> >::const_iterator j = ref_fonts.begin (); - list<shared_ptr<Font> >::const_iterator k = fonts.begin (); - - while (j != ref_fonts.end ()) { - if (**j != **k) { - throw JoinError (_("Content to be joined must use the same fonts.")); - } - ++j; - ++k; - } - } - - _use = ref->use (); - _burn = ref->burn (); - _x_offset = ref->x_offset (); - _y_offset = ref->y_offset (); - _x_scale = ref->x_scale (); - _y_scale = ref->y_scale (); - _language = ref->language (); - _fonts = ref_fonts; - _line_spacing = ref->line_spacing (); - _fade_in = ref->fade_in (); - _fade_out = ref->fade_out (); - _outline_width = ref->outline_width (); - - connect_to_fonts (); -} /** _mutex must not be held on entry */ void diff --git a/src/lib/caption_content.h b/src/lib/caption_content.h index 25f7a1d66..297289f18 100644 --- a/src/lib/caption_content.h +++ b/src/lib/caption_content.h @@ -59,7 +59,6 @@ class CaptionContent : public ContentPart { public: explicit CaptionContent (Content* parent); - CaptionContent (Content* parent, std::vector<boost::shared_ptr<Content> >); void as_xml (xmlpp::Node *) const; std::string identifier () const; diff --git a/src/lib/content.cc b/src/lib/content.cc index af4c6c701..d232f6e49 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -104,40 +104,6 @@ Content::Content (shared_ptr<const Film> film, cxml::ConstNodePtr node) _video_frame_rate = node->optional_number_child<double> ("VideoFrameRate"); } -Content::Content (shared_ptr<const Film> film, vector<shared_ptr<Content> > c) - : _film (film) - , _position (c.front()->position ()) - , _trim_start (c.front()->trim_start ()) - , _trim_end (c.back()->trim_end ()) - , _video_frame_rate (c.front()->video_frame_rate()) - , _change_signals_frequent (false) -{ - for (size_t i = 0; i < c.size(); ++i) { - if (i > 0 && c[i]->trim_start() > ContentTime ()) { - throw JoinError (_("Only the first piece of content to be joined can have a start trim.")); - } - - if (i < (c.size() - 1) && c[i]->trim_end () > ContentTime ()) { - throw JoinError (_("Only the last piece of content to be joined can have an end trim.")); - } - - if ( - (_video_frame_rate && !c[i]->_video_frame_rate) || - (!_video_frame_rate && c[i]->_video_frame_rate) - ) { - throw JoinError (_("Content to be joined must have the same video frame rate")); - } - - if (_video_frame_rate && fabs (_video_frame_rate.get() - c[i]->_video_frame_rate.get()) > VIDEO_FRAME_RATE_EPSILON) { - throw JoinError (_("Content to be joined must have the same video frame rate")); - } - - for (size_t j = 0; j < c[i]->number_of_paths(); ++j) { - _paths.push_back (c[i]->path (j)); - } - } -} - void Content::as_xml (xmlpp::Node* node, bool with_paths) const { diff --git a/src/lib/content.h b/src/lib/content.h index 7ff20e96c..1e594e136 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -67,7 +67,6 @@ public: Content (boost::shared_ptr<const Film>, DCPTime); Content (boost::shared_ptr<const Film>, boost::filesystem::path); Content (boost::shared_ptr<const Film>, cxml::ConstNodePtr); - Content (boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >); virtual ~Content () {} /** Examine the content to establish digest, frame rates and any other diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h index eceafa105..769857fd3 100644 --- a/src/lib/exceptions.h +++ b/src/lib/exceptions.h @@ -81,14 +81,6 @@ private: boost::filesystem::path _file; }; -class JoinError : public std::runtime_error -{ -public: - explicit JoinError (std::string s) - : std::runtime_error (s) - {} -}; - /** @class OpenFileError. * @brief Indicates that some error occurred when trying to open a file. */ diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index dd4ed7063..7a821a04e 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -128,67 +128,6 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, cxml::ConstNodePtr no } -FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<shared_ptr<Content> > c) - : Content (film, c) -{ - vector<shared_ptr<Content> >::const_iterator i = c.begin (); - - bool need_video = false; - bool need_audio = false; - bool need_caption = false; - - if (i != c.end ()) { - need_video = static_cast<bool> ((*i)->video); - need_audio = static_cast<bool> ((*i)->audio); - need_caption = static_cast<bool> ((*i)->caption); - } - - while (i != c.end ()) { - if (need_video != static_cast<bool> ((*i)->video)) { - throw JoinError (_("Content to be joined must all have or not have video")); - } - if (need_audio != static_cast<bool> ((*i)->audio)) { - throw JoinError (_("Content to be joined must all have or not have audio")); - } - if (need_caption != static_cast<bool> ((*i)->caption)) { - throw JoinError (_("Content to be joined must all have or not have captions")); - } - ++i; - } - - if (need_video) { - video.reset (new VideoContent (this, c)); - } - if (need_audio) { - audio.reset (new AudioContent (this, c)); - } - if (need_caption) { - caption.reset (new CaptionContent (this, c)); - } - - shared_ptr<FFmpegContent> ref = dynamic_pointer_cast<FFmpegContent> (c[0]); - DCPOMATIC_ASSERT (ref); - - for (size_t i = 0; i < c.size(); ++i) { - shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c[i]); - if (fc->caption && fc->caption->use() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) { - throw JoinError (_("Content to be joined must use the same subtitle stream.")); - } - } - - /* XXX: should probably check that more of the stuff below is the same in *this and ref */ - - _subtitle_streams = ref->subtitle_streams (); - _subtitle_stream = ref->subtitle_stream (); - _first_video = ref->_first_video; - _filters = ref->_filters; - _color_range = ref->_color_range; - _color_primaries = ref->_color_primaries; - _color_trc = ref->_color_trc; - _colorspace = ref->_colorspace; - _bits_per_pixel = ref->_bits_per_pixel; -} - void FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const { diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index 64f6f9ff8..21f5d4680 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -48,7 +48,6 @@ class FFmpegContent : public Content public: FFmpegContent (boost::shared_ptr<const Film>, boost::filesystem::path); FFmpegContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int version, std::list<std::string> &); - FFmpegContent (boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >); boost::shared_ptr<FFmpegContent> shared_from_this () { return boost::dynamic_pointer_cast<FFmpegContent> (Content::shared_from_this ()); diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index d3ba6c1ab..0dba55525 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -154,56 +154,6 @@ VideoContent::VideoContent (Content* parent, cxml::ConstNodePtr node, int versio } } -VideoContent::VideoContent (Content* parent, vector<shared_ptr<Content> > c) - : ContentPart (parent) - , _length (0) - , _yuv (false) -{ - shared_ptr<VideoContent> ref = c[0]->video; - DCPOMATIC_ASSERT (ref); - - for (size_t i = 1; i < c.size(); ++i) { - - if (c[i]->video->size() != ref->size()) { - throw JoinError (_("Content to be joined must have the same picture size.")); - } - - if (c[i]->video->frame_type() != ref->frame_type()) { - throw JoinError (_("Content to be joined must have the same video frame type.")); - } - - if (c[i]->video->crop() != ref->crop()) { - throw JoinError (_("Content to be joined must have the same crop.")); - } - - if (c[i]->video->scale() != ref->scale()) { - throw JoinError (_("Content to be joined must have the same scale setting.")); - } - - if (c[i]->video->colour_conversion() != ref->colour_conversion()) { - throw JoinError (_("Content to be joined must have the same colour conversion.")); - } - - if (c[i]->video->fade_in() != ref->fade_in() || c[i]->video->fade_out() != ref->fade_out()) { - throw JoinError (_("Content to be joined must have the same fades.")); - } - - _length += c[i]->video->length (); - - if (c[i]->video->yuv ()) { - _yuv = true; - } - } - - _size = ref->size (); - _frame_type = ref->frame_type (); - _crop = ref->crop (); - _scale = ref->scale (); - _colour_conversion = ref->colour_conversion (); - _fade_in = ref->fade_in (); - _fade_out = ref->fade_out (); -} - void VideoContent::as_xml (xmlpp::Node* node) const { diff --git a/src/lib/video_content.h b/src/lib/video_content.h index 774210c13..1fc87bb9b 100644 --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -52,7 +52,6 @@ class VideoContent : public ContentPart, public boost::enable_shared_from_this<V { public: explicit VideoContent (Content* parent); - VideoContent (Content* parent, std::vector<boost::shared_ptr<Content> >); void as_xml (xmlpp::Node *) const; std::string technical_summary () const; |
