From 254b3044d72de6b033d7c584f5abd2b9aa70aad5 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 21 Nov 2018 01:59:04 +0000 Subject: [PATCH] Take Film pointer out of Content. --- src/lib/analyse_audio_job.cc | 4 +- src/lib/atmos_mxf_content.cc | 18 ++-- src/lib/atmos_mxf_content.h | 8 +- src/lib/audio_content.cc | 28 +++---- src/lib/audio_content.h | 8 +- src/lib/audio_decoder.cc | 24 +++--- src/lib/audio_decoder.h | 9 +- src/lib/content.cc | 58 +++++-------- src/lib/content.h | 30 +++---- src/lib/content_factory.cc | 42 +++++----- src/lib/content_factory.h | 2 +- src/lib/dcp.cc | 2 +- src/lib/dcp_content.cc | 75 ++++++++--------- src/lib/dcp_content.h | 21 ++--- src/lib/dcp_decoder.cc | 53 +++++++----- src/lib/dcp_decoder.h | 16 ++-- src/lib/dcp_subtitle_content.cc | 16 ++-- src/lib/dcp_subtitle_content.h | 8 +- src/lib/dcp_subtitle_decoder.cc | 10 +-- src/lib/dcp_subtitle_decoder.h | 6 +- src/lib/decoder.cc | 16 ++-- src/lib/decoder.h | 7 +- src/lib/decoder_factory.cc | 14 ++-- src/lib/decoder_factory.h | 2 +- src/lib/decoder_part.cc | 3 +- src/lib/decoder_part.h | 6 +- src/lib/empty.cc | 6 +- src/lib/empty.h | 2 +- src/lib/examine_content_job.cc | 2 +- src/lib/ffmpeg.cc | 6 +- src/lib/ffmpeg_content.cc | 30 +++---- src/lib/ffmpeg_content.h | 12 +-- src/lib/ffmpeg_decoder.cc | 58 ++++++------- src/lib/ffmpeg_decoder.h | 14 ++-- src/lib/film.cc | 24 +++--- src/lib/image_content.cc | 22 ++--- src/lib/image_content.h | 8 +- src/lib/image_decoder.cc | 14 ++-- src/lib/image_decoder.h | 6 +- src/lib/log.cc | 2 + src/lib/log.h | 2 + src/lib/overlaps.cc | 4 +- src/lib/overlaps.h | 3 +- src/lib/player.cc | 54 ++++++------ src/lib/player_video.cc | 4 +- src/lib/player_video.h | 3 +- src/lib/playlist.cc | 89 +++++++++++--------- src/lib/playlist.h | 25 +++--- src/lib/string_text_file_content.cc | 16 ++-- src/lib/string_text_file_content.h | 8 +- src/lib/string_text_file_decoder.cc | 10 +-- src/lib/string_text_file_decoder.h | 7 +- src/lib/text_decoder.cc | 3 +- src/lib/text_decoder.h | 3 +- src/lib/video_content.cc | 25 +++--- src/lib/video_content.h | 10 +-- src/lib/video_decoder.cc | 8 +- src/lib/video_decoder.h | 7 +- src/lib/video_mxf_content.cc | 18 ++-- src/lib/video_mxf_content.h | 8 +- src/lib/video_mxf_decoder.cc | 15 ++-- src/lib/video_mxf_decoder.h | 6 +- src/tools/dcpomatic_player.cc | 12 ++- src/wx/audio_dialog.cc | 2 +- src/wx/audio_panel.cc | 6 +- src/wx/content_menu.cc | 6 +- src/wx/content_panel.cc | 6 +- src/wx/controls.cc | 8 +- src/wx/film_viewer.cc | 2 +- src/wx/player_information.cc | 4 +- src/wx/subtitle_appearance_dialog.cc | 17 ++-- src/wx/subtitle_appearance_dialog.h | 4 +- src/wx/text_panel.cc | 6 +- src/wx/text_view.cc | 2 +- src/wx/timeline.cc | 30 ++++--- src/wx/timeline_content_view.cc | 4 +- src/wx/timing_panel.cc | 30 +++---- src/wx/video_panel.cc | 12 +-- test/4k_test.cc | 2 +- test/audio_analysis_test.cc | 12 +-- test/audio_delay_test.cc | 2 +- test/audio_processor_test.cc | 2 +- test/butler_test.cc | 4 +- test/closed_caption_test.cc | 8 +- test/content_test.cc | 12 +-- test/dcp_playback_test.cc | 2 +- test/dcp_subtitle_test.cc | 26 +++--- test/digest_test.cc | 6 +- test/empty_test.cc | 20 ++--- test/ffmpeg_audio_only_test.cc | 2 +- test/ffmpeg_audio_test.cc | 6 +- test/ffmpeg_dcp_test.cc | 2 +- test/ffmpeg_decoder_seek_test.cc | 13 ++- test/ffmpeg_decoder_sequential_test.cc | 2 +- test/ffmpeg_encoder_test.cc | 42 +++++----- test/ffmpeg_examiner_test.cc | 2 +- test/ffmpeg_pts_offset_test.cc | 12 +-- test/file_naming_test.cc | 12 +-- test/frame_rate_test.cc | 24 +++--- test/import_dcp_test.cc | 4 +- test/interrupt_encoder_test.cc | 2 +- test/isdcf_name_test.cc | 4 +- test/j2k_bandwidth_test.cc | 2 +- test/optimise_stills_test.cc | 4 +- test/player_test.cc | 36 ++++---- test/recover_test.cc | 6 +- test/reels_test.cc | 50 +++++------ test/remake_id_test.cc | 6 +- test/remake_with_subtitle_test.cc | 2 +- test/repeat_frame_test.cc | 2 +- test/required_disk_space_test.cc | 4 +- test/scaling_test.cc | 2 +- test/silence_padding_test.cc | 2 +- test/skip_frame_test.cc | 2 +- test/srt_subtitle_test.cc | 16 ++-- test/ssa_subtitle_test.cc | 2 +- test/subtitle_charset_test.cc | 6 +- test/subtitle_reel_number_test.cc | 2 +- test/subtitle_trim_test.cc | 2 +- test/threed_test.cc | 16 ++-- test/time_calculation_test.cc | 112 ++++++++++++------------- test/torture_test.cc | 12 +-- test/upmixer_a_test.cc | 2 +- test/vf_kdm_test.cc | 6 +- test/vf_test.cc | 66 +++++++-------- test/video_content_scale_test.cc | 2 +- test/video_mxf_content_test.cc | 2 +- 127 files changed, 881 insertions(+), 877 deletions(-) diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc index 5994bc71a..8c9a90283 100644 --- a/src/lib/analyse_audio_job.cc +++ b/src/lib/analyse_audio_job.cc @@ -111,7 +111,7 @@ AnalyseAudioJob::run () player->set_play_referenced (); player->Audio.connect (bind (&AnalyseAudioJob::analyse, this, _1, _2)); - DCPTime const length = _playlist->length (); + DCPTime const length = _playlist->length (_film); Frame const len = DCPTime (length - _start).frames_round (_film->audio_frame_rate()); _samples_per_point = max (int64_t (1), len / _num_points); @@ -214,6 +214,6 @@ AnalyseAudioJob::analyse (shared_ptr b, DCPTime time) _done += frames; - DCPTime const length = _playlist->length (); + DCPTime const length = _playlist->length (_film); set_progress ((time.seconds() - _start.seconds()) / (length.seconds() - _start.seconds())); } diff --git a/src/lib/atmos_mxf_content.cc b/src/lib/atmos_mxf_content.cc index a42b10954..8300c2cd6 100644 --- a/src/lib/atmos_mxf_content.cc +++ b/src/lib/atmos_mxf_content.cc @@ -33,14 +33,14 @@ using std::list; using std::string; using boost::shared_ptr; -AtmosMXFContent::AtmosMXFContent (shared_ptr film, boost::filesystem::path path) - : Content (film, path) +AtmosMXFContent::AtmosMXFContent (boost::filesystem::path path) + : Content (path) { } -AtmosMXFContent::AtmosMXFContent (shared_ptr film, cxml::ConstNodePtr node, int) - : Content (film, node) +AtmosMXFContent::AtmosMXFContent (cxml::ConstNodePtr node, int) + : Content (node) { } @@ -65,10 +65,10 @@ AtmosMXFContent::valid_mxf (boost::filesystem::path path) } void -AtmosMXFContent::examine (shared_ptr job) +AtmosMXFContent::examine (shared_ptr film, shared_ptr job) { job->set_progress_unknown (); - Content::examine (job); + Content::examine (film, job); shared_ptr a (new dcp::AtmosAsset (path(0))); { @@ -91,8 +91,8 @@ AtmosMXFContent::as_xml (xmlpp::Node* node, bool with_paths) const } DCPTime -AtmosMXFContent::full_length () const +AtmosMXFContent::full_length (shared_ptr film) const { - FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate()); - return DCPTime::from_frames (llrint (_length * frc.factor()), film()->video_frame_rate()); + FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate()); + return DCPTime::from_frames (llrint (_length * frc.factor()), film->video_frame_rate()); } diff --git a/src/lib/atmos_mxf_content.h b/src/lib/atmos_mxf_content.h index 0f5225c2e..156ebc788 100644 --- a/src/lib/atmos_mxf_content.h +++ b/src/lib/atmos_mxf_content.h @@ -23,17 +23,17 @@ class AtmosMXFContent : public Content { public: - AtmosMXFContent (boost::shared_ptr film, boost::filesystem::path path); - AtmosMXFContent (boost::shared_ptr film, cxml::ConstNodePtr node, int version); + AtmosMXFContent (boost::filesystem::path path); + AtmosMXFContent (cxml::ConstNodePtr node, int version); boost::shared_ptr shared_from_this () { return boost::dynamic_pointer_cast (Content::shared_from_this ()); } - void examine (boost::shared_ptr job); + void examine (boost::shared_ptr film, boost::shared_ptr job); std::string summary () const; void as_xml (xmlpp::Node* node, bool with_path) const; - DCPTime full_length () const; + DCPTime full_length (boost::shared_ptr film) const; static bool valid_mxf (boost::filesystem::path path); diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index 59ba992ad..f33720119 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -194,12 +194,12 @@ AudioContent::mapping () const * that it is in sync with the active video content at its start time. */ int -AudioContent::resampled_frame_rate () const +AudioContent::resampled_frame_rate (shared_ptr film) const { /* Resample to a DCI-approved sample rate */ double t = has_rate_above_48k() ? 96000 : 48000; - FrameRateChange frc (_parent->active_video_frame_rate(), _parent->film()->video_frame_rate()); + FrameRateChange frc (_parent->active_video_frame_rate(film), 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 @@ -214,7 +214,7 @@ AudioContent::resampled_frame_rate () const } string -AudioContent::processing_description () const +AudioContent::processing_description (shared_ptr film) const { if (streams().empty ()) { return ""; @@ -233,7 +233,7 @@ AudioContent::processing_description () const optional common_frame_rate; BOOST_FOREACH (AudioStreamPtr i, streams()) { - if (i->frame_rate() != resampled_frame_rate()) { + if (i->frame_rate() != resampled_frame_rate(film)) { resampled = true; } else { not_resampled = true; @@ -250,14 +250,14 @@ AudioContent::processing_description () const } if (not_resampled && resampled) { - return String::compose (_("Some audio will be resampled to %1Hz"), resampled_frame_rate ()); + return String::compose (_("Some audio will be resampled to %1Hz"), resampled_frame_rate(film)); } if (!not_resampled && resampled) { if (same) { - return String::compose (_("Audio will be resampled from %1Hz to %2Hz"), common_frame_rate.get(), resampled_frame_rate ()); + return String::compose (_("Audio will be resampled from %1Hz to %2Hz"), common_frame_rate.get(), resampled_frame_rate(film)); } else { - return String::compose (_("Audio will be resampled to %1Hz"), resampled_frame_rate ()); + return String::compose (_("Audio will be resampled to %1Hz"), resampled_frame_rate(film)); } } @@ -295,7 +295,7 @@ AudioContent::channel_names () const } void -AudioContent::add_properties (list& p) const +AudioContent::add_properties (shared_ptr film, list& p) const { shared_ptr stream; if (streams().size() == 1) { @@ -307,8 +307,8 @@ AudioContent::add_properties (list& p) const p.push_back (UserProperty (UserProperty::AUDIO, _("Content audio sample rate"), stream->frame_rate(), _("Hz"))); } - FrameRateChange const frc (_parent->active_video_frame_rate(), _parent->film()->video_frame_rate()); - ContentTime const c (_parent->full_length(), frc); + FrameRateChange const frc (_parent->active_video_frame_rate(film), film->video_frame_rate()); + ContentTime const c (_parent->full_length(film), frc); p.push_back ( UserProperty (UserProperty::LENGTH, _("Full length in video frames at content rate"), c.frames_round(frc.source)) @@ -324,7 +324,7 @@ AudioContent::add_properties (list& p) const ); } - p.push_back (UserProperty (UserProperty::AUDIO, _("DCP sample rate"), resampled_frame_rate (), _("Hz"))); + p.push_back (UserProperty (UserProperty::AUDIO, _("DCP sample rate"), resampled_frame_rate(film), _("Hz"))); p.push_back (UserProperty (UserProperty::LENGTH, _("Full length in video frames at DCP rate"), c.frames_round (frc.dcp))); if (stream) { @@ -332,7 +332,7 @@ AudioContent::add_properties (list& p) const UserProperty ( UserProperty::LENGTH, _("Full length in audio samples at DCP rate"), - c.frames_round (resampled_frame_rate ()) + c.frames_round(resampled_frame_rate(film)) ) ); } @@ -397,9 +397,9 @@ AudioContent::take_settings_from (shared_ptr c) } void -AudioContent::modify_position (DCPTime& pos) const +AudioContent::modify_position (shared_ptr film, DCPTime& pos) const { - pos = pos.round (_parent->film()->audio_frame_rate()); + pos = pos.round (film->audio_frame_rate()); } void diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h index eec67b201..051fc8db8 100644 --- a/src/lib/audio_content.h +++ b/src/lib/audio_content.h @@ -52,7 +52,7 @@ public: AudioMapping mapping () const; void set_mapping (AudioMapping); - int resampled_frame_rate () const; + int resampled_frame_rate (boost::shared_ptr film) const; bool has_rate_above_48k () const; std::vector channel_names () const; @@ -69,7 +69,7 @@ public: return _delay; } - std::string processing_description () const; + std::string processing_description (boost::shared_ptr film) const; std::vector streams () const { boost::mutex::scoped_lock lm (_mutex); @@ -81,9 +81,9 @@ public: void set_streams (std::vector streams); AudioStreamPtr stream () const; - void add_properties (std::list &) const; + void add_properties (boost::shared_ptr film, std::list &) const; - void modify_position (DCPTime& pos) const; + void modify_position (boost::shared_ptr film, DCPTime& pos) const; void modify_trim_start (ContentTime& pos) const; static boost::shared_ptr from_xml (Content* parent, cxml::ConstNodePtr, int version); diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc index b4aa2bacd..95b3a130d 100644 --- a/src/lib/audio_decoder.cc +++ b/src/lib/audio_decoder.cc @@ -29,7 +29,7 @@ #include "i18n.h" -#define LOG_GENERAL(...) _log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); +#define LOG_GENERAL(...) dcpomatic_log->log (String::compose(__VA_ARGS__), LogEntry::TYPE_GENERAL); using std::cout; using std::map; @@ -37,8 +37,8 @@ using std::pair; using boost::shared_ptr; using boost::optional; -AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr content, shared_ptr log, bool fast) - : DecoderPart (parent, log) +AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr content, bool fast) + : DecoderPart (parent) , _content (content) , _fast (fast) { @@ -49,7 +49,7 @@ AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr cont } void -AudioDecoder::emit (AudioStreamPtr stream, shared_ptr data, ContentTime time) +AudioDecoder::emit (shared_ptr film, AudioStreamPtr stream, shared_ptr data, ContentTime time) { if (ignore ()) { return; @@ -66,7 +66,7 @@ AudioDecoder::emit (AudioStreamPtr stream, shared_ptr data, silence (_content->delay ()); } time += ContentTime::from_seconds (_content->delay() / 1000.0); - _positions[stream] = time.frames_round (_content->resampled_frame_rate ()); + _positions[stream] = time.frames_round (_content->resampled_frame_rate(film)); } shared_ptr resampler; @@ -74,15 +74,15 @@ AudioDecoder::emit (AudioStreamPtr stream, shared_ptr data, if (i != _resamplers.end ()) { resampler = i->second; } else { - if (stream->frame_rate() != _content->resampled_frame_rate()) { + if (stream->frame_rate() != _content->resampled_frame_rate(film)) { LOG_GENERAL ( "Creating new resampler from %1 to %2 with %3 channels", stream->frame_rate(), - _content->resampled_frame_rate(), + _content->resampled_frame_rate(film), stream->channels() ); - resampler.reset (new Resampler (stream->frame_rate(), _content->resampled_frame_rate(), stream->channels())); + resampler.reset (new Resampler (stream->frame_rate(), _content->resampled_frame_rate(film), stream->channels())); if (_fast) { resampler->set_fast (); } @@ -104,19 +104,19 @@ AudioDecoder::emit (AudioStreamPtr stream, shared_ptr data, /** @return Time just after the last thing that was emitted from a given stream */ ContentTime -AudioDecoder::stream_position (AudioStreamPtr stream) const +AudioDecoder::stream_position (shared_ptr film, AudioStreamPtr stream) const { PositionMap::const_iterator i = _positions.find (stream); DCPOMATIC_ASSERT (i != _positions.end ()); - return ContentTime::from_frames (i->second, _content->resampled_frame_rate()); + return ContentTime::from_frames (i->second, _content->resampled_frame_rate(film)); } ContentTime -AudioDecoder::position () const +AudioDecoder::position (shared_ptr film) const { optional p; for (PositionMap::const_iterator i = _positions.begin(); i != _positions.end(); ++i) { - ContentTime const ct = stream_position (i->first); + ContentTime const ct = stream_position (film, i->first); if (!p || ct < *p) { p = ct; } diff --git a/src/lib/audio_decoder.h b/src/lib/audio_decoder.h index 8765be426..50e361e8f 100644 --- a/src/lib/audio_decoder.h +++ b/src/lib/audio_decoder.h @@ -36,6 +36,7 @@ class AudioBuffers; class AudioContent; class AudioDecoderStream; class Log; +class Film; class Resampler; /** @class AudioDecoder. @@ -44,14 +45,14 @@ class Resampler; class AudioDecoder : public boost::enable_shared_from_this, public DecoderPart { public: - AudioDecoder (Decoder* parent, boost::shared_ptr content, boost::shared_ptr log, bool fast); + AudioDecoder (Decoder* parent, boost::shared_ptr content, bool fast); - ContentTime position () const; - void emit (AudioStreamPtr stream, boost::shared_ptr, ContentTime); + ContentTime position (boost::shared_ptr film) const; + void emit (boost::shared_ptr film, AudioStreamPtr stream, boost::shared_ptr, ContentTime); void seek (); void flush (); - ContentTime stream_position (AudioStreamPtr stream) const; + ContentTime stream_position (boost::shared_ptr film, AudioStreamPtr stream) const; /** @return Number of frames of data that were accepted */ boost::signals2::signal Data; diff --git a/src/lib/content.cc b/src/lib/content.cc index 6f5d23fd5..5139eb4cc 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -60,9 +60,8 @@ int const ContentProperty::TRIM_START = 403; int const ContentProperty::TRIM_END = 404; int const ContentProperty::VIDEO_FRAME_RATE = 405; -Content::Content (shared_ptr film) - : _film (film) - , _position (0) +Content::Content () + : _position (0) , _trim_start (0) , _trim_end (0) , _change_signals_frequent (false) @@ -70,9 +69,8 @@ Content::Content (shared_ptr film) } -Content::Content (shared_ptr film, DCPTime p) - : _film (film) - , _position (p) +Content::Content (DCPTime p) + : _position (p) , _trim_start (0) , _trim_end (0) , _change_signals_frequent (false) @@ -80,9 +78,8 @@ Content::Content (shared_ptr film, DCPTime p) } -Content::Content (shared_ptr film, boost::filesystem::path p) - : _film (film) - , _position (0) +Content::Content (boost::filesystem::path p) + : _position (0) , _trim_start (0) , _trim_end (0) , _change_signals_frequent (false) @@ -90,9 +87,8 @@ Content::Content (shared_ptr film, boost::filesystem::path p) add_path (p); } -Content::Content (shared_ptr film, cxml::ConstNodePtr node) - : _film (film) - , _change_signals_frequent (false) +Content::Content (cxml::ConstNodePtr node) + : _change_signals_frequent (false) { list path_children = node->node_children ("Path"); BOOST_FOREACH (cxml::NodePtr i, path_children) { @@ -113,9 +109,8 @@ Content::Content (shared_ptr film, cxml::ConstNodePtr node) _video_frame_rate = node->optional_number_child ("VideoFrameRate"); } -Content::Content (shared_ptr film, vector > c) - : _film (film) - , _position (c.front()->position ()) +Content::Content (vector > c) + : _position (c.front()->position ()) , _trim_start (c.front()->trim_start ()) , _trim_end (c.back()->trim_end ()) , _video_frame_rate (c.front()->video_frame_rate()) @@ -184,7 +179,7 @@ Content::calculate_digest () const } void -Content::examine (shared_ptr job) +Content::examine (shared_ptr, shared_ptr job) { if (job) { job->sub (_("Computing digest")); @@ -216,16 +211,16 @@ Content::signal_change (ChangeType c, int p) } void -Content::set_position (DCPTime p) +Content::set_position (shared_ptr film, DCPTime p) { /* video and audio content can modify its position */ if (video) { - video->modify_position (p); + video->modify_position (film, p); } if (audio) { - audio->modify_position (p); + audio->modify_position (film, p); } ChangeSignaller cc (this, ContentProperty::POSITION); @@ -275,13 +270,8 @@ Content::set_trim_end (ContentTime t) shared_ptr -Content::clone () const +Content::clone (shared_ptr film) const { - shared_ptr film = _film.lock (); - if (!film) { - return shared_ptr (); - } - /* This is a bit naughty, but I can't think of a compelling reason not to do it ... */ xmlpp::Document doc; xmlpp::Node* node = doc.create_root_node ("Content"); @@ -289,7 +279,7 @@ Content::clone () const /* notes is unused here (we assume) */ list notes; - return content_factory (film, cxml::NodePtr (new cxml::Node (node)), Film::current_state_version, notes); + return content_factory (film, cxml::NodePtr(new cxml::Node(node)), Film::current_state_version, notes); } string @@ -303,9 +293,9 @@ Content::technical_summary () const } DCPTime -Content::length_after_trim () const +Content::length_after_trim (shared_ptr film) const { - return max (DCPTime (), full_length() - DCPTime (trim_start() + trim_end(), film()->active_frame_rate_change (position ()))); + return max (DCPTime(), full_length(film) - DCPTime(trim_start() + trim_end(), film->active_frame_rate_change(position()))); } /** @return string which changes when something about this content changes which affects @@ -373,14 +363,6 @@ Content::user_properties () const return p; } -shared_ptr -Content::film () const -{ - shared_ptr film = _film.lock (); - DCPOMATIC_ASSERT (film); - return film; -} - /** @return DCP times of points within this content where a reel split could occur */ list Content::reel_split_points () const @@ -424,7 +406,7 @@ Content::unset_video_frame_rate () } double -Content::active_video_frame_rate () const +Content::active_video_frame_rate (shared_ptr film) const { { boost::mutex::scoped_lock lm (_mutex); @@ -437,8 +419,6 @@ Content::active_video_frame_rate () const prepared for any concurrent video content or perhaps just the DCP rate. */ - shared_ptr film = _film.lock (); - DCPOMATIC_ASSERT (film); return film->active_frame_rate_change(position()).source; } diff --git a/src/lib/content.h b/src/lib/content.h index 2eaa738d2..c6fa2c9f4 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -64,18 +64,18 @@ public: class Content : public boost::enable_shared_from_this, public Signaller, public boost::noncopyable { public: - explicit Content (boost::shared_ptr); - Content (boost::shared_ptr, DCPTime); - Content (boost::shared_ptr, boost::filesystem::path); - Content (boost::shared_ptr, cxml::ConstNodePtr); - Content (boost::shared_ptr, std::vector >); + explicit Content (); + Content (DCPTime); + Content (boost::filesystem::path); + Content (cxml::ConstNodePtr); + Content (std::vector >); virtual ~Content () {} /** Examine the content to establish digest, frame rates and any other * useful metadata. * @param job Job to use to report progress, or 0. */ - virtual void examine (boost::shared_ptr job); + virtual void examine (boost::shared_ptr film, boost::shared_ptr job); virtual void take_settings_from (boost::shared_ptr c); @@ -90,14 +90,14 @@ public: virtual std::string technical_summary () const; virtual void as_xml (xmlpp::Node *, bool with_paths) const; - virtual DCPTime full_length () const = 0; + virtual DCPTime full_length (boost::shared_ptr) const = 0; virtual std::string identifier () const; /** @return points at which to split this content when * REELTYPE_BY_VIDEO_CONTENT is in use. */ virtual std::list reel_split_points () const; - boost::shared_ptr clone () const; + boost::shared_ptr clone (boost::shared_ptr film) const; void set_paths (std::vector paths); @@ -134,7 +134,7 @@ public: return _digest; } - void set_position (DCPTime); + void set_position (boost::shared_ptr film, DCPTime); /** DCPTime that this content starts; i.e. the time that the first * bit of the content (trimmed or not) will happen. @@ -159,11 +159,11 @@ public: } /** @return Time immediately after the last thing in this content */ - DCPTime end () const { - return position() + length_after_trim(); + DCPTime end (boost::shared_ptr film) const { + return position() + length_after_trim(film); } - DCPTime length_after_trim () const; + DCPTime length_after_trim (boost::shared_ptr film) const; boost::optional video_frame_rate () const { boost::mutex::scoped_lock lm (_mutex); @@ -173,14 +173,12 @@ public: void set_video_frame_rate (double r); void unset_video_frame_rate (); - double active_video_frame_rate () const; + double active_video_frame_rate (boost::shared_ptr film) const; void set_change_signals_frequent (bool f) { _change_signals_frequent = f; } - boost::shared_ptr film () const; - std::list user_properties () const; std::string calculate_digest () const; @@ -199,8 +197,6 @@ protected: virtual void add_properties (std::list &) const; - boost::weak_ptr _film; - /** _mutex which should be used to protect accesses, as examine * jobs can update content state in threads other than the main one. */ diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc index 10486b0c3..934677c66 100644 --- a/src/lib/content_factory.cc +++ b/src/lib/content_factory.cc @@ -47,10 +47,9 @@ using std::list; using boost::shared_ptr; using boost::optional; -#define LOG_GENERAL(...) film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); +#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); /** Create a Content object from an XML node. - * @param film Film that the content will be in. * @param node XML description. * @param version XML state version. * @param notes A list to which is added descriptions of any non-critial warnings / messages. @@ -67,14 +66,14 @@ content_factory (shared_ptr film, cxml::ConstNodePtr node, int versi /* SndfileContent is now handled by the FFmpeg code rather than by separate libsndfile-based code. */ - content.reset (new FFmpegContent (film, node, version, notes)); + content.reset (new FFmpegContent (node, version, notes)); } else if (type == "Image") { - content.reset (new ImageContent (film, node, version)); + content.reset (new ImageContent (node, version)); } else if (type == "Sndfile") { /* SndfileContent is now handled by the FFmpeg code rather than by separate libsndfile-based code. */ - content.reset (new FFmpegContent (film, node, version, notes)); + content.reset (new FFmpegContent (node, version, notes)); content->audio->set_stream ( AudioStreamPtr ( @@ -88,20 +87,20 @@ content_factory (shared_ptr film, cxml::ConstNodePtr node, int versi ); } else if (type == "SubRip" || type == "TextSubtitle") { - content.reset (new StringTextFileContent (film, node, version)); + content.reset (new StringTextFileContent (node, version)); } else if (type == "DCP") { - content.reset (new DCPContent (film, node, version)); + content.reset (new DCPContent (node, version)); } else if (type == "DCPSubtitle") { - content.reset (new DCPSubtitleContent (film, node, version)); + content.reset (new DCPSubtitleContent (node, version)); } else if (type == "VideoMXF") { - content.reset (new VideoMXFContent (film, node, version)); + content.reset (new VideoMXFContent (node, version)); } else if (type == "AtmosMXF") { - content.reset (new AtmosMXFContent (film, node, version)); + content.reset (new AtmosMXFContent (node, version)); } /* See if this content should be nudged to start on a video frame */ DCPTime const old_pos = content->position(); - content->set_position(old_pos); + content->set_position(film, old_pos); if (old_pos != content->position()) { string note = _("Your project contains video content that was not aligned to a frame boundary."); note += " "; @@ -143,12 +142,11 @@ content_factory (shared_ptr film, cxml::ConstNodePtr node, int versi } /** Create some Content objects from a file or directory. - * @param film Film that the content will be in. * @param path File or directory. * @return Content objects. */ list > -content_factory (shared_ptr film, boost::filesystem::path path) +content_factory (boost::filesystem::path path) { list > content; @@ -193,10 +191,10 @@ content_factory (shared_ptr film, boost::filesystem::path path) } if (image_files > 0 && sound_files == 0) { - content.push_back (shared_ptr (new ImageContent (film, path))); + content.push_back (shared_ptr (new ImageContent(path))); } else if (image_files == 0 && sound_files > 0) { for (boost::filesystem::directory_iterator i(path); i != boost::filesystem::directory_iterator(); ++i) { - content.push_back (shared_ptr (new FFmpegContent (film, i->path()))); + content.push_back (shared_ptr (new FFmpegContent(i->path()))); } } @@ -208,26 +206,26 @@ content_factory (shared_ptr film, boost::filesystem::path path) transform (ext.begin(), ext.end(), ext.begin(), ::tolower); if (valid_image_file (path)) { - single.reset (new ImageContent (film, path)); + single.reset (new ImageContent(path)); } else if (ext == ".srt" || ext == ".ssa" || ext == ".ass") { - single.reset (new StringTextFileContent (film, path)); + single.reset (new StringTextFileContent(path)); } else if (ext == ".xml") { cxml::Document doc; doc.read_file (path); if (doc.root_name() == "DCinemaSecurityMessage") { throw KDMAsContentError (); } - single.reset (new DCPSubtitleContent (film, path)); + single.reset (new DCPSubtitleContent(path)); } else if (ext == ".mxf" && dcp::SMPTESubtitleAsset::valid_mxf (path)) { - single.reset (new DCPSubtitleContent (film, path)); + single.reset (new DCPSubtitleContent(path)); } else if (ext == ".mxf" && VideoMXFContent::valid_mxf (path)) { - single.reset (new VideoMXFContent (film, path)); + single.reset (new VideoMXFContent(path)); } else if (ext == ".mxf" && AtmosMXFContent::valid_mxf (path)) { - single.reset (new AtmosMXFContent (film, path)); + single.reset (new AtmosMXFContent(path)); } if (!single) { - single.reset (new FFmpegContent (film, path)); + single.reset (new FFmpegContent(path)); } content.push_back (single); diff --git a/src/lib/content_factory.h b/src/lib/content_factory.h index f712d9364..af77d9358 100644 --- a/src/lib/content_factory.h +++ b/src/lib/content_factory.h @@ -29,4 +29,4 @@ class Film; class Content; extern boost::shared_ptr content_factory (boost::shared_ptr, cxml::ConstNodePtr, int, std::list &); -extern std::list > content_factory (boost::shared_ptr, boost::filesystem::path); +extern std::list > content_factory (boost::filesystem::path); diff --git a/src/lib/dcp.cc b/src/lib/dcp.cc index 9db478330..1bf15ca24 100644 --- a/src/lib/dcp.cc +++ b/src/lib/dcp.cc @@ -35,7 +35,7 @@ using std::list; using std::string; using boost::shared_ptr; -#define LOG_GENERAL(...) _dcp_content->film()->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); +#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); /** Find all the CPLs in our directories, cross-add assets and return the CPLs */ list > diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index cc636b0bf..0bd28a9e3 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -64,11 +64,10 @@ int const DCPContentProperty::NAME = 605; int const DCPContentProperty::TEXTS = 606; int const DCPContentProperty::CPL = 607; -#define LOG_GENERAL(...) this->film()->log()->log(String::compose(__VA_ARGS__), LogEntry::TYPE_GENERAL); +#define LOG_GENERAL(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_GENERAL); -DCPContent::DCPContent (shared_ptr film, boost::filesystem::path p) - : Content (film) - , _encrypted (false) +DCPContent::DCPContent (boost::filesystem::path p) + : _encrypted (false) , _needs_assets (false) , _kdm_valid (false) , _reference_video (false) @@ -85,8 +84,8 @@ DCPContent::DCPContent (shared_ptr film, boost::filesystem::path p) } } -DCPContent::DCPContent (shared_ptr film, cxml::ConstNodePtr node, int version) - : Content (film, node) +DCPContent::DCPContent (cxml::ConstNodePtr node, int version) + : Content (node) { video = VideoContent::from_xml (this, node, version); audio = AudioContent::from_xml (this, node, version); @@ -176,7 +175,7 @@ DCPContent::read_directory (boost::filesystem::path p) } void -DCPContent::examine (shared_ptr job) +DCPContent::examine (shared_ptr film, shared_ptr job) { bool const needed_assets = needs_assets (); bool const needed_kdm = needs_kdm (); @@ -192,7 +191,7 @@ DCPContent::examine (shared_ptr job) if (job) { job->set_progress_unknown (); } - Content::examine (job); + Content::examine (film, job); shared_ptr examiner (new DCPExaminer (shared_from_this ())); @@ -214,7 +213,7 @@ DCPContent::examine (shared_ptr job) AudioStreamPtr as (new AudioStream (examiner->audio_frame_rate(), examiner->audio_length(), examiner->audio_channels())); audio->set_stream (as); AudioMapping m = as->mapping (); - film()->make_audio_mapping_default (m); + film->make_audio_mapping_default (m); as->set_mapping (m); } @@ -338,13 +337,13 @@ DCPContent::as_xml (xmlpp::Node* node, bool with_paths) const } DCPTime -DCPContent::full_length () const +DCPContent::full_length (shared_ptr film) const { if (!video) { return DCPTime(); } - FrameRateChange const frc (active_video_frame_rate (), film()->video_frame_rate ()); - return DCPTime::from_frames (llrint (video->length () * frc.factor ()), film()->video_frame_rate ()); + FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate()); + return DCPTime::from_frames (llrint(video->length() * frc.factor()), film->video_frame_rate()); } string @@ -406,14 +405,14 @@ DCPContent::directories () const } void -DCPContent::add_properties (list& p) const +DCPContent::add_properties (shared_ptr film, list& p) const { Content::add_properties (p); if (video) { video->add_properties (p); } if (audio) { - audio->add_properties (p); + audio->add_properties (film, p); } } @@ -460,7 +459,7 @@ DCPContent::set_reference_text (TextType type, bool r) } list -DCPContent::reels () const +DCPContent::reels (shared_ptr film) const { list reel_lengths = _reel_lengths; if (reel_lengths.empty ()) { @@ -470,7 +469,7 @@ DCPContent::reels () const reel_lengths = examiner->reel_lengths (); } catch (...) { /* Could not examine the DCP; guess reels */ - reel_lengths.push_back (length_after_trim().frames_round (film()->video_frame_rate ())); + reel_lengths.push_back (length_after_trim(film).frames_round(film->video_frame_rate())); } } @@ -485,10 +484,10 @@ DCPContent::reels () const BOOST_FOREACH (int64_t i, reel_lengths) { /* This reel runs from `pos' to `to' */ - DCPTime const to = pos + DCPTime::from_frames (i, film()->video_frame_rate()); + DCPTime const to = pos + DCPTime::from_frames (i, film->video_frame_rate()); if (to > position()) { - p.push_back (DCPTimePeriod (max(position(), pos), min(end(), to))); - if (to > end()) { + p.push_back (DCPTimePeriod (max(position(), pos), min(end(film), to))); + if (to > end(film)) { break; } } @@ -499,25 +498,25 @@ DCPContent::reels () const } list -DCPContent::reel_split_points () const +DCPContent::reel_split_points (shared_ptr film) const { list s; - BOOST_FOREACH (DCPTimePeriod i, reels()) { + BOOST_FOREACH (DCPTimePeriod i, reels(film)) { s.push_back (i.from); } return s; } bool -DCPContent::can_reference (function)> part, string overlapping, string& why_not) const +DCPContent::can_reference (shared_ptr film, function)> part, string overlapping, string& why_not) const { /* We must be using the same standard as the film */ if (_standard) { - if (_standard.get() == dcp::INTEROP && !film()->interop()) { + if (_standard.get() == dcp::INTEROP && !film->interop()) { /// TRANSLATORS: this string will follow "Cannot reference this DCP: " why_not = _("it is Interop and the film is set to SMPTE."); return false; - } else if (_standard.get() == dcp::SMPTE && film()->interop()) { + } else if (_standard.get() == dcp::SMPTE && film->interop()) { /// TRANSLATORS: this string will follow "Cannot reference this DCP: " why_not = _("it is SMPTE and the film is set to Interop."); return false; @@ -525,17 +524,17 @@ DCPContent::can_reference (function)> part, stri } /* And the same frame rate */ - if (!video_frame_rate() || (lrint(video_frame_rate().get()) != film()->video_frame_rate())) { + if (!video_frame_rate() || (lrint(video_frame_rate().get()) != film->video_frame_rate())) { /// TRANSLATORS: this string will follow "Cannot reference this DCP: " why_not = _("it has a different frame rate to the film."); return false; } - list const fr = film()->reels (); + list const fr = film->reels (); list reel_list; try { - reel_list = reels (); + reel_list = reels (film); } catch (dcp::DCPReadError) { /* We couldn't read the DCP; it's probably missing */ return false; @@ -555,7 +554,7 @@ DCPContent::can_reference (function)> part, stri } } - ContentList a = overlaps (film()->content(), part, position(), end()); + ContentList a = overlaps (film, film->content(), part, position(), end(film)); if (a.size() != 1 || a.front().get() != this) { why_not = overlapping; return false; @@ -571,7 +570,7 @@ bool check_video (shared_ptr c) } bool -DCPContent::can_reference_video (string& why_not) const +DCPContent::can_reference_video (shared_ptr film, string& why_not) const { if (!video) { why_not = _("There is no video in this DCP"); @@ -583,7 +582,7 @@ DCPContent::can_reference_video (string& why_not) const video_res = RESOLUTION_4K; } - if (film()->resolution() != video_res) { + if (film->resolution() != video_res) { if (video_res == RESOLUTION_4K) { /// TRANSLATORS: this string will follow "Cannot reference this DCP: " why_not = _("it is 4K and the film is 2K."); @@ -592,14 +591,14 @@ DCPContent::can_reference_video (string& why_not) const why_not = _("it is 2K and the film is 4K."); } return false; - } else if (film()->frame_size() != video->size()) { + } else if (film->frame_size() != video->size()) { /// TRANSLATORS: this string will follow "Cannot reference this DCP: " why_not = _("its video frame size differs from the film's."); return false; } /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - return can_reference (bind (&check_video, _1), _("it overlaps other video content; remove the other content."), why_not); + return can_reference (film, bind (&check_video, _1), _("it overlaps other video content; remove the other content."), why_not); } static @@ -609,11 +608,11 @@ bool check_audio (shared_ptr c) } bool -DCPContent::can_reference_audio (string& why_not) const +DCPContent::can_reference_audio (shared_ptr film, string& why_not) const { shared_ptr decoder; try { - decoder.reset (new DCPDecoder (shared_from_this(), film()->log(), false)); + decoder.reset (new DCPDecoder (shared_from_this(), false)); } catch (dcp::DCPReadError) { /* We couldn't read the DCP, so it's probably missing */ return false; @@ -634,7 +633,7 @@ DCPContent::can_reference_audio (string& why_not) const } /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - return can_reference (bind (&check_audio, _1), _("it overlaps other audio content; remove the other content."), why_not); + return can_reference (film, bind (&check_audio, _1), _("it overlaps other audio content; remove the other content."), why_not); } static @@ -644,11 +643,11 @@ bool check_text (shared_ptr c) } bool -DCPContent::can_reference_text (TextType type, string& why_not) const +DCPContent::can_reference_text (shared_ptr film, TextType type, string& why_not) const { shared_ptr decoder; try { - decoder.reset (new DCPDecoder (shared_from_this(), film()->log(), false)); + decoder.reset (new DCPDecoder (shared_from_this(), false)); } catch (dcp::DCPReadError) { /* We couldn't read the DCP, so it's probably missing */ return false; @@ -671,7 +670,7 @@ DCPContent::can_reference_text (TextType type, string& why_not) const } /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - return can_reference (bind (&check_text, _1), _("it overlaps other text content; remove the other content."), why_not); + return can_reference (film, bind (&check_text, _1), _("it overlaps other text content; remove the other content."), why_not); } void diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index 2a3ef46e8..874e1ee31 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -50,8 +50,8 @@ class ContentPart; class DCPContent : public Content { public: - DCPContent (boost::shared_ptr, boost::filesystem::path p); - DCPContent (boost::shared_ptr, cxml::ConstNodePtr, int version); + DCPContent (boost::filesystem::path p); + DCPContent (cxml::ConstNodePtr, int version); boost::shared_ptr shared_from_this () { return boost::dynamic_pointer_cast (Content::shared_from_this ()); @@ -61,9 +61,9 @@ public: return boost::dynamic_pointer_cast (Content::shared_from_this ()); } - DCPTime full_length () const; + DCPTime full_length (boost::shared_ptr film) const; - void examine (boost::shared_ptr); + void examine (boost::shared_ptr film, boost::shared_ptr); std::string summary () const; std::string technical_summary () const; void as_xml (xmlpp::Node *, bool with_paths) const; @@ -71,7 +71,7 @@ public: void take_settings_from (boost::shared_ptr c); void set_default_colour_conversion (); - std::list reel_split_points () const; + std::list reel_split_points (boost::shared_ptr film) const; std::vector directories () const; @@ -98,7 +98,7 @@ public: return _reference_video; } - bool can_reference_video (std::string &) const; + bool can_reference_video (boost::shared_ptr film, std::string &) const; void set_reference_audio (bool r); @@ -107,7 +107,7 @@ public: return _reference_audio; } - bool can_reference_audio (std::string &) const; + bool can_reference_audio (boost::shared_ptr film, std::string &) const; void set_reference_text (TextType type, bool r); @@ -119,7 +119,7 @@ public: return _reference_text[type]; } - bool can_reference_text (TextType type, std::string &) const; + bool can_reference_text (boost::shared_ptr film, TextType type, std::string &) const; void set_cpl (std::string id); @@ -148,11 +148,12 @@ public: private: friend class reels_test5; - void add_properties (std::list& p) const; + void add_properties (boost::shared_ptr film, std::list& p) const; void read_directory (boost::filesystem::path); - std::list reels () const; + std::list reels (boost::shared_ptr film) const; bool can_reference ( + boost::shared_ptr film, boost::function )>, std::string overlapping, std::string& why_not diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index 71a7e42d0..a67b244f7 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -55,19 +55,19 @@ using boost::shared_ptr; using boost::dynamic_pointer_cast; using boost::optional; -DCPDecoder::DCPDecoder (shared_ptr c, shared_ptr log, bool fast) +DCPDecoder::DCPDecoder (shared_ptr c, bool fast) : DCP (c) , _decode_referenced (false) { if (c->video) { - video.reset (new VideoDecoder (this, c, log)); + video.reset (new VideoDecoder (this, c)); } if (c->audio) { - audio.reset (new AudioDecoder (this, c->audio, log, fast)); + audio.reset (new AudioDecoder (this, c->audio, fast)); } BOOST_FOREACH (shared_ptr i, c->text) { /* XXX: this time here should be the time of the first subtitle, not 0 */ - text.push_back (shared_ptr (new TextDecoder (this, i, log, ContentTime()))); + text.push_back (shared_ptr (new TextDecoder (this, i, ContentTime()))); } list > cpl_list = cpls (); @@ -101,13 +101,13 @@ DCPDecoder::DCPDecoder (shared_ptr c, shared_ptr log, boo bool -DCPDecoder::pass () +DCPDecoder::pass (shared_ptr film) { if (_reel == _reels.end () || !_dcp_content->can_be_played ()) { return true; } - double const vfr = _dcp_content->active_video_frame_rate (); + double const vfr = _dcp_content->active_video_frame_rate (film); /* Frame within the (played part of the) reel that is coming up next */ int64_t const frame = _next.frames_round (vfr); @@ -118,12 +118,13 @@ DCPDecoder::pass () /* We must emit texts first as when we emit the video for this frame it will expect already to have the texts. */ - pass_texts (_next, picture_asset->size()); + pass_texts (film, _next, picture_asset->size()); if ((_mono_reader || _stereo_reader) && (_decode_referenced || !_dcp_content->reference_video())) { int64_t const entry_point = (*_reel)->main_picture()->entry_point (); if (_mono_reader) { video->emit ( + film, shared_ptr ( new J2KImageProxy ( _mono_reader->get_frame (entry_point + frame), @@ -136,6 +137,7 @@ DCPDecoder::pass () ); } else { video->emit ( + film, shared_ptr ( new J2KImageProxy ( _stereo_reader->get_frame (entry_point + frame), @@ -149,6 +151,7 @@ DCPDecoder::pass () ); video->emit ( + film, shared_ptr ( new J2KImageProxy ( _stereo_reader->get_frame (entry_point + frame), @@ -179,7 +182,7 @@ DCPDecoder::pass () } } - audio->emit (_dcp_content->audio->stream(), data, ContentTime::from_frames (_offset, vfr) + _next); + audio->emit (film, _dcp_content->audio->stream(), data, ContentTime::from_frames (_offset, vfr) + _next); } _next += ContentTime::from_frames (1, vfr); @@ -195,29 +198,37 @@ DCPDecoder::pass () } void -DCPDecoder::pass_texts (ContentTime next, dcp::Size size) +DCPDecoder::pass_texts (shared_ptr film, ContentTime next, dcp::Size size) { list >::const_iterator decoder = text.begin (); if ((*_reel)->main_subtitle()) { DCPOMATIC_ASSERT (decoder != text.end ()); pass_texts ( - next, (*_reel)->main_subtitle()->asset(), _dcp_content->reference_text(TEXT_OPEN_SUBTITLE), (*_reel)->main_subtitle()->entry_point(), *decoder, size + film, + next, + (*_reel)->main_subtitle()->asset(), + _dcp_content->reference_text(TEXT_OPEN_SUBTITLE), + (*_reel)->main_subtitle()->entry_point(), + *decoder, + size ); ++decoder; } BOOST_FOREACH (shared_ptr i, (*_reel)->closed_captions()) { DCPOMATIC_ASSERT (decoder != text.end ()); pass_texts ( - next, i->asset(), _dcp_content->reference_text(TEXT_CLOSED_CAPTION), i->entry_point(), *decoder, size + film, next, i->asset(), _dcp_content->reference_text(TEXT_CLOSED_CAPTION), i->entry_point(), *decoder, size ); ++decoder; } } void -DCPDecoder::pass_texts (ContentTime next, shared_ptr asset, bool reference, int64_t entry_point, shared_ptr decoder, dcp::Size size) +DCPDecoder::pass_texts ( + shared_ptr film, ContentTime next, shared_ptr asset, bool reference, int64_t entry_point, shared_ptr decoder, dcp::Size size + ) { - double const vfr = _dcp_content->active_video_frame_rate (); + double const vfr = _dcp_content->active_video_frame_rate (film); /* Frame within the (played part of the) reel that is coming up next */ int64_t const frame = next.frames_round (vfr); @@ -348,13 +359,13 @@ DCPDecoder::get_readers () } void -DCPDecoder::seek (ContentTime t, bool accurate) +DCPDecoder::seek (shared_ptr film, ContentTime t, bool accurate) { if (!_dcp_content->can_be_played ()) { return; } - Decoder::seek (t, accurate); + Decoder::seek (film, t, accurate); _reel = _reels.begin (); _offset = 0; @@ -371,8 +382,8 @@ DCPDecoder::seek (ContentTime t, bool accurate) /* Seek to pre-roll position */ - while (_reel != _reels.end() && pre >= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate ())) { - ContentTime rd = ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate ()); + while (_reel != _reels.end() && pre >= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate(film))) { + ContentTime rd = ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate(film)); pre -= rd; t -= rd; next_reel (); @@ -380,16 +391,16 @@ DCPDecoder::seek (ContentTime t, bool accurate) /* Pass texts in the pre-roll */ - double const vfr = _dcp_content->active_video_frame_rate (); + double const vfr = _dcp_content->active_video_frame_rate (film); for (int i = 0; i < pre_roll_seconds * vfr; ++i) { - pass_texts (pre, (*_reel)->main_picture()->asset()->size()); + pass_texts (film, pre, (*_reel)->main_picture()->asset()->size()); pre += ContentTime::from_frames (1, vfr); } /* Seek to correct position */ - while (_reel != _reels.end() && t >= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate ())) { - t -= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate ()); + while (_reel != _reels.end() && t >= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate(film))) { + t -= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->active_video_frame_rate(film)); next_reel (); } diff --git a/src/lib/dcp_decoder.h b/src/lib/dcp_decoder.h index 8281babc3..d3c5c57ed 100644 --- a/src/lib/dcp_decoder.h +++ b/src/lib/dcp_decoder.h @@ -40,7 +40,7 @@ struct dcp_subtitle_within_dcp_test; class DCPDecoder : public DCP, public Decoder { public: - DCPDecoder (boost::shared_ptr, boost::shared_ptr log, bool fast); + DCPDecoder (boost::shared_ptr, bool fast); std::list > reels () const { return _reels; @@ -49,17 +49,23 @@ public: void set_decode_referenced (bool r); void set_forced_reduction (boost::optional reduction); - bool pass (); - void seek (ContentTime t, bool accurate); + bool pass (boost::shared_ptr film); + void seek (boost::shared_ptr film, ContentTime t, bool accurate); private: friend struct dcp_subtitle_within_dcp_test; void next_reel (); void get_readers (); - void pass_texts (ContentTime next, dcp::Size size); + void pass_texts (boost::shared_ptr film, ContentTime next, dcp::Size size); void pass_texts ( - ContentTime next, boost::shared_ptr asset, bool reference, int64_t entry_point, boost::shared_ptr decoder, dcp::Size size + boost::shared_ptr film, + ContentTime next, + boost::shared_ptr asset, + bool reference, + int64_t entry_point, + boost::shared_ptr decoder, + dcp::Size size ); /** Time of next thing to return from pass relative to the start of _reel */ diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc index a8e98d426..21a50c199 100644 --- a/src/lib/dcp_subtitle_content.cc +++ b/src/lib/dcp_subtitle_content.cc @@ -37,23 +37,23 @@ using boost::shared_ptr; using boost::dynamic_pointer_cast; using dcp::raw_convert; -DCPSubtitleContent::DCPSubtitleContent (shared_ptr film, boost::filesystem::path path) - : Content (film, path) +DCPSubtitleContent::DCPSubtitleContent (boost::filesystem::path path) + : Content (path) { text.push_back (shared_ptr (new TextContent (this, TEXT_OPEN_SUBTITLE, TEXT_OPEN_SUBTITLE))); } -DCPSubtitleContent::DCPSubtitleContent (shared_ptr film, cxml::ConstNodePtr node, int version) - : Content (film, node) +DCPSubtitleContent::DCPSubtitleContent (cxml::ConstNodePtr node, int version) + : Content (node) , _length (node->number_child ("Length")) { text = TextContent::from_xml (this, node, version); } void -DCPSubtitleContent::examine (shared_ptr job) +DCPSubtitleContent::examine (shared_ptr film, shared_ptr job) { - Content::examine (job); + Content::examine (film, job); shared_ptr sc = load (path (0)); @@ -82,9 +82,9 @@ DCPSubtitleContent::examine (shared_ptr job) } DCPTime -DCPSubtitleContent::full_length () const +DCPSubtitleContent::full_length (shared_ptr film) const { - FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate()); + FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate()); return DCPTime (_length, frc); } diff --git a/src/lib/dcp_subtitle_content.h b/src/lib/dcp_subtitle_content.h index 36945adcd..5eaad0d2f 100644 --- a/src/lib/dcp_subtitle_content.h +++ b/src/lib/dcp_subtitle_content.h @@ -24,14 +24,14 @@ class DCPSubtitleContent : public DCPSubtitle, public Content { public: - DCPSubtitleContent (boost::shared_ptr, boost::filesystem::path); - DCPSubtitleContent (boost::shared_ptr, cxml::ConstNodePtr, int); + DCPSubtitleContent (boost::filesystem::path); + DCPSubtitleContent (cxml::ConstNodePtr, int); - void examine (boost::shared_ptr); + void examine (boost::shared_ptr film, boost::shared_ptr); std::string summary () const; std::string technical_summary () const; void as_xml (xmlpp::Node *, bool with_paths) const; - DCPTime full_length () const; + DCPTime full_length (boost::shared_ptr film) const; private: ContentTime _length; diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index 9c803a3b6..07e879ddf 100644 --- a/src/lib/dcp_subtitle_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -29,7 +29,7 @@ using boost::shared_ptr; using boost::dynamic_pointer_cast; using boost::bind; -DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr content, shared_ptr log) +DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr content) { shared_ptr c (load (content->path (0))); _subtitles = c->subtitles (); @@ -39,13 +39,13 @@ DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr con if (_next != _subtitles.end()) { first = content_time_period(*_next).from; } - text.push_back (shared_ptr (new TextDecoder (this, content->only_text(), log, first))); + text.push_back (shared_ptr (new TextDecoder (this, content->only_text(), first))); } void -DCPSubtitleDecoder::seek (ContentTime time, bool accurate) +DCPSubtitleDecoder::seek (shared_ptr film, ContentTime time, bool accurate) { - Decoder::seek (time, accurate); + Decoder::seek (film, time, accurate); _next = _subtitles.begin (); list >::const_iterator i = _subtitles.begin (); @@ -55,7 +55,7 @@ DCPSubtitleDecoder::seek (ContentTime time, bool accurate) } bool -DCPSubtitleDecoder::pass () +DCPSubtitleDecoder::pass (shared_ptr) { if (_next == _subtitles.end ()) { return true; diff --git a/src/lib/dcp_subtitle_decoder.h b/src/lib/dcp_subtitle_decoder.h index 984d98826..7e832241e 100644 --- a/src/lib/dcp_subtitle_decoder.h +++ b/src/lib/dcp_subtitle_decoder.h @@ -26,10 +26,10 @@ class DCPSubtitleContent; class DCPSubtitleDecoder : public DCPSubtitle, public Decoder { public: - DCPSubtitleDecoder (boost::shared_ptr, boost::shared_ptr log); + DCPSubtitleDecoder (boost::shared_ptr); - bool pass (); - void seek (ContentTime time, bool accurate); + bool pass (boost::shared_ptr film); + void seek (boost::shared_ptr film, ContentTime time, bool accurate); private: ContentTimePeriod content_time_period (boost::shared_ptr s) const; diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc index 6078141dc..fb7663f5c 100644 --- a/src/lib/decoder.cc +++ b/src/lib/decoder.cc @@ -31,21 +31,21 @@ using boost::shared_ptr; /** @return Earliest time of content that the next pass() will emit */ ContentTime -Decoder::position () const +Decoder::position (shared_ptr film) const { optional pos; - if (video && !video->ignore() && (!pos || video->position() < *pos)) { - pos = video->position(); + if (video && !video->ignore() && (!pos || video->position(film) < *pos)) { + pos = video->position(film); } - if (audio && !audio->ignore() && (!pos || audio->position() < *pos)) { - pos = audio->position(); + if (audio && !audio->ignore() && (!pos || audio->position(film) < *pos)) { + pos = audio->position(film); } BOOST_FOREACH (shared_ptr i, text) { - if (!i->ignore() && (!pos || i->position() < *pos)) { - pos = i->position(); + if (!i->ignore() && (!pos || i->position(film) < *pos)) { + pos = i->position(film); } } @@ -53,7 +53,7 @@ Decoder::position () const } void -Decoder::seek (ContentTime, bool) +Decoder::seek (shared_ptr, ContentTime, bool) { if (video) { video->seek (); diff --git a/src/lib/decoder.h b/src/lib/decoder.h index 55d9cfc64..a8a67ee72 100644 --- a/src/lib/decoder.h +++ b/src/lib/decoder.h @@ -34,6 +34,7 @@ class VideoDecoder; class AudioDecoder; class TextDecoder; class DecoderPart; +class Film; /** @class Decoder. * @brief Parent class for decoders of content. @@ -52,10 +53,10 @@ public: /** Do some decoding and perhaps emit video, audio or subtitle data. * @return true if this decoder will emit no more data unless a seek() happens. */ - virtual bool pass () = 0; - virtual void seek (ContentTime time, bool accurate); + virtual bool pass (boost::shared_ptr film) = 0; + virtual void seek (boost::shared_ptr film, ContentTime time, bool accurate); - ContentTime position () const; + ContentTime position (boost::shared_ptr film) const; }; #endif diff --git a/src/lib/decoder_factory.cc b/src/lib/decoder_factory.cc index df23ef6f6..b3e16a3f0 100644 --- a/src/lib/decoder_factory.cc +++ b/src/lib/decoder_factory.cc @@ -37,17 +37,17 @@ using boost::shared_ptr; using boost::dynamic_pointer_cast; shared_ptr -decoder_factory (shared_ptr content, shared_ptr log, bool fast) +decoder_factory (shared_ptr film, shared_ptr content, bool fast) { shared_ptr fc = dynamic_pointer_cast (content); if (fc) { - return shared_ptr (new FFmpegDecoder (fc, log, fast)); + return shared_ptr (new FFmpegDecoder(film, fc, fast)); } shared_ptr dc = dynamic_pointer_cast (content); if (dc) { try { - return shared_ptr (new DCPDecoder (dc, log, fast)); + return shared_ptr (new DCPDecoder(dc, fast)); } catch (KDMError& e) { /* This will be found and reported to the user when the content is examined */ return shared_ptr(); @@ -56,22 +56,22 @@ decoder_factory (shared_ptr content, shared_ptr log, bool fa shared_ptr ic = dynamic_pointer_cast (content); if (ic) { - return shared_ptr (new ImageDecoder (ic, log)); + return shared_ptr (new ImageDecoder(ic)); } shared_ptr rc = dynamic_pointer_cast (content); if (rc) { - return shared_ptr (new StringTextFileDecoder (rc, log)); + return shared_ptr (new StringTextFileDecoder(rc)); } shared_ptr dsc = dynamic_pointer_cast (content); if (dsc) { - return shared_ptr (new DCPSubtitleDecoder (dsc, log)); + return shared_ptr (new DCPSubtitleDecoder(dsc)); } shared_ptr vmc = dynamic_pointer_cast (content); if (vmc) { - return shared_ptr (new VideoMXFDecoder (vmc, log)); + return shared_ptr (new VideoMXFDecoder(vmc)); } return shared_ptr (); diff --git a/src/lib/decoder_factory.h b/src/lib/decoder_factory.h index 52a53afd2..d4e39da17 100644 --- a/src/lib/decoder_factory.h +++ b/src/lib/decoder_factory.h @@ -21,7 +21,7 @@ class ImageDecoder; extern boost::shared_ptr decoder_factory ( + boost::shared_ptr film, boost::shared_ptr content, - boost::shared_ptr log, bool fast ); diff --git a/src/lib/decoder_part.cc b/src/lib/decoder_part.cc index d8f988388..3e06204de 100644 --- a/src/lib/decoder_part.cc +++ b/src/lib/decoder_part.cc @@ -23,9 +23,8 @@ using boost::shared_ptr; -DecoderPart::DecoderPart (Decoder* parent, shared_ptr log) +DecoderPart::DecoderPart (Decoder* parent) : _parent (parent) - , _log (log) , _ignore (false) { diff --git a/src/lib/decoder_part.h b/src/lib/decoder_part.h index 0b8b6a43b..7ba2cb2eb 100644 --- a/src/lib/decoder_part.h +++ b/src/lib/decoder_part.h @@ -26,14 +26,15 @@ class Decoder; class Log; +class Film; class DecoderPart { public: - DecoderPart (Decoder* parent, boost::shared_ptr log); + DecoderPart (Decoder* parent); virtual ~DecoderPart () {} - virtual ContentTime position () const = 0; + virtual ContentTime position (boost::shared_ptr film) const = 0; virtual void seek () = 0; void set_ignore (bool i) { @@ -46,7 +47,6 @@ public: protected: Decoder* _parent; - boost::shared_ptr _log; private: bool _ignore; diff --git a/src/lib/empty.cc b/src/lib/empty.cc index 1e6e1c3fb..1df318b25 100644 --- a/src/lib/empty.cc +++ b/src/lib/empty.cc @@ -35,16 +35,16 @@ using boost::shared_ptr; using boost::dynamic_pointer_cast; using boost::function; -Empty::Empty (list > pieces, DCPTime length, function)> part) +Empty::Empty (shared_ptr film, list > pieces, function)> part) { list full; BOOST_FOREACH (shared_ptr i, pieces) { if (part(i)) { - full.push_back (DCPTimePeriod (i->content->position(), i->content->end())); + full.push_back (DCPTimePeriod (i->content->position(), i->content->end(film))); } } - _periods = subtract (DCPTimePeriod(DCPTime(), length), coalesce(full)); + _periods = subtract (DCPTimePeriod(DCPTime(), film->length()), coalesce(full)); if (!_periods.empty ()) { _position = _periods.front().from; diff --git a/src/lib/empty.h b/src/lib/empty.h index 73548f729..50f21fc4d 100644 --- a/src/lib/empty.h +++ b/src/lib/empty.h @@ -35,7 +35,7 @@ class Empty { public: Empty () {} - Empty (std::list > pieces, DCPTime length, boost::function)> part); + Empty (boost::shared_ptr film, std::list > pieces, boost::function)> part); DCPTime position () const { return _position; diff --git a/src/lib/examine_content_job.cc b/src/lib/examine_content_job.cc index a9df63be7..81088a441 100644 --- a/src/lib/examine_content_job.cc +++ b/src/lib/examine_content_job.cc @@ -53,7 +53,7 @@ ExamineContentJob::json_name () const void ExamineContentJob::run () { - _content->examine (shared_from_this ()); + _content->examine (_film, shared_from_this()); set_progress (1); set_state (FINISHED_OK); } diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index 1502b3de9..3bd08e84a 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -113,7 +113,6 @@ FFmpeg::setup_general () /* This might not work too well in some cases of multiple FFmpeg decoders, but it's probably good enough. */ - _ffmpeg_log = _ffmpeg_content->film()->log (); av_log_set_callback (FFmpeg::ffmpeg_log_callback); _file_group.set_paths (_ffmpeg_content->paths ()); @@ -219,10 +218,7 @@ FFmpeg::setup_decoders () throw DecodeError (N_("could not open decoder")); } } else { - shared_ptr log = _ffmpeg_log.lock (); - if (log) { - log->log (String::compose ("No codec found for stream %1", i), LogEntry::TYPE_WARNING); - } + dcpomatic_log->log (String::compose ("No codec found for stream %1", i), LogEntry::TYPE_WARNING); } } } diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index c7a15619d..2b494dc92 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -45,7 +45,7 @@ extern "C" { #include "i18n.h" -#define LOG_GENERAL(...) film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); +#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); using std::string; using std::vector; @@ -63,8 +63,8 @@ int const FFmpegContentProperty::SUBTITLE_STREAMS = 100; int const FFmpegContentProperty::SUBTITLE_STREAM = 101; int const FFmpegContentProperty::FILTERS = 102; -FFmpegContent::FFmpegContent (shared_ptr film, boost::filesystem::path p) - : Content (film, p) +FFmpegContent::FFmpegContent (boost::filesystem::path p) + : Content (p) , _encrypted (false) { @@ -81,8 +81,8 @@ get_optional_enum (cxml::ConstNodePtr node, string name) return static_cast(*v); } -FFmpegContent::FFmpegContent (shared_ptr film, cxml::ConstNodePtr node, int version, list& notes) - : Content (film, node) +FFmpegContent::FFmpegContent (cxml::ConstNodePtr node, int version, list& notes) + : Content (node) { video = VideoContent::from_xml (this, node, version); audio = AudioContent::from_xml (this, node, version); @@ -130,8 +130,8 @@ FFmpegContent::FFmpegContent (shared_ptr film, cxml::ConstNodePtr no _encrypted = node->optional_bool_child("Encrypted").get_value_or(false); } -FFmpegContent::FFmpegContent (shared_ptr film, vector > c) - : Content (film, c) +FFmpegContent::FFmpegContent (vector > c) + : Content (c) { vector >::const_iterator i = c.begin (); @@ -258,14 +258,14 @@ FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const } void -FFmpegContent::examine (shared_ptr job) +FFmpegContent::examine (shared_ptr film, shared_ptr job) { ChangeSignaller cc1 (this, FFmpegContentProperty::SUBTITLE_STREAMS); ChangeSignaller cc2 (this, FFmpegContentProperty::SUBTITLE_STREAM); job->set_progress_unknown (); - Content::examine (job); + Content::examine (film, job); shared_ptr examiner (new FFmpegExaminer (shared_from_this (), job)); @@ -309,7 +309,7 @@ FFmpegContent::examine (shared_ptr job) AudioStreamPtr as = audio->streams().front(); AudioMapping m = as->mapping (); - film()->make_audio_mapping_default (m, first_path); + film->make_audio_mapping_default (m, first_path); as->set_mapping (m); } @@ -400,11 +400,11 @@ operator!= (FFmpegStream const & a, FFmpegStream const & b) } DCPTime -FFmpegContent::full_length () const +FFmpegContent::full_length (shared_ptr film) const { - FrameRateChange const frc (active_video_frame_rate (), film()->video_frame_rate ()); + FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate()); if (video) { - return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film()->video_frame_rate()); + return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film->video_frame_rate()); } DCPOMATIC_ASSERT (audio); @@ -490,7 +490,7 @@ FFmpegContent::set_default_colour_conversion () } void -FFmpegContent::add_properties (list& p) const +FFmpegContent::add_properties (shared_ptr film, list& p) const { Content::add_properties (p); @@ -627,7 +627,7 @@ FFmpegContent::add_properties (list& p) const } if (audio) { - audio->add_properties (p); + audio->add_properties (film, p); } } diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index d2e164f1d..8bd5ef4fa 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -46,20 +46,20 @@ public: class FFmpegContent : public Content { public: - FFmpegContent (boost::shared_ptr, boost::filesystem::path); - FFmpegContent (boost::shared_ptr, cxml::ConstNodePtr, int version, std::list &); - FFmpegContent (boost::shared_ptr, std::vector >); + FFmpegContent (boost::filesystem::path); + FFmpegContent (cxml::ConstNodePtr, int version, std::list &); + FFmpegContent (std::vector >); boost::shared_ptr shared_from_this () { return boost::dynamic_pointer_cast (Content::shared_from_this ()); } - void examine (boost::shared_ptr); + void examine (boost::shared_ptr film, boost::shared_ptr); void take_settings_from (boost::shared_ptr c); std::string summary () const; std::string technical_summary () const; void as_xml (xmlpp::Node *, bool with_paths) const; - DCPTime full_length () const; + DCPTime full_length (boost::shared_ptr film) const; std::string identifier () const; @@ -104,7 +104,7 @@ public: } private: - void add_properties (std::list &) const; + void add_properties (boost::shared_ptr film, std::list &) const; friend struct ffmpeg_pts_offset_test; friend struct audio_sampling_rate_test; diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 9076464ac..0e40f128b 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -58,10 +58,10 @@ extern "C" { #include "i18n.h" -#define LOG_GENERAL(...) _log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); -#define LOG_ERROR(...) _log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_ERROR); -#define LOG_WARNING_NC(...) _log->log (__VA_ARGS__, LogEntry::TYPE_WARNING); -#define LOG_WARNING(...) _log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_WARNING); +#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); +#define LOG_ERROR(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_ERROR); +#define LOG_WARNING_NC(...) dcpomatic_log->log (__VA_ARGS__, LogEntry::TYPE_WARNING); +#define LOG_WARNING(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_WARNING); using std::cout; using std::string; @@ -78,14 +78,13 @@ using boost::optional; using boost::dynamic_pointer_cast; using dcp::Size; -FFmpegDecoder::FFmpegDecoder (shared_ptr c, shared_ptr log, bool fast) +FFmpegDecoder::FFmpegDecoder (shared_ptr film, shared_ptr c, bool fast) : FFmpeg (c) - , _log (log) , _have_current_subtitle (false) { if (c->video) { - video.reset (new VideoDecoder (this, c, log)); - _pts_offset = pts_offset (c->ffmpeg_audio_streams(), c->first_video(), c->active_video_frame_rate()); + video.reset (new VideoDecoder (this, c)); + _pts_offset = pts_offset (c->ffmpeg_audio_streams(), c->first_video(), c->active_video_frame_rate(film)); /* It doesn't matter what size or pixel format this is, it just needs to be black */ _black_image.reset (new Image (AV_PIX_FMT_RGB24, dcp::Size (128, 128), true)); _black_image->make_black (); @@ -94,19 +93,19 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr c, shared_ptr } if (c->audio) { - audio.reset (new AudioDecoder (this, c->audio, log, fast)); + audio.reset (new AudioDecoder (this, c->audio, fast)); } if (c->only_text()) { /* XXX: this time here should be the time of the first subtitle, not 0 */ - text.push_back (shared_ptr (new TextDecoder (this, c->only_text(), log, ContentTime()))); + text.push_back (shared_ptr (new TextDecoder (this, c->only_text(), ContentTime()))); } _next_time.resize (_format_context->nb_streams); } void -FFmpegDecoder::flush () +FFmpegDecoder::flush (shared_ptr film) { /* Get any remaining frames */ @@ -115,29 +114,29 @@ FFmpegDecoder::flush () /* XXX: should we reset _packet.data and size after each *_decode_* call? */ - while (video && decode_video_packet ()) {} + while (video && decode_video_packet(film)) {} if (audio) { - decode_audio_packet (); + decode_audio_packet (film); } /* Make sure all streams are the same length and round up to the next video frame */ - FrameRateChange const frc = _ffmpeg_content->film()->active_frame_rate_change(_ffmpeg_content->position()); - ContentTime full_length (_ffmpeg_content->full_length(), frc); + FrameRateChange const frc = film->active_frame_rate_change(_ffmpeg_content->position()); + ContentTime full_length (_ffmpeg_content->full_length(film), frc); full_length = full_length.ceil (frc.source); if (video) { double const vfr = _ffmpeg_content->video_frame_rate().get(); Frame const f = full_length.frames_round (vfr); - Frame v = video->position().frames_round (vfr) + 1; + Frame v = video->position(film).frames_round (vfr) + 1; while (v < f) { - video->emit (shared_ptr (new RawImageProxy (_black_image)), v); + video->emit (film, shared_ptr (new RawImageProxy (_black_image)), v); ++v; } } BOOST_FOREACH (shared_ptr i, _ffmpeg_content->ffmpeg_audio_streams ()) { - ContentTime a = audio->stream_position(i); + ContentTime a = audio->stream_position(film, i); /* Unfortunately if a is 0 that really means that we don't know the stream position since there has been no data on it since the last seek. In this case we'll just do nothing here. I'm not sure if that's the right idea. @@ -147,7 +146,7 @@ FFmpegDecoder::flush () ContentTime to_do = min (full_length - a, ContentTime::from_seconds (0.1)); shared_ptr silence (new AudioBuffers (i->channels(), to_do.frames_ceil (i->frame_rate()))); silence->make_silent (); - audio->emit (i, silence, a); + audio->emit (film, i, silence, a); a += to_do; } } @@ -159,7 +158,7 @@ FFmpegDecoder::flush () } bool -FFmpegDecoder::pass () +FFmpegDecoder::pass (shared_ptr film) { int r = av_read_frame (_format_context, &_packet); @@ -175,7 +174,7 @@ FFmpegDecoder::pass () LOG_ERROR (N_("error on av_read_frame (%1) (%2)"), &buf[0], r); } - flush (); + flush (film); return true; } @@ -183,11 +182,11 @@ FFmpegDecoder::pass () shared_ptr fc = _ffmpeg_content; if (_video_stream && si == _video_stream.get() && !video->ignore()) { - decode_video_packet (); + decode_video_packet (film); } else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index(_format_context, si) && !only_text()->ignore()) { decode_subtitle_packet (); } else { - decode_audio_packet (); + decode_audio_packet (film); } av_packet_unref (&_packet); @@ -341,9 +340,9 @@ FFmpegDecoder::bytes_per_audio_sample (shared_ptr stream) con } void -FFmpegDecoder::seek (ContentTime time, bool accurate) +FFmpegDecoder::seek (shared_ptr film, ContentTime time, bool accurate) { - Decoder::seek (time, accurate); + Decoder::seek (film, time, accurate); /* If we are doing an `accurate' seek, we need to use pre-roll, as we don't really know what the seek will give us. @@ -396,7 +395,7 @@ FFmpegDecoder::seek (ContentTime time, bool accurate) } void -FFmpegDecoder::decode_audio_packet () +FFmpegDecoder::decode_audio_packet (shared_ptr film) { /* Audio packets can contain multiple frames, so we may have to call avcodec_decode_audio4 several times. @@ -479,7 +478,7 @@ FFmpegDecoder::decode_audio_packet () /* Give this data provided there is some, and its time is sane */ if (ct >= ContentTime() && data->frames() > 0) { - audio->emit (*stream, data, ct); + audio->emit (film, *stream, data, ct); } } @@ -489,7 +488,7 @@ FFmpegDecoder::decode_audio_packet () } bool -FFmpegDecoder::decode_video_packet () +FFmpegDecoder::decode_video_packet (shared_ptr film) { DCPOMATIC_ASSERT (_video_stream); @@ -527,8 +526,9 @@ FFmpegDecoder::decode_video_packet () double const pts = i->second * av_q2d (_format_context->streams[_video_stream.get()]->time_base) + _pts_offset.seconds (); video->emit ( + film, shared_ptr (new RawImageProxy (image)), - llrint(pts * _ffmpeg_content->active_video_frame_rate()) + llrint(pts * _ffmpeg_content->active_video_frame_rate(film)) ); } else { LOG_WARNING_NC ("Dropping frame without PTS"); diff --git a/src/lib/ffmpeg_decoder.h b/src/lib/ffmpeg_decoder.h index 16a55d558..408ce30a7 100644 --- a/src/lib/ffmpeg_decoder.h +++ b/src/lib/ffmpeg_decoder.h @@ -45,21 +45,21 @@ struct ffmpeg_pts_offset_test; class FFmpegDecoder : public FFmpeg, public Decoder { public: - FFmpegDecoder (boost::shared_ptr, boost::shared_ptr log, bool fast); + FFmpegDecoder (boost::shared_ptr film, boost::shared_ptr, bool fast); - bool pass (); - void seek (ContentTime time, bool); + bool pass (boost::shared_ptr film); + void seek (boost::shared_ptr film, ContentTime time, bool); private: friend struct ::ffmpeg_pts_offset_test; - void flush (); + void flush (boost::shared_ptr film); AVSampleFormat audio_sample_format (boost::shared_ptr stream) const; int bytes_per_audio_sample (boost::shared_ptr stream) const; - bool decode_video_packet (); - void decode_audio_packet (); + bool decode_video_packet (boost::shared_ptr film); + void decode_audio_packet (boost::shared_ptr film); void decode_subtitle_packet (); void decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTime from); @@ -68,8 +68,6 @@ private: void maybe_add_subtitle (); boost::shared_ptr deinterleave_audio (boost::shared_ptr stream) const; - boost::shared_ptr _log; - std::list > _filter_graphs; boost::mutex _filter_graphs_mutex; diff --git a/src/lib/film.cc b/src/lib/film.cc index 426c7f81d..4d6b3d7e3 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -975,7 +975,7 @@ Film::signal_change (ChangeType type, Property p) /* We want to call Playlist::maybe_sequence but this must happen after the main signal emission (since the butler will see that emission and un-suspend itself). */ - emit (boost::bind(&Playlist::maybe_sequence, _playlist.get())); + emit (boost::bind(&Playlist::maybe_sequence, _playlist.get(), shared_from_this())); } } else { Change (type, p); @@ -1116,7 +1116,7 @@ Film::maybe_add_content (weak_ptr j, weak_ptr c, bool disable_audi if (Config::instance()->automatic_audio_analysis() && content->audio && !disable_audio_analysis) { shared_ptr playlist (new Playlist); - playlist->add (content); + playlist->add (shared_from_this(), content); boost::signals2::connection c; JobManager::instance()->analyse_audio ( shared_from_this(), playlist, false, c, bind (&Film::audio_analysis_finished, this) @@ -1130,9 +1130,9 @@ Film::add_content (shared_ptr c) { /* Add {video,subtitle} content after any existing {video,subtitle} content */ if (c->video) { - c->set_position (_playlist->video_end()); + c->set_position (shared_from_this(), _playlist->video_end(shared_from_this())); } else if (!c->text.empty()) { - c->set_position (_playlist->text_end()); + c->set_position (shared_from_this(), _playlist->text_end(shared_from_this())); } if (_template_film) { @@ -1142,7 +1142,7 @@ Film::add_content (shared_ptr c) } } - _playlist->add (c); + _playlist->add (shared_from_this(), c); } void @@ -1154,20 +1154,20 @@ Film::remove_content (shared_ptr c) void Film::move_content_earlier (shared_ptr c) { - _playlist->move_earlier (c); + _playlist->move_earlier (shared_from_this(), c); } void Film::move_content_later (shared_ptr c) { - _playlist->move_later (c); + _playlist->move_later (shared_from_this(), c); } /** @return length of the film from time 0 to the last thing on the playlist */ DCPTime Film::length () const { - return _playlist->length().ceil(video_frame_rate()); + return _playlist->length(shared_from_this()).ceil(video_frame_rate()); } int @@ -1379,7 +1379,7 @@ Film::make_kdms ( uint64_t Film::required_disk_space () const { - return _playlist->required_disk_space (j2k_bandwidth(), audio_channels(), audio_frame_rate()); + return _playlist->required_disk_space (shared_from_this(), j2k_bandwidth(), audio_channels(), audio_frame_rate()); } /** This method checks the disk that the Film is on and tries to decide whether or not @@ -1513,7 +1513,7 @@ Film::audio_output_names () const void Film::repeat_content (ContentList c, int n) { - _playlist->repeat (c, n); + _playlist->repeat (shared_from_this(), c, n); } void @@ -1554,7 +1554,7 @@ Film::reels () const } } - DCPTime video_end = last_video ? last_video->end() : DCPTime(0); + DCPTime video_end = last_video ? last_video->end(shared_from_this()) : DCPTime(0); if (last_split) { /* Definitely go from the last split to the end of the video content */ p.push_back (DCPTimePeriod (last_split.get(), video_end)); @@ -1589,7 +1589,7 @@ Film::reels () const string Film::content_summary (DCPTimePeriod period) const { - return _playlist->content_summary (period); + return _playlist->content_summary (shared_from_this(), period); } void diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc index 9e0bb09b5..55ffac4f2 100644 --- a/src/lib/image_content.cc +++ b/src/lib/image_content.cc @@ -40,8 +40,7 @@ using std::list; using std::vector; using boost::shared_ptr; -ImageContent::ImageContent (shared_ptr film, boost::filesystem::path p) - : Content (film) +ImageContent::ImageContent (boost::filesystem::path p) { video.reset (new VideoContent (this)); @@ -55,8 +54,8 @@ ImageContent::ImageContent (shared_ptr film, boost::filesystem::path } -ImageContent::ImageContent (shared_ptr film, cxml::ConstNodePtr node, int version) - : Content (film, node) +ImageContent::ImageContent (cxml::ConstNodePtr node, int version) + : Content (node) { video = VideoContent::from_xml (this, node, version); } @@ -102,7 +101,7 @@ ImageContent::as_xml (xmlpp::Node* node, bool with_paths) const } void -ImageContent::examine (shared_ptr job) +ImageContent::examine (shared_ptr film, shared_ptr job) { if (_path_to_scan) { job->sub (_("Scanning image files")); @@ -126,10 +125,7 @@ ImageContent::examine (shared_ptr job) set_paths (paths); } - Content::examine (job); - - shared_ptr film = _film.lock (); - DCPOMATIC_ASSERT (film); + Content::examine (film, job); shared_ptr examiner (new ImageExaminer (film, shared_from_this(), job)); video->take_from_examiner (examiner); @@ -137,12 +133,10 @@ ImageContent::examine (shared_ptr job) } DCPTime -ImageContent::full_length () const +ImageContent::full_length (shared_ptr film) const { - shared_ptr film = _film.lock (); - DCPOMATIC_ASSERT (film); - FrameRateChange const frc (active_video_frame_rate(), film->video_frame_rate()); - return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor ()), film->video_frame_rate ()); + FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate()); + return DCPTime::from_frames (llrint(video->length_after_3d_combine() * frc.factor()), film->video_frame_rate()); } string diff --git a/src/lib/image_content.h b/src/lib/image_content.h index eeaf1e2b0..bc0f33151 100644 --- a/src/lib/image_content.h +++ b/src/lib/image_content.h @@ -26,18 +26,18 @@ class ImageContent : public Content { public: - ImageContent (boost::shared_ptr, boost::filesystem::path); - ImageContent (boost::shared_ptr, cxml::ConstNodePtr, int); + ImageContent (boost::filesystem::path); + ImageContent (cxml::ConstNodePtr, int); boost::shared_ptr shared_from_this () { return boost::dynamic_pointer_cast (Content::shared_from_this ()); }; - void examine (boost::shared_ptr); + void examine (boost::shared_ptr film, boost::shared_ptr); std::string summary () const; std::string technical_summary () const; void as_xml (xmlpp::Node *, bool with_paths) const; - DCPTime full_length () const; + DCPTime full_length (boost::shared_ptr film) const; std::string identifier () const; diff --git a/src/lib/image_decoder.cc b/src/lib/image_decoder.cc index e06f6023d..ce8843b0d 100644 --- a/src/lib/image_decoder.cc +++ b/src/lib/image_decoder.cc @@ -36,15 +36,15 @@ using std::cout; using boost::shared_ptr; using dcp::Size; -ImageDecoder::ImageDecoder (shared_ptr c, shared_ptr log) +ImageDecoder::ImageDecoder (shared_ptr c) : _image_content (c) , _frame_video_position (0) { - video.reset (new VideoDecoder (this, c, log)); + video.reset (new VideoDecoder (this, c)); } bool -ImageDecoder::pass () +ImageDecoder::pass (boost::shared_ptr film) { if (_frame_video_position >= _image_content->video->length()) { return true; @@ -71,14 +71,14 @@ ImageDecoder::pass () } } - video->emit (_image, _frame_video_position); + video->emit (film, _image, _frame_video_position); ++_frame_video_position; return false; } void -ImageDecoder::seek (ContentTime time, bool accurate) +ImageDecoder::seek (shared_ptr film, ContentTime time, bool accurate) { - Decoder::seek (time, accurate); - _frame_video_position = time.frames_round (_image_content->active_video_frame_rate ()); + Decoder::seek (film, time, accurate); + _frame_video_position = time.frames_round (_image_content->active_video_frame_rate(film)); } diff --git a/src/lib/image_decoder.h b/src/lib/image_decoder.h index 140032317..25ad9f07f 100644 --- a/src/lib/image_decoder.h +++ b/src/lib/image_decoder.h @@ -27,14 +27,14 @@ class ImageProxy; class ImageDecoder : public Decoder { public: - ImageDecoder (boost::shared_ptr c, boost::shared_ptr log); + ImageDecoder (boost::shared_ptr c); boost::shared_ptr content () { return _image_content; } - bool pass (); - void seek (ContentTime, bool); + bool pass (boost::shared_ptr film); + void seek (boost::shared_ptr film, ContentTime, bool); private: diff --git a/src/lib/log.cc b/src/lib/log.cc index e3ffd1cad..8f7794aed 100644 --- a/src/lib/log.cc +++ b/src/lib/log.cc @@ -35,6 +35,8 @@ using std::string; using std::cout; using boost::shared_ptr; +boost::shared_ptr dcpomatic_log; + Log::Log () : _types (0) { diff --git a/src/lib/log.h b/src/lib/log.h index 65d0229e9..636de6a58 100644 --- a/src/lib/log.h +++ b/src/lib/log.h @@ -66,4 +66,6 @@ private: boost::signals2::scoped_connection _config_connection; }; +extern boost::shared_ptr dcpomatic_log; + #endif diff --git a/src/lib/overlaps.cc b/src/lib/overlaps.cc index 54077d96b..4c75ac0c3 100644 --- a/src/lib/overlaps.cc +++ b/src/lib/overlaps.cc @@ -26,12 +26,12 @@ using boost::shared_ptr; using boost::function; -ContentList overlaps (ContentList cl, function)> part, DCPTime from, DCPTime to) +ContentList overlaps (shared_ptr film, ContentList cl, function)> part, DCPTime from, DCPTime to) { ContentList overlaps; DCPTimePeriod period (from, to); BOOST_FOREACH (shared_ptr i, cl) { - if (part(i) && DCPTimePeriod(i->position(), i->end()).overlap(period)) { + if (part(i) && DCPTimePeriod(i->position(), i->end(film)).overlap(period)) { overlaps.push_back (i); } } diff --git a/src/lib/overlaps.h b/src/lib/overlaps.h index 7dd9802c3..be3edf9d4 100644 --- a/src/lib/overlaps.h +++ b/src/lib/overlaps.h @@ -22,11 +22,12 @@ #include "dcpomatic_time.h" class ContentPart; +class Film; /** @return Pieces of content with a given part (video, audio, * subtitle) that overlap a specified time range in the given * ContentList */ ContentList overlaps ( - ContentList cl, boost::function)> part, DCPTime from, DCPTime to + boost::shared_ptr film, ContentList cl, boost::function)> part, DCPTime from, DCPTime to ); diff --git a/src/lib/player.cc b/src/lib/player.cc index a7440cb4f..283a641d9 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -60,7 +60,7 @@ #include "i18n.h" -#define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); +#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); using std::list; using std::cout; @@ -155,8 +155,8 @@ Player::setup_pieces_unlocked () continue; } - shared_ptr decoder = decoder_factory (i, _film->log(), _fast); - FrameRateChange frc (i->active_video_frame_rate(), _film->video_frame_rate()); + shared_ptr decoder = decoder_factory (_film, i, _fast); + FrameRateChange frc (i->active_video_frame_rate(_film), _film->video_frame_rate()); if (!decoder) { /* Not something that we can decode; e.g. Atmos content */ @@ -227,8 +227,8 @@ Player::setup_pieces_unlocked () } } - _black = Empty (_pieces, _film->length(), bind(&have_video, _1)); - _silent = Empty (_pieces, _film->length(), bind(&have_audio, _1)); + _black = Empty (_film, _pieces, bind(&have_video, _1)); + _silent = Empty (_film, _pieces, bind(&have_audio, _1)); _last_video_time = DCPTime (); _last_video_eyes = EYES_BOTH; @@ -343,7 +343,7 @@ Frame Player::dcp_to_content_video (shared_ptr piece, DCPTime t) const { DCPTime s = t - piece->content->position (); - s = min (piece->content->length_after_trim(), s); + s = min (piece->content->length_after_trim(_film), s); s = max (DCPTime(), s + DCPTime (piece->content->trim_start(), piece->frc)); /* It might seem more logical here to convert s to a ContentTime (using the FrameRateChange) @@ -368,7 +368,7 @@ Frame Player::dcp_to_resampled_audio (shared_ptr piece, DCPTime t) const { DCPTime s = t - piece->content->position (); - s = min (piece->content->length_after_trim(), s); + s = min (piece->content->length_after_trim(_film), s); /* See notes in dcp_to_content_video */ return max (DCPTime (), DCPTime (piece->content->trim_start (), piece->frc) + s).frames_floor (_film->audio_frame_rate ()); } @@ -386,7 +386,7 @@ ContentTime Player::dcp_to_content_time (shared_ptr piece, DCPTime t) const { DCPTime s = t - piece->content->position (); - s = min (piece->content->length_after_trim(), s); + s = min (piece->content->length_after_trim(_film), s); return max (ContentTime (), ContentTime (s, piece->frc) + piece->content->trim_start()); } @@ -480,7 +480,7 @@ Player::get_reel_assets () scoped_ptr decoder; try { - decoder.reset (new DCPDecoder (j, _film->log(), false)); + decoder.reset (new DCPDecoder (j, false)); } catch (...) { return a; } @@ -554,7 +554,7 @@ Player::pass () return false; } - if (_playlist->length() == DCPTime()) { + if (_playlist->length(_film) == DCPTime()) { /* Special case of an empty Film; just give one black frame */ emit_video (black_player_video_frame(EYES_BOTH), DCPTime()); return true; @@ -570,8 +570,8 @@ Player::pass () continue; } - DCPTime const t = content_time_to_dcp (i, max(i->decoder->position(), i->content->trim_start())); - if (t > i->content->end()) { + DCPTime const t = content_time_to_dcp (i, max(i->decoder->position(_film), i->content->trim_start())); + if (t > i->content->end(_film)) { i->done = true; } else { @@ -610,7 +610,7 @@ Player::pass () switch (which) { case CONTENT: - earliest_content->done = earliest_content->decoder->pass (); + earliest_content->done = earliest_content->decoder->pass (_film); break; case BLACK: emit_video (black_player_video_frame(EYES_BOTH), _black.position()); @@ -735,7 +735,7 @@ Player::video (weak_ptr wp, ContentVideo video) return; } - FrameRateChange frc(piece->content->active_video_frame_rate(), _film->video_frame_rate()); + FrameRateChange frc(piece->content->active_video_frame_rate(_film), _film->video_frame_rate()); if (frc.skip && (video.frame % 2) == 1) { return; } @@ -754,7 +754,7 @@ Player::video (weak_ptr wp, ContentVideo video) /* Fill gaps that we discover now that we have some video which needs to be emitted. This is where we need to fill to. */ - DCPTime fill_to = min (time, piece->content->end()); + DCPTime fill_to = min (time, piece->content->end(_film)); if (_last_video_time) { DCPTime fill_from = max (*_last_video_time, piece->content->position()); @@ -764,7 +764,7 @@ Player::video (weak_ptr wp, ContentVideo video) if (fill_to_eyes == EYES_BOTH) { fill_to_eyes = EYES_LEFT; } - if (fill_to == piece->content->end()) { + if (fill_to == piece->content->end(_film)) { /* Don't fill after the end of the content */ fill_to_eyes = EYES_LEFT; } @@ -801,7 +801,7 @@ Player::video (weak_ptr wp, ContentVideo video) new PlayerVideo ( video.image, piece->content->video->crop (), - piece->content->video->fade (video.frame), + piece->content->video->fade (_film, video.frame), piece->content->video->scale().size ( piece->content->video, _video_container_size, _film->frame_size () ), @@ -816,7 +816,7 @@ Player::video (weak_ptr wp, ContentVideo video) DCPTime t = time; for (int i = 0; i < frc.repeat; ++i) { - if (t < piece->content->end()) { + if (t < piece->content->end(_film)) { emit_video (_last_video[wp], t); } t += one_video_frame (); @@ -839,7 +839,7 @@ Player::audio (weak_ptr wp, AudioStreamPtr stream, ContentAudio content_a /* Compute time in the DCP */ DCPTime time = resampled_audio_to_dcp (piece, content_audio.frame); /* And the end of this block in the DCP */ - DCPTime end = time + DCPTime::from_frames(content_audio.audio->frames(), content->resampled_frame_rate()); + DCPTime end = time + DCPTime::from_frames(content_audio.audio->frames(), content->resampled_frame_rate(_film)); /* Remove anything that comes before the start or after the end of the content */ if (time < piece->content->position()) { @@ -850,11 +850,11 @@ Player::audio (weak_ptr wp, AudioStreamPtr stream, ContentAudio content_a } content_audio.audio = cut.first; time = cut.second; - } else if (time > piece->content->end()) { + } else if (time > piece->content->end(_film)) { /* Discard it all */ return; - } else if (end > piece->content->end()) { - Frame const remaining_frames = DCPTime(piece->content->end() - time).frames_round(_film->audio_frame_rate()); + } else if (end > piece->content->end(_film)) { + Frame const remaining_frames = DCPTime(piece->content->end(_film) - time).frames_round(_film->audio_frame_rate()); if (remaining_frames == 0) { return; } @@ -933,7 +933,7 @@ Player::plain_text_start (weak_ptr wp, weak_ptr wc, Co PlayerText ps; DCPTime const from (content_time_to_dcp (piece, subtitle.from())); - if (from > piece->content->end()) { + if (from > piece->content->end(_film)) { return; } @@ -984,7 +984,7 @@ Player::subtitle_stop (weak_ptr wp, weak_ptr wc, Conte DCPTime const dcp_to = content_time_to_dcp (piece, to); - if (dcp_to > piece->content->end()) { + if (dcp_to > piece->content->end(_film)) { return; } @@ -1024,11 +1024,11 @@ Player::seek (DCPTime time, bool accurate) BOOST_FOREACH (shared_ptr i, _pieces) { if (time < i->content->position()) { /* Before; seek to the start of the content */ - i->decoder->seek (dcp_to_content_time (i, i->content->position()), accurate); + i->decoder->seek (_film, dcp_to_content_time (i, i->content->position()), accurate); i->done = false; - } else if (i->content->position() <= time && time < i->content->end()) { + } else if (i->content->position() <= time && time < i->content->end(_film)) { /* During; seek to position */ - i->decoder->seek (dcp_to_content_time (i, time), accurate); + i->decoder->seek (_film, dcp_to_content_time (i, time), accurate); i->done = false; } else { /* After; this piece is done */ diff --git a/src/lib/player_video.cc b/src/lib/player_video.cc index 94432d66e..6c0cf20c1 100644 --- a/src/lib/player_video.cc +++ b/src/lib/player_video.cc @@ -315,7 +315,7 @@ PlayerVideo::shallow_copy () const * @return true if this was possible, false if not. */ bool -PlayerVideo::reset_metadata (dcp::Size video_container_size, dcp::Size film_frame_size) +PlayerVideo::reset_metadata (shared_ptr film, dcp::Size video_container_size, dcp::Size film_frame_size) { shared_ptr content = _content.lock(); if (!content || !_video_frame) { @@ -323,7 +323,7 @@ PlayerVideo::reset_metadata (dcp::Size video_container_size, dcp::Size film_fram } _crop = content->video->crop(); - _fade = content->video->fade(_video_frame.get()); + _fade = content->video->fade(film, _video_frame.get()); _inter_size = content->video->scale().size(content->video, video_container_size, film_frame_size); _out_size = video_container_size; _colour_conversion = content->video->colour_conversion(); diff --git a/src/lib/player_video.h b/src/lib/player_video.h index 8ffe70afb..a874fd3b2 100644 --- a/src/lib/player_video.h +++ b/src/lib/player_video.h @@ -34,6 +34,7 @@ extern "C" { class Image; class ImageProxy; +class Film; class Socket; /** Everything needed to describe a video frame coming out of the player, but with the @@ -71,7 +72,7 @@ public: void add_metadata (xmlpp::Node* node) const; void send_binary (boost::shared_ptr socket) const; - bool reset_metadata (dcp::Size video_container_size, dcp::Size film_frame_size); + bool reset_metadata (boost::shared_ptr film, dcp::Size video_container_size, dcp::Size film_frame_size); bool has_j2k () const; dcp::Data j2k () const; diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index e4fc0f072..0e6497495 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -61,12 +61,15 @@ Playlist::Playlist () Playlist::~Playlist () { _content.clear (); - reconnect (); + disconnect (); } void -Playlist::content_change (ChangeType type, weak_ptr content, int property, bool frequent) +Playlist::content_change (weak_ptr weak_film, ChangeType type, weak_ptr content, int property, bool frequent) { + shared_ptr film = weak_film.lock (); + DCPOMATIC_ASSERT (film); + if (type == CHANGE_TYPE_DONE) { if ( property == ContentProperty::TRIM_START || @@ -79,7 +82,7 @@ Playlist::content_change (ChangeType type, weak_ptr content, int proper - any other position changes will be timeline drags which should not result in content being sequenced. */ - maybe_sequence (); + maybe_sequence (film); } if ( @@ -100,7 +103,7 @@ Playlist::content_change (ChangeType type, weak_ptr content, int proper } void -Playlist::maybe_sequence () +Playlist::maybe_sequence (shared_ptr film) { if (!_sequence || _sequencing) { return; @@ -123,11 +126,11 @@ Playlist::maybe_sequence () } if (i->video->frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) { - i->set_position (next_right); - next_right = i->end(); + i->set_position (film, next_right); + next_right = i->end(film); } else { - i->set_position (next_left); - next_left = i->end(); + i->set_position (film, next_left); + next_left = i->end(film); } placed.push_back (i); @@ -141,8 +144,8 @@ Playlist::maybe_sequence () continue; } - i->set_position (next); - next = i->end(); + i->set_position (film, next); + next = i->end(film); } @@ -188,7 +191,7 @@ Playlist::set_from_xml (shared_ptr film, cxml::ConstNodePtr node, in /* This shouldn't be necessary but better safe than sorry (there could be old files) */ sort (_content.begin(), _content.end(), ContentSorter ()); - reconnect (); + reconnect (film); } /** @param node <Playlist> node. @@ -203,12 +206,12 @@ Playlist::as_xml (xmlpp::Node* node, bool with_content_paths) } void -Playlist::add (shared_ptr c) +Playlist::add (shared_ptr film, shared_ptr c) { Change (CHANGE_TYPE_PENDING); _content.push_back (c); sort (_content.begin(), _content.end(), ContentSorter ()); - reconnect (); + reconnect (film); Change (CHANGE_TYPE_DONE); } @@ -323,11 +326,11 @@ Playlist::best_video_frame_rate () const /** @return length of the playlist from time 0 to the last thing on the playlist */ DCPTime -Playlist::length () const +Playlist::length (shared_ptr film) const { DCPTime len; BOOST_FOREACH (shared_ptr i, _content) { - len = max (len, i->end()); + len = max (len, i->end(film)); } return len; @@ -350,26 +353,32 @@ Playlist::start () const } void -Playlist::reconnect () +Playlist::disconnect () { for (list::iterator i = _content_connections.begin(); i != _content_connections.end(); ++i) { i->disconnect (); } _content_connections.clear (); +} + +void +Playlist::reconnect (shared_ptr film) +{ + disconnect (); BOOST_FOREACH (shared_ptr i, _content) { - _content_connections.push_back (i->Change.connect(boost::bind(&Playlist::content_change, this, _1, _2, _3, _4))); + _content_connections.push_back (i->Change.connect(boost::bind(&Playlist::content_change, this, film, _1, _2, _3, _4))); } } DCPTime -Playlist::video_end () const +Playlist::video_end (shared_ptr film) const { DCPTime end; BOOST_FOREACH (shared_ptr i, _content) { if (i->video) { - end = max (end, i->end ()); + end = max (end, i->end(film)); } } @@ -377,12 +386,12 @@ Playlist::video_end () const } DCPTime -Playlist::text_end () const +Playlist::text_end (shared_ptr film) const { DCPTime end; BOOST_FOREACH (shared_ptr i, _content) { if (!i->text.empty ()) { - end = max (end, i->end ()); + end = max (end, i->end(film)); } } @@ -446,14 +455,14 @@ Playlist::content () const } void -Playlist::repeat (ContentList c, int n) +Playlist::repeat (shared_ptr film, ContentList c, int n) { pair range (DCPTime::max (), DCPTime ()); BOOST_FOREACH (shared_ptr i, c) { range.first = min (range.first, i->position ()); range.second = max (range.second, i->position ()); - range.first = min (range.first, i->end ()); - range.second = max (range.second, i->end ()); + range.first = min (range.first, i->end(film)); + range.second = max (range.second, i->end(film)); } Change (CHANGE_TYPE_PENDING); @@ -461,8 +470,8 @@ Playlist::repeat (ContentList c, int n) DCPTime pos = range.second; for (int i = 0; i < n; ++i) { BOOST_FOREACH (shared_ptr j, c) { - shared_ptr copy = j->clone (); - copy->set_position (pos + copy->position() - range.first); + shared_ptr copy = j->clone (film); + copy->set_position (film, pos + copy->position() - range.first); _content.push_back (copy); } pos += range.second - range.first; @@ -470,12 +479,12 @@ Playlist::repeat (ContentList c, int n) sort (_content.begin(), _content.end(), ContentSorter ()); - reconnect (); + reconnect (film); Change (CHANGE_TYPE_DONE); } void -Playlist::move_earlier (shared_ptr c) +Playlist::move_earlier (shared_ptr film, shared_ptr c) { ContentList::iterator previous = _content.end (); ContentList::iterator i = _content.begin(); @@ -492,12 +501,12 @@ Playlist::move_earlier (shared_ptr c) shared_ptr previous_c = *previous; DCPTime const p = previous_c->position (); - previous_c->set_position (p + c->length_after_trim ()); - c->set_position (p); + previous_c->set_position (film, p + c->length_after_trim(film)); + c->set_position (film, p); } void -Playlist::move_later (shared_ptr c) +Playlist::move_later (shared_ptr film, shared_ptr c) { ContentList::iterator i = _content.begin(); while (i != _content.end() && *i != c) { @@ -515,24 +524,24 @@ Playlist::move_later (shared_ptr c) shared_ptr next_c = *next; - next_c->set_position (c->position ()); - c->set_position (c->position() + next_c->length_after_trim ()); + next_c->set_position (film, c->position()); + c->set_position (film, c->position() + next_c->length_after_trim(film)); } int64_t -Playlist::required_disk_space (int j2k_bandwidth, int audio_channels, int audio_frame_rate) const +Playlist::required_disk_space (shared_ptr film, int j2k_bandwidth, int audio_channels, int audio_frame_rate) const { - int64_t video = uint64_t (j2k_bandwidth / 8) * length().seconds (); - int64_t audio = uint64_t (audio_channels * audio_frame_rate * 3) * length().seconds (); + int64_t video = uint64_t (j2k_bandwidth / 8) * length(film).seconds(); + int64_t audio = uint64_t (audio_channels * audio_frame_rate * 3) * length(film).seconds(); BOOST_FOREACH (shared_ptr i, _content) { shared_ptr d = dynamic_pointer_cast (i); if (d) { if (d->reference_video()) { - video -= uint64_t (j2k_bandwidth / 8) * d->length_after_trim().seconds(); + video -= uint64_t (j2k_bandwidth / 8) * d->length_after_trim(film).seconds(); } if (d->reference_audio()) { - audio -= uint64_t (audio_channels * audio_frame_rate * 3) * d->length_after_trim().seconds(); + audio -= uint64_t (audio_channels * audio_frame_rate * 3) * d->length_after_trim(film).seconds(); } } } @@ -542,13 +551,13 @@ Playlist::required_disk_space (int j2k_bandwidth, int audio_channels, int audio_ } string -Playlist::content_summary (DCPTimePeriod period) const +Playlist::content_summary (shared_ptr film, DCPTimePeriod period) const { string best_summary; int best_score = -1; BOOST_FOREACH (shared_ptr i, _content) { int score = 0; - optional const o = DCPTimePeriod(i->position(), i->end()).overlap (period); + optional const o = DCPTimePeriod(i->position(), i->end(film)).overlap (period); if (o) { score += 100 * o.get().duration().get() / period.duration().get(); } diff --git a/src/lib/playlist.h b/src/lib/playlist.h index d55232dad..d9140bdfb 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -48,31 +48,31 @@ public: void as_xml (xmlpp::Node *, bool with_content_paths); void set_from_xml (boost::shared_ptr film, cxml::ConstNodePtr node, int version, std::list& notes); - void add (boost::shared_ptr); + void add (boost::shared_ptr film, boost::shared_ptr); void remove (boost::shared_ptr); void remove (ContentList); - void move_earlier (boost::shared_ptr); - void move_later (boost::shared_ptr); + void move_earlier (boost::shared_ptr film, boost::shared_ptr); + void move_later (boost::shared_ptr film, boost::shared_ptr); ContentList content () const; std::string video_identifier () const; - DCPTime length () const; + DCPTime length (boost::shared_ptr film) const; boost::optional start () const; - int64_t required_disk_space (int j2k_bandwidth, int audio_channels, int audio_frame_rate) const; + int64_t required_disk_space (boost::shared_ptr film, int j2k_bandwidth, int audio_channels, int audio_frame_rate) const; int best_video_frame_rate () const; - DCPTime video_end () const; - DCPTime text_end () const; + DCPTime video_end (boost::shared_ptr film) const; + DCPTime text_end (boost::shared_ptr film) const; FrameRateChange active_frame_rate_change (DCPTime, int dcp_frame_rate) const; - std::string content_summary (DCPTimePeriod period) const; + std::string content_summary (boost::shared_ptr film, DCPTimePeriod period) const; std::pair speed_up_range (int dcp_video_frame_rate) const; void set_sequence (bool); - void maybe_sequence (); + void maybe_sequence (boost::shared_ptr film); - void repeat (ContentList, int); + void repeat (boost::shared_ptr film, ContentList, int); /** Emitted when content has been added to or removed from the playlist; implies OrderChanged */ mutable boost::signals2::signal Change; @@ -81,8 +81,9 @@ public: mutable boost::signals2::signal, int, bool)> ContentChange; private: - void content_change (ChangeType, boost::weak_ptr, int, bool); - void reconnect (); + void content_change (boost::weak_ptr, ChangeType, boost::weak_ptr, int, bool); + void disconnect (); + void reconnect (boost::shared_ptr film); /** List of content. Kept sorted in position order. */ ContentList _content; diff --git a/src/lib/string_text_file_content.cc b/src/lib/string_text_file_content.cc index 9c941c2bb..35f76be7c 100644 --- a/src/lib/string_text_file_content.cc +++ b/src/lib/string_text_file_content.cc @@ -36,23 +36,23 @@ using boost::shared_ptr; using boost::optional; using dcp::raw_convert; -StringTextFileContent::StringTextFileContent (shared_ptr film, boost::filesystem::path path) - : Content (film, path) +StringTextFileContent::StringTextFileContent (boost::filesystem::path path) + : Content (path) { text.push_back (shared_ptr (new TextContent (this, TEXT_OPEN_SUBTITLE, TEXT_UNKNOWN))); } -StringTextFileContent::StringTextFileContent (shared_ptr film, cxml::ConstNodePtr node, int version) - : Content (film, node) +StringTextFileContent::StringTextFileContent (cxml::ConstNodePtr node, int version) + : Content (node) , _length (node->number_child ("Length")) { text = TextContent::from_xml (this, node, version); } void -StringTextFileContent::examine (boost::shared_ptr job) +StringTextFileContent::examine (shared_ptr film, shared_ptr job) { - Content::examine (job); + Content::examine (film, job); StringTextFile s (shared_from_this ()); /* Default to turning these subtitles on */ @@ -89,8 +89,8 @@ StringTextFileContent::as_xml (xmlpp::Node* node, bool with_paths) const } DCPTime -StringTextFileContent::full_length () const +StringTextFileContent::full_length (shared_ptr film) const { - FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate ()); + FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate()); return DCPTime (_length, frc); } diff --git a/src/lib/string_text_file_content.h b/src/lib/string_text_file_content.h index c2de86ce5..9a71d5828 100644 --- a/src/lib/string_text_file_content.h +++ b/src/lib/string_text_file_content.h @@ -28,18 +28,18 @@ class Job; class StringTextFileContent : public Content { public: - StringTextFileContent (boost::shared_ptr, boost::filesystem::path); - StringTextFileContent (boost::shared_ptr, cxml::ConstNodePtr, int); + StringTextFileContent (boost::filesystem::path); + StringTextFileContent (cxml::ConstNodePtr, int); boost::shared_ptr shared_from_this () { return boost::dynamic_pointer_cast (Content::shared_from_this ()); } - void examine (boost::shared_ptr); + void examine (boost::shared_ptr film, boost::shared_ptr); std::string summary () const; std::string technical_summary () const; void as_xml (xmlpp::Node *, bool with_paths) const; - DCPTime full_length () const; + DCPTime full_length (boost::shared_ptr film) const; private: ContentTime _length; diff --git a/src/lib/string_text_file_decoder.cc b/src/lib/string_text_file_decoder.cc index 8286c1e39..e67450b8b 100644 --- a/src/lib/string_text_file_decoder.cc +++ b/src/lib/string_text_file_decoder.cc @@ -35,7 +35,7 @@ using boost::shared_ptr; using boost::optional; using boost::dynamic_pointer_cast; -StringTextFileDecoder::StringTextFileDecoder (shared_ptr content, shared_ptr log) +StringTextFileDecoder::StringTextFileDecoder (shared_ptr content) : StringTextFile (content) , _next (0) { @@ -43,11 +43,11 @@ StringTextFileDecoder::StringTextFileDecoder (shared_ptr (new TextDecoder (this, content->only_text(), log, first))); + text.push_back (shared_ptr (new TextDecoder (this, content->only_text(), first))); } void -StringTextFileDecoder::seek (ContentTime time, bool accurate) +StringTextFileDecoder::seek (shared_ptr film, ContentTime time, bool accurate) { /* It's worth back-tracking a little here as decoding is cheap and it's nice if we don't miss too many subtitles when seeking. @@ -57,7 +57,7 @@ StringTextFileDecoder::seek (ContentTime time, bool accurate) time = ContentTime(); } - Decoder::seek (time, accurate); + Decoder::seek (film, time, accurate); _next = 0; while (_next < _subtitles.size() && ContentTime::from_seconds (_subtitles[_next].from.all_as_seconds ()) < time) { @@ -66,7 +66,7 @@ StringTextFileDecoder::seek (ContentTime time, bool accurate) } bool -StringTextFileDecoder::pass () +StringTextFileDecoder::pass (shared_ptr) { if (_next >= _subtitles.size ()) { return true; diff --git a/src/lib/string_text_file_decoder.h b/src/lib/string_text_file_decoder.h index 6a9552bbe..8cdf8cd9e 100644 --- a/src/lib/string_text_file_decoder.h +++ b/src/lib/string_text_file_decoder.h @@ -25,15 +25,14 @@ #include "decoder.h" class StringTextFileContent; -class Log; class StringTextFileDecoder : public Decoder, public StringTextFile { public: - StringTextFileDecoder (boost::shared_ptr, boost::shared_ptr log); + StringTextFileDecoder (boost::shared_ptr); - void seek (ContentTime time, bool accurate); - bool pass (); + void seek (boost::shared_ptr film, ContentTime time, bool accurate); + bool pass (boost::shared_ptr film); private: ContentTimePeriod content_time_period (sub::Subtitle s) const; diff --git a/src/lib/text_decoder.cc b/src/lib/text_decoder.cc index d6cf517c2..74fea6ec3 100644 --- a/src/lib/text_decoder.cc +++ b/src/lib/text_decoder.cc @@ -40,10 +40,9 @@ using boost::function; TextDecoder::TextDecoder ( Decoder* parent, shared_ptr c, - shared_ptr log, ContentTime first ) - : DecoderPart (parent, log) + : DecoderPart (parent) , _content (c) , _position (first) { diff --git a/src/lib/text_decoder.h b/src/lib/text_decoder.h index d45e37fc7..a82f43f51 100644 --- a/src/lib/text_decoder.h +++ b/src/lib/text_decoder.h @@ -41,11 +41,10 @@ public: TextDecoder ( Decoder* parent, boost::shared_ptr, - boost::shared_ptr log, ContentTime first ); - ContentTime position () const { + ContentTime position (boost::shared_ptr) const { return _position; } diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 8cb305463..15445a68a 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -38,7 +38,7 @@ #include "i18n.h" -#define LOG_GENERAL(...) _parent->film()->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); +#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); int const VideoContentProperty::SIZE = 0; int const VideoContentProperty::FRAME_TYPE = 1; @@ -332,10 +332,9 @@ VideoContent::size_after_crop () const } void -VideoContent::scale_and_crop_to_fit_width () +VideoContent::scale_and_crop_to_fit_width (shared_ptr film) { - shared_ptr film = _parent->film (); - set_scale (VideoContentScale (film->container ())); + set_scale (VideoContentScale(film->container())); int const crop = max (0, int (size().height - double (film->frame_size().height) * size().width / film->frame_size().width)); set_left_crop (0); @@ -345,10 +344,9 @@ VideoContent::scale_and_crop_to_fit_width () } void -VideoContent::scale_and_crop_to_fit_height () +VideoContent::scale_and_crop_to_fit_height (shared_ptr film) { - shared_ptr film = _parent->film (); - set_scale (VideoContentScale (film->container ())); + set_scale (VideoContentScale(film->container())); int const crop = max (0, int (size().width - double (film->frame_size().width) * size().height / film->frame_size().height)); set_left_crop (crop / 2); @@ -359,13 +357,11 @@ VideoContent::scale_and_crop_to_fit_height () /** @param f Frame index within the whole (untrimmed) content */ optional -VideoContent::fade (Frame f) const +VideoContent::fade (shared_ptr film, Frame f) const { DCPOMATIC_ASSERT (f >= 0); - shared_ptr film = _parent->film (); - - double const vfr = _parent->active_video_frame_rate (); + double const vfr = _parent->active_video_frame_rate(film); Frame const ts = _parent->trim_start().frames_round(vfr); if ((f - ts) < fade_in()) { @@ -381,7 +377,7 @@ VideoContent::fade (Frame f) const } string -VideoContent::processing_description () const +VideoContent::processing_description (shared_ptr film) const { string d; char buffer[256]; @@ -417,7 +413,6 @@ VideoContent::processing_description () const d += buffer; } - shared_ptr film = _parent->film (); dcp::Size const container_size = film->frame_size (); dcp::Size const scaled = scale().size (shared_from_this(), container_size, container_size); @@ -547,9 +542,9 @@ VideoContent::take_settings_from (shared_ptr c) } void -VideoContent::modify_position (DCPTime& pos) const +VideoContent::modify_position (shared_ptr film, DCPTime& pos) const { - pos = pos.round (_parent->film()->video_frame_rate()); + pos = pos.round (film->video_frame_rate()); } void diff --git a/src/lib/video_content.h b/src/lib/video_content.h index 774210c13..7ecc2813a 100644 --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@ -156,19 +156,19 @@ public: dcp::Size size_after_3d_split () const; dcp::Size size_after_crop () const; - boost::optional fade (Frame) const; + boost::optional fade (boost::shared_ptr film, Frame) const; - void scale_and_crop_to_fit_width (); - void scale_and_crop_to_fit_height (); + void scale_and_crop_to_fit_width (boost::shared_ptr film); + void scale_and_crop_to_fit_height (boost::shared_ptr film); - std::string processing_description () const; + std::string processing_description (boost::shared_ptr film) const; void set_length (Frame); void take_from_examiner (boost::shared_ptr); void add_properties (std::list &) const; - void modify_position (DCPTime& pos) const; + void modify_position (boost::shared_ptr film, DCPTime& pos) const; void modify_trim_start (ContentTime& pos) const; static boost::shared_ptr from_xml (Content* parent, cxml::ConstNodePtr, int); diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc index 3625e074f..813320eb8 100644 --- a/src/lib/video_decoder.cc +++ b/src/lib/video_decoder.cc @@ -36,8 +36,8 @@ using std::back_inserter; using boost::shared_ptr; using boost::optional; -VideoDecoder::VideoDecoder (Decoder* parent, shared_ptr c, shared_ptr log) - : DecoderPart (parent, log) +VideoDecoder::VideoDecoder (Decoder* parent, shared_ptr c) + : DecoderPart (parent) , _content (c) { @@ -53,7 +53,7 @@ VideoDecoder::VideoDecoder (Decoder* parent, shared_ptr c, shared * and so on. */ void -VideoDecoder::emit (shared_ptr image, Frame frame) +VideoDecoder::emit (shared_ptr film, shared_ptr image, Frame frame) { if (ignore ()) { return; @@ -95,7 +95,7 @@ VideoDecoder::emit (shared_ptr image, Frame frame) DCPOMATIC_ASSERT (false); } - _position = ContentTime::from_frames (frame, _content->active_video_frame_rate ()); + _position = ContentTime::from_frames (frame, _content->active_video_frame_rate(film)); } void diff --git a/src/lib/video_decoder.h b/src/lib/video_decoder.h index 3fc30cf9d..0fc7ca5a4 100644 --- a/src/lib/video_decoder.h +++ b/src/lib/video_decoder.h @@ -44,20 +44,19 @@ class Log; class VideoDecoder : public DecoderPart { public: - VideoDecoder (Decoder* parent, boost::shared_ptr c, boost::shared_ptr log); + VideoDecoder (Decoder* parent, boost::shared_ptr c); friend struct video_decoder_fill_test1; friend struct video_decoder_fill_test2; friend struct ffmpeg_pts_offset_test; friend void ffmpeg_decoder_sequential_test_one (boost::filesystem::path file, float fps, int gaps, int video_length); - ContentTime position () const { + ContentTime position (boost::shared_ptr) const { return _position; } void seek (); - - void emit (boost::shared_ptr, Frame frame); + void emit (boost::shared_ptr film, boost::shared_ptr, Frame frame); /** @return true if the emitted data was accepted, false if not */ boost::signals2::signal Data; diff --git a/src/lib/video_mxf_content.cc b/src/lib/video_mxf_content.cc index 8e762ae14..4f69cb2e2 100644 --- a/src/lib/video_mxf_content.cc +++ b/src/lib/video_mxf_content.cc @@ -36,14 +36,14 @@ using std::list; using std::string; using boost::shared_ptr; -VideoMXFContent::VideoMXFContent (shared_ptr film, boost::filesystem::path path) - : Content (film, path) +VideoMXFContent::VideoMXFContent (boost::filesystem::path path) + : Content (path) { } -VideoMXFContent::VideoMXFContent (shared_ptr film, cxml::ConstNodePtr node, int version) - : Content (film, node) +VideoMXFContent::VideoMXFContent (cxml::ConstNodePtr node, int version) + : Content (node) { video = VideoContent::from_xml (this, node, version); } @@ -78,11 +78,11 @@ VideoMXFContent::valid_mxf (boost::filesystem::path path) } void -VideoMXFContent::examine (shared_ptr job) +VideoMXFContent::examine (shared_ptr film, shared_ptr job) { job->set_progress_unknown (); - Content::examine (job); + Content::examine (film, job); video.reset (new VideoContent (this)); shared_ptr examiner (new VideoMXFExaminer (shared_from_this ())); @@ -117,10 +117,10 @@ VideoMXFContent::as_xml (xmlpp::Node* node, bool with_paths) const } DCPTime -VideoMXFContent::full_length () const +VideoMXFContent::full_length (shared_ptr film) const { - FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate()); - return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film()->video_frame_rate()); + FrameRateChange const frc (active_video_frame_rate(film), film->video_frame_rate()); + return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film->video_frame_rate()); } void diff --git a/src/lib/video_mxf_content.h b/src/lib/video_mxf_content.h index 1fa428704..c536cb2aa 100644 --- a/src/lib/video_mxf_content.h +++ b/src/lib/video_mxf_content.h @@ -23,19 +23,19 @@ class VideoMXFContent : public Content { public: - VideoMXFContent (boost::shared_ptr film, boost::filesystem::path path); - VideoMXFContent (boost::shared_ptr film, cxml::ConstNodePtr node, int version); + VideoMXFContent (boost::filesystem::path path); + VideoMXFContent (cxml::ConstNodePtr node, int version); boost::shared_ptr shared_from_this () { return boost::dynamic_pointer_cast (Content::shared_from_this ()); } - void examine (boost::shared_ptr job); + void examine (boost::shared_ptr film, boost::shared_ptr job); std::string summary () const; std::string technical_summary () const; std::string identifier () const; void as_xml (xmlpp::Node* node, bool with_paths) const; - DCPTime full_length () const; + DCPTime full_length (boost::shared_ptr film) const; void add_properties (std::list& p) const; static bool valid_mxf (boost::filesystem::path path); diff --git a/src/lib/video_mxf_decoder.cc b/src/lib/video_mxf_decoder.cc index 194830c63..7d9656dd5 100644 --- a/src/lib/video_mxf_decoder.cc +++ b/src/lib/video_mxf_decoder.cc @@ -31,10 +31,10 @@ using boost::shared_ptr; using boost::optional; -VideoMXFDecoder::VideoMXFDecoder (shared_ptr content, shared_ptr log) +VideoMXFDecoder::VideoMXFDecoder (shared_ptr content) : _content (content) { - video.reset (new VideoDecoder (this, content, log)); + video.reset (new VideoDecoder (this, content)); shared_ptr mono; try { @@ -68,9 +68,9 @@ VideoMXFDecoder::VideoMXFDecoder (shared_ptr content, sha } bool -VideoMXFDecoder::pass () +VideoMXFDecoder::pass (shared_ptr film) { - double const vfr = _content->active_video_frame_rate (); + double const vfr = _content->active_video_frame_rate (film); int64_t const frame = _next.frames_round (vfr); if (frame >= _content->video->length()) { @@ -79,6 +79,7 @@ VideoMXFDecoder::pass () if (_mono_reader) { video->emit ( + film, shared_ptr ( new J2KImageProxy (_mono_reader->get_frame(frame), _size, AV_PIX_FMT_XYZ12LE, optional()) ), @@ -86,12 +87,14 @@ VideoMXFDecoder::pass () ); } else { video->emit ( + film, shared_ptr ( new J2KImageProxy (_stereo_reader->get_frame(frame), _size, dcp::EYE_LEFT, AV_PIX_FMT_XYZ12LE, optional()) ), frame ); video->emit ( + film, shared_ptr ( new J2KImageProxy (_stereo_reader->get_frame(frame), _size, dcp::EYE_RIGHT, AV_PIX_FMT_XYZ12LE, optional()) ), @@ -104,8 +107,8 @@ VideoMXFDecoder::pass () } void -VideoMXFDecoder::seek (ContentTime t, bool accurate) +VideoMXFDecoder::seek (shared_ptr film, ContentTime t, bool accurate) { - Decoder::seek (t, accurate); + Decoder::seek (film, t, accurate); _next = t; } diff --git a/src/lib/video_mxf_decoder.h b/src/lib/video_mxf_decoder.h index 3cbdcfb2d..6b5b328ac 100644 --- a/src/lib/video_mxf_decoder.h +++ b/src/lib/video_mxf_decoder.h @@ -28,10 +28,10 @@ class Log; class VideoMXFDecoder : public Decoder { public: - VideoMXFDecoder (boost::shared_ptr, boost::shared_ptr log); + VideoMXFDecoder (boost::shared_ptr); - bool pass (); - void seek (ContentTime t, bool accurate); + bool pass (boost::shared_ptr film); + void seek (boost::shared_ptr film, ContentTime t, bool accurate); private: diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 473cc6d8b..7028624a8 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -38,6 +38,7 @@ #include "lib/job_manager.h" #include "lib/job.h" #include "lib/film.h" +#include "lib/null_log.h" #include "lib/video_content.h" #include "lib/text_content.h" #include "lib/ratio.h" @@ -126,6 +127,9 @@ public: , _view_full_screen (0) , _view_dual_screen (0) { + /* XXX */ + dcpomatic_log.reset (new NullLog()); + cout << "here's the log " << dcpomatic_log.get() << "\n"; #if defined(DCPOMATIC_WINDOWS) maybe_open_console (); @@ -399,7 +403,7 @@ public: reset_film (); try { - shared_ptr dcp (new DCPContent(_film, dir)); + shared_ptr dcp (new DCPContent(dir)); _film->examine_and_add_content (dcp); bool const ok = display_progress (_("DCP-o-matic Player"), _("Loading content")); if (!ok || !report_errors_from_last_job(this)) { @@ -489,7 +493,7 @@ public: if (kdm) { dcp->add_kdm (*kdm); - dcp->examine (shared_ptr()); + dcp->examine (_film, shared_ptr()); } } @@ -692,7 +696,7 @@ private: DCPOMATIC_ASSERT (dcp); try { dcp->add_kdm (dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (d->GetPath ()), MAX_KDM_SIZE))); - dcp->examine (shared_ptr()); + dcp->examine (_film, shared_ptr()); } catch (exception& e) { error_dialog (this, wxString::Format (_("Could not load KDM.")), std_to_wx(e.what())); d->Destroy (); @@ -753,7 +757,7 @@ private: } dcp->set_cpl ((*i)->id()); - dcp->examine (shared_ptr()); + dcp->examine (_film, shared_ptr()); } void view_full_screen () diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc index e1f7c15a6..48540077e 100644 --- a/src/wx/audio_dialog.cc +++ b/src/wx/audio_dialog.cc @@ -156,7 +156,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr film, shared_ptr (_playlist)->add (content); + const_pointer_cast(_playlist)->add(film, content); } else { _playlist = film->playlist (); } diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index 954d1676d..38504eacf 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -266,7 +266,7 @@ AudioPanel::setup_description () return; } - checked_set (_description, ac.front()->audio->processing_description ()); + checked_set (_description, ac.front()->audio->processing_description(_parent->film())); } void @@ -304,7 +304,7 @@ AudioPanel::setup_sensitivity () } string why_not; - bool const can_reference = dcp && dcp->can_reference_audio (why_not); + bool const can_reference = dcp && dcp->can_reference_audio (_parent->film(), why_not); setup_refer_button (_reference, _reference_note, dcp, can_reference, why_not); if (_reference->GetValue ()) { @@ -353,7 +353,7 @@ AudioPanel::setup_peak () _peak->SetLabel (wxT ("")); } else { shared_ptr playlist (new Playlist); - playlist->add (sel.front ()); + playlist->add (_parent->film(), sel.front()); try { shared_ptr analysis (new AudioAnalysis (_parent->film()->audio_analysis_path (playlist))); peak_dB = 20 * log10 (analysis->overall_sample_peak().first.peak) + analysis->gain_correction (playlist); diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc index 6a5ca8be4..017d2c659 100644 --- a/src/wx/content_menu.cc +++ b/src/wx/content_menu.cc @@ -209,7 +209,7 @@ ContentMenu::join () } try { - shared_ptr joined (new FFmpegContent (film, fc)); + shared_ptr joined (new FFmpegContent(fc)); film->remove_content (_content); film->examine_and_add_content (joined); } catch (JoinError& e) { @@ -306,9 +306,9 @@ ContentMenu::find_missing () if (r == wxID_OK) { if (dc) { - content.push_back (shared_ptr (new DCPContent (film, path))); + content.push_back (shared_ptr(new DCPContent(path))); } else { - content = content_factory (film, path); + content = content_factory (path); } } diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index 8e6c49294..93b270faa 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -450,7 +450,7 @@ ContentPanel::add_folder_clicked () list > content; try { - content = content_factory (_film, path); + content = content_factory (path); } catch (exception& e) { error_dialog (_parent, e.what()); return; @@ -493,7 +493,7 @@ ContentPanel::add_dcp_clicked () } try { - _film->examine_and_add_content (shared_ptr (new DCPContent (_film, path))); + _film->examine_and_add_content (shared_ptr (new DCPContent (path))); } catch (exception& e) { error_dialog (_parent, e.what()); } @@ -755,7 +755,7 @@ ContentPanel::add_files (list paths) try { BOOST_FOREACH (boost::filesystem::path i, paths) { - BOOST_FOREACH (shared_ptr j, content_factory (_film, i)) { + BOOST_FOREACH (shared_ptr j, content_factory(i)) { _film->examine_and_add_content (j); } } diff --git a/src/wx/controls.cc b/src/wx/controls.cc index cf805e8f7..af1dbdf14 100644 --- a/src/wx/controls.cc +++ b/src/wx/controls.cc @@ -214,7 +214,7 @@ Controls::Controls (wxWindow* parent, shared_ptr viewer, bool editor void Controls::add_clicked () { - shared_ptr sel = selected_content()->clone(); + shared_ptr sel = selected_content()->clone(_film); DCPOMATIC_ASSERT (sel); _film->examine_and_add_content (sel); bool const ok = display_progress (_("DCP-o-matic"), _("Loading DCP")); @@ -604,7 +604,7 @@ Controls::add_content_to_list (shared_ptr content, wxListCtrl* ctrl) wxListItem it; it.SetId(N); it.SetColumn(0); - DCPTime length = content->length_after_trim (); + DCPTime length = content->length_after_trim (_film); int seconds = length.seconds(); int minutes = seconds / 60; seconds -= minutes * 60; @@ -662,9 +662,9 @@ Controls::update_content_directory () try { shared_ptr content; if (is_directory(*i) && (is_regular_file(*i / "ASSETMAP") || is_regular_file(*i / "ASSETMAP.xml"))) { - content.reset (new DCPContent(_film, *i)); + content.reset (new DCPContent(*i)); } else if (i->path().extension() == ".mp4" || i->path().extension() == ".ecinema") { - content = content_factory(_film, *i).front(); + content = content_factory(*i).front(); } if (content) { diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index afa1940db..2d489b3e8 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -544,7 +544,7 @@ FilmViewer::quick_refresh () return false; } - if (!_player_video.first->reset_metadata (_player->video_container_size(), _film->frame_size())) { + if (!_player_video.first->reset_metadata (_film, _player->video_container_size(), _film->frame_size())) { return false; } diff --git a/src/wx/player_information.cc b/src/wx/player_information.cc index c0821510c..5f480d5b4 100644 --- a/src/wx/player_information.cc +++ b/src/wx/player_information.cc @@ -153,8 +153,8 @@ PlayerInformation::triggered_update () string const len = String::compose( wx_to_std(_("Length: %1 (%2 frames)")), - time_to_hmsf(dcp->full_length(), lrint(*vfr)), - dcp->full_length().frames_round(*vfr) + time_to_hmsf(dcp->full_length(fv->film()), lrint(*vfr)), + dcp->full_length(fv->film()).frames_round(*vfr) ); checked_set (_dcp[r++], std_to_wx(len)); diff --git a/src/wx/subtitle_appearance_dialog.cc b/src/wx/subtitle_appearance_dialog.cc index 6473cd68b..a37f5a2ce 100644 --- a/src/wx/subtitle_appearance_dialog.cc +++ b/src/wx/subtitle_appearance_dialog.cc @@ -39,8 +39,9 @@ int const SubtitleAppearanceDialog::NONE = 0; int const SubtitleAppearanceDialog::OUTLINE = 1; int const SubtitleAppearanceDialog::SHADOW = 2; -SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr content, shared_ptr caption) +SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr film, shared_ptr content, shared_ptr caption) : wxDialog (parent, wxID_ANY, _("Caption appearance")) + , _film (film) , _content (content) , _caption (caption) { @@ -164,17 +165,17 @@ SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr optional fade_in = _caption->fade_in(); _force_fade_in->SetValue (static_cast(fade_in)); if (fade_in) { - _fade_in->set (*fade_in, _content->active_video_frame_rate()); + _fade_in->set (*fade_in, _content->active_video_frame_rate(film)); } else { - _fade_in->set (ContentTime(), _content->active_video_frame_rate()); + _fade_in->set (ContentTime(), _content->active_video_frame_rate(film)); } optional fade_out = _caption->fade_out(); _force_fade_out->SetValue (static_cast(fade_out)); if (fade_out) { - _fade_out->set (*fade_out, _content->active_video_frame_rate ()); + _fade_out->set (*fade_out, _content->active_video_frame_rate(film)); } else { - _fade_out->set (ContentTime(), _content->active_video_frame_rate ()); + _fade_out->set (ContentTime(), _content->active_video_frame_rate(film)); } _outline_width->SetValue (_caption->outline_width ()); @@ -213,6 +214,8 @@ SubtitleAppearanceDialog::set_to (wxWindow* w, int& r) void SubtitleAppearanceDialog::apply () { + shared_ptr film = _film.lock (); + if (_force_colour->GetValue ()) { wxColour const c = _colour->GetColour (); _caption->set_colour (dcp::Colour (c.Red(), c.Green(), c.Blue())); @@ -241,12 +244,12 @@ SubtitleAppearanceDialog::apply () _caption->unset_effect_colour (); } if (_force_fade_in->GetValue ()) { - _caption->set_fade_in (_fade_in->get (_content->active_video_frame_rate ())); + _caption->set_fade_in (_fade_in->get(_content->active_video_frame_rate(film))); } else { _caption->unset_fade_in (); } if (_force_fade_out->GetValue ()) { - _caption->set_fade_out (_fade_out->get (_content->active_video_frame_rate ())); + _caption->set_fade_out (_fade_out->get(_content->active_video_frame_rate(film))); } else { _caption->unset_fade_out (); } diff --git a/src/wx/subtitle_appearance_dialog.h b/src/wx/subtitle_appearance_dialog.h index 80ef58470..d02e283d9 100644 --- a/src/wx/subtitle_appearance_dialog.h +++ b/src/wx/subtitle_appearance_dialog.h @@ -32,11 +32,12 @@ class RGBAColourPicker; class FFmpegSubtitleStream; class wxCheckBox; class wxWidget; +class Film; class SubtitleAppearanceDialog : public wxDialog { public: - SubtitleAppearanceDialog (wxWindow* parent, boost::shared_ptr content, boost::shared_ptr caption); + SubtitleAppearanceDialog (wxWindow* parent, boost::shared_ptr film, boost::shared_ptr content, boost::shared_ptr caption); void apply (); @@ -46,6 +47,7 @@ private: wxCheckBox* set_to (wxWindow* w, int& r); void content_change (ChangeType type); + boost::weak_ptr _film; wxCheckBox* _force_colour; wxColourPickerCtrl* _colour; wxCheckBox* _force_effect; diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc index 350dddc0d..4b53a941e 100644 --- a/src/wx/text_panel.cc +++ b/src/wx/text_panel.cc @@ -457,7 +457,7 @@ TextPanel::setup_sensitivity () } string why_not; - bool const can_reference = dcp && dcp->can_reference_text (_original_type, why_not); + bool const can_reference = dcp && dcp->can_reference_text (_parent->film(), _original_type, why_not); setup_refer_button (_reference, _reference_note, dcp, can_reference, why_not); bool const reference = _reference->GetValue (); @@ -582,7 +582,7 @@ TextPanel::text_view_clicked () ContentList c = _parent->selected_text (); DCPOMATIC_ASSERT (c.size() == 1); - shared_ptr decoder = decoder_factory (c.front(), _parent->film()->log(), false); + shared_ptr decoder = decoder_factory (_parent->film(), c.front(), false); if (decoder) { _text_view = new TextView (this, _parent->film(), c.front(), c.front()->text_of_original_type(_original_type), decoder, _parent->film_viewer()); @@ -627,7 +627,7 @@ TextPanel::appearance_dialog_clicked () ContentList c = _parent->selected_text (); DCPOMATIC_ASSERT (c.size() == 1); - SubtitleAppearanceDialog* d = new SubtitleAppearanceDialog (this, c.front(), c.front()->text_of_original_type(_original_type)); + SubtitleAppearanceDialog* d = new SubtitleAppearanceDialog (this, _parent->film(), c.front(), c.front()->text_of_original_type(_original_type)); if (d->ShowModal () == wxID_OK) { d->apply (); } diff --git a/src/wx/text_view.cc b/src/wx/text_view.cc index 9b591b191..49a98dc5e 100644 --- a/src/wx/text_view.cc +++ b/src/wx/text_view.cc @@ -96,7 +96,7 @@ TextView::TextView ( i->Stop.connect (bind (&TextView::data_stop, this, _1)); } } - while (!decoder->pass ()) {} + while (!decoder->pass (film)) {} SetSizerAndFit (sizer); } diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index a607b1eb1..206c13cf6 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -268,7 +268,7 @@ Timeline::film_content_change (ChangeType type, int property, bool frequent) template int -place (TimelineViewList& views, int& tracks) +place (shared_ptr film, TimelineViewList& views, int& tracks) { int const base = tracks; @@ -282,7 +282,7 @@ place (TimelineViewList& views, int& tracks) int t = base; shared_ptr content = cv->content(); - DCPTimePeriod const content_period (content->position(), content->end()); + DCPTimePeriod const content_period (content->position(), content->end(film)); while (true) { TimelineViewList::iterator j = views.begin(); @@ -296,7 +296,7 @@ place (TimelineViewList& views, int& tracks) shared_ptr test_content = test->content(); if ( test->track() && test->track().get() == t && - content_period.overlap(DCPTimePeriod(test_content->position(), test_content->end()))) { + content_period.overlap(DCPTimePeriod(test_content->position(), test_content->end(film)))) { /* we have an overlap on track `t' */ ++t; break; @@ -354,6 +354,9 @@ Timeline::assign_tracks () Audio N */ + shared_ptr film = _film.lock (); + DCPOMATIC_ASSERT (film); + _tracks = 0; for (TimelineViewList::iterator i = _views.begin(); i != _views.end(); ++i) { @@ -386,7 +389,7 @@ Timeline::assign_tracks () /* Texts */ - int const text_tracks = place (_views, _tracks); + int const text_tracks = place (film, _views, _tracks); /* Atmos */ @@ -412,7 +415,7 @@ Timeline::assign_tracks () TimelineViewList views = _views; sort(views.begin(), views.end(), AudioMappingComparator()); - int const audio_tracks = place (views, _tracks); + int const audio_tracks = place (film, views, _tracks); _labels_view->set_3d (have_3d); _labels_view->set_audio_tracks (audio_tracks); @@ -520,10 +523,13 @@ Timeline::left_down_select (wxMouseEvent& ev) continue; } + shared_ptr film = _film.lock (); + DCPOMATIC_ASSERT (film); + _start_snaps.push_back (cv->content()->position()); _end_snaps.push_back (cv->content()->position()); - _start_snaps.push_back (cv->content()->end()); - _end_snaps.push_back (cv->content()->end()); + _start_snaps.push_back (cv->content()->end(film)); + _end_snaps.push_back (cv->content()->end(film)); BOOST_FOREACH (DCPTime i, cv->content()->reel_split_points()) { _start_snaps.push_back (i); @@ -725,9 +731,11 @@ Timeline::set_position_from_event (wxMouseEvent& ev) DCPTime new_position = _down_view_position + DCPTime::from_seconds ((p.x - _down_point.x) / pps); - if (_snap) { + shared_ptr film = _film.lock (); + DCPOMATIC_ASSERT (film); - DCPTime const new_end = new_position + _down_view->content()->length_after_trim(); + if (_snap) { + DCPTime const new_end = new_position + _down_view->content()->length_after_trim(film); /* Signed `distance' to nearest thing (i.e. negative is left on the timeline, positive is right). */ @@ -755,10 +763,8 @@ Timeline::set_position_from_event (wxMouseEvent& ev) new_position = DCPTime (); } - _down_view->content()->set_position (new_position); + _down_view->content()->set_position (film, new_position); - shared_ptr film = _film.lock (); - DCPOMATIC_ASSERT (film); film->set_sequence (false); } diff --git a/src/wx/timeline_content_view.cc b/src/wx/timeline_content_view.cc index 12691f661..69f1723ce 100644 --- a/src/wx/timeline_content_view.cc +++ b/src/wx/timeline_content_view.cc @@ -50,7 +50,7 @@ TimelineContentView::bbox () const return dcpomatic::Rect ( time_x (content->position ()), y_pos (_track.get()), - content->length_after_trim().seconds() * _timeline.pixels_per_second().get_value_or(0), + content->length_after_trim(film).seconds() * _timeline.pixels_per_second().get_value_or(0), _timeline.pixels_per_track() ); } @@ -104,7 +104,7 @@ TimelineContentView::do_paint (wxGraphicsContext* gc, list } DCPTime const position = cont->position (); - DCPTime const len = cont->length_after_trim (); + DCPTime const len = cont->length_after_trim (film); wxColour selected (background_colour().Red() / 2, background_colour().Green() / 2, background_colour().Blue() / 2); diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc index b1d13367f..cbaed6870 100644 --- a/src/wx/timing_panel.cc +++ b/src/wx/timing_panel.cc @@ -227,11 +227,11 @@ TimingPanel::update_full_length () { set check; BOOST_FOREACH (shared_ptr i, _parent->selected ()) { - check.insert (i->full_length ()); + check.insert (i->full_length(_parent->film())); } if (check.size() == 1) { - _full_length->set (_parent->selected().front()->full_length (), _parent->film()->video_frame_rate ()); + _full_length->set (_parent->selected().front()->full_length(_parent->film()), _parent->film()->video_frame_rate()); } else { _full_length->clear (); } @@ -242,11 +242,11 @@ TimingPanel::update_play_length () { set check; BOOST_FOREACH (shared_ptr i, _parent->selected ()) { - check.insert (i->length_after_trim ()); + check.insert (i->length_after_trim(_parent->film())); } if (check.size() == 1) { - _play_length->set (_parent->selected().front()->length_after_trim (), _parent->film()->video_frame_rate ()); + _play_length->set (_parent->selected().front()->length_after_trim(_parent->film()), _parent->film()->video_frame_rate()); } else { _play_length->clear (); } @@ -371,7 +371,7 @@ TimingPanel::position_changed () { DCPTime const pos = _position->get (_parent->film()->video_frame_rate ()); BOOST_FOREACH (shared_ptr i, _parent->selected ()) { - i->set_position (pos); + i->set_position (_parent->film(), pos); } } @@ -407,7 +407,7 @@ TimingPanel::trim_start_changed () ContentTime const trim = _trim_start->get (_parent->film()->video_frame_rate ()); BOOST_FOREACH (shared_ptr i, _parent->selected ()) { - if (i->position() <= ph && ph < i->end()) { + if (i->position() <= ph && ph < i->end(_parent->film())) { /* The playhead is in i. Use it as a reference to work out where to put the playhead post-trim; we're trying to keep the playhead at the same frame of content that we're looking at pre-trim. @@ -457,7 +457,7 @@ TimingPanel::play_length_changed () BOOST_FOREACH (shared_ptr i, _parent->selected ()) { FrameRateChange const frc = _parent->film()->active_frame_rate_change (i->position ()); i->set_trim_end ( - ContentTime (max(DCPTime(), i->full_length() - play_length), frc) - i->trim_start () + ContentTime (max(DCPTime(), i->full_length(_parent->film()) - play_length), frc) - i->trim_start() ); } } @@ -522,9 +522,9 @@ TimingPanel::trim_start_to_playhead_clicked () fv->set_coalesce_player_changes (true); BOOST_FOREACH (shared_ptr i, _parent->selected ()) { - if (i->position() < ph && ph < i->end ()) { - FrameRateChange const frc = film->active_frame_rate_change (i->position ()); - i->set_trim_start (i->trim_start() + ContentTime (ph - i->position (), frc)); + if (i->position() < ph && ph < i->end(film)) { + FrameRateChange const frc = film->active_frame_rate_change (i->position()); + i->set_trim_start (i->trim_start() + ContentTime (ph - i->position(), frc)); new_ph = i->position (); } } @@ -547,9 +547,9 @@ TimingPanel::trim_end_to_playhead_clicked () shared_ptr film = _parent->film (); DCPTime const ph = fv->position().floor (film->video_frame_rate ()); BOOST_FOREACH (shared_ptr i, _parent->selected ()) { - if (i->position() < ph && ph < i->end ()) { + if (i->position() < ph && ph < i->end(film)) { FrameRateChange const frc = film->active_frame_rate_change (i->position ()); - i->set_trim_end (ContentTime (i->position() + i->full_length() - ph - DCPTime::from_frames (1, frc.dcp), frc) - i->trim_start()); + i->set_trim_end (ContentTime(i->position() + i->full_length(film) - ph - DCPTime::from_frames(1, frc.dcp), frc) - i->trim_start()); } } } @@ -572,7 +572,7 @@ TimingPanel::setup_sensitivity () DCPTime const ph = fv->position (); bool any_over_ph = false; BOOST_FOREACH (shared_ptr i, _parent->selected ()) { - if (i->position() <= ph && ph < i->end()) { + if (i->position() <= ph && ph < i->end(_parent->film())) { any_over_ph = true; } } @@ -601,8 +601,8 @@ TimingPanel::move_to_start_of_reel_clicked () MoveToDialog* d = new MoveToDialog (this, position, _parent->film()); if (d->ShowModal() == wxID_OK) { - BOOST_FOREACH (shared_ptr i, _parent->selected ()) { - i->set_position (d->position ()); + BOOST_FOREACH (shared_ptr i, _parent->selected()) { + i->set_position (_parent->film(), d->position()); } } d->Destroy (); diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index c525c1003..55c0984a3 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -361,8 +361,8 @@ VideoPanel::film_content_changed (int property) if (check.size() == 1) { _fade_in->set ( - ContentTime::from_frames (vc.front()->video->fade_in (), vc.front()->active_video_frame_rate ()), - vc.front()->active_video_frame_rate () + ContentTime::from_frames (vc.front()->video->fade_in(), vc.front()->active_video_frame_rate(_parent->film())), + vc.front()->active_video_frame_rate(_parent->film()) ); } else { _fade_in->clear (); @@ -375,8 +375,8 @@ VideoPanel::film_content_changed (int property) if (check.size() == 1) { _fade_out->set ( - ContentTime::from_frames (vc.front()->video->fade_out (), vc.front()->active_video_frame_rate ()), - vc.front()->active_video_frame_rate () + ContentTime::from_frames (vc.front()->video->fade_out(), vc.front()->active_video_frame_rate(_parent->film())), + vc.front()->active_video_frame_rate(_parent->film()) ); } else { _fade_out->clear (); @@ -420,7 +420,7 @@ VideoPanel::setup_description () return; } - string d = vc.front()->video->processing_description (); + string d = vc.front()->video->processing_description (_parent->film()); size_t lines = count (d.begin(), d.end(), '\n'); for (int i = lines; i < 6; ++i) { @@ -504,7 +504,7 @@ VideoPanel::setup_sensitivity () } string why_not; - bool const can_reference = dcp && dcp->can_reference_video (why_not); + bool const can_reference = dcp && dcp->can_reference_video (_parent->film(), why_not); setup_refer_button (_reference, _reference_note, dcp, can_reference, why_not); if (_reference->GetValue ()) { diff --git a/test/4k_test.cc b/test/4k_test.cc index e6e2cc7ce..da3fdf020 100644 --- a/test/4k_test.cc +++ b/test/4k_test.cc @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE (fourk_test) { shared_ptr film = new_test_film ("4k_test"); film->set_name ("4k_test"); - shared_ptr c (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr c (new FFmpegContent("test/data/test.mp4")); film->set_resolution (RESOLUTION_4K); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_container (Ratio::from_id ("185")); diff --git a/test/audio_analysis_test.cc b/test/audio_analysis_test.cc index a49987125..2fbaef7ea 100644 --- a/test/audio_analysis_test.cc +++ b/test/audio_analysis_test.cc @@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE (audio_analysis_test) film->set_name ("audio_analysis_test"); boost::filesystem::path p = private_data / "betty_L.wav"; - shared_ptr c (new FFmpegContent (film, p)); + shared_ptr c (new FFmpegContent(p)); film->examine_and_add_content (c); wait_for_jobs (); @@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE (audio_analysis_negative_delay_test) { shared_ptr film = new_test_film ("audio_analysis_negative_delay_test"); film->set_name ("audio_analysis_negative_delay_test"); - shared_ptr c (new FFmpegContent (film, private_data / "boon_telly.mkv")); + shared_ptr c (new FFmpegContent(private_data / "boon_telly.mkv")); film->examine_and_add_content (c); wait_for_jobs (); @@ -144,7 +144,7 @@ BOOST_AUTO_TEST_CASE (audio_analysis_test2) { shared_ptr film = new_test_film ("audio_analysis_test2"); film->set_name ("audio_analysis_test2"); - shared_ptr c (new FFmpegContent (film, private_data / "3d_thx_broadway_2010_lossless.m2ts")); + shared_ptr c (new FFmpegContent(private_data / "3d_thx_broadway_2010_lossless.m2ts")); film->examine_and_add_content (c); wait_for_jobs (); @@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE (audio_analysis_test3) film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); film->set_name ("frobozz"); - shared_ptr content (new FFmpegContent (film, "test/data/white.wav")); + shared_ptr content (new FFmpegContent("test/data/white.wav")); film->examine_and_add_content (content); wait_for_jobs (); @@ -191,12 +191,12 @@ BOOST_AUTO_TEST_CASE (analyse_audio_test4) film->set_container (Ratio::from_id ("185")); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); film->set_name ("frobozz"); - shared_ptr content = content_factory(film, private_data / "20 The Wedding Convoy Song.m4a").front(); + shared_ptr content = content_factory(private_data / "20 The Wedding Convoy Song.m4a").front(); film->examine_and_add_content (content); wait_for_jobs (); shared_ptr playlist (new Playlist); - playlist->add (content); + playlist->add (film, content); boost::signals2::connection c; JobManager::instance()->analyse_audio (film, playlist, false, c, boost::bind (&finished)); BOOST_CHECK (!wait_for_jobs ()); diff --git a/test/audio_delay_test.cc b/test/audio_delay_test.cc index db64bc7c8..d486364f2 100644 --- a/test/audio_delay_test.cc +++ b/test/audio_delay_test.cc @@ -58,7 +58,7 @@ void test_audio_delay (int delay_in_ms) film->set_container (Ratio::from_id ("185")); film->set_name (film_name); - shared_ptr content (new FFmpegContent (film, "test/data/staircase.wav")); + shared_ptr content (new FFmpegContent("test/data/staircase.wav")); film->examine_and_add_content (content); wait_for_jobs (); content->audio->set_delay (delay_in_ms); diff --git a/test/audio_processor_test.cc b/test/audio_processor_test.cc index de212f611..9c790833c 100644 --- a/test/audio_processor_test.cc +++ b/test/audio_processor_test.cc @@ -39,7 +39,7 @@ BOOST_AUTO_TEST_CASE (audio_processor_test) { shared_ptr film = new_test_film ("audio_processor_test"); film->set_name ("audio_processor_test"); - shared_ptr c (new FFmpegContent (film, "test/data/white.wav")); + shared_ptr c (new FFmpegContent("test/data/white.wav")); film->examine_and_add_content (c); wait_for_jobs (); diff --git a/test/butler_test.cc b/test/butler_test.cc index 0ee06c1ac..a453bd858 100644 --- a/test/butler_test.cc +++ b/test/butler_test.cc @@ -37,9 +37,9 @@ BOOST_AUTO_TEST_CASE (butler_test1) film->set_name ("butler_test1"); film->set_container (Ratio::from_id ("185")); - shared_ptr video = content_factory(film, "test/data/flat_red.png").front (); + shared_ptr video = content_factory("test/data/flat_red.png").front (); film->examine_and_add_content (video); - shared_ptr audio = content_factory(film, "test/data/staircase.wav").front (); + shared_ptr audio = content_factory("test/data/staircase.wav").front (); film->examine_and_add_content (audio); BOOST_REQUIRE (!wait_for_jobs ()); diff --git a/test/closed_caption_test.cc b/test/closed_caption_test.cc index 0409d5849..b50430d48 100644 --- a/test/closed_caption_test.cc +++ b/test/closed_caption_test.cc @@ -35,7 +35,7 @@ using boost::shared_ptr; BOOST_AUTO_TEST_CASE (closed_caption_test1) { shared_ptr film = new_test_film2 ("closed_caption_test1"); - shared_ptr content (new StringTextFileContent (film, "test/data/subrip.srt")); + shared_ptr content (new StringTextFileContent("test/data/subrip.srt")); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); @@ -60,11 +60,11 @@ BOOST_AUTO_TEST_CASE (closed_caption_test1) BOOST_AUTO_TEST_CASE (closed_caption_test2) { shared_ptr film = new_test_film2 ("closed_caption_test2"); - shared_ptr content1 (new StringTextFileContent (film, "test/data/subrip.srt")); + shared_ptr content1 (new StringTextFileContent("test/data/subrip.srt")); film->examine_and_add_content (content1); - shared_ptr content2 (new StringTextFileContent (film, "test/data/subrip2.srt")); + shared_ptr content2 (new StringTextFileContent("test/data/subrip2.srt")); film->examine_and_add_content (content2); - shared_ptr content3 (new StringTextFileContent (film, "test/data/subrip3.srt")); + shared_ptr content3 (new StringTextFileContent("test/data/subrip3.srt")); film->examine_and_add_content (content3); BOOST_REQUIRE (!wait_for_jobs ()); diff --git a/test/content_test.cc b/test/content_test.cc index 398c88be2..55e34ac5f 100644 --- a/test/content_test.cc +++ b/test/content_test.cc @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE (content_test1) film->set_name ("content_test1"); film->set_container (Ratio::from_id ("185")); - shared_ptr content = content_factory(film, private_data / "demo_sound_bug.mkv").front (); + shared_ptr content = content_factory(private_data / "demo_sound_bug.mkv").front (); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); film->make_dcp (); @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE (content_test2) { shared_ptr film = new_test_film2 ("content_test2"); - shared_ptr content = content_factory(film, "test/data/red_23976.mp4").front(); + shared_ptr content = content_factory("test/data/red_23976.mp4").front(); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); content->set_trim_start(ContentTime::from_seconds(0.5)); @@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE (content_test3) shared_ptr film = new_test_film2 ("content_test3"); film->set_sequence (false); - shared_ptr content = content_factory(film, "test/data/red_24.mp4").front(); + shared_ptr content = content_factory("test/data/red_24.mp4").front(); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); @@ -104,15 +104,15 @@ BOOST_AUTO_TEST_CASE (content_test3) /* Position */ /* 12 frames */ - content->set_position (DCPTime::from_seconds (12.0 / 24.0)); + content->set_position (film, DCPTime::from_seconds(12.0 / 24.0)); BOOST_CHECK (content->position() == DCPTime::from_seconds (12.0 / 24.0)); /* 11.2 frames */ - content->set_position (DCPTime::from_seconds (11.2 / 24.0)); + content->set_position (film, DCPTime::from_seconds(11.2 / 24.0)); BOOST_CHECK (content->position() == DCPTime::from_seconds (11.0 / 24.0)); /* 13.9 frames */ - content->set_position (DCPTime::from_seconds (13.9 / 24.0)); + content->set_position (film, DCPTime::from_seconds(13.9 / 24.0)); BOOST_CHECK (content->position() == DCPTime::from_seconds (14.0 / 24.0)); content->set_video_frame_rate (25); diff --git a/test/dcp_playback_test.cc b/test/dcp_playback_test.cc index 3e3ffe089..4bb4d5a5d 100644 --- a/test/dcp_playback_test.cc +++ b/test/dcp_playback_test.cc @@ -33,7 +33,7 @@ using boost::optional; BOOST_AUTO_TEST_CASE (dcp_playback_test) { shared_ptr film = new_test_film ("dcp_playback_test"); - shared_ptr content (new DCPContent(film, private_data / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV")); + shared_ptr content (new DCPContent(private_data / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV")); film->examine_and_add_content (content); wait_for_jobs (); diff --git a/test/dcp_subtitle_test.cc b/test/dcp_subtitle_test.cc index 47938d309..5a1cf4391 100644 --- a/test/dcp_subtitle_test.cc +++ b/test/dcp_subtitle_test.cc @@ -65,11 +65,11 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test) film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); film->set_name ("frobozz"); film->set_interop (false); - shared_ptr content (new DCPSubtitleContent (film, "test/data/dcp_sub.xml")); + shared_ptr content (new DCPSubtitleContent ("test/data/dcp_sub.xml")); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); - BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(2).get()); + BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(2).get()); content->only_text()->set_use (true); content->only_text()->set_burn (false); @@ -86,15 +86,15 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_within_dcp_test) film->set_container (Ratio::from_id ("185")); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); film->set_name ("frobozz"); - shared_ptr content (new DCPContent (film, private_data / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV")); + shared_ptr content (new DCPContent(private_data / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV")); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); - shared_ptr decoder (new DCPDecoder (content, film->log(), false)); + shared_ptr decoder (new DCPDecoder (content, false)); decoder->only_text()->PlainStart.connect (bind (store, _1)); stored = optional (); - while (!decoder->pass() && !stored) {} + while (!decoder->pass(film) && !stored) {} BOOST_REQUIRE (stored); BOOST_REQUIRE_EQUAL (stored->subs.size(), 2); @@ -109,15 +109,15 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test2) film->set_container (Ratio::from_id ("185")); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); film->set_name ("frobozz"); - shared_ptr content (new DCPSubtitleContent (film, "test/data/dcp_sub2.xml")); + shared_ptr content (new DCPSubtitleContent("test/data/dcp_sub2.xml")); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); - shared_ptr decoder (new DCPSubtitleDecoder (content, film->log())); + shared_ptr decoder (new DCPSubtitleDecoder(content)); decoder->only_text()->PlainStart.connect (bind (store, _1)); stored = optional (); - while (!decoder->pass ()) { + while (!decoder->pass(film)) { if (stored && stored->from() == ContentTime(0)) { BOOST_CHECK_EQUAL (stored->subs.front().text(), "<b>Hello world!</b>"); } @@ -132,16 +132,16 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test3) film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); film->set_name ("frobozz"); film->set_interop (true); - shared_ptr content (new DCPSubtitleContent (film, "test/data/dcp_sub3.xml")); + shared_ptr content (new DCPSubtitleContent ("test/data/dcp_sub3.xml")); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); film->make_dcp (); BOOST_REQUIRE (!wait_for_jobs ()); - shared_ptr decoder (new DCPSubtitleDecoder (content, film->log())); + shared_ptr decoder (new DCPSubtitleDecoder (content)); stored = optional (); - while (!decoder->pass ()) { + while (!decoder->pass (film)) { decoder->only_text()->PlainStart.connect (bind (store, _1)); if (stored && stored->from() == ContentTime::from_seconds(0.08)) { list s = stored->subs; @@ -165,9 +165,9 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test4) shared_ptr film = new_test_film2 ("dcp_subtitle_test4"); film->set_interop (true); - shared_ptr content (new DCPSubtitleContent (film, "test/data/dcp_sub3.xml")); + shared_ptr content (new DCPSubtitleContent ("test/data/dcp_sub3.xml")); film->examine_and_add_content (content); - shared_ptr content2 (new DCPSubtitleContent (film, "test/data/dcp_sub3.xml")); + shared_ptr content2 (new DCPSubtitleContent ("test/data/dcp_sub3.xml")); film->examine_and_add_content (content2); BOOST_REQUIRE (!wait_for_jobs ()); diff --git a/test/digest_test.cc b/test/digest_test.cc index 33eb00bf1..a3fd6c81b 100644 --- a/test/digest_test.cc +++ b/test/digest_test.cc @@ -63,9 +63,9 @@ BOOST_AUTO_TEST_CASE (digest_test) shared_ptr film = new_test_film ("digest_test"); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); film->set_name ("digest_test"); - shared_ptr r (new ImageContent (film, "test/data/flat_red.png")); - shared_ptr g (new ImageContent (film, "test/data/flat_green.png")); - shared_ptr b (new ImageContent (film, "test/data/flat_blue.png")); + shared_ptr r (new ImageContent("test/data/flat_red.png")); + shared_ptr g (new ImageContent("test/data/flat_green.png")); + shared_ptr b (new ImageContent("test/data/flat_blue.png")); film->examine_and_add_content (r); film->examine_and_add_content (g); film->examine_and_add_content (b); diff --git a/test/empty_test.cc b/test/empty_test.cc index 576577b97..890185267 100644 --- a/test/empty_test.cc +++ b/test/empty_test.cc @@ -44,8 +44,8 @@ BOOST_AUTO_TEST_CASE (empty_test1) film->set_name ("empty_test1"); film->set_container (Ratio::from_id ("185")); film->set_sequence (false); - shared_ptr contentA (new ImageContent (film, "test/data/simple_testcard_640x480.png")); - shared_ptr contentB (new ImageContent (film, "test/data/simple_testcard_640x480.png")); + shared_ptr contentA (new ImageContent("test/data/simple_testcard_640x480.png")); + shared_ptr contentB (new ImageContent("test/data/simple_testcard_640x480.png")); film->examine_and_add_content (contentA); film->examine_and_add_content (contentB); @@ -55,13 +55,13 @@ BOOST_AUTO_TEST_CASE (empty_test1) contentA->video->set_scale (VideoContentScale (Ratio::from_id ("185"))); contentA->video->set_length (3); - contentA->set_position (DCPTime::from_frames (2, vfr)); + contentA->set_position (film, DCPTime::from_frames (2, vfr)); contentB->video->set_scale (VideoContentScale (Ratio::from_id ("185"))); contentB->video->set_length (1); - contentB->set_position (DCPTime::from_frames (7, vfr)); + contentB->set_position (film, DCPTime::from_frames (7, vfr)); shared_ptr player (new Player(film, film->playlist())); - Empty black (player->_pieces, film->length(), bind(&has_video, _1)); + Empty black (film, player->_pieces, bind(&has_video, _1)); BOOST_REQUIRE_EQUAL (black._periods.size(), 2); BOOST_CHECK (black._periods.front().from == DCPTime()); BOOST_CHECK (black._periods.front().to == DCPTime::from_frames(2, vfr)); @@ -77,8 +77,8 @@ BOOST_AUTO_TEST_CASE (empty_test2) film->set_name ("empty_test1"); film->set_container (Ratio::from_id ("185")); film->set_sequence (false); - shared_ptr contentA (new ImageContent (film, "test/data/simple_testcard_640x480.png")); - shared_ptr contentB (new ImageContent (film, "test/data/simple_testcard_640x480.png")); + shared_ptr contentA (new ImageContent("test/data/simple_testcard_640x480.png")); + shared_ptr contentB (new ImageContent("test/data/simple_testcard_640x480.png")); film->examine_and_add_content (contentA); film->examine_and_add_content (contentB); @@ -88,13 +88,13 @@ BOOST_AUTO_TEST_CASE (empty_test2) contentA->video->set_scale (VideoContentScale (Ratio::from_id ("185"))); contentA->video->set_length (3); - contentA->set_position (DCPTime(0)); + contentA->set_position (film, DCPTime(0)); contentB->video->set_scale (VideoContentScale (Ratio::from_id ("185"))); contentB->video->set_length (1); - contentB->set_position (DCPTime::from_frames (7, vfr)); + contentB->set_position (film, DCPTime::from_frames(7, vfr)); shared_ptr player (new Player(film, film->playlist())); - Empty black (player->_pieces, film->length(), bind(&has_video, _1)); + Empty black (film, player->_pieces, bind(&has_video, _1)); BOOST_REQUIRE_EQUAL (black._periods.size(), 1); BOOST_CHECK (black._periods.front().from == DCPTime::from_frames(3, vfr)); BOOST_CHECK (black._periods.front().to == DCPTime::from_frames(7, vfr)); diff --git a/test/ffmpeg_audio_only_test.cc b/test/ffmpeg_audio_only_test.cc index e3c90cba9..8e2993e96 100644 --- a/test/ffmpeg_audio_only_test.cc +++ b/test/ffmpeg_audio_only_test.cc @@ -72,7 +72,7 @@ test (boost::filesystem::path file) shared_ptr film = new_test_film ("ffmpeg_audio_only_test"); film->set_name ("test_film"); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); - shared_ptr c (new FFmpegContent (film, file)); + shared_ptr c (new FFmpegContent(file)); film->examine_and_add_content (c); wait_for_jobs (); film->write_metadata (); diff --git a/test/ffmpeg_audio_test.cc b/test/ffmpeg_audio_test.cc index 0aafb505f..7a21ced06 100644 --- a/test/ffmpeg_audio_test.cc +++ b/test/ffmpeg_audio_test.cc @@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test) { shared_ptr film = new_test_film ("ffmpeg_audio_test"); film->set_name ("ffmpeg_audio_test"); - shared_ptr c (new FFmpegContent (film, "test/data/staircase.mov")); + shared_ptr c (new FFmpegContent ("test/data/staircase.mov")); film->examine_and_add_content (c); wait_for_jobs (); @@ -130,7 +130,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test) BOOST_AUTO_TEST_CASE (ffmpeg_audio_test2) { shared_ptr film = new_test_film2 ("ffmpeg_audio_test2"); - shared_ptr content = content_factory(film, private_data / "wayne.mkv").front(); + shared_ptr content = content_factory(private_data / "wayne.mkv").front(); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); @@ -142,7 +142,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test2) BOOST_AUTO_TEST_CASE (ffmpeg_audio_test3) { shared_ptr film = new_test_film2 ("ffmpeg_audio_test2"); - shared_ptr content = content_factory(film, private_data / "wayne.mkv").front(); + shared_ptr content = content_factory(private_data / "wayne.mkv").front(); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); diff --git a/test/ffmpeg_dcp_test.cc b/test/ffmpeg_dcp_test.cc index 7cdecb22f..4b2388bcd 100644 --- a/test/ffmpeg_dcp_test.cc +++ b/test/ffmpeg_dcp_test.cc @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_dcp_test) { shared_ptr film = new_test_film ("ffmpeg_dcp_test"); film->set_name ("test_film2"); - shared_ptr c (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr c (new FFmpegContent("test/data/test.mp4")); film->examine_and_add_content (c); wait_for_jobs (); diff --git a/test/ffmpeg_decoder_seek_test.cc b/test/ffmpeg_decoder_seek_test.cc index c09fd02f3..c6fae48cd 100644 --- a/test/ffmpeg_decoder_seek_test.cc +++ b/test/ffmpeg_decoder_seek_test.cc @@ -54,12 +54,12 @@ store (ContentVideo v) } static void -check (shared_ptr decoder, int frame) +check (shared_ptr film, shared_ptr decoder, int frame) { BOOST_REQUIRE (decoder->ffmpeg_content()->video_frame_rate ()); - decoder->seek (ContentTime::from_frames (frame, decoder->ffmpeg_content()->video_frame_rate().get()), true); + decoder->seek (film, ContentTime::from_frames (frame, decoder->ffmpeg_content()->video_frame_rate().get()), true); stored = optional (); - while (!decoder->pass() && !stored) {} + while (!decoder->pass(film) && !stored) {} BOOST_CHECK (stored->frame <= frame); } @@ -70,15 +70,14 @@ test (boost::filesystem::path file, vector frames) BOOST_REQUIRE (boost::filesystem::exists (path)); shared_ptr film = new_test_film ("ffmpeg_decoder_seek_test_" + file.string()); - shared_ptr content (new FFmpegContent (film, path)); + shared_ptr content (new FFmpegContent (path)); film->examine_and_add_content (content); wait_for_jobs (); - shared_ptr log (new NullLog); - shared_ptr decoder (new FFmpegDecoder (content, log, false)); + shared_ptr decoder (new FFmpegDecoder (film, content, false)); decoder->video->Data.connect (bind (&store, _1)); for (vector::const_iterator i = frames.begin(); i != frames.end(); ++i) { - check (decoder, *i); + check (film, decoder, *i); } } diff --git a/test/ffmpeg_decoder_sequential_test.cc b/test/ffmpeg_decoder_sequential_test.cc index 81dd07784..50c96afed 100644 --- a/test/ffmpeg_decoder_sequential_test.cc +++ b/test/ffmpeg_decoder_sequential_test.cc @@ -61,7 +61,7 @@ ffmpeg_decoder_sequential_test_one (boost::filesystem::path file, float fps, int BOOST_REQUIRE (boost::filesystem::exists (path)); shared_ptr film = new_test_film ("ffmpeg_decoder_sequential_test_" + file.string()); - shared_ptr content (new FFmpegContent (film, path)); + shared_ptr content (new FFmpegContent(path)); film->examine_and_add_content (content); wait_for_jobs (); film->write_metadata (); diff --git a/test/ffmpeg_encoder_test.cc b/test/ffmpeg_encoder_test.cc index 4b323c5bf..4f7725f0b 100644 --- a/test/ffmpeg_encoder_test.cc +++ b/test/ffmpeg_encoder_test.cc @@ -56,7 +56,7 @@ ffmpeg_content_test (int number, boost::filesystem::path content, ExportFormat f shared_ptr film = new_test_film (name); film->set_name (name); - shared_ptr c (new FFmpegContent (film, content)); + shared_ptr c (new FFmpegContent(content)); film->set_container (Ratio::from_id ("185")); film->set_audio_channels (6); @@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test5) { shared_ptr film = new_test_film ("ffmpeg_encoder_prores_test5"); film->set_name ("ffmpeg_encoder_prores_test5"); - shared_ptr c (new ImageContent (film, private_data / "bbc405.png")); + shared_ptr c (new ImageContent(private_data / "bbc405.png")); film->set_container (Ratio::from_id ("185")); film->set_audio_channels (6); @@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test6) film->set_container (Ratio::from_id ("185")); film->set_audio_channels (6); - shared_ptr s (new StringTextFileContent (film, "test/data/subrip2.srt")); + shared_ptr s (new StringTextFileContent("test/data/subrip2.srt")); film->examine_and_add_content (s); BOOST_REQUIRE (!wait_for_jobs ()); s->only_text()->set_colour (dcp::Colour (255, 255, 0)); @@ -142,11 +142,11 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test7) film->set_container (Ratio::from_id ("185")); film->set_audio_channels (6); - shared_ptr c (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr c (new FFmpegContent("test/data/test.mp4")); film->examine_and_add_content (c); BOOST_REQUIRE (!wait_for_jobs ()); - shared_ptr s (new StringTextFileContent (film, "test/data/subrip.srt")); + shared_ptr s (new StringTextFileContent("test/data/subrip.srt")); film->examine_and_add_content (s); BOOST_REQUIRE (!wait_for_jobs ()); s->only_text()->set_colour (dcp::Colour (255, 255, 0)); @@ -172,7 +172,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test2) film->set_container (Ratio::from_id ("185")); film->set_audio_channels (6); - shared_ptr s (new StringTextFileContent (film, "test/data/subrip2.srt")); + shared_ptr s (new StringTextFileContent("test/data/subrip2.srt")); film->examine_and_add_content (s); BOOST_REQUIRE (!wait_for_jobs ()); s->only_text()->set_colour (dcp::Colour (255, 255, 0)); @@ -193,11 +193,11 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test3) film->set_container (Ratio::from_id ("185")); film->set_audio_channels (6); - shared_ptr c (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr c (new FFmpegContent("test/data/test.mp4")); film->examine_and_add_content (c); BOOST_REQUIRE (!wait_for_jobs ()); - shared_ptr s (new StringTextFileContent (film, "test/data/subrip.srt")); + shared_ptr s (new StringTextFileContent("test/data/subrip.srt")); film->examine_and_add_content (s); BOOST_REQUIRE (!wait_for_jobs ()); s->only_text()->set_colour (dcp::Colour (255, 255, 0)); @@ -214,7 +214,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test3) BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test4) { shared_ptr film = new_test_film2("ffmpeg_encoder_h264_test4"); - film->examine_and_add_content(shared_ptr(new DCPContent(film, "test/data/scope_dcp"))); + film->examine_and_add_content(shared_ptr(new DCPContent("test/data/scope_dcp"))); BOOST_REQUIRE(!wait_for_jobs()); film->set_container(Ratio::from_id("185")); @@ -232,43 +232,43 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test5) film->set_container (Ratio::from_id ("185")); film->set_audio_channels (6); - shared_ptr L (new FFmpegContent (film, "test/data/L.wav")); + shared_ptr L (new FFmpegContent("test/data/L.wav")); film->examine_and_add_content (L); - shared_ptr R (new FFmpegContent (film, "test/data/R.wav")); + shared_ptr R (new FFmpegContent("test/data/R.wav")); film->examine_and_add_content (R); - shared_ptr C (new FFmpegContent (film, "test/data/C.wav")); + shared_ptr C (new FFmpegContent("test/data/C.wav")); film->examine_and_add_content (C); - shared_ptr Ls (new FFmpegContent (film, "test/data/Ls.wav")); + shared_ptr Ls (new FFmpegContent("test/data/Ls.wav")); film->examine_and_add_content (Ls); - shared_ptr Rs (new FFmpegContent (film, "test/data/Rs.wav")); + shared_ptr Rs (new FFmpegContent("test/data/Rs.wav")); film->examine_and_add_content (Rs); - shared_ptr Lfe (new FFmpegContent (film, "test/data/Lfe.wav")); + shared_ptr Lfe (new FFmpegContent("test/data/Lfe.wav")); film->examine_and_add_content (Lfe); BOOST_REQUIRE (!wait_for_jobs ()); AudioMapping map (1, MAX_DCP_AUDIO_CHANNELS); - L->set_position (DCPTime::from_seconds (0)); + L->set_position (film, DCPTime::from_seconds(0)); map.make_zero (); map.set (0, 0, 1); L->audio->set_mapping (map); - R->set_position (DCPTime::from_seconds (1)); + R->set_position (film, DCPTime::from_seconds(1)); map.make_zero (); map.set (0, 1, 1); R->audio->set_mapping (map); - C->set_position (DCPTime::from_seconds (2)); + C->set_position (film, DCPTime::from_seconds(2)); map.make_zero (); map.set (0, 2, 1); C->audio->set_mapping (map); - Lfe->set_position (DCPTime::from_seconds (3)); + Lfe->set_position (film, DCPTime::from_seconds(3)); map.make_zero (); map.set (0, 3, 1); Lfe->audio->set_mapping (map); - Ls->set_position (DCPTime::from_seconds (4)); + Ls->set_position (film, DCPTime::from_seconds(4)); map.make_zero (); map.set (0, 4, 1); Ls->audio->set_mapping (map); - Rs->set_position (DCPTime::from_seconds (5)); + Rs->set_position (film, DCPTime::from_seconds(5)); map.make_zero (); map.set (0, 5, 1); Rs->audio->set_mapping (map); diff --git a/test/ffmpeg_examiner_test.cc b/test/ffmpeg_examiner_test.cc index 0233db1f0..d4614e226 100644 --- a/test/ffmpeg_examiner_test.cc +++ b/test/ffmpeg_examiner_test.cc @@ -35,7 +35,7 @@ using boost::shared_ptr; BOOST_AUTO_TEST_CASE (ffmpeg_examiner_test) { shared_ptr film = new_test_film ("ffmpeg_examiner_test"); - shared_ptr content (new FFmpegContent (film, "test/data/count300bd24.m2ts")); + shared_ptr content (new FFmpegContent ("test/data/count300bd24.m2ts")); shared_ptr examiner (new FFmpegExaminer (content)); BOOST_CHECK_EQUAL (examiner->first_video().get().get(), ContentTime::from_seconds(600).get()); diff --git a/test/ffmpeg_pts_offset_test.cc b/test/ffmpeg_pts_offset_test.cc index bdc46f6d9..1d3619219 100644 --- a/test/ffmpeg_pts_offset_test.cc +++ b/test/ffmpeg_pts_offset_test.cc @@ -36,7 +36,7 @@ using boost::shared_ptr; BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test) { shared_ptr film = new_test_film ("ffmpeg_pts_offset_test"); - shared_ptr content (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr content (new FFmpegContent ("test/data/test.mp4")); film->examine_and_add_content (content); wait_for_jobs (); @@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test) /* Sound == video so no offset required */ content->_first_video = ContentTime (); content->ffmpeg_audio_streams().front()->first_audio = ContentTime (); - FFmpegDecoder decoder (content, film->log(), false); + FFmpegDecoder decoder (film, content, false); BOOST_CHECK_EQUAL (decoder._pts_offset.get(), 0); } @@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test) /* Common offset should be removed */ content->_first_video = ContentTime::from_seconds (600); content->ffmpeg_audio_streams().front()->first_audio = ContentTime::from_seconds (600); - FFmpegDecoder decoder (content, film->log(), false); + FFmpegDecoder decoder (film, content, false); BOOST_CHECK_EQUAL (decoder._pts_offset.get(), ContentTime::from_seconds(-600).get()); } @@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test) /* Video is on a frame boundary */ content->_first_video = ContentTime::from_frames (1, 24); content->ffmpeg_audio_streams().front()->first_audio = ContentTime (); - FFmpegDecoder decoder (content, film->log(), false); + FFmpegDecoder decoder (film, content, false); BOOST_CHECK_EQUAL (decoder._pts_offset.get(), 0); } @@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test) double const frame = 1.0 / 24.0; content->_first_video = ContentTime::from_seconds (frame + 0.0215); content->ffmpeg_audio_streams().front()->first_audio = ContentTime (); - FFmpegDecoder decoder (content, film->log(), false); + FFmpegDecoder decoder (film, content, false); BOOST_CHECK_CLOSE (decoder._pts_offset.seconds(), (frame - 0.0215), 0.00001); } @@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test) double const frame = 1.0 / 24.0; content->_first_video = ContentTime::from_seconds (frame + 0.0215 + 4.1); content->ffmpeg_audio_streams().front()->first_audio = ContentTime::from_seconds (4.1); - FFmpegDecoder decoder (content, film->log(), false); + FFmpegDecoder decoder (film, content, false); BOOST_CHECK_CLOSE (decoder._pts_offset.seconds(), (frame - 0.0215) - 4.1, 0.1); } } diff --git a/test/file_naming_test.cc b/test/file_naming_test.cc index bd7efb0d9..f06fdfa42 100644 --- a/test/file_naming_test.cc +++ b/test/file_naming_test.cc @@ -59,11 +59,11 @@ BOOST_AUTO_TEST_CASE (file_naming_test) shared_ptr film = new_test_film ("file_naming_test"); film->set_name ("file_naming_test"); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); - shared_ptr r (new FFmpegContent (film, "test/data/flat_red.png")); + shared_ptr r (new FFmpegContent("test/data/flat_red.png")); film->examine_and_add_content (r); - shared_ptr g (new FFmpegContent (film, "test/data/flat_green.png")); + shared_ptr g (new FFmpegContent("test/data/flat_green.png")); film->examine_and_add_content (g); - shared_ptr b (new FFmpegContent (film, "test/data/flat_blue.png")); + shared_ptr b (new FFmpegContent("test/data/flat_blue.png")); film->examine_and_add_content (b); wait_for_jobs (); @@ -98,11 +98,11 @@ BOOST_AUTO_TEST_CASE (file_naming_test2) shared_ptr film = new_test_film ("file_naming_test2"); film->set_name ("file_naming_test2"); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); - shared_ptr r (new FFmpegContent (film, "test/data/flät_red.png")); + shared_ptr r (new FFmpegContent("test/data/flät_red.png")); film->examine_and_add_content (r); - shared_ptr g (new FFmpegContent (film, "test/data/flat_green.png")); + shared_ptr g (new FFmpegContent("test/data/flat_green.png")); film->examine_and_add_content (g); - shared_ptr b (new FFmpegContent (film, "test/data/flat_blue.png")); + shared_ptr b (new FFmpegContent("test/data/flat_blue.png")); film->examine_and_add_content (b); wait_for_jobs (); diff --git a/test/frame_rate_test.cc b/test/frame_rate_test.cc index 9521e3909..4192ce5e2 100644 --- a/test/frame_rate_test.cc +++ b/test/frame_rate_test.cc @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single) { shared_ptr film = new_test_film ("best_dcp_frame_rate_test_single"); /* Get any piece of content, it doesn't matter what */ - shared_ptr content (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr content (new FFmpegContent("test/data/test.mp4")); film->examine_and_add_content (content); wait_for_jobs (); @@ -222,9 +222,9 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_double) { shared_ptr film = new_test_film ("best_dcp_frame_rate_test_double"); /* Get any old content, it doesn't matter what */ - shared_ptr A (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr A (new FFmpegContent("test/data/test.mp4")); film->examine_and_add_content (A); - shared_ptr B (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr B (new FFmpegContent("test/data/test.mp4")); film->examine_and_add_content (B); wait_for_jobs (); @@ -253,7 +253,7 @@ BOOST_AUTO_TEST_CASE (audio_sampling_rate_test) { shared_ptr film = new_test_film ("audio_sampling_rate_test"); /* Get any piece of content, it doesn't matter what */ - shared_ptr content (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr content (new FFmpegContent("test/data/test.mp4")); film->examine_and_add_content (content); wait_for_jobs (); @@ -269,34 +269,34 @@ BOOST_AUTO_TEST_CASE (audio_sampling_rate_test) content->_video_frame_rate = 24; film->set_video_frame_rate (24); stream->_frame_rate = 48000; - BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), 48000); + BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), 48000); stream->_frame_rate = 44100; - BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), 48000); + BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), 48000); stream->_frame_rate = 80000; - BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), 96000); + BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), 96000); content->_video_frame_rate = 23.976; film->set_video_frame_rate (24); stream->_frame_rate = 48000; - BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), 47952); + BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), 47952); content->_video_frame_rate = 29.97; film->set_video_frame_rate (30); BOOST_CHECK_EQUAL (film->video_frame_rate (), 30); stream->_frame_rate = 48000; - BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), 47952); + BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), 47952); content->_video_frame_rate = 25; film->set_video_frame_rate (24); stream->_frame_rate = 48000; - BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), 50000); + BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), 50000); content->_video_frame_rate = 25; film->set_video_frame_rate (24); stream->_frame_rate = 44100; - BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), 50000); + BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), 50000); /* Check some out-there conversions (not the best) */ @@ -306,5 +306,5 @@ BOOST_AUTO_TEST_CASE (audio_sampling_rate_test) /* The FrameRateChange within resampled_frame_rate should choose to double-up the 14.99 fps video to 30 and then run it slow at 25. */ - BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(), lrint (48000 * 2 * 14.99 / 25)); + BOOST_CHECK_EQUAL (content->audio->resampled_frame_rate(film), lrint (48000 * 2 * 14.99 / 25)); } diff --git a/test/import_dcp_test.cc b/test/import_dcp_test.cc index 9bec45354..71689f613 100644 --- a/test/import_dcp_test.cc +++ b/test/import_dcp_test.cc @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE (import_dcp_test) A->set_name ("frobozz"); A->set_interop (false); - shared_ptr c (new FFmpegContent (A, "test/data/test.mp4")); + shared_ptr c (new FFmpegContent("test/data/test.mp4")); A->examine_and_add_content (c); A->set_encrypted (true); BOOST_CHECK (!wait_for_jobs ()); @@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE (import_dcp_test) B->set_name ("frobozz"); B->set_interop (false); - shared_ptr d (new DCPContent (B, "build/test/import_dcp_test/" + A->dcp_name())); + shared_ptr d (new DCPContent("build/test/import_dcp_test/" + A->dcp_name())); B->examine_and_add_content (d); BOOST_CHECK (!wait_for_jobs ()); d->add_kdm (kdm); diff --git a/test/interrupt_encoder_test.cc b/test/interrupt_encoder_test.cc index 3b5717f16..20a442428 100644 --- a/test/interrupt_encoder_test.cc +++ b/test/interrupt_encoder_test.cc @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE (interrupt_encoder_test) film->set_container (Ratio::from_id ("185")); film->set_name ("interrupt_encoder_test"); - shared_ptr content (new FFmpegContent (film, private_data / "prophet_long_clip.mkv")); + shared_ptr content (new FFmpegContent(private_data / "prophet_long_clip.mkv")); film->examine_and_add_content (content); wait_for_jobs (); diff --git a/test/isdcf_name_test.cc b/test/isdcf_name_test.cc index 52a1cd29a..a33a6a460 100644 --- a/test/isdcf_name_test.cc +++ b/test/isdcf_name_test.cc @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) /* Test interior aspect ratio: shouldn't be shown with trailers */ - shared_ptr content (new ImageContent (film, "test/data/simple_testcard_640x480.png")); + shared_ptr content (new ImageContent ("test/data/simple_testcard_640x480.png")); film->examine_and_add_content (content); wait_for_jobs (); content->video->set_scale (VideoContentScale (Ratio::from_id ("133"))); @@ -149,7 +149,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test) /* Test audio channel markup */ film->set_audio_channels (6); - shared_ptr sound (new FFmpegContent (film, "test/data/sine_440.wav")); + shared_ptr sound (new FFmpegContent("test/data/sine_440.wav")); film->examine_and_add_content (sound); wait_for_jobs (); BOOST_CHECK_EQUAL (film->isdcf_name(false), "LikeShouting_XSN-2_F-133_DE-fr_US-R_10_4K_DI_20140704_PP_SMPTE_OV"); diff --git a/test/j2k_bandwidth_test.cc b/test/j2k_bandwidth_test.cc index a941b4ae6..92f6f90d8 100644 --- a/test/j2k_bandwidth_test.cc +++ b/test/j2k_bandwidth_test.cc @@ -45,7 +45,7 @@ check (int target_bits_per_second) film->set_name (name); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_j2k_bandwidth (target_bits_per_second); - shared_ptr content (new ImageContent (film, private_data / "prophet_frame.tiff")); + shared_ptr content (new ImageContent(private_data / "prophet_frame.tiff")); film->examine_and_add_content (content); wait_for_jobs (); content->video->set_length (24 * duration); diff --git a/test/optimise_stills_test.cc b/test/optimise_stills_test.cc index b939d2914..3e69c95b6 100644 --- a/test/optimise_stills_test.cc +++ b/test/optimise_stills_test.cc @@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE (optimise_stills_test1) film->set_container (Ratio::from_id ("185")); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); film->set_name ("frobozz"); - shared_ptr content = content_factory(film, "test/data/flat_red.png").front (); + shared_ptr content = content_factory("test/data/flat_red.png").front (); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); film->make_dcp (); @@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE (optimise_stills_test2) film->set_container (Ratio::from_id ("185")); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); film->set_name ("frobozz"); - shared_ptr content = content_factory(film, "test/data/flat_red.png").front (); + shared_ptr content = content_factory("test/data/flat_red.png").front (); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); content->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT_RIGHT); diff --git a/test/player_test.cc b/test/player_test.cc index 598e7a01a..2ebcec4bf 100644 --- a/test/player_test.cc +++ b/test/player_test.cc @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE (player_silence_padding_test) { shared_ptr film = new_test_film ("player_silence_padding_test"); film->set_name ("player_silence_padding_test"); - shared_ptr c (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr c (new FFmpegContent("test/data/test.mp4")); film->set_container (Ratio::from_id ("185")); film->set_audio_channels (6); @@ -93,8 +93,8 @@ BOOST_AUTO_TEST_CASE (player_black_fill_test) film->set_container (Ratio::from_id ("185")); film->set_sequence (false); film->set_interop (false); - shared_ptr contentA (new ImageContent (film, "test/data/simple_testcard_640x480.png")); - shared_ptr contentB (new ImageContent (film, "test/data/simple_testcard_640x480.png")); + shared_ptr contentA (new ImageContent("test/data/simple_testcard_640x480.png")); + shared_ptr contentB (new ImageContent("test/data/simple_testcard_640x480.png")); film->examine_and_add_content (contentA); film->examine_and_add_content (contentB); @@ -102,10 +102,10 @@ BOOST_AUTO_TEST_CASE (player_black_fill_test) contentA->video->set_scale (VideoContentScale (Ratio::from_id ("185"))); contentA->video->set_length (3); - contentA->set_position (DCPTime::from_frames (2, film->video_frame_rate ())); + contentA->set_position (film, DCPTime::from_frames(2, film->video_frame_rate())); contentB->video->set_scale (VideoContentScale (Ratio::from_id ("185"))); contentB->video->set_length (1); - contentB->set_position (DCPTime::from_frames (7, film->video_frame_rate ())); + contentB->set_position (film, DCPTime::from_frames(7, film->video_frame_rate())); film->make_dcp (); @@ -132,17 +132,17 @@ BOOST_AUTO_TEST_CASE (player_subframe_test) film->set_name ("reels_test7"); film->set_container (Ratio::from_id ("185")); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); - shared_ptr A = content_factory(film, "test/data/flat_red.png").front(); + shared_ptr A = content_factory("test/data/flat_red.png").front(); film->examine_and_add_content (A); BOOST_REQUIRE (!wait_for_jobs ()); - shared_ptr B = content_factory(film, "test/data/awkward_length.wav").front(); + shared_ptr B = content_factory("test/data/awkward_length.wav").front(); film->examine_and_add_content (B); BOOST_REQUIRE (!wait_for_jobs ()); film->set_video_frame_rate (24); A->video->set_length (3 * 24); - BOOST_CHECK (A->full_length() == DCPTime::from_frames(3 * 24, 24)); - BOOST_CHECK (B->full_length() == DCPTime(289920)); + BOOST_CHECK (A->full_length(film) == DCPTime::from_frames(3 * 24, 24)); + BOOST_CHECK (B->full_length(film) == DCPTime(289920)); /* Length should be rounded up from B's length to the next video frame */ BOOST_CHECK (film->length() == DCPTime::from_frames(3 * 24 + 1, 24)); @@ -177,11 +177,11 @@ BOOST_AUTO_TEST_CASE (player_interleave_test) film->set_container (Ratio::from_id ("185")); film->set_audio_channels (6); - shared_ptr c (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr c (new FFmpegContent("test/data/test.mp4")); film->examine_and_add_content (c); BOOST_REQUIRE (!wait_for_jobs ()); - shared_ptr s (new StringTextFileContent (film, "test/data/subrip.srt")); + shared_ptr s (new StringTextFileContent("test/data/subrip.srt")); film->examine_and_add_content (s); BOOST_REQUIRE (!wait_for_jobs ()); @@ -202,7 +202,7 @@ BOOST_AUTO_TEST_CASE (player_interleave_test) BOOST_AUTO_TEST_CASE (player_seek_test) { shared_ptr film (new Film (optional())); - shared_ptr dcp (new DCPContent (film, private_data / "awkward_subs")); + shared_ptr dcp (new DCPContent(private_data / "awkward_subs")); film->examine_and_add_content (dcp, true); BOOST_REQUIRE (!wait_for_jobs ()); dcp->only_text()->set_use (true); @@ -233,7 +233,7 @@ BOOST_AUTO_TEST_CASE (player_seek_test) BOOST_AUTO_TEST_CASE (player_seek_test2) { shared_ptr film (new Film (optional())); - shared_ptr dcp (new DCPContent (film, private_data / "awkward_subs2")); + shared_ptr dcp (new DCPContent(private_data / "awkward_subs2")); film->examine_and_add_content (dcp, true); BOOST_REQUIRE (!wait_for_jobs ()); dcp->only_text()->set_use (true); @@ -262,15 +262,15 @@ BOOST_AUTO_TEST_CASE (player_seek_test2) BOOST_AUTO_TEST_CASE (player_trim_test) { shared_ptr film = new_test_film2 ("player_trim_test"); - shared_ptr A = content_factory(film, "test/data/flat_red.png").front(); + shared_ptr A = content_factory("test/data/flat_red.png").front(); film->examine_and_add_content (A); BOOST_REQUIRE (!wait_for_jobs ()); A->video->set_length (10 * 24); - shared_ptr B = content_factory(film, "test/data/flat_red.png").front(); + shared_ptr B = content_factory("test/data/flat_red.png").front(); film->examine_and_add_content (B); BOOST_REQUIRE (!wait_for_jobs ()); B->video->set_length (10 * 24); - B->set_position (DCPTime::from_seconds (10)); + B->set_position (film, DCPTime::from_seconds(10)); B->set_trim_start (ContentTime::from_seconds (2)); film->make_dcp (); @@ -299,9 +299,9 @@ store (list* out, PlayerText text, TextType type, optional tr BOOST_AUTO_TEST_CASE (player_ignore_video_and_audio_test) { shared_ptr film = new_test_film2 ("player_ignore_video_and_audio_test"); - shared_ptr ff = content_factory(film, private_data / "boon_telly.mkv").front(); + shared_ptr ff = content_factory(private_data / "boon_telly.mkv").front(); film->examine_and_add_content (ff); - shared_ptr text = content_factory(film, "test/data/subrip.srt").front(); + shared_ptr text = content_factory("test/data/subrip.srt").front(); film->examine_and_add_content (text); BOOST_REQUIRE (!wait_for_jobs()); text->only_text()->set_type (TEXT_CLOSED_CAPTION); diff --git a/test/recover_test.cc b/test/recover_test.cc index 4222426c3..017c01927 100644 --- a/test/recover_test.cc +++ b/test/recover_test.cc @@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE (recover_test_2d) film->set_container (Ratio::from_id ("185")); film->set_name ("recover_test"); - shared_ptr content (new FFmpegContent (film, "test/data/count300bd24.m2ts")); + shared_ptr content (new FFmpegContent("test/data/count300bd24.m2ts")); film->examine_and_add_content (content); wait_for_jobs (); @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE (recover_test_3d) film->set_name ("recover_test"); film->set_three_d (true); - shared_ptr content (new ImageContent (film, "test/data/3d_test")); + shared_ptr content (new ImageContent("test/data/3d_test")); content->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT_RIGHT); film->examine_and_add_content (content); wait_for_jobs (); @@ -126,7 +126,7 @@ BOOST_AUTO_TEST_CASE (recover_test_2d_encrypted) film->set_name ("recover_test"); film->set_encrypted (true); - shared_ptr content (new FFmpegContent (film, "test/data/count300bd24.m2ts")); + shared_ptr content (new FFmpegContent("test/data/count300bd24.m2ts")); film->examine_and_add_content (content); wait_for_jobs (); diff --git a/test/reels_test.cc b/test/reels_test.cc index 76dbb61ed..c27762fdb 100644 --- a/test/reels_test.cc +++ b/test/reels_test.cc @@ -45,12 +45,12 @@ BOOST_AUTO_TEST_CASE (reels_test1) { shared_ptr film = new_test_film ("reels_test1"); film->set_container (Ratio::from_id ("185")); - shared_ptr A (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr A (new FFmpegContent("test/data/test.mp4")); film->examine_and_add_content (A); - shared_ptr B (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr B (new FFmpegContent("test/data/test.mp4")); film->examine_and_add_content (B); wait_for_jobs (); - BOOST_CHECK_EQUAL (A->full_length().get(), 288000); + BOOST_CHECK_EQUAL (A->full_length(film).get(), 288000); film->set_reel_type (REELTYPE_SINGLE); list r = film->reels (); @@ -95,21 +95,21 @@ BOOST_AUTO_TEST_CASE (reels_test2) film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); { - shared_ptr c (new ImageContent (film, "test/data/flat_red.png")); + shared_ptr c (new ImageContent("test/data/flat_red.png")); film->examine_and_add_content (c); wait_for_jobs (); c->video->set_length (24); } { - shared_ptr c (new ImageContent (film, "test/data/flat_green.png")); + shared_ptr c (new ImageContent("test/data/flat_green.png")); film->examine_and_add_content (c); wait_for_jobs (); c->video->set_length (24); } { - shared_ptr c (new ImageContent (film, "test/data/flat_blue.png")); + shared_ptr c (new ImageContent("test/data/flat_blue.png")); film->examine_and_add_content (c); wait_for_jobs (); c->video->set_length (24); @@ -129,7 +129,7 @@ BOOST_AUTO_TEST_CASE (reels_test2) film2->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); film2->set_reel_type (REELTYPE_BY_VIDEO_CONTENT); - shared_ptr c (new DCPContent (film2, film->dir (film->dcp_name ()))); + shared_ptr c (new DCPContent(film->dir(film->dcp_name()))); film2->examine_and_add_content (c); BOOST_REQUIRE (!wait_for_jobs ()); @@ -163,9 +163,9 @@ BOOST_AUTO_TEST_CASE (reels_test3) film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT); - shared_ptr dcp (new DCPContent (film, "test/data/reels_test2")); + shared_ptr dcp (new DCPContent("test/data/reels_test2")); film->examine_and_add_content (dcp); - shared_ptr sub (new StringTextFileContent (film, "test/data/subrip.srt")); + shared_ptr sub (new StringTextFileContent("test/data/subrip.srt")); film->examine_and_add_content (sub); wait_for_jobs (); @@ -182,7 +182,7 @@ BOOST_AUTO_TEST_CASE (reels_test3) BOOST_CHECK_EQUAL (i->to.get(), 96000 * 3); ++i; BOOST_CHECK_EQUAL (i->from.get(), 96000 * 3); - BOOST_CHECK_EQUAL (i->to.get(), sub->full_length().ceil(film->video_frame_rate()).get()); + BOOST_CHECK_EQUAL (i->to.get(), sub->full_length(film).ceil(film->video_frame_rate()).get()); } /** Check creation of a multi-reel DCP with a single .srt subtitle file; @@ -200,13 +200,13 @@ BOOST_AUTO_TEST_CASE (reels_test4) /* 4 piece of 1s-long content */ shared_ptr content[4]; for (int i = 0; i < 4; ++i) { - content[i].reset (new ImageContent (film, "test/data/flat_green.png")); + content[i].reset (new ImageContent("test/data/flat_green.png")); film->examine_and_add_content (content[i]); wait_for_jobs (); content[i]->video->set_length (24); } - shared_ptr subs (new StringTextFileContent (film, "test/data/subrip3.srt")); + shared_ptr subs (new StringTextFileContent("test/data/subrip3.srt")); film->examine_and_add_content (subs); wait_for_jobs (); @@ -235,15 +235,15 @@ BOOST_AUTO_TEST_CASE (reels_test5) { shared_ptr film = new_test_film ("reels_test5"); film->set_sequence (false); - shared_ptr dcp (new DCPContent (film, "test/data/reels_test4")); + shared_ptr dcp (new DCPContent("test/data/reels_test4")); film->examine_and_add_content (dcp); BOOST_REQUIRE (!wait_for_jobs ()); /* Set to 2123 but it will be rounded up to the next frame (4000) */ - dcp->set_position(DCPTime(2123)); + dcp->set_position(film, DCPTime(2123)); { - list p = dcp->reels (); + list p = dcp->reels (film); BOOST_REQUIRE_EQUAL (p.size(), 4); list::const_iterator i = p.begin(); BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 96000))); @@ -254,7 +254,7 @@ BOOST_AUTO_TEST_CASE (reels_test5) { dcp->set_trim_start (ContentTime::from_seconds (0.5)); - list p = dcp->reels (); + list p = dcp->reels (film); BOOST_REQUIRE_EQUAL (p.size(), 4); list::const_iterator i = p.begin(); BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 48000))); @@ -265,7 +265,7 @@ BOOST_AUTO_TEST_CASE (reels_test5) { dcp->set_trim_end (ContentTime::from_seconds (0.5)); - list p = dcp->reels (); + list p = dcp->reels (film); BOOST_REQUIRE_EQUAL (p.size(), 4); list::const_iterator i = p.begin(); BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 48000))); @@ -276,7 +276,7 @@ BOOST_AUTO_TEST_CASE (reels_test5) { dcp->set_trim_start (ContentTime::from_seconds (1.5)); - list p = dcp->reels (); + list p = dcp->reels (film); BOOST_REQUIRE_EQUAL (p.size(), 3); list::const_iterator i = p.begin(); BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 48000))); @@ -292,7 +292,7 @@ BOOST_AUTO_TEST_CASE (reels_test6) film->set_name ("reels_test6"); film->set_container (Ratio::from_id ("185")); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); - shared_ptr A (new FFmpegContent (film, "test/data/test2.mp4")); + shared_ptr A (new FFmpegContent("test/data/test2.mp4")); film->examine_and_add_content (A); BOOST_REQUIRE (!wait_for_jobs ()); @@ -313,10 +313,10 @@ BOOST_AUTO_TEST_CASE (reels_test7) film->set_name ("reels_test7"); film->set_container (Ratio::from_id ("185")); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); - shared_ptr A = content_factory(film, "test/data/flat_red.png").front(); + shared_ptr A = content_factory("test/data/flat_red.png").front(); film->examine_and_add_content (A); BOOST_REQUIRE (!wait_for_jobs ()); - shared_ptr B = content_factory(film, "test/data/awkward_length.wav").front(); + shared_ptr B = content_factory("test/data/awkward_length.wav").front(); film->examine_and_add_content (B); BOOST_REQUIRE (!wait_for_jobs ()); film->set_video_frame_rate (24); @@ -338,7 +338,7 @@ BOOST_AUTO_TEST_CASE (reels_test8) film->set_name ("reels_test8"); film->set_container (Ratio::from_id ("185")); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); - shared_ptr A (new FFmpegContent (film, "test/data/test2.mp4")); + shared_ptr A (new FFmpegContent("test/data/test2.mp4")); film->examine_and_add_content (A); BOOST_REQUIRE (!wait_for_jobs ()); @@ -351,7 +351,7 @@ BOOST_AUTO_TEST_CASE (reels_test8) BOOST_AUTO_TEST_CASE (reels_test9) { shared_ptr film = new_test_film2("reels_test9a"); - shared_ptr A(new FFmpegContent(film, "test/data/flat_red.png")); + shared_ptr A(new FFmpegContent("test/data/flat_red.png")); film->examine_and_add_content(A); BOOST_REQUIRE(!wait_for_jobs()); A->video->set_length(5 * 24); @@ -360,9 +360,9 @@ BOOST_AUTO_TEST_CASE (reels_test9) BOOST_REQUIRE(!wait_for_jobs()); shared_ptr film2 = new_test_film2("reels_test9b"); - shared_ptr B(new DCPContent(film2, film->dir(film->dcp_name()))); + shared_ptr B(new DCPContent(film->dir(film->dcp_name()))); film2->examine_and_add_content(B); - film2->examine_and_add_content(content_factory(film, "test/data/dcp_sub4.xml").front()); + film2->examine_and_add_content(content_factory("test/data/dcp_sub4.xml").front()); B->set_reference_video(true); B->set_reference_audio(true); BOOST_REQUIRE(!wait_for_jobs()); diff --git a/test/remake_id_test.cc b/test/remake_id_test.cc index ac1bfbe14..349884f91 100644 --- a/test/remake_id_test.cc +++ b/test/remake_id_test.cc @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE (remake_id_test1) { /* Make a DCP */ shared_ptr film = new_test_film2 ("remake_id_test1_1"); - shared_ptr content = content_factory(film, "test/data/flat_red.png").front(); + shared_ptr content = content_factory("test/data/flat_red.png").front(); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); film->make_dcp (); @@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE (remake_id_test2) { /* Make a DCP */ shared_ptr film = new_test_film2 ("remake_id_test2_1"); - shared_ptr content = content_factory(film, "test/data/flat_red.png").front(); + shared_ptr content = content_factory("test/data/flat_red.png").front(); film->examine_and_add_content (content); film->set_encrypted (true); BOOST_REQUIRE (!wait_for_jobs ()); @@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE (remake_id_test2) /* Import the DCP into a new film */ shared_ptr film2 = new_test_film2("remake_id_test2_2"); - shared_ptr dcp_content(new DCPContent(film2, film->dir(film->dcp_name()))); + shared_ptr dcp_content(new DCPContent(film->dir(film->dcp_name()))); film2->examine_and_add_content(dcp_content); BOOST_REQUIRE(!wait_for_jobs()); dcp_content->add_kdm(kdm); diff --git a/test/remake_with_subtitle_test.cc b/test/remake_with_subtitle_test.cc index c54dee61f..399796698 100644 --- a/test/remake_with_subtitle_test.cc +++ b/test/remake_with_subtitle_test.cc @@ -34,7 +34,7 @@ using boost::dynamic_pointer_cast; BOOST_AUTO_TEST_CASE (remake_with_subtitle_test) { shared_ptr film = new_test_film2 ("remake_with_subtitle_test"); - shared_ptr content = dynamic_pointer_cast(content_factory(film, private_data / "prophet_short_clip.mkv").front()); + shared_ptr content = dynamic_pointer_cast(content_factory(private_data / "prophet_short_clip.mkv").front()); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); content->only_text()->set_burn (true); diff --git a/test/repeat_frame_test.cc b/test/repeat_frame_test.cc index fd64ba018..badf5d9ff 100644 --- a/test/repeat_frame_test.cc +++ b/test/repeat_frame_test.cc @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE (repeat_frame_test) film->set_container (Ratio::from_id ("185")); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); film->set_interop (false); - shared_ptr c (new FFmpegContent (film, "test/data/red_24.mp4")); + shared_ptr c (new FFmpegContent("test/data/red_24.mp4")); film->examine_and_add_content (c); wait_for_jobs (); diff --git a/test/required_disk_space_test.cc b/test/required_disk_space_test.cc index bcb53bdaf..812b35ff8 100644 --- a/test/required_disk_space_test.cc +++ b/test/required_disk_space_test.cc @@ -43,10 +43,10 @@ BOOST_AUTO_TEST_CASE (required_disk_space_test) shared_ptr film = new_test_film ("required_disk_space_test"); film->set_j2k_bandwidth (100000000); film->set_audio_channels (6); - shared_ptr content_a = content_factory(film, "test/data/flat_blue.png").front(); + shared_ptr content_a = content_factory("test/data/flat_blue.png").front(); BOOST_REQUIRE (content_a); film->examine_and_add_content (content_a); - shared_ptr content_b (new DCPContent (film, "test/data/burnt_subtitle_test_dcp")); + shared_ptr content_b (new DCPContent("test/data/burnt_subtitle_test_dcp")); film->examine_and_add_content (content_b); wait_for_jobs (); film->write_metadata (); diff --git a/test/scaling_test.cc b/test/scaling_test.cc index ed0461005..d2f886736 100644 --- a/test/scaling_test.cc +++ b/test/scaling_test.cc @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE (scaling_test) shared_ptr film = new_test_film ("scaling_test"); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_name ("scaling_test"); - shared_ptr imc (new ImageContent (film, "test/data/simple_testcard_640x480.png")); + shared_ptr imc (new ImageContent("test/data/simple_testcard_640x480.png")); film->examine_and_add_content (imc); diff --git a/test/silence_padding_test.cc b/test/silence_padding_test.cc index 6c7d0b5ff..2bc0c3bb6 100644 --- a/test/silence_padding_test.cc +++ b/test/silence_padding_test.cc @@ -50,7 +50,7 @@ test_silence_padding (int channels) film->set_container (Ratio::from_id ("185")); film->set_name (film_name); - shared_ptr content (new FFmpegContent (film, "test/data/staircase.wav")); + shared_ptr content (new FFmpegContent("test/data/staircase.wav")); film->examine_and_add_content (content); wait_for_jobs (); diff --git a/test/skip_frame_test.cc b/test/skip_frame_test.cc index fdea35849..6c08291e1 100644 --- a/test/skip_frame_test.cc +++ b/test/skip_frame_test.cc @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE (skip_frame_test) film->set_container (Ratio::from_id ("185")); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); film->set_interop (false); - shared_ptr c (new FFmpegContent (film, "test/data/count300bd48.m2ts")); + shared_ptr c (new FFmpegContent("test/data/count300bd48.m2ts")); film->examine_and_add_content (c); wait_for_jobs (); diff --git a/test/srt_subtitle_test.cc b/test/srt_subtitle_test.cc index c4bdd76d1..31a082015 100644 --- a/test/srt_subtitle_test.cc +++ b/test/srt_subtitle_test.cc @@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test) film->set_name ("frobozz"); film->set_audio_channels (6); film->set_interop (false); - shared_ptr content (new StringTextFileContent (film, "test/data/subrip2.srt")); + shared_ptr content (new StringTextFileContent("test/data/subrip2.srt")); film->examine_and_add_content (content); wait_for_jobs (); @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test2) film->set_name ("frobozz"); film->set_audio_channels (6); film->set_interop (false); - shared_ptr content (new StringTextFileContent (film, "test/data/subrip2.srt")); + shared_ptr content (new StringTextFileContent ("test/data/subrip2.srt")); film->examine_and_add_content (content); wait_for_jobs (); @@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test3) film->set_name ("frobozz"); film->set_interop (true); film->set_audio_channels (6); - shared_ptr content (new StringTextFileContent (film, private_data / "Ankoemmling_short.srt")); + shared_ptr content (new StringTextFileContent(private_data / "Ankoemmling_short.srt")); film->examine_and_add_content (content); wait_for_jobs (); @@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test4) film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); film->set_name ("frobozz"); film->set_interop (false); - shared_ptr content (new StringTextFileContent (film, "test/data/subrip2.srt")); + shared_ptr content (new StringTextFileContent("test/data/subrip2.srt")); content->only_text()->set_use (true); content->only_text()->set_burn (false); film->examine_and_add_content (content); @@ -146,13 +146,13 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test5) film->set_name ("frobozz"); film->set_interop (true); film->set_sequence (false); - shared_ptr content (new StringTextFileContent (film, "test/data/subrip2.srt")); + shared_ptr content (new StringTextFileContent("test/data/subrip2.srt")); content->only_text()->set_use (true); content->only_text()->set_burn (false); film->examine_and_add_content (content); film->examine_and_add_content (content); wait_for_jobs (); - content->set_position (DCPTime (0)); + content->set_position (film, DCPTime()); film->make_dcp (); wait_for_jobs (); film->write_metadata (); @@ -164,7 +164,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test6) { shared_ptr film = new_test_film2 ("srt_subtitle_test6"); film->set_interop (false); - shared_ptr content (new StringTextFileContent (film, "test/data/frames.srt")); + shared_ptr content (new StringTextFileContent("test/data/frames.srt")); content->only_text()->set_use (true); content->only_text()->set_burn (false); film->examine_and_add_content (content); @@ -185,7 +185,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test6) BOOST_AUTO_TEST_CASE (srt_subtitle_test4) { shared_ptr film = new_test_film ("subrip_render_test"); - shared_ptr content (new StringTextFile (film, "test/data/subrip.srt")); + shared_ptr content (new StringTextFile("test/data/subrip.srt")); content->examine (shared_ptr (), true); BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds ((3 * 60) + 56.471)); diff --git a/test/ssa_subtitle_test.cc b/test/ssa_subtitle_test.cc index cd22450a6..c1524bc29 100644 --- a/test/ssa_subtitle_test.cc +++ b/test/ssa_subtitle_test.cc @@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE (ssa_subtitle_test1) film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); film->set_name ("frobozz"); film->set_interop (true); - shared_ptr content (new StringTextFileContent (film, private_data / "DKH_UT_EN20160601def.ssa")); + shared_ptr content (new StringTextFileContent(private_data / "DKH_UT_EN20160601def.ssa")); film->examine_and_add_content (content); wait_for_jobs (); diff --git a/test/subtitle_charset_test.cc b/test/subtitle_charset_test.cc index 9c61b83f4..29dabe4bb 100644 --- a/test/subtitle_charset_test.cc +++ b/test/subtitle_charset_test.cc @@ -33,7 +33,7 @@ using boost::dynamic_pointer_cast; BOOST_AUTO_TEST_CASE (subtitle_charset_test1) { shared_ptr film = new_test_film2 ("subtitle_charset_test1"); - shared_ptr content = content_factory (film, private_data / "PADDINGTON soustitresVFdef.srt").front (); + shared_ptr content = content_factory (private_data / "PADDINGTON soustitresVFdef.srt").front(); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); } @@ -42,11 +42,11 @@ BOOST_AUTO_TEST_CASE (subtitle_charset_test1) BOOST_AUTO_TEST_CASE (subtitle_charset_test2) { shared_ptr film = new_test_film2 ("subtitle_charset_test2"); - shared_ptr content = content_factory (film, "test/data/osx.srt").front (); + shared_ptr content = content_factory ("test/data/osx.srt").front(); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); shared_ptr ts = dynamic_pointer_cast (content); BOOST_REQUIRE (ts); /* Make sure we got the subtitle data from the file */ - BOOST_REQUIRE_EQUAL (content->full_length().get(), 6052032); + BOOST_REQUIRE_EQUAL (content->full_length(film).get(), 6052032); } diff --git a/test/subtitle_reel_number_test.cc b/test/subtitle_reel_number_test.cc index f02920b7f..0726ee2e4 100644 --- a/test/subtitle_reel_number_test.cc +++ b/test/subtitle_reel_number_test.cc @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE (subtitle_reel_number_test) film->set_container (Ratio::from_id ("185")); film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); film->set_name ("frobozz"); - shared_ptr content (new StringTextFileContent (film, "test/data/subrip5.srt")); + shared_ptr content (new StringTextFileContent("test/data/subrip5.srt")); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); content->only_text()->set_use (true); diff --git a/test/subtitle_trim_test.cc b/test/subtitle_trim_test.cc index 33bcf823f..2380449d8 100644 --- a/test/subtitle_trim_test.cc +++ b/test/subtitle_trim_test.cc @@ -29,7 +29,7 @@ using boost::shared_ptr; BOOST_AUTO_TEST_CASE (subtitle_trim_test1) { shared_ptr film = new_test_film2 ("subtitle_trim_test1"); - shared_ptr content (new DCPSubtitleContent (film, "test/data/dcp_sub5.xml")); + shared_ptr content (new DCPSubtitleContent ("test/data/dcp_sub5.xml")); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); diff --git a/test/threed_test.cc b/test/threed_test.cc index 41d92bc2f..a8d3f8a00 100644 --- a/test/threed_test.cc +++ b/test/threed_test.cc @@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE (threed_test1) { shared_ptr film = new_test_film ("threed_test1"); film->set_name ("test_film1"); - shared_ptr c (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr c (new FFmpegContent("test/data/test.mp4")); film->examine_and_add_content (c); wait_for_jobs (); @@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE (threed_test2) { shared_ptr film = new_test_film ("threed_test2"); film->set_name ("test_film2"); - shared_ptr c (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr c (new FFmpegContent("test/data/test.mp4")); film->examine_and_add_content (c); wait_for_jobs (); @@ -85,9 +85,9 @@ BOOST_AUTO_TEST_CASE (threed_test2) BOOST_AUTO_TEST_CASE (threed_test3) { shared_ptr film = new_test_film2 ("threed_test3"); - shared_ptr L (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr L (new FFmpegContent("test/data/test.mp4")); film->examine_and_add_content (L); - shared_ptr R (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr R (new FFmpegContent("test/data/test.mp4")); film->examine_and_add_content (R); wait_for_jobs (); @@ -104,9 +104,9 @@ BOOST_AUTO_TEST_CASE (threed_test3) BOOST_AUTO_TEST_CASE (threed_test4) { shared_ptr film = new_test_film2 ("threed_test4"); - shared_ptr L (new FFmpegContent (film, private_data / "LEFT_TEST_DCP3D4K.mov")); + shared_ptr L (new FFmpegContent(private_data / "LEFT_TEST_DCP3D4K.mov")); film->examine_and_add_content (L); - shared_ptr R (new FFmpegContent (film, private_data / "RIGHT_TEST_DCP3D4K.mov")); + shared_ptr R (new FFmpegContent(private_data / "RIGHT_TEST_DCP3D4K.mov")); film->examine_and_add_content (R); wait_for_jobs (); @@ -123,9 +123,9 @@ BOOST_AUTO_TEST_CASE (threed_test4) BOOST_AUTO_TEST_CASE (threed_test5) { shared_ptr film = new_test_film2 ("threed_test5"); - shared_ptr L (new FFmpegContent (film, private_data / "boon_telly.mkv")); + shared_ptr L (new FFmpegContent(private_data / "boon_telly.mkv")); film->examine_and_add_content (L); - shared_ptr R (new FFmpegContent (film, private_data / "boon_telly.mkv")); + shared_ptr R (new FFmpegContent(private_data / "boon_telly.mkv")); film->examine_and_add_content (R); wait_for_jobs (); diff --git a/test/time_calculation_test.cc b/test/time_calculation_test.cc index 86b702f37..e995a4ed0 100644 --- a/test/time_calculation_test.cc +++ b/test/time_calculation_test.cc @@ -132,23 +132,23 @@ BOOST_AUTO_TEST_CASE (ffmpeg_time_calculation_test) doc->read_string (xml); list notes; - shared_ptr content (new FFmpegContent (film, doc, film->state_version(), notes)); + shared_ptr content (new FFmpegContent(doc, film->state_version(), notes)); /* 25fps content, 25fps DCP */ film->set_video_frame_rate (25); - BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 25.0).get()); + BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 25.0).get()); /* 25fps content, 24fps DCP; length should be increased */ film->set_video_frame_rate (24); - BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 24.0).get()); + BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 24.0).get()); /* 25fps content, 30fps DCP; length should be decreased */ film->set_video_frame_rate (30); - BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 30.0).get()); + BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 30.0).get()); /* 25fps content, 50fps DCP; length should be the same */ film->set_video_frame_rate (50); - BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 25.0).get()); + BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 25.0).get()); /* 25fps content, 60fps DCP; length should be decreased */ film->set_video_frame_rate (60); - BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() * (50.0 / 60) / 25.0).get()); + BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(content->video->length() * (50.0 / 60) / 25.0).get()); /* Make the content audio-only */ content->video.reset (); @@ -156,23 +156,23 @@ BOOST_AUTO_TEST_CASE (ffmpeg_time_calculation_test) /* 24fps content, 24fps DCP */ film->set_video_frame_rate (24); content->set_video_frame_rate (24); - BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(1).get()); + BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(1).get()); /* 25fps content, 25fps DCP */ film->set_video_frame_rate (25); content->set_video_frame_rate (25); - BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(1).get()); + BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(1).get()); /* 25fps content, 24fps DCP; length should be increased */ film->set_video_frame_rate (24); - BOOST_CHECK_SMALL (labs (content->full_length().get() - DCPTime::from_seconds(25.0 / 24).get()), 2L); + BOOST_CHECK_SMALL (labs (content->full_length(film).get() - DCPTime::from_seconds(25.0 / 24).get()), 2L); /* 25fps content, 30fps DCP; length should be decreased */ film->set_video_frame_rate (30); - BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(25.0 / 30).get()); + BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(25.0 / 30).get()); /* 25fps content, 50fps DCP; length should be the same */ film->set_video_frame_rate (50); - BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(1).get()); + BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(1).get()); /* 25fps content, 60fps DCP; length should be decreased */ film->set_video_frame_rate (60); - BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(50.0 / 60).get()); + BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(50.0 / 60).get()); } @@ -185,14 +185,14 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) doc->read_string (xml); list notes; - shared_ptr content (new FFmpegContent (film, doc, film->state_version(), notes)); + shared_ptr content (new FFmpegContent(doc, film->state_version(), notes)); film->set_sequence (false); film->add_content (content); shared_ptr player (new Player (film, film->playlist ())); /* Position 0, no trim, content rate = DCP rate */ - content->set_position (DCPTime ()); + content->set_position (film, DCPTime()); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -204,7 +204,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (3.0)), 72); /* Position 3s, no trim, content rate = DCP rate */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -218,7 +218,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (9.75)), 162); /* Position 3s, 1.5s trim, content rate = DCP rate */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime::from_seconds (1.5)); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -235,7 +235,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) Now, for example, a DCPTime position of 3s means 3s at 25fps. Since we run the video fast (at 25fps) in this case, this means 75 frames of content video will be used. */ - content->set_position (DCPTime ()); + content->set_position (film, DCPTime()); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (25); @@ -247,7 +247,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (3.0)), 75); /* Position 3s, no trim, content rate 24, DCP rate 25 */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (25); @@ -264,7 +264,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) so it's 1.6s at 24fps. Note that trims are rounded to the nearest video frame, so some of these results are not quite what you'd perhaps expect. */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime::from_seconds (1.6)); content->set_video_frame_rate (24); film->set_video_frame_rate (25); @@ -283,7 +283,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) be used to make 3 * 48 frames of DCP video. The results should be the same as the content rate = DCP rate case. */ - content->set_position (DCPTime ()); + content->set_position (film, DCPTime()); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (48); @@ -295,7 +295,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (3.0)), 72); /* Position 3s, no trim, content rate 24, DCP rate 48 */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (48); @@ -309,7 +309,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (9.75)), 162); /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime::from_seconds (1.5)); content->set_video_frame_rate (24); film->set_video_frame_rate (48); @@ -327,7 +327,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) with skipped frames in this case, 3 * 48 frames of content video will be used to make 3 * 24 frames of DCP video. */ - content->set_position (DCPTime ()); + content->set_position (film, DCPTime()); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (48); film->set_video_frame_rate (24); @@ -339,7 +339,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (3.0)), 144); /* Position 3s, no trim, content rate 24, DCP rate 48 */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (48); film->set_video_frame_rate (24); @@ -353,7 +353,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (9.75)), 324); /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime::from_seconds (1.5)); content->set_video_frame_rate (48); film->set_video_frame_rate (24); @@ -367,7 +367,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (9.75)), 396); /* Position 0s, no trim, content rate 29.9978733, DCP rate 30 */ - content->set_position (DCPTime::from_seconds (0)); + content->set_position (film, DCPTime::from_seconds(0)); content->set_trim_start (ContentTime::from_seconds (0)); content->set_video_frame_rate (29.9978733); film->set_video_frame_rate (30); @@ -391,14 +391,14 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) doc->read_string (xml); list notes; - shared_ptr content (new FFmpegContent (film, doc, film->state_version(), notes)); + shared_ptr content (new FFmpegContent(doc, film->state_version(), notes)); film->set_sequence (false); film->add_content (content); shared_ptr player (new Player (film, film->playlist ())); /* Position 0, no trim, content rate = DCP rate */ - content->set_position (DCPTime ()); + content->set_position (film, DCPTime()); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -410,7 +410,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 72).get(), DCPTime::from_seconds(3.0).get()); /* Position 3s, no trim, content rate = DCP rate */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -422,7 +422,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 162).get(), DCPTime::from_seconds(9.75).get()); /* Position 3s, 1.5s trim, content rate = DCP rate */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime::from_seconds (1.5)); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -438,7 +438,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) Now, for example, a DCPTime position of 3s means 3s at 25fps. Since we run the video fast (at 25fps) in this case, this means 75 frames of content video will be used. */ - content->set_position (DCPTime ()); + content->set_position (film, DCPTime()); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (25); @@ -450,7 +450,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 75).get(), DCPTime::from_seconds(3.0).get()); /* Position 3s, no trim, content rate 24, DCP rate 25 */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (25); @@ -462,7 +462,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 169).get(), DCPTime::from_seconds(9.76).get()); /* Position 3s, 1.6s trim, content rate 24, DCP rate 25, so the 1.6s trim is at 24fps */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime::from_seconds (1.6)); content->set_video_frame_rate (24); film->set_video_frame_rate (25); @@ -480,7 +480,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) be used to make 3 * 48 frames of DCP video. The results should be the same as the content rate = DCP rate case. */ - content->set_position (DCPTime ()); + content->set_position (film, DCPTime()); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (48); @@ -492,7 +492,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(3.0).get()); /* Position 3s, no trim, content rate 24, DCP rate 48 */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (48); @@ -504,7 +504,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 162).get(), DCPTime::from_seconds(9.75).get()); /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime::from_seconds (1.5)); content->set_video_frame_rate (24); film->set_video_frame_rate (48); @@ -521,7 +521,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) with skipped frames in this case, 3 * 48 frames of content video will be used to make 3 * 24 frames of DCP video. */ - content->set_position (DCPTime ()); + content->set_position (film, DCPTime()); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (48); film->set_video_frame_rate (24); @@ -533,7 +533,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 144).get(), DCPTime::from_seconds(3.0).get()); /* Position 3s, no trim, content rate 24, DCP rate 48 */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (48); film->set_video_frame_rate (24); @@ -545,7 +545,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 324).get(), DCPTime::from_seconds(9.75).get()); /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime::from_seconds (1.5)); content->set_video_frame_rate (48); film->set_video_frame_rate (24); @@ -567,7 +567,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) doc->read_string (xml); list notes; - shared_ptr content (new FFmpegContent (film, doc, film->state_version(), notes)); + shared_ptr content (new FFmpegContent(doc, film->state_version(), notes)); AudioStreamPtr stream = content->audio->streams().front(); film->set_sequence (false); film->add_content (content); @@ -575,7 +575,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) shared_ptr player (new Player (film, film->playlist ())); /* Position 0, no trim, video/audio content rate = video/audio DCP rate */ - content->set_position (DCPTime ()); + content->set_position (film, DCPTime()); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -588,7 +588,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (3.0)), 144000); /* Position 3s, no trim, video/audio content rate = video/audio DCP rate */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds (3)); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -603,7 +603,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 324000); /* Position 3s, 1.5s trim, video/audio content rate = video/audio DCP rate */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds (3)); content->set_trim_start (ContentTime::from_seconds (1.5)); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -618,7 +618,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 396000); /* Position 0, no trim, content video rate 24, DCP video rate 25, both audio rates still 48k */ - content->set_position (DCPTime ()); + content->set_position (film, DCPTime()); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (25); @@ -631,7 +631,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (3.0)), 144000); /* Position 3s, no trim, content video rate 24, DCP rate 25, both audio rates still 48k. */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (25); @@ -648,7 +648,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) /* Position 3s, 1.6s trim, content rate 24, DCP rate 25, both audio rates still 48k. 1s of content is 46080 samples after resampling. */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime::from_seconds (1.6)); content->set_video_frame_rate (24); film->set_video_frame_rate (25); @@ -667,7 +667,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) with repeated frames in this case, audio samples will map straight through. The results should be the same as the content rate = DCP rate case. */ - content->set_position (DCPTime ()); + content->set_position (film, DCPTime()); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (48); @@ -680,7 +680,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (3.0)), 144000); /* Position 3s, no trim, content rate 24, DCP rate 48 */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -695,7 +695,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 324000); /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime::from_seconds (1.5)); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -713,7 +713,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) Now, for example, a DCPTime position of 3s means 3s at 24fps. Since we run the video with skipped frames in this case, audio samples should map straight through. */ - content->set_position (DCPTime ()); + content->set_position (film, DCPTime()); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (48); @@ -726,7 +726,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (3.0)), 144000); /* Position 3s, no trim, content rate 24, DCP rate 48 */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -741,7 +741,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 324000); /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime::from_seconds (1.5)); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -756,7 +756,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 396000); /* Position 0, no trim, video content rate = video DCP rate, content audio rate = 44.1k */ - content->set_position (DCPTime ()); + content->set_position (film, DCPTime()); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -769,7 +769,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (3.0)), 144000); /* Position 3s, no trim, video content rate = video DCP rate, content audio rate = 44.1k */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime ()); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -784,7 +784,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 324000); /* Position 3s, 1.5s trim, video content rate = video DCP rate, content audio rate = 44.1k */ - content->set_position (DCPTime::from_seconds (3)); + content->set_position (film, DCPTime::from_seconds(3)); content->set_trim_start (ContentTime::from_seconds (1.5)); content->set_video_frame_rate (24); film->set_video_frame_rate (24); @@ -799,7 +799,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 396000); /* Check with a large start trim */ - content->set_position (DCPTime::from_seconds (0)); + content->set_position (film, DCPTime::from_seconds(0)); content->set_trim_start (ContentTime::from_seconds (54143)); content->set_video_frame_rate (24); film->set_video_frame_rate (24); diff --git a/test/torture_test.cc b/test/torture_test.cc index 3736b3e65..b6079096d 100644 --- a/test/torture_test.cc +++ b/test/torture_test.cc @@ -56,28 +56,28 @@ BOOST_AUTO_TEST_CASE (torture_test1) film->set_sequence (false); /* Staircase at an offset of 2000 samples, trimmed both start and end, with a gain of 6dB */ - shared_ptr staircase = content_factory(film, "test/data/staircase.wav").front (); + shared_ptr staircase = content_factory("test/data/staircase.wav").front (); film->examine_and_add_content (staircase); wait_for_jobs (); - staircase->set_position (DCPTime::from_frames (2000, film->audio_frame_rate())); + staircase->set_position (film, DCPTime::from_frames (2000, film->audio_frame_rate())); staircase->set_trim_start (ContentTime::from_frames (12, 48000)); staircase->set_trim_end (ContentTime::from_frames (35, 48000)); staircase->audio->set_gain (20 * log10(2)); /* And again at an offset of 50000 samples, trimmed both start and end, with a gain of 6dB */ - staircase = content_factory(film, "test/data/staircase.wav").front (); + staircase = content_factory("test/data/staircase.wav").front (); film->examine_and_add_content (staircase); wait_for_jobs (); - staircase->set_position (DCPTime::from_frames (50000, film->audio_frame_rate())); + staircase->set_position (film, DCPTime::from_frames(50000, film->audio_frame_rate())); staircase->set_trim_start (ContentTime::from_frames (12, 48000)); staircase->set_trim_end (ContentTime::from_frames (35, 48000)); staircase->audio->set_gain (20 * log10(2)); /* 1s of red at 5s in */ - shared_ptr red = content_factory(film, "test/data/flat_red.png").front (); + shared_ptr red = content_factory("test/data/flat_red.png").front (); film->examine_and_add_content (red); wait_for_jobs (); - red->set_position (DCPTime::from_seconds (5)); + red->set_position (film, DCPTime::from_seconds(5)); red->video->set_length (24); film->set_video_frame_rate (24); diff --git a/test/upmixer_a_test.cc b/test/upmixer_a_test.cc index 651ac7f38..c89d3f29a 100644 --- a/test/upmixer_a_test.cc +++ b/test/upmixer_a_test.cc @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE (upmixer_a_test) film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); film->set_name ("frobozz"); film->set_audio_processor (AudioProcessor::from_id ("stereo-5.1-upmix-a")); - shared_ptr content (new FFmpegContent (film, "test/data/white.wav")); + shared_ptr content (new FFmpegContent ("test/data/white.wav")); film->examine_and_add_content (content); wait_for_jobs (); diff --git a/test/vf_kdm_test.cc b/test/vf_kdm_test.cc index bbaa3d6d2..9b48f9b28 100644 --- a/test/vf_kdm_test.cc +++ b/test/vf_kdm_test.cc @@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE (vf_kdm_test) A->set_name ("frobozz"); A->set_interop (true); - shared_ptr c (new FFmpegContent (A, "test/data/test.mp4")); + shared_ptr c (new FFmpegContent("test/data/test.mp4")); A->examine_and_add_content (c); A->set_encrypted (true); wait_for_jobs (); @@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE (vf_kdm_test) B->set_name ("frobozz"); B->set_interop (true); - shared_ptr d (new DCPContent (B, "build/test/vf_kdm_test_ov/" + A->dcp_name())); + shared_ptr d (new DCPContent ("build/test/vf_kdm_test_ov/" + A->dcp_name())); d->add_kdm (A_kdm); d->set_reference_video (true); B->examine_and_add_content (d); @@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE (vf_kdm_test) C->set_name ("frobozz"); C->set_interop (true); - shared_ptr e (new DCPContent (C, "build/test/vf_kdm_test_vf/" + B->dcp_name())); + shared_ptr e (new DCPContent ("build/test/vf_kdm_test_vf/" + B->dcp_name())); e->add_kdm (B_kdm); e->add_ov ("build/test/vf_kdm_test_ov/" + A->dcp_name()); C->examine_and_add_content (e); diff --git a/test/vf_test.cc b/test/vf_test.cc index fa1e7cdab..285139f7e 100644 --- a/test/vf_test.cc +++ b/test/vf_test.cc @@ -48,44 +48,44 @@ BOOST_AUTO_TEST_CASE (vf_test1) { shared_ptr film = new_test_film ("vf_test1"); film->set_interop (false); - shared_ptr dcp (new DCPContent (film, "test/data/reels_test2")); + shared_ptr dcp (new DCPContent ("test/data/reels_test2")); film->examine_and_add_content (dcp); wait_for_jobs (); /* Multi-reel DCP can't be referenced if we are using a single reel for the project */ film->set_reel_type (REELTYPE_SINGLE); string why_not; - BOOST_CHECK (!dcp->can_reference_video(why_not)); - BOOST_CHECK (!dcp->can_reference_audio(why_not)); - BOOST_CHECK (!dcp->can_reference_text(TEXT_OPEN_SUBTITLE, why_not)); - BOOST_CHECK (!dcp->can_reference_text(TEXT_CLOSED_CAPTION, why_not)); + BOOST_CHECK (!dcp->can_reference_video(film, why_not)); + BOOST_CHECK (!dcp->can_reference_audio(film, why_not)); + BOOST_CHECK (!dcp->can_reference_text(film, TEXT_OPEN_SUBTITLE, why_not)); + BOOST_CHECK (!dcp->can_reference_text(film, TEXT_CLOSED_CAPTION, why_not)); /* Multi-reel DCP can be referenced if we are using by-video-content */ film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT); - BOOST_CHECK (dcp->can_reference_video(why_not)); - BOOST_CHECK (dcp->can_reference_audio(why_not)); + BOOST_CHECK (dcp->can_reference_video(film, why_not)); + BOOST_CHECK (dcp->can_reference_audio(film, why_not)); /* (but reels_test2 has no texts to reference) */ - BOOST_CHECK (!dcp->can_reference_text(TEXT_OPEN_SUBTITLE, why_not)); - BOOST_CHECK (!dcp->can_reference_text(TEXT_CLOSED_CAPTION, why_not)); + BOOST_CHECK (!dcp->can_reference_text(film, TEXT_OPEN_SUBTITLE, why_not)); + BOOST_CHECK (!dcp->can_reference_text(film, TEXT_CLOSED_CAPTION, why_not)); - shared_ptr other (new FFmpegContent (film, "test/data/test.mp4")); + shared_ptr other (new FFmpegContent("test/data/test.mp4")); film->examine_and_add_content (other); wait_for_jobs (); /* Not possible if there is overlap */ - other->set_position (DCPTime (0)); - BOOST_CHECK (!dcp->can_reference_video(why_not)); - BOOST_CHECK (!dcp->can_reference_audio(why_not)); - BOOST_CHECK (!dcp->can_reference_text(TEXT_OPEN_SUBTITLE, why_not)); - BOOST_CHECK (!dcp->can_reference_text(TEXT_CLOSED_CAPTION, why_not)); + other->set_position (film, DCPTime()); + BOOST_CHECK (!dcp->can_reference_video(film, why_not)); + BOOST_CHECK (!dcp->can_reference_audio(film, why_not)); + BOOST_CHECK (!dcp->can_reference_text(film, TEXT_OPEN_SUBTITLE, why_not)); + BOOST_CHECK (!dcp->can_reference_text(film, TEXT_CLOSED_CAPTION, why_not)); /* This should not be considered an overlap */ - other->set_position (dcp->end ()); - BOOST_CHECK (dcp->can_reference_video(why_not)); - BOOST_CHECK (dcp->can_reference_audio(why_not)); + other->set_position (film, dcp->end(film)); + BOOST_CHECK (dcp->can_reference_video(film, why_not)); + BOOST_CHECK (dcp->can_reference_audio(film, why_not)); /* (reels_test2 has no texts to reference) */ - BOOST_CHECK (!dcp->can_reference_text(TEXT_OPEN_SUBTITLE, why_not)); - BOOST_CHECK (!dcp->can_reference_text(TEXT_CLOSED_CAPTION, why_not)); + BOOST_CHECK (!dcp->can_reference_text(film, TEXT_OPEN_SUBTITLE, why_not)); + BOOST_CHECK (!dcp->can_reference_text(film, TEXT_CLOSED_CAPTION, why_not)); } /** Make a OV with video and audio and a VF referencing the OV and adding subs */ @@ -95,11 +95,11 @@ BOOST_AUTO_TEST_CASE (vf_test2) shared_ptr ov = new_test_film ("vf_test2_ov"); ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); ov->set_name ("vf_test2_ov"); - shared_ptr video = content_factory (ov, "test/data/flat_red.png").front(); + shared_ptr video = content_factory ("test/data/flat_red.png").front(); ov->examine_and_add_content (video); wait_for_jobs (); video->video->set_length (24 * 5); - shared_ptr audio = content_factory(ov, "test/data/white.wav").front(); + shared_ptr audio = content_factory ("test/data/white.wav").front(); ov->examine_and_add_content (audio); wait_for_jobs (); ov->make_dcp (); @@ -110,13 +110,13 @@ BOOST_AUTO_TEST_CASE (vf_test2) vf->set_name ("vf_test2_vf"); vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); vf->set_reel_type (REELTYPE_BY_VIDEO_CONTENT); - shared_ptr dcp (new DCPContent (vf, ov->dir (ov->dcp_name ()))); + shared_ptr dcp (new DCPContent(ov->dir (ov->dcp_name ()))); BOOST_REQUIRE (dcp); vf->examine_and_add_content (dcp); wait_for_jobs (); dcp->set_reference_video (true); dcp->set_reference_audio (true); - shared_ptr sub = content_factory(vf, "test/data/subrip4.srt").front(); + shared_ptr sub = content_factory("test/data/subrip4.srt").front(); vf->examine_and_add_content (sub); DCPOMATIC_ASSERT (!wait_for_jobs ()); vf->make_dcp (); @@ -153,11 +153,11 @@ BOOST_AUTO_TEST_CASE (vf_test3) shared_ptr ov = new_test_film ("vf_test3_ov"); ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); ov->set_name ("vf_test3_ov"); - shared_ptr video = content_factory(ov, "test/data/flat_red.png").front(); + shared_ptr video = content_factory("test/data/flat_red.png").front(); ov->examine_and_add_content (video); wait_for_jobs (); video->video->set_length (24 * 5); - shared_ptr audio = content_factory(ov, "test/data/white.wav").front(); + shared_ptr audio = content_factory("test/data/white.wav").front(); ov->examine_and_add_content (audio); wait_for_jobs (); ov->make_dcp (); @@ -168,7 +168,7 @@ BOOST_AUTO_TEST_CASE (vf_test3) vf->set_name ("vf_test3_vf"); vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); vf->set_reel_type (REELTYPE_BY_VIDEO_CONTENT); - shared_ptr dcp (new DCPContent (vf, ov->dir (ov->dcp_name ()))); + shared_ptr dcp (new DCPContent(ov->dir(ov->dcp_name()))); BOOST_REQUIRE (dcp); dcp->set_trim_start (ContentTime::from_seconds (1)); dcp->set_trim_end (ContentTime::from_seconds (1)); @@ -199,11 +199,11 @@ BOOST_AUTO_TEST_CASE (vf_test4) shared_ptr ov = new_test_film ("vf_test4_ov"); ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); ov->set_name ("vf_test4_ov"); - shared_ptr video = content_factory (ov, "test/data/flat_red.png").front(); + shared_ptr video = content_factory("test/data/flat_red.png").front(); ov->examine_and_add_content (video); wait_for_jobs (); video->video->set_length (24 * 5); - shared_ptr audio = content_factory(ov, "test/data/white.wav").front(); + shared_ptr audio = content_factory("test/data/white.wav").front(); ov->examine_and_add_content (audio); wait_for_jobs (); ov->make_dcp (); @@ -215,17 +215,17 @@ BOOST_AUTO_TEST_CASE (vf_test4) vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST")); vf->set_reel_type (REELTYPE_BY_VIDEO_CONTENT); vf->set_sequence (false); - shared_ptr dcp (new DCPContent (vf, ov->dir (ov->dcp_name ()))); + shared_ptr dcp (new DCPContent(ov->dir(ov->dcp_name()))); BOOST_REQUIRE (dcp); vf->examine_and_add_content (dcp); wait_for_jobs (); - dcp->set_position(DCPTime::from_seconds(10)); + dcp->set_position(vf, DCPTime::from_seconds(10)); dcp->set_reference_video (true); dcp->set_reference_audio (true); - shared_ptr more_video = content_factory(vf, "test/data/flat_red.png").front(); + shared_ptr more_video = content_factory("test/data/flat_red.png").front(); vf->examine_and_add_content (more_video); DCPOMATIC_ASSERT (!wait_for_jobs ()); - more_video->set_position (DCPTime ()); + more_video->set_position (vf, DCPTime()); vf->write_metadata (); vf->make_dcp (); DCPOMATIC_ASSERT (!wait_for_jobs ()); diff --git a/test/video_content_scale_test.cc b/test/video_content_scale_test.cc index 35812df35..67bfda3e5 100644 --- a/test/video_content_scale_test.cc +++ b/test/video_content_scale_test.cc @@ -96,7 +96,7 @@ test (dcp::Size content_size, dcp::Size display_size, dcp::Size film_size, Crop doc->read_string (s); list notes; - shared_ptr vc (new FFmpegContent (film, doc, 10, notes)); + shared_ptr vc (new FFmpegContent (doc, 10, notes)); optional sc; if (ratio) { diff --git a/test/video_mxf_content_test.cc b/test/video_mxf_content_test.cc index 9104702b6..5da7ad641 100644 --- a/test/video_mxf_content_test.cc +++ b/test/video_mxf_content_test.cc @@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE (video_mxf_content_test) film->set_container (Ratio::from_id ("185")); film->set_name ("video_mxf_content_test"); - shared_ptr content = content_factory(film, ref_mxf).front(); + shared_ptr content = content_factory(ref_mxf).front(); shared_ptr check = dynamic_pointer_cast (content); BOOST_REQUIRE (check); film->examine_and_add_content (content); -- 2.30.2