X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Ffilm.cc;h=ad565aca0b2e6bcd16717fd9f64f6d31f0ec8187;hb=01791aac0b11e9f296cd31a7803e287203bd8355;hp=fc1d2d8a4ee2fa7c98ee7d34ad06a639cf42b38e;hpb=996b0c06e23bcb6b300d7b8799df94993692e07d;p=dcpomatic.git diff --git a/src/lib/film.cc b/src/lib/film.cc index fc1d2d8a4..ad565aca0 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1,5 +1,3 @@ -/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */ - /* Copyright (C) 2012 Carl Hetherington @@ -34,12 +32,10 @@ #include #include #include "film.h" -#include "container.h" #include "job.h" #include "filter.h" #include "util.h" #include "job_manager.h" -#include "ab_transcode_job.h" #include "transcode_job.h" #include "scp_dcp_job.h" #include "log.h" @@ -49,13 +45,14 @@ #include "config.h" #include "version.h" #include "ui_signaller.h" -#include "analyse_audio_job.h" #include "playlist.h" #include "player.h" #include "ffmpeg_content.h" #include "imagemagick_content.h" #include "sndfile_content.h" #include "dcp_content_type.h" +#include "ratio.h" +#include "cross.h" #include "i18n.h" @@ -74,7 +71,9 @@ using std::endl; using std::cout; using std::list; using boost::shared_ptr; +using boost::weak_ptr; using boost::lexical_cast; +using boost::dynamic_pointer_cast; using boost::to_upper_copy; using boost::ends_with; using boost::starts_with; @@ -94,14 +93,13 @@ Film::Film (string d) , _dcp_content_type (Config::instance()->default_dcp_content_type ()) , _container (Config::instance()->default_container ()) , _scaler (Scaler::from_id ("bicubic")) - , _ab (false) , _with_subtitles (false) , _subtitle_offset (0) , _subtitle_scale (1) , _colour_lut (0) , _j2k_bandwidth (200000000) , _dci_metadata (Config::instance()->default_dci_metadata ()) - , _dcp_video_frame_rate (0) + , _dcp_video_frame_rate (24) , _dcp_audio_channels (MAX_AUDIO_CHANNELS) , _dirty (false) { @@ -143,7 +141,6 @@ Film::Film (Film const & o) , _dcp_content_type (o._dcp_content_type) , _container (o._container) , _scaler (o._scaler) - , _ab (o._ab) , _with_subtitles (o._with_subtitles) , _subtitle_offset (o._subtitle_offset) , _subtitle_scale (o._subtitle_scale) @@ -171,11 +168,6 @@ Film::video_state_identifier () const << "_" << j2k_bandwidth() << "_" << lexical_cast (colour_lut()); - if (ab()) { - pair fa = Filter::ffmpeg_strings (Config::instance()->reference_filters()); - s << "ab_" << Config::instance()->reference_scaler()->id() << "_" << fa.first << "_" << fa.second; - } - return s.str (); } @@ -230,13 +222,12 @@ Film::filename_safe_name () const return o; } -string -Film::audio_analysis_path () const +boost::filesystem::path +Film::audio_analysis_path (shared_ptr c) const { - boost::filesystem::path p; - p /= "analysis"; - p /= _playlist->audio_digest(); - return file (p.string ()); + boost::filesystem::path p = dir ("analysis"); + p /= c->digest(); + return p; } /** Add suitable Jobs to the JobManager to create a DCP for this Film */ @@ -294,46 +285,7 @@ Film::make_dcp () throw MissingSettingError (_("name")); } - shared_ptr r; - - if (ab()) { - r = JobManager::instance()->add (shared_ptr (new ABTranscodeJob (shared_from_this()))); - } else { - r = JobManager::instance()->add (shared_ptr (new TranscodeJob (shared_from_this()))); - } -} - -/** Start a job to analyse the audio in our Playlist */ -void -Film::analyse_audio () -{ - if (_analyse_audio_job) { - return; - } - - _analyse_audio_job.reset (new AnalyseAudioJob (shared_from_this())); - _analyse_audio_job->Finished.connect (bind (&Film::analyse_audio_finished, this)); - JobManager::instance()->add (_analyse_audio_job); -} - -/** Start a job to examine a piece of content */ -void -Film::examine_content (shared_ptr c) -{ - shared_ptr j (new ExamineContentJob (shared_from_this(), c)); - JobManager::instance()->add (j); -} - -void -Film::analyse_audio_finished () -{ - ensure_ui_thread (); - - if (_analyse_audio_job->finished_ok ()) { - AudioAnalysisSucceeded (); - } - - _analyse_audio_job.reset (); + JobManager::instance()->add (shared_ptr (new TranscodeJob (shared_from_this()))); } /** Start a job to send our DCP to the configured TMS */ @@ -392,7 +344,6 @@ Film::write_metadata () const } root->add_child("Scaler")->add_child_text (_scaler->id ()); - root->add_child("AB")->add_child_text (_ab ? "1" : "0"); root->add_child("WithSubtitles")->add_child_text (_with_subtitles ? "1" : "0"); root->add_child("SubtitleOffset")->add_child_text (lexical_cast (_subtitle_offset)); root->add_child("SubtitleScale")->add_child_text (lexical_cast (_subtitle_scale)); @@ -435,12 +386,11 @@ Film::read_metadata () { optional c = f.optional_string_child ("Container"); if (c) { - _container = Container::from_id (c.get ()); + _container = Ratio::from_id (c.get ()); } } _scaler = Scaler::from_id (f.string_child ("Scaler")); - _ab = f.bool_child ("AB"); _with_subtitles = f.bool_child ("WithSubtitles"); _subtitle_offset = f.number_child ("SubtitleOffset"); _subtitle_scale = f.number_child ("SubtitleScale"); @@ -611,7 +561,7 @@ Film::set_dcp_content_type (DCPContentType const * t) } void -Film::set_container (Container const * c) +Film::set_container (Ratio const * c) { { boost::mutex::scoped_lock lm (_state_mutex); @@ -630,16 +580,6 @@ Film::set_scaler (Scaler const * s) signal_changed (SCALER); } -void -Film::set_ab (bool a) -{ - { - boost::mutex::scoped_lock lm (_state_mutex); - _ab = a; - } - signal_changed (AB); -} - void Film::set_with_subtitles (bool w) { @@ -812,11 +752,32 @@ Film::content () const return _playlist->content (); } +void +Film::examine_and_add_content (shared_ptr c) +{ + shared_ptr j (new ExamineContentJob (shared_from_this(), c)); + j->Finished.connect (bind (&Film::add_content_weak, this, boost::weak_ptr (c))); + JobManager::instance()->add (j); +} + +void +Film::add_content_weak (weak_ptr c) +{ + shared_ptr content = c.lock (); + if (content) { + add_content (content); + } +} + void Film::add_content (shared_ptr c) { + /* Add video content after any existing content */ + if (dynamic_pointer_cast (c)) { + c->set_start (_playlist->video_end ()); + } + _playlist->add (c); - examine_content (c); } void @@ -903,3 +864,15 @@ Film::dcp_audio_frame_rate () const /* XXX */ return 48000; } + +void +Film::set_sequence_video (bool s) +{ + _playlist->set_sequence_video (s); +} + +libdcp::Size +Film::full_frame () const +{ + return libdcp::Size (2048, 1080); +}