2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include <boost/filesystem.hpp>
29 #include <boost/algorithm/string.hpp>
30 #include <boost/lexical_cast.hpp>
31 #include <boost/date_time.hpp>
34 #include "imagemagick_encoder.h"
37 #include "transcoder.h"
39 #include "job_manager.h"
40 #include "ab_transcode_job.h"
41 #include "transcode_job.h"
42 #include "scp_dcp_job.h"
43 #include "copy_from_dvd_job.h"
44 #include "make_dcp_job.h"
47 #include "exceptions.h"
48 #include "examine_content_job.h"
50 #include "decoder_factory.h"
52 #include "check_hashes_job.h"
54 #include "ui_signaller.h"
57 using namespace boost;
59 /** Construct a Film object in a given directory, reading any metadata
60 * file that exists in that directory. An exception will be thrown if
61 * must_exist is true, and the specified directory does not exist.
63 * @param d Film directory.
64 * @param must_exist true to throw an exception if does not exist.
67 Film::Film (string d, bool must_exist)
68 : _use_dci_name (false)
69 , _dcp_content_type (0)
71 , _scaler (Scaler::from_id ("bicubic"))
73 , _dcp_trim_action (CUT)
78 , _still_duration (10)
79 , _subtitle_stream (-1)
80 , _with_subtitles (false)
81 , _subtitle_offset (0)
84 , _audio_sample_rate (0)
85 , _has_subtitles (false)
86 , _frames_per_second (0)
89 /* Make state.directory a complete path without ..s (where possible)
90 (Code swiped from Adam Bowen on stackoverflow)
93 filesystem::path p (filesystem::system_complete (d));
94 filesystem::path result;
95 for (filesystem::path::iterator i = p.begin(); i != p.end(); ++i) {
97 if (filesystem::is_symlink (result) || result.filename() == "..") {
100 result = result.parent_path ();
102 } else if (*i != ".") {
107 set_directory (result.string ());
109 if (!filesystem::exists (directory())) {
111 throw OpenFileError (directory());
113 filesystem::create_directory (directory());
119 _log = new FileLog (file ("log"));
122 Film::Film (Film const & o)
124 , _directory (o._directory)
126 , _use_dci_name (o._use_dci_name)
127 , _content (o._content)
128 , _dcp_content_type (o._dcp_content_type)
129 , _format (o._format)
131 , _filters (o._filters)
132 , _scaler (o._scaler)
133 , _dcp_frames (o._dcp_frames)
134 , _dcp_trim_action (o._dcp_trim_action)
135 , _dcp_ab (o._dcp_ab)
136 , _audio_stream (o._audio_stream)
137 , _audio_gain (o._audio_gain)
138 , _audio_delay (o._audio_delay)
139 , _still_duration (o._still_duration)
140 , _subtitle_stream (o._subtitle_stream)
141 , _with_subtitles (o._with_subtitles)
142 , _subtitle_offset (o._subtitle_offset)
143 , _subtitle_scale (o._subtitle_scale)
144 , _audio_language (o._audio_language)
145 , _subtitle_language (o._subtitle_language)
146 , _territory (o._territory)
147 , _rating (o._rating)
148 , _studio (o._studio)
149 , _facility (o._facility)
150 , _package_type (o._package_type)
151 , _thumbs (o._thumbs)
153 , _length (o._length)
154 , _audio_sample_rate (o._audio_sample_rate)
155 , _content_digest (o._content_digest)
156 , _has_subtitles (o._has_subtitles)
157 , _audio_streams (o._audio_streams)
158 , _subtitle_streams (o._subtitle_streams)
159 , _frames_per_second (o._frames_per_second)
170 /** @return The path to the directory to write JPEG2000 files to */
172 Film::j2k_dir () const
181 pair<string, string> f = Filter::ffmpeg_strings (filters());
183 /* Write stuff to specify the filter / post-processing settings that are in use,
184 so that we don't get confused about J2K files generated using different
189 << "_" << content_digest()
190 << "_" << crop().left << "_" << crop().right << "_" << crop().top << "_" << crop().bottom
191 << "_" << f.first << "_" << f.second
192 << "_" << scaler()->id();
196 /* Similarly for the A/B case */
199 pair<string, string> fa = Filter::ffmpeg_strings (Config::instance()->reference_filters());
200 s << "ab_" << Config::instance()->reference_scaler()->id() << "_" << fa.first << "_" << fa.second;
204 return dir (p.string());
207 /** Add suitable Jobs to the JobManager to create a DCP for this Film.
208 * @param true to transcode, false to use the WAV and J2K files that are already there.
211 Film::make_dcp (bool transcode)
213 if (dcp_name().find ("/") != string::npos) {
214 throw BadSettingError ("name", "cannot contain slashes");
217 log()->log (String::compose ("DVD-o-matic %1 git %2 using %3", dvdomatic_version, dvdomatic_git_commit, dependency_version_summary()));
221 gethostname (buffer, sizeof (buffer));
222 log()->log (String::compose ("Starting to make DCP on %1", buffer));
226 throw MissingSettingError ("format");
229 if (content().empty ()) {
230 throw MissingSettingError ("content");
233 if (dcp_content_type() == 0) {
234 throw MissingSettingError ("content type");
237 if (name().empty()) {
238 throw MissingSettingError ("name");
241 shared_ptr<Options> o (new Options (j2k_dir(), ".j2c", dir ("wavs")));
242 o->out_size = format()->dcp_size ();
243 if (dcp_frames() == 0) {
244 /* Decode the whole film, no blacking */
247 switch (dcp_trim_action()) {
249 /* Decode only part of the film, no blacking */
253 /* Decode the whole film, but black some frames out */
254 o->black_after = dcp_frames ();
258 o->padding = format()->dcp_padding (this);
259 o->ratio = format()->ratio_as_float (this);
260 o->decode_subtitles = with_subtitles ();
266 r = JobManager::instance()->add (shared_ptr<Job> (new ABTranscodeJob (shared_from_this(), o, shared_ptr<Job> ())));
268 r = JobManager::instance()->add (shared_ptr<Job> (new TranscodeJob (shared_from_this(), o, shared_ptr<Job> ())));
272 r = JobManager::instance()->add (shared_ptr<Job> (new CheckHashesJob (shared_from_this(), o, r)));
273 JobManager::instance()->add (shared_ptr<Job> (new MakeDCPJob (shared_from_this(), o, r)));
277 Film::copy_from_dvd_post_gui ()
279 const string dvd_dir = dir ("dvd");
282 uintmax_t largest_size = 0;
283 for (filesystem::directory_iterator i = filesystem::directory_iterator (dvd_dir); i != filesystem::directory_iterator(); ++i) {
284 uintmax_t const s = filesystem::file_size (*i);
285 if (s > largest_size) {
287 #if BOOST_FILESYSTEM_VERSION == 3
288 largest_file = filesystem::path(*i).generic_string();
290 largest_file = i->string ();
296 set_content (largest_file);
299 /** Start a job to examine our content file */
301 Film::examine_content ()
303 if (_examine_content_job) {
307 set_thumbs (vector<int> ());
308 filesystem::remove_all (dir ("thumbs"));
310 /* This call will recreate the directory */
313 _examine_content_job.reset (new ExamineContentJob (shared_from_this(), shared_ptr<Job> ()));
314 _examine_content_job->Finished.connect (sigc::mem_fun (*this, &Film::examine_content_post_gui));
315 JobManager::instance()->add (_examine_content_job);
319 Film::examine_content_post_gui ()
321 set_length (_examine_content_job->last_video_frame ());
322 _examine_content_job.reset ();
324 string const tdir = dir ("thumbs");
327 for (filesystem::directory_iterator i = filesystem::directory_iterator (tdir); i != filesystem::directory_iterator(); ++i) {
329 /* Aah, the sweet smell of progress */
330 #if BOOST_FILESYSTEM_VERSION == 3
331 string const l = filesystem::path(*i).leaf().generic_string();
333 string const l = i->leaf ();
336 size_t const d = l.find (".png");
337 size_t const t = l.find (".tmp");
338 if (d != string::npos && t == string::npos) {
339 thumbs.push_back (atoi (l.substr (0, d).c_str()));
343 sort (thumbs.begin(), thumbs.end());
348 /** @return full paths to any audio files that this Film has */
350 Film::audio_files () const
353 for (filesystem::directory_iterator i = filesystem::directory_iterator (dir("wavs")); i != filesystem::directory_iterator(); ++i) {
354 f.push_back (i->path().string ());
360 /** Start a job to send our DCP to the configured TMS */
362 Film::send_dcp_to_tms ()
364 shared_ptr<Job> j (new SCPDCPJob (shared_from_this(), shared_ptr<Job> ()));
365 JobManager::instance()->add (j);
369 Film::copy_from_dvd ()
371 shared_ptr<Job> j (new CopyFromDVDJob (shared_from_this(), shared_ptr<Job> ()));
372 j->Finished.connect (sigc::mem_fun (*this, &Film::copy_from_dvd_post_gui));
373 JobManager::instance()->add (j);
376 /** Count the number of frames that have been encoded for this film.
377 * @return frame count.
380 Film::encoded_frames () const
387 for (filesystem::directory_iterator i = filesystem::directory_iterator (j2k_dir ()); i != filesystem::directory_iterator(); ++i) {
389 this_thread::interruption_point ();
395 /** Return the filename of a subtitle image if one exists for a given thumb index.
396 * @param Thumbnail index.
397 * @return Position of the image within the source frame, and the image filename, if one exists.
398 * Otherwise the filename will be empty.
400 pair<Position, string>
401 Film::thumb_subtitle (int n) const
403 string sub_file = thumb_base(n) + ".sub";
404 if (!filesystem::exists (sub_file)) {
405 return pair<Position, string> ();
408 pair<Position, string> sub;
410 ifstream f (sub_file.c_str ());
411 multimap<string, string> kv = read_key_value (f);
412 for (map<string, string>::const_iterator i = kv.begin(); i != kv.end(); ++i) {
413 if (i->first == "x") {
414 sub.first.x = lexical_cast<int> (i->second);
415 } else if (i->first == "y") {
416 sub.first.y = lexical_cast<int> (i->second);
417 sub.second = String::compose ("%1.sub.png", thumb_base(n));
424 /** Write state to our `metadata' file */
426 Film::write_metadata () const
428 filesystem::create_directories (directory());
430 string const m = file ("metadata");
431 ofstream f (m.c_str ());
433 throw CreateFileError (m);
437 f << "name " << _name << "\n";
438 f << "use_dci_name " << _use_dci_name << "\n";
439 f << "content " << _content << "\n";
440 if (_dcp_content_type) {
441 f << "dcp_content_type " << _dcp_content_type->pretty_name () << "\n";
444 f << "format " << _format->as_metadata () << "\n";
446 f << "left_crop " << _crop.left << "\n";
447 f << "right_crop " << _crop.right << "\n";
448 f << "top_crop " << _crop.top << "\n";
449 f << "bottom_crop " << _crop.bottom << "\n";
450 for (vector<Filter const *>::const_iterator i = _filters.begin(); i != _filters.end(); ++i) {
451 f << "filter " << (*i)->id () << "\n";
453 f << "scaler " << _scaler->id () << "\n";
454 f << "dcp_frames " << _dcp_frames << "\n";
456 f << "dcp_trim_action ";
457 switch (_dcp_trim_action) {
466 f << "dcp_ab " << (_dcp_ab ? "1" : "0") << "\n";
467 f << "selected_audio_stream " << _audio_stream << "\n";
468 f << "audio_gain " << _audio_gain << "\n";
469 f << "audio_delay " << _audio_delay << "\n";
470 f << "still_duration " << _still_duration << "\n";
471 f << "selected_subtitle_stream " << _subtitle_stream << "\n";
472 f << "with_subtitles " << _with_subtitles << "\n";
473 f << "subtitle_offset " << _subtitle_offset << "\n";
474 f << "subtitle_scale " << _subtitle_scale << "\n";
475 f << "audio_language " << _audio_language << "\n";
476 f << "subtitle_language " << _subtitle_language << "\n";
477 f << "territory " << _territory << "\n";
478 f << "rating " << _rating << "\n";
479 f << "studio " << _studio << "\n";
480 f << "facility " << _facility << "\n";
481 f << "package_type " << _package_type << "\n";
483 /* Cached stuff; this is information about our content; we could
484 look it up each time, but that's slow.
486 for (vector<int>::const_iterator i = _thumbs.begin(); i != _thumbs.end(); ++i) {
487 f << "thumb " << *i << "\n";
489 f << "width " << _size.width << "\n";
490 f << "height " << _size.height << "\n";
491 f << "length " << _length << "\n";
492 f << "audio_sample_rate " << _audio_sample_rate << "\n";
493 f << "content_digest " << _content_digest << "\n";
494 f << "has_subtitles " << _has_subtitles << "\n";
496 for (vector<AudioStream>::const_iterator i = _audio_streams.begin(); i != _audio_streams.end(); ++i) {
497 f << "audio_stream " << i->to_string () << "\n";
500 for (vector<SubtitleStream>::const_iterator i = _subtitle_streams.begin(); i != _subtitle_streams.end(); ++i) {
501 f << "subtitle_stream " << i->to_string () << "\n";
504 f << "frames_per_second " << _frames_per_second << "\n";
509 /** Read state from our metadata file */
511 Film::read_metadata ()
513 ifstream f (file("metadata").c_str());
514 multimap<string, string> kv = read_key_value (f);
515 for (multimap<string, string>::const_iterator i = kv.begin(); i != kv.end(); ++i) {
516 string const k = i->first;
517 string const v = i->second;
519 /* User-specified stuff */
522 } else if (k == "use_dci_name") {
523 _use_dci_name = (v == "1");
524 } else if (k == "content") {
526 } else if (k == "dcp_content_type") {
527 _dcp_content_type = DCPContentType::from_pretty_name (v);
528 } else if (k == "format") {
529 _format = Format::from_metadata (v);
530 } else if (k == "left_crop") {
531 _crop.left = atoi (v.c_str ());
532 } else if (k == "right_crop") {
533 _crop.right = atoi (v.c_str ());
534 } else if (k == "top_crop") {
535 _crop.top = atoi (v.c_str ());
536 } else if (k == "bottom_crop") {
537 _crop.bottom = atoi (v.c_str ());
538 } else if (k == "filter") {
539 _filters.push_back (Filter::from_id (v));
540 } else if (k == "scaler") {
541 _scaler = Scaler::from_id (v);
542 } else if (k == "dcp_frames") {
543 _dcp_frames = atoi (v.c_str ());
544 } else if (k == "dcp_trim_action") {
546 _dcp_trim_action = CUT;
547 } else if (v == "black_out") {
548 _dcp_trim_action = BLACK_OUT;
550 } else if (k == "dcp_ab") {
551 _dcp_ab = (v == "1");
552 } else if (k == "selected_audio_stream") {
553 _audio_stream = atoi (v.c_str ());
554 } else if (k == "audio_gain") {
555 _audio_gain = atof (v.c_str ());
556 } else if (k == "audio_delay") {
557 _audio_delay = atoi (v.c_str ());
558 } else if (k == "still_duration") {
559 _still_duration = atoi (v.c_str ());
560 } else if (k == "selected_subtitle_stream") {
561 _subtitle_stream = atoi (v.c_str ());
562 } else if (k == "with_subtitles") {
563 _with_subtitles = (v == "1");
564 } else if (k == "subtitle_offset") {
565 _subtitle_offset = atoi (v.c_str ());
566 } else if (k == "subtitle_scale") {
567 _subtitle_scale = atof (v.c_str ());
568 } else if (k == "audio_language") {
570 } else if (k == "subtitle_language") {
571 _subtitle_language = v;
572 } else if (k == "territory") {
574 } else if (k == "rating") {
576 } else if (k == "studio") {
578 } else if (k == "facility") {
580 } else if (k == "package_type") {
586 int const n = atoi (v.c_str ());
587 /* Only add it to the list if it still exists */
588 if (filesystem::exists (thumb_file_for_frame (n))) {
589 _thumbs.push_back (n);
591 } else if (k == "width") {
592 _size.width = atoi (v.c_str ());
593 } else if (k == "height") {
594 _size.height = atoi (v.c_str ());
595 } else if (k == "length") {
596 _length = atof (v.c_str ());
597 } else if (k == "audio_sample_rate") {
598 _audio_sample_rate = atoi (v.c_str ());
599 } else if (k == "content_digest") {
601 } else if (k == "has_subtitles") {
602 _has_subtitles = (v == "1");
603 } else if (k == "audio_stream") {
604 _audio_streams.push_back (AudioStream (v));
605 } else if (k == "subtitle_stream") {
606 _subtitle_streams.push_back (SubtitleStream (v));
607 } else if (k == "frames_per_second") {
608 _frames_per_second = atof (v.c_str ());
615 /** @param n A thumb index.
616 * @return The path to the thumb's image file.
619 Film::thumb_file (int n) const
621 return thumb_file_for_frame (thumb_frame (n));
624 /** @param n A frame index within the Film.
625 * @return The path to the thumb's image file for this frame;
626 * we assume that it exists.
629 Film::thumb_file_for_frame (int n) const
631 return thumb_base_for_frame(n) + ".png";
635 Film::thumb_base (int n) const
637 return thumb_base_for_frame (thumb_frame (n));
641 Film::thumb_base_for_frame (int n) const
645 s << setfill('0') << n;
655 /** @param n A thumb index.
656 * @return The frame within the Film that it is for.
659 Film::thumb_frame (int n) const
661 assert (n < int (_thumbs.size ()));
666 Film::cropped_size (Size s) const
668 s.width -= _crop.left + _crop.right;
669 s.height -= _crop.top + _crop.bottom;
673 /** Given a directory name, return its full path within the Film's directory.
674 * The directory (and its parents) will be created if they do not exist.
677 Film::dir (string d) const
682 filesystem::create_directories (p);
686 /** Given a file or directory name, return its full path within the Film's directory */
688 Film::file (string f) const
696 /** @return full path of the content (actual video) file
700 Film::content_path () const
702 if (filesystem::path(_content).has_root_directory ()) {
706 return file (_content);
710 Film::content_type () const
712 #if BOOST_FILESYSTEM_VERSION == 3
713 string ext = filesystem::path(_content).extension().string();
715 string ext = filesystem::path(_content).extension();
718 transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
720 if (ext == ".tif" || ext == ".tiff" || ext == ".jpg" || ext == ".jpeg" || ext == ".png") {
727 /** @return The sampling rate that we will resample the audio to */
729 Film::target_audio_sample_rate () const
731 /* Resample to a DCI-approved sample rate */
732 double t = dcp_audio_sample_rate (_audio_sample_rate);
734 /* Compensate for the fact that video will be rounded to the
735 nearest integer number of frames per second.
737 if (rint (_frames_per_second) != _frames_per_second) {
738 t *= _frames_per_second / rint (_frames_per_second);
745 Film::dcp_length () const
754 /** @return a DCI-compliant name for a DCP of this film */
756 Film::dci_name () const
760 string fixed_name = to_upper_copy (_name);
761 for (size_t i = 0; i < fixed_name.length(); ++i) {
762 if (fixed_name[i] == ' ') {
767 /* Spec is that the name part should be maximum 14 characters, as I understand it */
768 if (fixed_name.length() > 14) {
769 fixed_name = fixed_name.substr (0, 14);
772 d << fixed_name << "_";
774 if (_dcp_content_type) {
775 d << _dcp_content_type->dci_name() << "_";
779 d << _format->dci_name() << "_";
782 if (!_audio_language.empty ()) {
783 d << _audio_language;
784 if (!_subtitle_language.empty() && _with_subtitles) {
785 d << "-" << _subtitle_language;
793 if (!_territory.empty ()) {
795 if (!_rating.empty ()) {
801 switch (_audio_streams[_audio_stream].channels()) {
818 if (!_studio.empty ()) {
822 gregorian::date today = gregorian::day_clock::local_day ();
823 d << gregorian::to_iso_string (today) << "_";
825 if (!_facility.empty ()) {
826 d << _facility << "_";
829 if (!_package_type.empty ()) {
836 /** @return name to give the DCP */
838 Film::dcp_name () const
849 Film::set_directory (string d)
856 Film::set_name (string n)
859 signal_changed (NAME);
863 Film::set_use_dci_name (bool u)
866 signal_changed (USE_DCI_NAME);
870 Film::set_content (string c)
872 string check = _directory;
874 #if BOOST_FILESYSTEM_VERSION == 3
875 filesystem::path slash ("/");
876 string platform_slash = slash.make_preferred().string ();
878 #ifdef DVDOMATIC_WINDOWS
879 string platform_slash = "\\";
881 string platform_slash = "/";
885 if (!ends_with (check, platform_slash)) {
886 check += platform_slash;
889 if (filesystem::path(c).has_root_directory () && starts_with (c, check)) {
890 c = c.substr (_directory.length() + 1);
897 /* Create a temporary decoder so that we can get information
903 shared_ptr<Options> o (new Options ("", "", ""));
904 o->out_size = Size (1024, 1024);
906 shared_ptr<Decoder> d = decoder_factory (shared_from_this(), o, 0, 0);
908 set_size (d->native_size ());
909 set_frames_per_second (d->frames_per_second ());
910 set_audio_sample_rate (d->audio_sample_rate ());
911 set_has_subtitles (d->has_subtitles ());
912 set_audio_streams (d->audio_streams ());
913 set_subtitle_streams (d->subtitle_streams ());
914 set_audio_stream (audio_streams().empty() ? -1 : 0);
915 set_subtitle_stream (subtitle_streams().empty() ? -1 : 0);
917 signal_changed (CONTENT);
919 set_content_digest (md5_digest (content_path ()));
923 Film::set_dcp_content_type (DCPContentType const * t)
925 _dcp_content_type = t;
926 signal_changed (DCP_CONTENT_TYPE);
930 Film::set_format (Format const * f)
933 signal_changed (FORMAT);
937 Film::set_crop (Crop c)
940 signal_changed (CROP);
944 Film::set_left_crop (int c)
946 if (_crop.left == c) {
951 signal_changed (CROP);
955 Film::set_right_crop (int c)
957 if (_crop.right == c) {
962 signal_changed (CROP);
966 Film::set_top_crop (int c)
968 if (_crop.top == c) {
973 signal_changed (CROP);
977 Film::set_bottom_crop (int c)
979 if (_crop.bottom == c) {
984 signal_changed (CROP);
988 Film::set_filters (vector<Filter const *> f)
991 signal_changed (FILTERS);
995 Film::set_scaler (Scaler const * s)
998 signal_changed (SCALER);
1002 Film::set_dcp_frames (int f)
1005 signal_changed (DCP_FRAMES);
1009 Film::set_dcp_trim_action (TrimAction a)
1011 _dcp_trim_action = a;
1012 signal_changed (DCP_TRIM_ACTION);
1016 Film::set_dcp_ab (bool a)
1019 signal_changed (DCP_AB);
1023 Film::set_audio_stream (int s)
1026 signal_changed (AUDIO_STREAM);
1030 Film::set_audio_gain (float g)
1033 signal_changed (AUDIO_GAIN);
1037 Film::set_audio_delay (int d)
1040 signal_changed (AUDIO_DELAY);
1044 Film::set_still_duration (int d)
1046 _still_duration = d;
1047 signal_changed (STILL_DURATION);
1051 Film::set_subtitle_stream (int s)
1053 _subtitle_stream = s;
1054 signal_changed (SUBTITLE_STREAM);
1058 Film::set_with_subtitles (bool w)
1060 _with_subtitles = w;
1061 signal_changed (WITH_SUBTITLES);
1065 Film::set_subtitle_offset (int o)
1067 _subtitle_offset = o;
1068 signal_changed (SUBTITLE_OFFSET);
1072 Film::set_subtitle_scale (float s)
1074 _subtitle_scale = s;
1075 signal_changed (SUBTITLE_SCALE);
1079 Film::set_audio_language (string l)
1081 _audio_language = l;
1082 signal_changed (DCI_METADATA);
1086 Film::set_subtitle_language (string l)
1088 _subtitle_language = l;
1089 signal_changed (DCI_METADATA);
1093 Film::set_territory (string t)
1096 signal_changed (DCI_METADATA);
1100 Film::set_rating (string r)
1103 signal_changed (DCI_METADATA);
1107 Film::set_studio (string s)
1110 signal_changed (DCI_METADATA);
1114 Film::set_facility (string f)
1117 signal_changed (DCI_METADATA);
1121 Film::set_package_type (string p)
1124 signal_changed (DCI_METADATA);
1128 Film::set_thumbs (vector<int> t)
1131 signal_changed (THUMBS);
1135 Film::set_size (Size s)
1138 signal_changed (SIZE);
1142 Film::set_length (int l)
1145 signal_changed (LENGTH);
1149 Film::set_audio_sample_rate (int r)
1151 _audio_sample_rate = r;
1152 signal_changed (AUDIO_SAMPLE_RATE);
1156 Film::set_content_digest (string d)
1158 _content_digest = d;
1163 Film::set_has_subtitles (bool s)
1166 signal_changed (HAS_SUBTITLES);
1170 Film::set_audio_streams (vector<AudioStream> s)
1177 Film::set_subtitle_streams (vector<SubtitleStream> s)
1179 _subtitle_streams = s;
1184 Film::set_frames_per_second (float f)
1186 _frames_per_second = f;
1187 signal_changed (FRAMES_PER_SECOND);
1191 Film::signal_changed (Property p)
1194 ui_signaller->emit (boost::bind (boost::ref (Changed), p));
1198 Film::audio_channels () const
1200 if (_audio_stream == -1) {
1204 return _audio_streams[_audio_stream].channels ();