diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-05-13 14:43:27 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-05-18 11:50:29 +0100 |
| commit | 29fe2d3a4c347e15b987f9e61e56d22a21d4678f (patch) | |
| tree | 910b7afc8a109733edd76befc0d17e9be902fb1b /src/lib | |
| parent | 640a1ef73e575fe891a420dec392dace8b1a0255 (diff) | |
Remove unnecessary Film variable in ContentPart.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/audio_content.cc | 25 | ||||
| -rw-r--r-- | src/lib/audio_content.h | 8 | ||||
| -rw-r--r-- | src/lib/content_part.h | 4 | ||||
| -rw-r--r-- | src/lib/dcp_content.cc | 12 | ||||
| -rw-r--r-- | src/lib/dcp_subtitle_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 18 | ||||
| -rw-r--r-- | src/lib/image_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/sndfile_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/subtitle_content.cc | 17 | ||||
| -rw-r--r-- | src/lib/subtitle_content.h | 8 | ||||
| -rw-r--r-- | src/lib/text_subtitle_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/video_content.cc | 32 | ||||
| -rw-r--r-- | src/lib/video_content.h | 8 |
13 files changed, 67 insertions, 81 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index 540279a95..6cce9536e 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -48,8 +48,8 @@ int const AudioContentProperty::STREAMS = 200; int const AudioContentProperty::GAIN = 201; int const AudioContentProperty::DELAY = 202; -AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film) - : ContentPart (parent, film) +AudioContent::AudioContent (Content* parent) + : ContentPart (parent) , _gain (0) , _delay (Config::instance()->default_audio_delay ()) { @@ -57,17 +57,17 @@ AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film) } shared_ptr<AudioContent> -AudioContent::from_xml (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node) +AudioContent::from_xml (Content* parent, cxml::ConstNodePtr node) { if (!node->optional_number_child<double> ("AudioGain")) { return shared_ptr<AudioContent> (); } - return shared_ptr<AudioContent> (new AudioContent (parent, film, node)); + return shared_ptr<AudioContent> (new AudioContent (parent, node)); } -AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node) - : ContentPart (parent, film) +AudioContent::AudioContent (Content* parent, cxml::ConstNodePtr node) + : ContentPart (parent) { _gain = node->number_child<double> ("AudioGain"); _delay = node->number_child<int> ("AudioDelay"); @@ -79,8 +79,8 @@ AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film, cxml:: } } -AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film, vector<shared_ptr<Content> > c) - : ContentPart (parent, film) +AudioContent::AudioContent (Content* parent, vector<shared_ptr<Content> > c) + : ContentPart (parent) { shared_ptr<AudioContent> ref = c[0]->audio; DCPOMATIC_ASSERT (ref); @@ -187,9 +187,7 @@ AudioContent::resampled_frame_rate () const /* Resample to a DCI-approved sample rate */ double t = has_rate_above_48k() ? 96000 : 48000; - shared_ptr<const Film> film = _film.lock (); - DCPOMATIC_ASSERT (film); - FrameRateChange frc (_parent->active_video_frame_rate(), film->video_frame_rate()); + FrameRateChange frc (_parent->active_video_frame_rate(), _parent->film()->video_frame_rate()); /* Compensate if the DCP is being run at a different frame rate to the source; that is, if the video is run such that it will @@ -297,10 +295,7 @@ AudioContent::add_properties (list<UserProperty>& p) const p.push_back (UserProperty (_("Audio"), _("Content audio frame rate"), stream->frame_rate(), _("Hz"))); } - shared_ptr<const Film> film = _film.lock (); - DCPOMATIC_ASSERT (film); - - FrameRateChange const frc (_parent->active_video_frame_rate(), film->video_frame_rate()); + FrameRateChange const frc (_parent->active_video_frame_rate(), _parent->film()->video_frame_rate()); ContentTime const c (_parent->full_length(), frc); p.push_back ( diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h index e196e15c2..f6cb447f9 100644 --- a/src/lib/audio_content.h +++ b/src/lib/audio_content.h @@ -42,8 +42,8 @@ public: class AudioContent : public ContentPart { public: - AudioContent (Content* parent, boost::shared_ptr<const Film>); - AudioContent (Content* parent, boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >); + AudioContent (Content* parent); + AudioContent (Content* parent, std::vector<boost::shared_ptr<Content> >); void as_xml (xmlpp::Node *) const; std::string technical_summary () const; @@ -81,11 +81,11 @@ public: void add_properties (std::list<UserProperty> &) const; - static boost::shared_ptr<AudioContent> from_xml (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr); + static boost::shared_ptr<AudioContent> from_xml (Content* parent, cxml::ConstNodePtr); private: - AudioContent (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr); + AudioContent (Content* parent, cxml::ConstNodePtr); /** Gain to apply to audio in dB */ double _gain; diff --git a/src/lib/content_part.h b/src/lib/content_part.h index dbc523239..98e9a6d1c 100644 --- a/src/lib/content_part.h +++ b/src/lib/content_part.h @@ -30,9 +30,8 @@ class Film; class ContentPart { public: - ContentPart (Content* parent, boost::shared_ptr<const Film> film) + ContentPart (Content* parent) : _parent (parent) - , _film (film) {} protected: @@ -65,7 +64,6 @@ protected: } Content* _parent; - boost::weak_ptr<const Film> _film; mutable boost::mutex _mutex; }; diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 83374fc30..b28e91dd5 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -62,8 +62,8 @@ DCPContent::DCPContent (shared_ptr<const Film> film, boost::filesystem::path p) , _reference_audio (false) , _reference_subtitle (false) { - video.reset (new VideoContent (this, film)); - audio.reset (new AudioContent (this, film)); + video.reset (new VideoContent (this)); + audio.reset (new AudioContent (this)); read_directory (p); set_default_colour_conversion (); @@ -72,9 +72,9 @@ DCPContent::DCPContent (shared_ptr<const Film> film, boost::filesystem::path p) DCPContent::DCPContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) : Content (film, node) { - video = VideoContent::from_xml (this, film, node, version); - audio = AudioContent::from_xml (this, film, node); - subtitle = SubtitleContent::from_xml (this, film, node, version); + video = VideoContent::from_xml (this, node, version); + audio = AudioContent::from_xml (this, node); + subtitle = SubtitleContent::from_xml (this, node, version); audio->set_stream ( AudioStreamPtr ( @@ -138,7 +138,7 @@ DCPContent::examine (shared_ptr<Job> job) boost::mutex::scoped_lock lm (_mutex); _name = examiner->name (); if (examiner->has_subtitles ()) { - subtitle.reset (new SubtitleContent (this, film())); + subtitle.reset (new SubtitleContent (this)); } _encrypted = examiner->encrypted (); _kdm_valid = examiner->kdm_valid (); diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc index a806c9cbd..bd5d5d70e 100644 --- a/src/lib/dcp_subtitle_content.cc +++ b/src/lib/dcp_subtitle_content.cc @@ -38,14 +38,14 @@ using boost::dynamic_pointer_cast; DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path) : Content (film, path) { - subtitle.reset (new SubtitleContent (this, film)); + subtitle.reset (new SubtitleContent (this)); } DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) : Content (film, node) , _length (node->number_child<ContentTime::Type> ("Length")) { - subtitle = SubtitleContent::from_xml (this, film, node, version); + subtitle = SubtitleContent::from_xml (this, node, version); } void diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 628c47b35..9a3348301 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -70,9 +70,9 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, boost::filesystem::pa FFmpegContent::FFmpegContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version, list<string>& notes) : Content (film, node) { - video = VideoContent::from_xml (this, film, node, version); - audio = AudioContent::from_xml (this, film, node); - subtitle = SubtitleContent::from_xml (this, film, node, version); + video = VideoContent::from_xml (this, node, version); + audio = AudioContent::from_xml (this, node); + subtitle = SubtitleContent::from_xml (this, node, version); list<cxml::NodePtr> c = node->node_children ("SubtitleStream"); for (list<cxml::NodePtr>::const_iterator i = c.begin(); i != c.end(); ++i) { @@ -120,9 +120,9 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, cxml::ConstNodePtr no FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<boost::shared_ptr<Content> > c) : Content (film, c) { - video.reset (new VideoContent (this, film, c)); - audio.reset (new AudioContent (this, film, c)); - subtitle.reset (new SubtitleContent (this, film, c)); + video.reset (new VideoContent (this, c)); + audio.reset (new AudioContent (this, c)); + subtitle.reset (new SubtitleContent (this, c)); shared_ptr<FFmpegContent> ref = dynamic_pointer_cast<FFmpegContent> (c[0]); DCPOMATIC_ASSERT (ref); @@ -208,7 +208,7 @@ FFmpegContent::examine (shared_ptr<Job> job) shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer (shared_from_this (), job)); if (examiner->has_video ()) { - video.reset (new VideoContent (this, film ())); + video.reset (new VideoContent (this)); video->take_from_examiner (examiner); set_default_colour_conversion (); } @@ -226,7 +226,7 @@ FFmpegContent::examine (shared_ptr<Job> job) } if (!examiner->audio_streams().empty ()) { - audio.reset (new AudioContent (this, film ())); + audio.reset (new AudioContent (this)); BOOST_FOREACH (shared_ptr<FFmpegAudioStream> i, examiner->audio_streams ()) { audio->add_stream (i); @@ -240,7 +240,7 @@ FFmpegContent::examine (shared_ptr<Job> job) _subtitle_streams = examiner->subtitle_streams (); if (!_subtitle_streams.empty ()) { - subtitle.reset (new SubtitleContent (this, film ())); + subtitle.reset (new SubtitleContent (this)); _subtitle_stream = _subtitle_streams.front (); } diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc index ef82b3779..6d1738419 100644 --- a/src/lib/image_content.cc +++ b/src/lib/image_content.cc @@ -41,7 +41,7 @@ using boost::shared_ptr; ImageContent::ImageContent (shared_ptr<const Film> film, boost::filesystem::path p) : Content (film) { - video.reset (new VideoContent (this, film)); + video.reset (new VideoContent (this)); if (boost::filesystem::is_regular_file (p) && valid_image_file (p)) { _paths.push_back (p); @@ -66,7 +66,7 @@ ImageContent::ImageContent (shared_ptr<const Film> film, boost::filesystem::path ImageContent::ImageContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) : Content (film, node) { - video = VideoContent::from_xml (this, film, node, version); + video = VideoContent::from_xml (this, node, version); } string diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc index 81e467d1d..aa31f52c0 100644 --- a/src/lib/sndfile_content.cc +++ b/src/lib/sndfile_content.cc @@ -41,13 +41,13 @@ using boost::shared_ptr; SndfileContent::SndfileContent (shared_ptr<const Film> film, boost::filesystem::path p) : Content (film, p) { - audio.reset (new AudioContent (this, film)); + audio.reset (new AudioContent (this)); } SndfileContent::SndfileContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) : Content (film, node) { - audio = AudioContent::from_xml (this, film, node); + audio = AudioContent::from_xml (this, node); if (audio) { audio->set_stream ( diff --git a/src/lib/subtitle_content.cc b/src/lib/subtitle_content.cc index 89953b0e5..01db0cee6 100644 --- a/src/lib/subtitle_content.cc +++ b/src/lib/subtitle_content.cc @@ -24,7 +24,6 @@ #include "font.h" #include "raw_convert.h" #include "content.h" -#include "film.h" #include <libcxml/cxml.h> #include <libxml++/libxml++.h> #include <boost/foreach.hpp> @@ -51,8 +50,8 @@ int const SubtitleContentProperty::COLOUR = 508; int const SubtitleContentProperty::OUTLINE = 509; int const SubtitleContentProperty::OUTLINE_COLOUR = 510; -SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film) - : ContentPart (parent, film) +SubtitleContent::SubtitleContent (Content* parent) + : ContentPart (parent) , _use (false) , _burn (false) , _x_offset (0) @@ -67,17 +66,17 @@ SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film) } shared_ptr<SubtitleContent> -SubtitleContent::from_xml (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) +SubtitleContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version) { if (!node->optional_number_child<double>("SubtitleXOffset") && !node->optional_number_child<double>("SubtitleOffset")) { return shared_ptr<SubtitleContent> (); } - return shared_ptr<SubtitleContent> (new SubtitleContent (parent, film, node, version)); + return shared_ptr<SubtitleContent> (new SubtitleContent (parent, node, version)); } -SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) - : ContentPart (parent, film) +SubtitleContent::SubtitleContent (Content* parent, cxml::ConstNodePtr node, int version) + : ContentPart (parent) , _use (false) , _burn (false) , _x_offset (0) @@ -125,8 +124,8 @@ SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film, connect_to_fonts (); } -SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film, vector<shared_ptr<Content> > c) - : ContentPart (parent, film) +SubtitleContent::SubtitleContent (Content* parent, vector<shared_ptr<Content> > c) + : ContentPart (parent) { shared_ptr<SubtitleContent> ref = c[0]->subtitle; DCPOMATIC_ASSERT (ref); diff --git a/src/lib/subtitle_content.h b/src/lib/subtitle_content.h index db2286339..5b8f9fc71 100644 --- a/src/lib/subtitle_content.h +++ b/src/lib/subtitle_content.h @@ -46,8 +46,8 @@ public: class SubtitleContent : public ContentPart { public: - SubtitleContent (Content* parent, boost::shared_ptr<const Film>); - SubtitleContent (Content* parent, boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >); + SubtitleContent (Content* parent); + SubtitleContent (Content* parent, std::vector<boost::shared_ptr<Content> >); void as_xml (xmlpp::Node *) const; std::string identifier () const; @@ -128,7 +128,7 @@ public: return _outline_colour; } - static boost::shared_ptr<SubtitleContent> from_xml (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr, int version); + static boost::shared_ptr<SubtitleContent> from_xml (Content* parent, cxml::ConstNodePtr, int version); protected: /** subtitle language (e.g. "German") or empty if it is not known */ @@ -137,7 +137,7 @@ protected: private: friend struct ffmpeg_pts_offset_test; - SubtitleContent (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr, int version); + SubtitleContent (Content* parent, cxml::ConstNodePtr, int version); void font_changed (); void connect_to_fonts (); diff --git a/src/lib/text_subtitle_content.cc b/src/lib/text_subtitle_content.cc index 4fdd690c3..bb5ade0c4 100644 --- a/src/lib/text_subtitle_content.cc +++ b/src/lib/text_subtitle_content.cc @@ -38,14 +38,14 @@ std::string const TextSubtitleContent::font_id = "font"; TextSubtitleContent::TextSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path) : Content (film, path) { - subtitle.reset (new SubtitleContent (this, film)); + subtitle.reset (new SubtitleContent (this)); } TextSubtitleContent::TextSubtitleContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) : Content (film, node) , _length (node->number_child<ContentTime::Type> ("Length")) { - subtitle = SubtitleContent::from_xml (this, film, node, version); + subtitle = SubtitleContent::from_xml (this, node, version); } void diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 75d94510a..fce90ad7b 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -39,7 +39,7 @@ #include "i18n.h" -#define LOG_GENERAL(...) film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); +#define LOG_GENERAL(...) _parent->film()->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); int const VideoContentProperty::SIZE = 0; int const VideoContentProperty::FRAME_TYPE = 1; @@ -63,8 +63,8 @@ using boost::shared_ptr; using boost::optional; using boost::dynamic_pointer_cast; -VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film) - : ContentPart (parent, film) +VideoContent::VideoContent (Content* parent) + : ContentPart (parent) , _length (0) , _frame_type (VIDEO_FRAME_TYPE_2D) , _scale (VideoContentScale (Ratio::from_id ("178"))) @@ -76,17 +76,17 @@ VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film) } shared_ptr<VideoContent> -VideoContent::from_xml (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) +VideoContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version) { if (!node->optional_number_child<int> ("VideoWidth")) { return shared_ptr<VideoContent> (); } - return shared_ptr<VideoContent> (new VideoContent (parent, film, node, version)); + return shared_ptr<VideoContent> (new VideoContent (parent, node, version)); } -VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) - : ContentPart (parent, film) +VideoContent::VideoContent (Content* parent, cxml::ConstNodePtr node, int version) + : ContentPart (parent) { _size.width = node->number_child<int> ("VideoWidth"); _size.height = node->number_child<int> ("VideoHeight"); @@ -129,8 +129,8 @@ VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film, cxml:: } } -VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film, vector<shared_ptr<Content> > c) - : ContentPart (parent, film) +VideoContent::VideoContent (Content* parent, vector<shared_ptr<Content> > c) + : ContentPart (parent) , _length (0) , _yuv (false) { @@ -222,8 +222,6 @@ VideoContent::take_from_examiner (shared_ptr<VideoExaminer> d) ); } - shared_ptr<const Film> film = _film.lock (); - DCPOMATIC_ASSERT (film); LOG_GENERAL ("Video length obtained from header as %1 frames", _length); if (d->video_frame_rate()) { @@ -301,8 +299,7 @@ VideoContent::size_after_crop () const void VideoContent::scale_and_crop_to_fit_width () { - shared_ptr<const Film> film = _film.lock (); - DCPOMATIC_ASSERT (film); + shared_ptr<const Film> film = _parent->film (); set_scale (VideoContentScale (film->container ())); int const crop = max (0, int (size().height - double (film->frame_size().height) * size().width / film->frame_size().width)); @@ -315,8 +312,7 @@ VideoContent::scale_and_crop_to_fit_width () void VideoContent::scale_and_crop_to_fit_height () { - shared_ptr<const Film> film = _film.lock (); - DCPOMATIC_ASSERT (film); + shared_ptr<const Film> film = _parent->film (); set_scale (VideoContentScale (film->container ())); int const crop = max (0, int (size().width - double (film->frame_size().width) * size().height / film->frame_size().height)); @@ -332,8 +328,7 @@ VideoContent::fade (Frame f) const { DCPOMATIC_ASSERT (f >= 0); - shared_ptr<const Film> film = _film.lock (); - DCPOMATIC_ASSERT (film); + shared_ptr<const Film> film = _parent->film (); double const vfr = _parent->active_video_frame_rate (); @@ -384,8 +379,7 @@ VideoContent::processing_description () const d << " (" << fixed << setprecision(2) << cropped.ratio () << ":1)\n"; } - shared_ptr<const Film> film = _film.lock (); - DCPOMATIC_ASSERT (film); + shared_ptr<const Film> film = _parent->film (); dcp::Size const container_size = film->frame_size (); dcp::Size const scaled = scale().size (shared_from_this(), container_size, container_size); diff --git a/src/lib/video_content.h b/src/lib/video_content.h index ef54a6be4..7d24b30ff 100644 --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@ -50,8 +50,8 @@ public: class VideoContent : public ContentPart, public boost::enable_shared_from_this<VideoContent> { public: - VideoContent (Content* parent, boost::shared_ptr<const Film>); - VideoContent (Content* parent, boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >); + VideoContent (Content* parent); + VideoContent (Content* parent, std::vector<boost::shared_ptr<Content> >); void as_xml (xmlpp::Node *) const; std::string technical_summary () const; @@ -166,7 +166,7 @@ public: void take_from_examiner (boost::shared_ptr<VideoExaminer>); void add_properties (std::list<UserProperty> &) const; - static boost::shared_ptr<VideoContent> from_xml (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr, int); + static boost::shared_ptr<VideoContent> from_xml (Content* parent, cxml::ConstNodePtr, int); private: @@ -175,7 +175,7 @@ private: friend struct best_dcp_frame_rate_test_double; friend struct audio_sampling_rate_test; - VideoContent (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr, int); + VideoContent (Content* parent, cxml::ConstNodePtr, int); void setup_default_colour_conversion (); Frame _length; |
