From fa35da1ebea58be1449f79c3f057265b7501c3b6 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 3 Jun 2014 23:37:12 +0100 Subject: Bump version --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index a0e776b0e..83fcc8960 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-06-03 Carl Hetherington + + * Version 1.69.21 released. + 2014-06-03 Carl Hetherington * Fix bad resampling of separate sound file sources that -- cgit v1.2.3 From b60186064405914b41780021f74dd7830f2ffecb Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 5 Jun 2014 11:48:54 +0100 Subject: Back port active_frame_rate_change stuff from v2, removing specification of video frame rate for sndfile sources. --- ChangeLog | 6 ++ src/lib/audio_content.cc | 2 +- src/lib/content.h | 2 - src/lib/film.cc | 7 +++ src/lib/film.h | 2 + src/lib/frame_rate_change.cc | 6 +- src/lib/frame_rate_change.h | 8 +++ src/lib/playlist.cc | 17 ++++++ src/lib/playlist.h | 2 + src/lib/sndfile_content.cc | 22 +------- src/lib/sndfile_content.h | 21 ------- src/lib/util.cc | 27 --------- src/wx/timing_panel.cc | 14 +---- test/audio_with_specified_video_frame_rate_test.cc | 65 ---------------------- test/wscript | 1 - 15 files changed, 52 insertions(+), 150 deletions(-) delete mode 100644 test/audio_with_specified_video_frame_rate_test.cc (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 83fcc8960..c6db10402 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-06-05 Carl Hetherington + + * Back-port changes from v2 which work out how separate + audio files should be resampled by looking at the video + files which are present at the same time. + 2014-06-03 Carl Hetherington * Version 1.69.21 released. diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index 7d77154e1..bf00b672a 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -160,7 +160,7 @@ AudioContent::output_audio_frame_rate () const /* Resample to a DCI-approved sample rate */ double t = dcp_audio_frame_rate (content_audio_frame_rate ()); - FrameRateChange frc (video_frame_rate(), film->video_frame_rate()); + FrameRateChange frc = film->active_frame_rate_change (position ()); /* 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 diff --git a/src/lib/content.h b/src/lib/content.h index 3cea93cfc..596a0a905 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -65,8 +65,6 @@ public: virtual void as_xml (xmlpp::Node *) const; virtual Time full_length () const = 0; virtual std::string identifier () const; - /** @return the video frame rate that this content has or was prepared to be used with */ - virtual float video_frame_rate () const = 0; boost::shared_ptr clone () const; diff --git a/src/lib/film.cc b/src/lib/film.cc index 1b5b2b366..9dce80071 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1041,3 +1041,10 @@ Film::should_be_enough_disk_space (double& required, double& available) const available = double (s.available) / 1073741824.0f; return (available - required) > 1; } + +FrameRateChange +Film::active_frame_rate_change (Time t) const +{ + return _playlist->active_frame_rate_change (t, video_frame_rate ()); +} + diff --git a/src/lib/film.h b/src/lib/film.h index 06c770efa..909bc0beb 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -36,6 +36,7 @@ #include "util.h" #include "types.h" #include "dci_metadata.h" +#include "frame_rate_change.h" class DCPContentType; class Log; @@ -119,6 +120,7 @@ public: Time length () const; bool has_subtitles () const; OutputVideoFrame best_video_frame_rate () const; + FrameRateChange active_frame_rate_change (Time) const; libdcp::KDM make_kdm ( diff --git a/src/lib/frame_rate_change.cc b/src/lib/frame_rate_change.cc index 3e9c4b505..454938ada 100644 --- a/src/lib/frame_rate_change.cc +++ b/src/lib/frame_rate_change.cc @@ -51,8 +51,10 @@ about_equal (float a, float b) } -FrameRateChange::FrameRateChange (float source, int dcp) - : skip (false) +FrameRateChange::FrameRateChange (float source_, int dcp_) + : source (source_) + , dcp (dcp_) + , skip (false) , repeat (1) , change_speed (false) { diff --git a/src/lib/frame_rate_change.h b/src/lib/frame_rate_change.h index 6165f6840..f53adc059 100644 --- a/src/lib/frame_rate_change.h +++ b/src/lib/frame_rate_change.h @@ -17,6 +17,9 @@ */ +#ifndef DCPOMATIC_FRAME_RATE_CHANGE_H +#define DCPOMATIC_FRAME_RATE_CHANGE_H + #include struct FrameRateChange @@ -34,6 +37,9 @@ struct FrameRateChange return repeat; } + float source; + int dcp; + /** true to skip every other frame */ bool skip; /** number of times to use each frame (e.g. 1 is normal, 2 means repeat each frame once, and so on) */ @@ -56,3 +62,5 @@ struct FrameRateChange std::string description; }; + +#endif diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 1f00d4d67..247c4837b 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -397,3 +397,20 @@ Playlist::move_later (shared_ptr c) Changed (); } + +FrameRateChange +Playlist::active_frame_rate_change (Time t, int dcp_video_frame_rate) const +{ + for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) { + shared_ptr vc = dynamic_pointer_cast (*i); + if (!vc) { + break; + } + + if (vc->position() >= t && t < vc->end()) { + return FrameRateChange (vc->video_frame_rate(), dcp_video_frame_rate); + } + } + + return FrameRateChange (dcp_video_frame_rate, dcp_video_frame_rate); +} diff --git a/src/lib/playlist.h b/src/lib/playlist.h index 394023f5c..effc52101 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -25,6 +25,7 @@ #include #include "ffmpeg_content.h" #include "audio_mapping.h" +#include "frame_rate_change.h" class Content; class FFmpegContent; @@ -74,6 +75,7 @@ public: int best_dcp_frame_rate () const; Time video_end () const; + FrameRateChange active_frame_rate_change (Time, int dcp_frame_rate) const; void set_sequence_video (bool); void maybe_sequence_video (); diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc index 6f18ebbb4..3efba6fd5 100644 --- a/src/lib/sndfile_content.cc +++ b/src/lib/sndfile_content.cc @@ -34,8 +34,6 @@ using std::cout; using boost::shared_ptr; using libdcp::raw_convert; -int const SndfileContentProperty::VIDEO_FRAME_RATE = 600; - SndfileContent::SndfileContent (shared_ptr f, boost::filesystem::path p) : Content (f, p) , AudioContent (f, p) @@ -150,9 +148,10 @@ SndfileContent::full_length () const shared_ptr film = _film.lock (); assert (film); - float const rate = _video_frame_rate.get_value_or (film->video_frame_rate ()); + FrameRateChange frc = film->active_frame_rate_change (position ()); + OutputAudioFrame const len = divide_with_round ( - audio_length() * output_audio_frame_rate() * rate, + audio_length() * output_audio_frame_rate() * frc.source, content_audio_frame_rate() * film->video_frame_rate() ); @@ -169,18 +168,3 @@ SndfileContent::set_audio_mapping (AudioMapping m) signal_changed (AudioContentProperty::AUDIO_MAPPING); } - -float -SndfileContent::video_frame_rate () const -{ - { - boost::mutex::scoped_lock lm (_mutex); - if (_video_frame_rate) { - return _video_frame_rate.get (); - } - } - - shared_ptr film = _film.lock (); - assert (film); - return film->video_frame_rate (); -} diff --git a/src/lib/sndfile_content.h b/src/lib/sndfile_content.h index dcfdfd8d7..a32043c5c 100644 --- a/src/lib/sndfile_content.h +++ b/src/lib/sndfile_content.h @@ -29,12 +29,6 @@ namespace cxml { class Node; } -class SndfileContentProperty -{ -public: - static int const VIDEO_FRAME_RATE; -}; - class SndfileContent : public AudioContent { public: @@ -73,17 +67,6 @@ public: return _audio_mapping; } - void set_video_frame_rate (float r) { - { - boost::mutex::scoped_lock lm (_mutex); - _video_frame_rate = r; - } - - signal_changed (SndfileContentProperty::VIDEO_FRAME_RATE); - } - - float video_frame_rate () const; - void set_audio_mapping (AudioMapping); static bool valid_file (boost::filesystem::path); @@ -93,10 +76,6 @@ private: AudioContent::Frame _audio_length; int _audio_frame_rate; AudioMapping _audio_mapping; - /** Video frame rate that this audio has been prepared for, - if specified. - */ - boost::optional _video_frame_rate; }; #endif diff --git a/src/lib/util.cc b/src/lib/util.cc index fa7be179a..200d311dc 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -465,33 +465,6 @@ md5_digest (vector files, shared_ptr job) return digester.get (); } -static bool -about_equal (float a, float b) -{ - /* A film of F seconds at f FPS will be Ff frames; - Consider some delta FPS d, so if we run the same - film at (f + d) FPS it will last F(f + d) seconds. - - Hence the difference in length over the length of the film will - be F(f + d) - Ff frames - = Ff + Fd - Ff frames - = Fd frames - = Fd/f seconds - - So if we accept a difference of 1 frame, ie 1/f seconds, we can - say that - - 1/f = Fd/f - ie 1 = Fd - ie d = 1/F - - So for a 3hr film, ie F = 3 * 60 * 60 = 10800, the acceptable - FPS error is 1/F ~= 0.0001 ~= 10-e4 - */ - - return (fabs (a - b) < 1e-4); -} - /** @param An arbitrary audio frame rate. * @return The appropriate DCP-approved frame rate (48kHz or 96kHz). */ diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc index 5cefe318a..6d9bf4539 100644 --- a/src/wx/timing_panel.cc +++ b/src/wx/timing_panel.cc @@ -19,7 +19,6 @@ #include "lib/content.h" #include "lib/image_content.h" -#include "lib/sndfile_content.h" #include "timing_panel.h" #include "wx_util.h" #include "timecode.h" @@ -93,8 +92,7 @@ TimingPanel::film_content_changed (int property) } else if ( property == ContentProperty::LENGTH || property == VideoContentProperty::VIDEO_FRAME_RATE || - property == VideoContentProperty::VIDEO_FRAME_TYPE || - property == SndfileContentProperty::VIDEO_FRAME_RATE + property == VideoContentProperty::VIDEO_FRAME_TYPE ) { if (content) { _full_length->set (content->full_length (), film_video_frame_rate); @@ -124,11 +122,8 @@ TimingPanel::film_content_changed (int property) if (property == VideoContentProperty::VIDEO_FRAME_RATE) { if (content) { shared_ptr vc = dynamic_pointer_cast (content); - shared_ptr sc = dynamic_pointer_cast (content); if (vc) { _video_frame_rate->SetValue (std_to_wx (lexical_cast (vc->video_frame_rate ()))); - } else if (sc) { - _video_frame_rate->SetValue (std_to_wx (lexical_cast (sc->video_frame_rate ()))); } else { _video_frame_rate->SetValue ("24"); } @@ -138,10 +133,9 @@ TimingPanel::film_content_changed (int property) } shared_ptr ic = dynamic_pointer_cast (content); - shared_ptr sc = dynamic_pointer_cast (content); _full_length->set_editable (ic && ic->still ()); _play_length->set_editable (!ic || !ic->still ()); - _video_frame_rate->Enable ((ic && !ic->still ()) || sc); + _video_frame_rate->Enable (ic && !ic->still ()); _set_video_frame_rate->Enable (false); } @@ -209,10 +203,6 @@ TimingPanel::set_video_frame_rate () if (ic) { ic->set_video_frame_rate (lexical_cast (wx_to_std (_video_frame_rate->GetValue ()))); } - shared_ptr sc = dynamic_pointer_cast (c.front ()); - if (sc) { - sc->set_video_frame_rate (lexical_cast (wx_to_std (_video_frame_rate->GetValue ()))); - } _set_video_frame_rate->Enable (false); } } diff --git a/test/audio_with_specified_video_frame_rate_test.cc b/test/audio_with_specified_video_frame_rate_test.cc deleted file mode 100644 index 986033205..000000000 --- a/test/audio_with_specified_video_frame_rate_test.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2014 Carl Hetherington - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include -#include "lib/film.h" -#include "lib/dcp_content_type.h" -#include "lib/ratio.h" -#include "lib/sndfile_content.h" -#include "lib/audio_buffers.h" -#include "lib/player.h" -#include "test.h" - -using std::cout; -using boost::shared_ptr; - -static -void -process_audio (shared_ptr buffers, int* samples) -{ - cout << "weeeeeeeeee " << buffers->frames() << "\n"; - *samples += buffers->frames (); -} - -/** Test the situation where a piece of SndfileContent has its video - * frame rate specified (i.e. the rate that it was prepared for), - * and hence might need resampling. - */ -BOOST_AUTO_TEST_CASE (audio_with_specified_video_frame_rate_test) -{ - /* Make a film using staircase.wav with the DCP at 30fps and the audio specified - as being prepared for 29.97. - */ - - shared_ptr film = new_test_film ("audio_with_specified_video_frame_rate_test"); - film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR")); - film->set_container (Ratio::from_id ("185")); - film->set_name ("audio_with_specified_video_frame_rate_test"); - - shared_ptr content (new SndfileContent (film, "test/data/sine_440.wav")); - content->set_video_frame_rate (29.97); - film->examine_and_add_content (content); - - wait_for_jobs (); - - film->set_video_frame_rate (30); - - BOOST_CHECK_EQUAL (content->content_audio_frame_rate(), 48000); - BOOST_CHECK_EQUAL (content->output_audio_frame_rate(), 47952); -} diff --git a/test/wscript b/test/wscript index 6f1490a15..676f47104 100644 --- a/test/wscript +++ b/test/wscript @@ -20,7 +20,6 @@ def build(bld): audio_delay_test.cc audio_mapping_test.cc audio_merger_test.cc - audio_with_specified_video_frame_rate_test.cc black_fill_test.cc client_server_test.cc colour_conversion_test.cc -- cgit v1.2.3 From 78b708f94d12b460d099a4323dd1ae7988672493 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 5 Jun 2014 11:59:13 +0100 Subject: Use Magick::Image::write rather than a hand-made loop; much faster. --- ChangeLog | 2 ++ src/lib/image_proxy.cc | 14 ++------------ 2 files changed, 4 insertions(+), 12 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index c6db10402..576fa0d39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-06-05 Carl Hetherington + * Large speed-up to multi-image source file decoding. + * Back-port changes from v2 which work out how separate audio files should be resampled by looking at the video files which are present at the same time. diff --git a/src/lib/image_proxy.cc b/src/lib/image_proxy.cc index 230bfacad..dbfd8c6d4 100644 --- a/src/lib/image_proxy.cc +++ b/src/lib/image_proxy.cc @@ -134,18 +134,8 @@ MagickImageProxy::image () const _image.reset (new Image (PIX_FMT_RGB24, size, true)); using namespace MagickCore; - - uint8_t* p = _image->data()[0]; - for (int y = 0; y < size.height; ++y) { - uint8_t* q = p; - for (int x = 0; x < size.width; ++x) { - Magick::Color c = magick_image->pixelColor (x, y); - *q++ = c.redQuantum() * 255 / QuantumRange; - *q++ = c.greenQuantum() * 255 / QuantumRange; - *q++ = c.blueQuantum() * 255 / QuantumRange; - } - p += _image->stride()[0]; - } + + magick_image->write (0, 0, size.width, size.height, "RGB", CharPixel, _image->data()[0]); delete magick_image; -- cgit v1.2.3 From c80c0258988b5884b8471e7c0b82e1d515657cbb Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 5 Jun 2014 12:03:23 +0100 Subject: Bump version --- ChangeLog | 4 ++++ debian/changelog | 5 +++-- wscript | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 576fa0d39..9872730be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-06-05 Carl Hetherington + + * Version 1.69.22 released. + 2014-06-05 Carl Hetherington * Large speed-up to multi-image source file decoding. diff --git a/debian/changelog b/debian/changelog index c0750ff6e..e839c2a7d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -dcpomatic (1.69.21-1) UNRELEASED; urgency=low +dcpomatic (1.69.22-1) UNRELEASED; urgency=low * New upstream release. * New upstream release. @@ -145,8 +145,9 @@ dcpomatic (1.69.21-1) UNRELEASED; urgency=low * New upstream release. * New upstream release. * New upstream release. + * New upstream release. - -- Carl Hetherington Tue, 03 Jun 2014 23:37:12 +0100 + -- Carl Hetherington Thu, 05 Jun 2014 12:03:23 +0100 dcpomatic (0.87-1) UNRELEASED; urgency=low diff --git a/wscript b/wscript index 8fdc1961e..57ba436b9 100644 --- a/wscript +++ b/wscript @@ -3,7 +3,7 @@ import os import sys APPNAME = 'dcpomatic' -VERSION = '1.69.21devel' +VERSION = '1.69.22' def options(opt): opt.load('compiler_cxx') -- cgit v1.2.3 From 600a0056e835343b854f00a82f54394c15bad443 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 6 Jun 2014 11:18:59 +0100 Subject: Bump version --- ChangeLog | 4 ++++ debian/changelog | 5 +++-- wscript | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 9872730be..191e55b54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-06-06 Carl Hetherington + + * Version 1.69.23 released. + 2014-06-05 Carl Hetherington * Version 1.69.22 released. diff --git a/debian/changelog b/debian/changelog index e839c2a7d..b816bf46f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -dcpomatic (1.69.22-1) UNRELEASED; urgency=low +dcpomatic (1.69.23-1) UNRELEASED; urgency=low * New upstream release. * New upstream release. @@ -146,8 +146,9 @@ dcpomatic (1.69.22-1) UNRELEASED; urgency=low * New upstream release. * New upstream release. * New upstream release. + * New upstream release. - -- Carl Hetherington Thu, 05 Jun 2014 12:03:23 +0100 + -- Carl Hetherington Fri, 06 Jun 2014 11:18:59 +0100 dcpomatic (0.87-1) UNRELEASED; urgency=low diff --git a/wscript b/wscript index ebed382b0..a08b97a43 100644 --- a/wscript +++ b/wscript @@ -3,7 +3,7 @@ import os import sys APPNAME = 'dcpomatic' -VERSION = '1.69.22devel' +VERSION = '1.69.23' def options(opt): opt.load('compiler_cxx') -- cgit v1.2.3 From a6b189f4327a210995480b3a4989b1866ea7db12 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 9 Jun 2014 00:43:08 +0100 Subject: Bump version --- ChangeLog | 4 ++++ debian/changelog | 5 +++-- wscript | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 191e55b54..d473393f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-06-09 Carl Hetherington + + * Version 1.69.24 released. + 2014-06-06 Carl Hetherington * Version 1.69.23 released. diff --git a/debian/changelog b/debian/changelog index b816bf46f..7cd4a2379 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -dcpomatic (1.69.23-1) UNRELEASED; urgency=low +dcpomatic (1.69.24-1) UNRELEASED; urgency=low * New upstream release. * New upstream release. @@ -147,8 +147,9 @@ dcpomatic (1.69.23-1) UNRELEASED; urgency=low * New upstream release. * New upstream release. * New upstream release. + * New upstream release. - -- Carl Hetherington Fri, 06 Jun 2014 11:18:59 +0100 + -- Carl Hetherington Mon, 09 Jun 2014 00:43:08 +0100 dcpomatic (0.87-1) UNRELEASED; urgency=low diff --git a/wscript b/wscript index a03b48530..6dcfe4e2a 100644 --- a/wscript +++ b/wscript @@ -3,7 +3,7 @@ import os import sys APPNAME = 'dcpomatic' -VERSION = '1.69.23devel' +VERSION = '1.69.24' def options(opt): opt.load('compiler_cxx') -- cgit v1.2.3 From 7e690d21278df14b113f3602cbbd43f6214fd614 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 9 Jun 2014 23:13:27 +0100 Subject: Emit the large bits of pointless silence which are the cause of #252 in half-second chunks, which at least fixes the out-of-memory condition. --- ChangeLog | 2 ++ src/lib/ffmpeg_decoder.cc | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index d473393f1..4ad416fcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-06-09 Carl Hetherington + * Work-around out-of-memory crashes with large start trims (#252). + * Version 1.69.24 released. 2014-06-06 Carl Hetherington diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 04dd7fd2d..a51b521d0 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -422,15 +422,18 @@ FFmpegDecoder::decode_audio_packet () if (pts > 0) { /* Emit some silence */ - shared_ptr silence ( - new AudioBuffers ( - _ffmpeg_content->audio_channels(), - pts * _ffmpeg_content->content_audio_frame_rate() - ) - ); + int64_t frames = pts * _ffmpeg_content->content_audio_frame_rate (); + while (frames > 0) { + int64_t const this_time = min (frames, (int64_t) _ffmpeg_content->content_audio_frame_rate() / 2); + + shared_ptr silence ( + new AudioBuffers (_ffmpeg_content->audio_channels(), this_time) + ); - silence->make_silent (); - audio (silence, _audio_position); + silence->make_silent (); + audio (silence, _audio_position); + frames -= this_time; + } } } -- cgit v1.2.3 From 93c996b302589dee7d43d990f3650d636345a545 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 9 Jun 2014 23:56:33 +0100 Subject: Use a SpinCtrlDouble for audio gain, and change its representation from float to double. Requested-by: Mattias Mattsson --- ChangeLog | 2 ++ src/lib/audio_content.cc | 2 +- src/lib/audio_content.h | 6 +++--- src/wx/audio_panel.cc | 6 ++++-- src/wx/audio_panel.h | 4 ++-- src/wx/content_widget.h | 24 ++++++++++++++++++++++++ src/wx/wx_util.cc | 15 +++++++++++++++ src/wx/wx_util.h | 3 +++ 8 files changed, 54 insertions(+), 8 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 4ad416fcc..c03d54e9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-06-09 Carl Hetherington + * Make audio gain a floating-point value in the UI (#367). + * Work-around out-of-memory crashes with large start trims (#252). * Version 1.69.24 released. diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index bf00b672a..29d159a29 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -98,7 +98,7 @@ AudioContent::as_xml (xmlpp::Node* node) const void -AudioContent::set_audio_gain (float g) +AudioContent::set_audio_gain (double g) { { boost::mutex::scoped_lock lm (_mutex); diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h index 2a1216d86..2c324a3a4 100644 --- a/src/lib/audio_content.h +++ b/src/lib/audio_content.h @@ -62,10 +62,10 @@ public: boost::signals2::connection analyse_audio (boost::function); - void set_audio_gain (float); + void set_audio_gain (double); void set_audio_delay (int); - float audio_gain () const { + double audio_gain () const { boost::mutex::scoped_lock lm (_mutex); return _audio_gain; } @@ -77,7 +77,7 @@ public: private: /** Gain to apply to audio in dB */ - float _audio_gain; + double _audio_gain; /** Delay to apply to audio (positive moves audio later) in milliseconds */ int _audio_delay; }; diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index 1c679d336..72cb9fe6a 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -50,9 +50,9 @@ AudioPanel::AudioPanel (FilmEditor* e) ++r; add_label_to_grid_bag_sizer (grid, this, _("Audio Gain"), true, wxGBPosition (r, 0)); - _gain = new ContentSpinCtrl ( + _gain = new ContentSpinCtrlDouble ( this, - new wxSpinCtrl (this), + new wxSpinCtrlDouble (this), AudioContentProperty::AUDIO_GAIN, boost::mem_fn (&AudioContent::audio_gain), boost::mem_fn (&AudioContent::set_audio_gain) @@ -88,6 +88,8 @@ AudioPanel::AudioPanel (FilmEditor* e) _sizer->Add (_mapping, 1, wxEXPAND | wxALL, 6); _gain->wrapped()->SetRange (-60, 60); + _gain->wrapped()->SetDigits (1); + _gain->wrapped()->SetIncrement (0.5); _delay->wrapped()->SetRange (-1000, 1000); _stream->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&AudioPanel::stream_changed, this)); diff --git a/src/wx/audio_panel.h b/src/wx/audio_panel.h index f1b932e7c..2ba5a9ffc 100644 --- a/src/wx/audio_panel.h +++ b/src/wx/audio_panel.h @@ -21,7 +21,7 @@ #include "film_editor_panel.h" #include "content_widget.h" -class wxSpinCtrl; +class wxSpinCtrlDouble; class wxButton; class wxChoice; class wxStaticText; @@ -44,7 +44,7 @@ private: void mapping_changed (AudioMapping); void setup_stream_description (); - ContentSpinCtrl* _gain; + ContentSpinCtrlDouble* _gain; wxButton* _gain_calculate_button; wxButton* _show; ContentSpinCtrl* _delay; diff --git a/src/wx/content_widget.h b/src/wx/content_widget.h index 30501c1a9..ca9485006 100644 --- a/src/wx/content_widget.h +++ b/src/wx/content_widget.h @@ -222,6 +222,30 @@ public: } }; +template +class ContentSpinCtrlDouble : public ContentWidget +{ +public: + ContentSpinCtrlDouble ( + wxWindow* parent, + wxSpinCtrlDouble* wrapped, + int property, + boost::function getter, + boost::function setter + ) + : ContentWidget ( + parent, + wrapped, + property, + getter, setter, + &caster, + &caster + ) + { + wrapped->Bind (wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, boost::bind (&ContentWidget::view_changed, this)); + } +}; + template class ContentChoice : public ContentWidget { diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 96278b82b..b73cd490d 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -189,6 +189,15 @@ checked_set (wxSpinCtrl* widget, int value) } } +void +checked_set (wxSpinCtrlDouble* widget, double value) +{ + /* XXX: completely arbitrary epsilon */ + if (fabs (widget->GetValue() - value) < 1e-16) { + widget->SetValue (value); + } +} + void checked_set (wxChoice* widget, int value) { @@ -297,6 +306,12 @@ wx_get (wxChoice* w) return w->GetSelection (); } +double +wx_get (wxSpinCtrlDouble* w) +{ + return w->GetValue (); +} + void run_gui_loop () { diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h index 56ed500f6..12a7115d5 100644 --- a/src/wx/wx_util.h +++ b/src/wx/wx_util.h @@ -31,6 +31,7 @@ class wxFilePickerCtrl; class wxSpinCtrl; +class wxSpinCtrlDouble; class wxGridBagSizer; #define DCPOMATIC_SIZER_X_GAP 8 @@ -86,6 +87,7 @@ extern std::string string_client_data (wxClientData* o); extern void checked_set (wxFilePickerCtrl* widget, std::string value); extern void checked_set (wxSpinCtrl* widget, int value); +extern void checked_set (wxSpinCtrlDouble* widget, double value); extern void checked_set (wxChoice* widget, int value); extern void checked_set (wxChoice* widget, std::string value); extern void checked_set (wxTextCtrl* widget, std::string value); @@ -95,6 +97,7 @@ extern void checked_set (wxStaticText* widget, std::string value); extern int wx_get (wxChoice* widget); extern int wx_get (wxSpinCtrl* widget); +extern double wx_get (wxSpinCtrlDouble* widget); /* GTK 2.24.17 has a buggy GtkFileChooserButton and it was put in Ubuntu 13.04. This also seems to apply to 2.24.20 in Ubuntu 13.10 and 2.24.23 in Ubuntu 14.04. -- cgit v1.2.3 From 971c18dd51fa6c886a80af87ee523681d6967271 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 9 Jun 2014 23:59:03 +0100 Subject: Bump version --- ChangeLog | 4 ++++ debian/changelog | 5 +++-- wscript | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index c03d54e9a..942fc99a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-06-09 Carl Hetherington + + * Version 1.69.25 released. + 2014-06-09 Carl Hetherington * Make audio gain a floating-point value in the UI (#367). diff --git a/debian/changelog b/debian/changelog index 7cd4a2379..bba63b12e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -dcpomatic (1.69.24-1) UNRELEASED; urgency=low +dcpomatic (1.69.25-1) UNRELEASED; urgency=low * New upstream release. * New upstream release. @@ -148,8 +148,9 @@ dcpomatic (1.69.24-1) UNRELEASED; urgency=low * New upstream release. * New upstream release. * New upstream release. + * New upstream release. - -- Carl Hetherington Mon, 09 Jun 2014 00:43:08 +0100 + -- Carl Hetherington Mon, 09 Jun 2014 23:59:02 +0100 dcpomatic (0.87-1) UNRELEASED; urgency=low diff --git a/wscript b/wscript index ba48a41db..6f73bc81e 100644 --- a/wscript +++ b/wscript @@ -3,7 +3,7 @@ import os import sys APPNAME = 'dcpomatic' -VERSION = '1.69.24devel' +VERSION = '1.69.25' def options(opt): opt.load('compiler_cxx') -- cgit v1.2.3 From ac1d52f98e8db9d428b08eb1de655ddfc83836e3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 10 Jun 2014 10:24:06 +0100 Subject: Fix server/client with non-RGB24 images. --- ChangeLog | 2 ++ src/lib/image_proxy.cc | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index c03d54e9a..a402353d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-06-09 Carl Hetherington + * Fix server/client with non-RGB24 sources. + * Make audio gain a floating-point value in the UI (#367). * Work-around out-of-memory crashes with large start trims (#252). diff --git a/src/lib/image_proxy.cc b/src/lib/image_proxy.cc index 618cdbcf3..4e2f8a135 100644 --- a/src/lib/image_proxy.cc +++ b/src/lib/image_proxy.cc @@ -55,7 +55,7 @@ RawImageProxy::RawImageProxy (shared_ptr xml, shared_ptr soc xml->number_child ("Width"), xml->number_child ("Height") ); - _image.reset (new Image (PIX_FMT_RGB24, size, true)); + _image.reset (new Image (static_cast (xml->number_child ("PixelFormat")), size, true)); _image->read_from_socket (socket); } @@ -71,6 +71,7 @@ RawImageProxy::add_metadata (xmlpp::Node* node) const node->add_child("Type")->add_child_text (N_("Raw")); node->add_child("Width")->add_child_text (libdcp::raw_convert (_image->size().width)); node->add_child("Height")->add_child_text (libdcp::raw_convert (_image->size().height)); + node->add_child("PixelFormat")->add_child_text (libdcp::raw_convert (_image->pixel_format ())); } void -- cgit v1.2.3 From 40183875ff823b8981b4369eddfe9bbb13938b03 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 10 Jun 2014 14:13:54 +0100 Subject: Fix crash when opening the timeline window with no content (#369). Reported-by: Corvo --- ChangeLog | 4 ++++ src/wx/timeline.cc | 29 ++++++++++++++++++++--------- src/wx/timeline.h | 4 ++-- 3 files changed, 26 insertions(+), 11 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 29576e478..345130646 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-06-10 Carl Hetherington + + * Fix crash when opening the timeline with no content (#369). + 2014-06-09 Carl Hetherington * Fix server/client with non-RGB24 sources. diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 1858afee7..d4df6d8b2 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -66,7 +66,7 @@ protected: int time_x (Time t) const { - return _timeline.tracks_position().x + t * _timeline.pixels_per_time_unit(); + return _timeline.tracks_position().x + t * _timeline.pixels_per_time_unit().get_value_or (0); } Timeline& _timeline; @@ -101,7 +101,7 @@ public: return dcpomatic::Rect ( time_x (content->position ()) - 8, y_pos (_track.get()) - 8, - content->length_after_trim () * _timeline.pixels_per_time_unit() + 16, + content->length_after_trim () * _timeline.pixels_per_time_unit().get_value_or(0) + 16, _timeline.track_height() + 16 ); } @@ -172,7 +172,7 @@ private: wxDouble name_leading; gc->GetTextExtent (name, &name_width, &name_height, &name_descent, &name_leading); - gc->Clip (wxRegion (time_x (position), y_pos (_track.get()), len * _timeline.pixels_per_time_unit(), _timeline.track_height())); + gc->Clip (wxRegion (time_x (position), y_pos (_track.get()), len * _timeline.pixels_per_time_unit().get_value_or(0), _timeline.track_height())); gc->DrawText (name, time_x (position) + 12, y_pos (_track.get() + 1) - name_height - 4); gc->ResetClip (); } @@ -269,9 +269,15 @@ private: void do_paint (wxGraphicsContext* gc) { + if (!_timeline.pixels_per_time_unit()) { + return; + } + + double const pptu = _timeline.pixels_per_time_unit().get (); + gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 1, wxPENSTYLE_SOLID)); - int mark_interval = rint (128 / (TIME_HZ * _timeline.pixels_per_time_unit ())); + int mark_interval = rint (128 / (TIME_HZ * pptu)); if (mark_interval > 5) { mark_interval -= mark_interval % 5; } @@ -295,7 +301,7 @@ private: gc->StrokePath (path); Time t = 0; - while ((t * _timeline.pixels_per_time_unit()) < _timeline.width()) { + while ((t * pptu) < _timeline.width()) { wxGraphicsPath path = gc->CreatePath (); path.MoveToPoint (time_x (t), _y - 4); path.AddLineToPoint (time_x (t), _y + 4); @@ -315,7 +321,7 @@ private: wxDouble str_leading; gc->GetTextExtent (str, &str_width, &str_height, &str_descent, &str_leading); - int const tx = _timeline.x_offset() + t * _timeline.pixels_per_time_unit(); + int const tx = _timeline.x_offset() + t * pptu; if ((tx + str_width) < _timeline.width()) { gc->DrawText (str, time_x (t), _y + 16); } @@ -335,7 +341,6 @@ Timeline::Timeline (wxWindow* parent, FilmEditor* ed, shared_ptr film) , _film (film) , _time_axis_view (new TimeAxisView (*this, 32)) , _tracks (0) - , _pixels_per_time_unit (0) , _left_down (false) , _down_view_position (0) , _first_move (false) @@ -575,6 +580,12 @@ Timeline::right_down (wxMouseEvent& ev) void Timeline::set_position_from_event (wxMouseEvent& ev) { + if (!_pixels_per_time_unit) { + return; + } + + double const pptu = _pixels_per_time_unit.get (); + wxPoint const p = ev.GetPosition(); if (!_first_move) { @@ -592,7 +603,7 @@ Timeline::set_position_from_event (wxMouseEvent& ev) return; } - Time new_position = _down_view_position + (p.x - _down_point.x) / _pixels_per_time_unit; + Time new_position = _down_view_position + (p.x - _down_point.x) / pptu; if (_snap) { @@ -630,7 +641,7 @@ Timeline::set_position_from_event (wxMouseEvent& ev) if (!first) { /* Snap if it's close; `close' means within a proportion of the time on the timeline */ - if (nearest_distance < (width() / pixels_per_time_unit()) / 32) { + if (nearest_distance < (width() / pptu) / 32) { new_position = nearest_new_position; } } diff --git a/src/wx/timeline.h b/src/wx/timeline.h index ef1d10797..7b4d75d09 100644 --- a/src/wx/timeline.h +++ b/src/wx/timeline.h @@ -52,7 +52,7 @@ public: return 48; } - double pixels_per_time_unit () const { + boost::optional pixels_per_time_unit () const { return _pixels_per_time_unit; } @@ -96,7 +96,7 @@ private: ViewList _views; boost::shared_ptr _time_axis_view; int _tracks; - double _pixels_per_time_unit; + boost::optional _pixels_per_time_unit; bool _left_down; wxPoint _down_point; boost::shared_ptr _down_view; -- cgit v1.2.3 From e7bc3bd16456c17bc6fe1d7981040b14e820505e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 10 Jun 2014 15:33:26 +0100 Subject: Use ISDCF rather than DCI when talking about the digital cinema naming convention (#362). Reported-by: Mattias Mattsson --- ChangeLog | 3 ++ src/lib/config.cc | 21 ++++++---- src/lib/config.h | 14 +++---- src/lib/dci_metadata.cc | 74 ----------------------------------- src/lib/dci_metadata.h | 52 ------------------------- src/lib/dcp_content_type.cc | 6 +-- src/lib/dcp_content_type.h | 8 ++-- src/lib/film.cc | 68 ++++++++++++++++++--------------- src/lib/film.h | 34 ++++++++--------- src/lib/isdcf_metadata.cc | 74 +++++++++++++++++++++++++++++++++++ src/lib/isdcf_metadata.h | 52 +++++++++++++++++++++++++ src/lib/ratio.h | 8 ++-- src/lib/wscript | 2 +- src/tools/dcpomatic_create.cc | 4 +- src/wx/config_dialog.cc | 18 ++++----- src/wx/dci_metadata_dialog.cc | 85 ----------------------------------------- src/wx/dci_metadata_dialog.h | 44 --------------------- src/wx/film_editor.cc | 38 +++++++++--------- src/wx/film_editor.h | 8 ++-- src/wx/isdcf_metadata_dialog.cc | 85 +++++++++++++++++++++++++++++++++++++++++ src/wx/isdcf_metadata_dialog.h | 44 +++++++++++++++++++++ src/wx/wscript | 2 +- test/4k_test.cc | 2 +- test/audio_delay_test.cc | 2 +- test/black_fill_test.cc | 2 +- test/film_metadata_test.cc | 2 +- test/play_test.cc | 2 +- test/recover_test.cc | 2 +- test/scaling_test.cc | 2 +- test/silence_padding_test.cc | 2 +- test/test.cc | 2 +- 31 files changed, 389 insertions(+), 373 deletions(-) delete mode 100644 src/lib/dci_metadata.cc delete mode 100644 src/lib/dci_metadata.h create mode 100644 src/lib/isdcf_metadata.cc create mode 100644 src/lib/isdcf_metadata.h delete mode 100644 src/wx/dci_metadata_dialog.cc delete mode 100644 src/wx/dci_metadata_dialog.h create mode 100644 src/wx/isdcf_metadata_dialog.cc create mode 100644 src/wx/isdcf_metadata_dialog.h (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 345130646..d9aeec1fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2014-06-10 Carl Hetherington + * Rename DCI to ISDCF when talking about the digital cinema + naming convention (#362). + * Fix crash when opening the timeline with no content (#369). 2014-06-09 Carl Hetherington diff --git a/src/lib/config.cc b/src/lib/config.cc index b97ad559d..0c3dd023d 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -64,7 +64,7 @@ Config::Config () , _allow_any_dcp_frame_rate (false) , _default_still_length (10) , _default_container (Ratio::from_id ("185")) - , _default_dcp_content_type (DCPContentType::from_dci_name ("TST")) + , _default_dcp_content_type (DCPContentType::from_isdcf_name ("TST")) , _default_j2k_bandwidth (100000000) , _default_audio_delay (0) , _kdm_email ( @@ -141,13 +141,18 @@ Config::read () c = f.optional_string_child ("DefaultDCPContentType"); if (c) { - _default_dcp_content_type = DCPContentType::from_dci_name (c.get ()); + _default_dcp_content_type = DCPContentType::from_isdcf_name (c.get ()); } _dcp_metadata.issuer = f.optional_string_child ("DCPMetadataIssuer").get_value_or (""); _dcp_metadata.creator = f.optional_string_child ("DCPMetadataCreator").get_value_or (""); - _default_dci_metadata = DCIMetadata (f.node_child ("DCIMetadata")); + if (version && version.get() >= 2) { + _default_isdcf_metadata = ISDCFMetadata (f.node_child ("ISDCFMetadata")); + } else { + _default_isdcf_metadata = ISDCFMetadata (f.node_child ("DCIMetadata")); + } + _default_still_length = f.optional_number_child("DefaultStillLength").get_value_or (10); _default_j2k_bandwidth = f.optional_number_child("DefaultJ2KBandwidth").get_value_or (200000000); _default_audio_delay = f.optional_number_child("DefaultAudioDelay").get_value_or (0); @@ -245,7 +250,7 @@ Config::read_old_metadata () } else if (k == "default_container") { _default_container = Ratio::from_id (v); } else if (k == "default_dcp_content_type") { - _default_dcp_content_type = DCPContentType::from_dci_name (v); + _default_dcp_content_type = DCPContentType::from_isdcf_name (v); } else if (k == "dcp_metadata_issuer") { _dcp_metadata.issuer = v; } else if (k == "dcp_metadata_creator") { @@ -254,7 +259,7 @@ Config::read_old_metadata () _dcp_metadata.issue_date = v; } - _default_dci_metadata.read_old_metadata (k, v); + _default_isdcf_metadata.read_old_metadata (k, v); } } @@ -315,7 +320,7 @@ Config::write () const xmlpp::Document doc; xmlpp::Element* root = doc.create_root_node ("Config"); - root->add_child("Version")->add_child_text ("1"); + root->add_child("Version")->add_child_text ("2"); root->add_child("NumLocalEncodingThreads")->add_child_text (raw_convert (_num_local_encoding_threads)); root->add_child("DefaultDirectory")->add_child_text (_default_directory.string ()); root->add_child("ServerPortBase")->add_child_text (raw_convert (_server_port_base)); @@ -339,12 +344,12 @@ Config::write () const root->add_child("DefaultContainer")->add_child_text (_default_container->id ()); } if (_default_dcp_content_type) { - root->add_child("DefaultDCPContentType")->add_child_text (_default_dcp_content_type->dci_name ()); + root->add_child("DefaultDCPContentType")->add_child_text (_default_dcp_content_type->isdcf_name ()); } root->add_child("DCPMetadataIssuer")->add_child_text (_dcp_metadata.issuer); root->add_child("DCPMetadataCreator")->add_child_text (_dcp_metadata.creator); - _default_dci_metadata.as_xml (root->add_child ("DCIMetadata")); + _default_isdcf_metadata.as_xml (root->add_child ("ISDCFMetadata")); root->add_child("DefaultStillLength")->add_child_text (raw_convert (_default_still_length)); root->add_child("DefaultJ2KBandwidth")->add_child_text (raw_convert (_default_j2k_bandwidth)); diff --git a/src/lib/config.h b/src/lib/config.h index bd8cfe297..671f53ef3 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -29,7 +29,7 @@ #include #include #include -#include "dci_metadata.h" +#include "isdcf_metadata.h" #include "colour_conversion.h" #include "server.h" @@ -121,8 +121,8 @@ public: return _allow_any_dcp_frame_rate; } - DCIMetadata default_dci_metadata () const { - return _default_dci_metadata; + ISDCFMetadata default_isdcf_metadata () const { + return _default_isdcf_metadata; } boost::optional language () const { @@ -254,8 +254,8 @@ public: changed (); } - void set_default_dci_metadata (DCIMetadata d) { - _default_dci_metadata = d; + void set_default_isdcf_metadata (ISDCFMetadata d) { + _default_isdcf_metadata = d; changed (); } @@ -389,8 +389,8 @@ private: std::list _allowed_dcp_frame_rates; /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */ bool _allow_any_dcp_frame_rate; - /** Default DCI metadata for newly-created Films */ - DCIMetadata _default_dci_metadata; + /** Default ISDCF metadata for newly-created Films */ + ISDCFMetadata _default_isdcf_metadata; boost::optional _language; int _default_still_length; Ratio const * _default_container; diff --git a/src/lib/dci_metadata.cc b/src/lib/dci_metadata.cc deleted file mode 100644 index ccdc1ee1c..000000000 --- a/src/lib/dci_metadata.cc +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (C) 2012-2014 Carl Hetherington - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include -#include -#include -#include "dci_metadata.h" - -#include "i18n.h" - -using std::string; -using boost::shared_ptr; -using libdcp::raw_convert; - -DCIMetadata::DCIMetadata (shared_ptr node) -{ - content_version = node->number_child ("ContentVersion"); - audio_language = node->string_child ("AudioLanguage"); - subtitle_language = node->string_child ("SubtitleLanguage"); - territory = node->string_child ("Territory"); - rating = node->string_child ("Rating"); - studio = node->string_child ("Studio"); - facility = node->string_child ("Facility"); - package_type = node->string_child ("PackageType"); -} - -void -DCIMetadata::as_xml (xmlpp::Node* root) const -{ - root->add_child("ContentVersion")->add_child_text (raw_convert (content_version)); - root->add_child("AudioLanguage")->add_child_text (audio_language); - root->add_child("SubtitleLanguage")->add_child_text (subtitle_language); - root->add_child("Territory")->add_child_text (territory); - root->add_child("Rating")->add_child_text (rating); - root->add_child("Studio")->add_child_text (studio); - root->add_child("Facility")->add_child_text (facility); - root->add_child("PackageType")->add_child_text (package_type); -} - -void -DCIMetadata::read_old_metadata (string k, string v) -{ - if (k == N_("audio_language")) { - audio_language = v; - } else if (k == N_("subtitle_language")) { - subtitle_language = v; - } else if (k == N_("territory")) { - territory = v; - } else if (k == N_("rating")) { - rating = v; - } else if (k == N_("studio")) { - studio = v; - } else if (k == N_("facility")) { - facility = v; - } else if (k == N_("package_type")) { - package_type = v; - } -} diff --git a/src/lib/dci_metadata.h b/src/lib/dci_metadata.h deleted file mode 100644 index 738e439de..000000000 --- a/src/lib/dci_metadata.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef DCPOMATIC_DCI_METADATA_H -#define DCPOMATIC_DCI_METADATA_H - -#include -#include - -namespace cxml { - class Node; -} - -class DCIMetadata -{ -public: - DCIMetadata () - : content_version (1) - {} - - DCIMetadata (boost::shared_ptr); - - void as_xml (xmlpp::Node *) const; - void read_old_metadata (std::string, std::string); - - int content_version; - std::string audio_language; - std::string subtitle_language; - std::string territory; - std::string rating; - std::string studio; - std::string facility; - std::string package_type; -}; - -#endif diff --git a/src/lib/dcp_content_type.cc b/src/lib/dcp_content_type.cc index 82bd5fa01..f24ed95ea 100644 --- a/src/lib/dcp_content_type.cc +++ b/src/lib/dcp_content_type.cc @@ -33,7 +33,7 @@ vector DCPContentType::_dcp_content_types; DCPContentType::DCPContentType (string p, libdcp::ContentKind k, string d) : _pretty_name (p) , _libdcp_kind (k) - , _dci_name (d) + , _isdcf_name (d) { } @@ -66,10 +66,10 @@ DCPContentType::from_pretty_name (string n) } DCPContentType const * -DCPContentType::from_dci_name (string n) +DCPContentType::from_isdcf_name (string n) { for (vector::const_iterator i = _dcp_content_types.begin(); i != _dcp_content_types.end(); ++i) { - if ((*i)->dci_name() == n) { + if ((*i)->isdcf_name() == n) { return *i; } } diff --git a/src/lib/dcp_content_type.h b/src/lib/dcp_content_type.h index 965c16347..88f3c4a85 100644 --- a/src/lib/dcp_content_type.h +++ b/src/lib/dcp_content_type.h @@ -45,12 +45,12 @@ public: return _libdcp_kind; } - std::string dci_name () const { - return _dci_name; + std::string isdcf_name () const { + return _isdcf_name; } static DCPContentType const * from_pretty_name (std::string); - static DCPContentType const * from_dci_name (std::string); + static DCPContentType const * from_isdcf_name (std::string); static DCPContentType const * from_index (int); static int as_index (DCPContentType const *); static std::vector all (); @@ -59,7 +59,7 @@ public: private: std::string _pretty_name; libdcp::ContentKind _libdcp_kind; - std::string _dci_name; + std::string _isdcf_name; /** All available DCP content types */ static std::vector _dcp_content_types; diff --git a/src/lib/film.cc b/src/lib/film.cc index 9dce80071..fb3026039 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -90,8 +90,10 @@ using libdcp::raw_convert; * Subtitle offset changed to subtitle y offset, and subtitle x offset added. * 7 -> 8 * Use tag in rather than . + * 8 -> 9 + * DCI -> ISDCF */ -int const Film::current_state_version = 8; +int const Film::current_state_version = 9; /** Construct a Film object in a given directory. * @@ -100,7 +102,7 @@ int const Film::current_state_version = 8; Film::Film (boost::filesystem::path dir, bool log) : _playlist (new Playlist) - , _use_dci_name (true) + , _use_isdcf_name (true) , _dcp_content_type (Config::instance()->default_dcp_content_type ()) , _container (Config::instance()->default_container ()) , _resolution (RESOLUTION_2K) @@ -109,7 +111,7 @@ Film::Film (boost::filesystem::path dir, bool log) , _signed (true) , _encrypted (false) , _j2k_bandwidth (Config::instance()->default_j2k_bandwidth ()) - , _dci_metadata (Config::instance()->default_dci_metadata ()) + , _isdcf_metadata (Config::instance()->default_isdcf_metadata ()) , _video_frame_rate (24) , _audio_channels (6) , _three_d (false) @@ -118,7 +120,7 @@ Film::Film (boost::filesystem::path dir, bool log) , _state_version (current_state_version) , _dirty (false) { - set_dci_date_today (); + set_isdcf_date_today (); _playlist->Changed.connect (bind (&Film::playlist_changed, this)); _playlist->ContentChanged.connect (bind (&Film::playlist_content_changed, this, _1, _2)); @@ -245,7 +247,7 @@ Film::audio_analysis_dir () const void Film::make_dcp () { - set_dci_date_today (); + set_isdcf_date_today (); if (dcp_name().find ("/") != string::npos) { throw BadSettingError (_("name"), _("cannot contain slashes")); @@ -349,10 +351,10 @@ Film::metadata () const root->add_child("Version")->add_child_text (raw_convert (current_state_version)); root->add_child("Name")->add_child_text (_name); - root->add_child("UseDCIName")->add_child_text (_use_dci_name ? "1" : "0"); + root->add_child("UseISDCFName")->add_child_text (_use_isdcf_name ? "1" : "0"); if (_dcp_content_type) { - root->add_child("DCPContentType")->add_child_text (_dcp_content_type->dci_name ()); + root->add_child("DCPContentType")->add_child_text (_dcp_content_type->isdcf_name ()); } if (_container) { @@ -363,9 +365,9 @@ Film::metadata () const root->add_child("Scaler")->add_child_text (_scaler->id ()); root->add_child("WithSubtitles")->add_child_text (_with_subtitles ? "1" : "0"); root->add_child("J2KBandwidth")->add_child_text (raw_convert (_j2k_bandwidth)); - _dci_metadata.as_xml (root->add_child ("DCIMetadata")); + _isdcf_metadata.as_xml (root->add_child ("ISDCFMetadata")); root->add_child("VideoFrameRate")->add_child_text (raw_convert (_video_frame_rate)); - root->add_child("DCIDate")->add_child_text (boost::gregorian::to_iso_string (_dci_date)); + root->add_child("ISDCFDate")->add_child_text (boost::gregorian::to_iso_string (_isdcf_date)); root->add_child("AudioChannels")->add_child_text (raw_convert (_audio_channels)); root->add_child("ThreeD")->add_child_text (_three_d ? "1" : "0"); root->add_child("SequenceVideo")->add_child_text (_sequence_video ? "1" : "0"); @@ -407,12 +409,20 @@ Film::read_metadata () } _name = f.string_child ("Name"); - _use_dci_name = f.bool_child ("UseDCIName"); + if (_state_version >= 9) { + _use_isdcf_name = f.bool_child ("UseISDCFName"); + _isdcf_metadata = ISDCFMetadata (f.node_child ("ISDCFMetadata")); + _isdcf_date = boost::gregorian::from_undelimited_string (f.string_child ("ISDCFDate")); + } else { + _use_isdcf_name = f.bool_child ("UseDCIName"); + _isdcf_metadata = ISDCFMetadata (f.node_child ("DCIMetadata")); + _isdcf_date = boost::gregorian::from_undelimited_string (f.string_child ("DCIDate")); + } { optional c = f.optional_string_child ("DCPContentType"); if (c) { - _dcp_content_type = DCPContentType::from_dci_name (c.get ()); + _dcp_content_type = DCPContentType::from_isdcf_name (c.get ()); } } @@ -427,9 +437,7 @@ Film::read_metadata () _scaler = Scaler::from_id (f.string_child ("Scaler")); _with_subtitles = f.bool_child ("WithSubtitles"); _j2k_bandwidth = f.number_child ("J2KBandwidth"); - _dci_metadata = DCIMetadata (f.node_child ("DCIMetadata")); _video_frame_rate = f.number_child ("VideoFrameRate"); - _dci_date = boost::gregorian::from_undelimited_string (f.string_child ("DCIDate")); _signed = f.optional_bool_child("Signed").get_value_or (true); _encrypted = f.bool_child ("Encrypted"); _audio_channels = f.number_child ("AudioChannels"); @@ -476,9 +484,9 @@ Film::file (boost::filesystem::path f) const return p; } -/** @return a DCI-compliant name for a DCP of this film */ +/** @return a ISDCF-compliant name for a DCP of this film */ string -Film::dci_name (bool if_created_now) const +Film::isdcf_name (bool if_created_now) const { stringstream d; @@ -497,8 +505,8 @@ Film::dci_name (bool if_created_now) const d << fixed_name; if (dcp_content_type()) { - d << "_" << dcp_content_type()->dci_name(); - d << "-" << dci_metadata().content_version; + d << "_" << dcp_content_type()->isdcf_name(); + d << "-" << isdcf_metadata().content_version; } if (three_d ()) { @@ -510,10 +518,10 @@ Film::dci_name (bool if_created_now) const } if (container()) { - d << "_" << container()->dci_name(); + d << "_" << container()->isdcf_name(); } - DCIMetadata const dm = dci_metadata (); + ISDCFMetadata const dm = isdcf_metadata (); if (!dm.audio_language.empty ()) { d << "_" << dm.audio_language; @@ -561,7 +569,7 @@ Film::dci_name (bool if_created_now) const if (if_created_now) { d << "_" << boost::gregorian::to_iso_string (boost::gregorian::day_clock::local_day ()); } else { - d << "_" << boost::gregorian::to_iso_string (_dci_date); + d << "_" << boost::gregorian::to_iso_string (_isdcf_date); } if (!dm.facility.empty ()) { @@ -579,8 +587,8 @@ Film::dci_name (bool if_created_now) const string Film::dcp_name (bool if_created_now) const { - if (use_dci_name()) { - return dci_name (if_created_now); + if (use_isdcf_name()) { + return isdcf_name (if_created_now); } return name(); @@ -602,10 +610,10 @@ Film::set_name (string n) } void -Film::set_use_dci_name (bool u) +Film::set_use_isdcf_name (bool u) { - _use_dci_name = u; - signal_changed (USE_DCI_NAME); + _use_isdcf_name = u; + signal_changed (USE_ISDCF_NAME); } void @@ -651,10 +659,10 @@ Film::set_j2k_bandwidth (int b) } void -Film::set_dci_metadata (DCIMetadata m) +Film::set_isdcf_metadata (ISDCFMetadata m) { - _dci_metadata = m; - signal_changed (DCI_METADATA); + _isdcf_metadata = m; + signal_changed (ISDCF_METADATA); } void @@ -708,9 +716,9 @@ Film::signal_changed (Property p) } void -Film::set_dci_date_today () +Film::set_isdcf_date_today () { - _dci_date = boost::gregorian::day_clock::local_day (); + _isdcf_date = boost::gregorian::day_clock::local_day (); } boost::filesystem::path diff --git a/src/lib/film.h b/src/lib/film.h index 909bc0beb..f77309862 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -35,7 +35,7 @@ #include #include "util.h" #include "types.h" -#include "dci_metadata.h" +#include "isdcf_metadata.h" #include "frame_rate_change.h" class DCPContentType; @@ -88,7 +88,7 @@ public: void write_metadata () const; boost::shared_ptr metadata () const; - std::string dci_name (bool if_created_now) const; + std::string isdcf_name (bool if_created_now) const; std::string dcp_name (bool if_created_now = false) const; /** @return true if our state has changed since we last saved it */ @@ -151,7 +151,7 @@ public: enum Property { NONE, NAME, - USE_DCI_NAME, + USE_ISDCF_NAME, /** The playlist's content list has changed (i.e. content has been added, moved around or removed) */ CONTENT, DCP_CONTENT_TYPE, @@ -162,7 +162,7 @@ public: SIGNED, ENCRYPTED, J2K_BANDWIDTH, - DCI_METADATA, + ISDCF_METADATA, VIDEO_FRAME_RATE, AUDIO_CHANNELS, /** The setting of _three_d has been changed */ @@ -182,8 +182,8 @@ public: return _name; } - bool use_dci_name () const { - return _use_dci_name; + bool use_isdcf_name () const { + return _use_isdcf_name; } DCPContentType const * dcp_content_type () const { @@ -219,8 +219,8 @@ public: return _j2k_bandwidth; } - DCIMetadata dci_metadata () const { - return _dci_metadata; + ISDCFMetadata isdcf_metadata () const { + return _isdcf_metadata; } /** @return The frame rate of the DCP */ @@ -249,7 +249,7 @@ public: void set_directory (boost::filesystem::path); void set_name (std::string); - void set_use_dci_name (bool); + void set_use_isdcf_name (bool); void examine_and_add_content (boost::shared_ptr); void add_content (boost::shared_ptr); void remove_content (boost::shared_ptr); @@ -263,11 +263,11 @@ public: void set_signed (bool); void set_encrypted (bool); void set_j2k_bandwidth (int); - void set_dci_metadata (DCIMetadata); + void set_isdcf_metadata (ISDCFMetadata); void set_video_frame_rate (int); void set_audio_channels (int); void set_three_d (bool); - void set_dci_date_today (); + void set_isdcf_date_today (); void set_sequence_video (bool); void set_interop (bool); @@ -300,8 +300,8 @@ private: /** Name for DCP-o-matic */ std::string _name; - /** True if a auto-generated DCI-compliant name should be used for our DCP */ - bool _use_dci_name; + /** True if a auto-generated ISDCF-compliant name should be used for our DCP */ + bool _use_isdcf_name; /** The type of content that this Film represents (feature, trailer etc.) */ DCPContentType const * _dcp_content_type; /** The container to put this Film in (flat, scope, etc.) */ @@ -316,12 +316,12 @@ private: bool _encrypted; /** bandwidth for J2K files in bits per second */ int _j2k_bandwidth; - /** DCI naming stuff */ - DCIMetadata _dci_metadata; + /** ISDCF naming stuff */ + ISDCFMetadata _isdcf_metadata; /** Frames per second to run our DCP at */ int _video_frame_rate; - /** The date that we should use in a DCI name */ - boost::gregorian::date _dci_date; + /** The date that we should use in a ISDCF name */ + boost::gregorian::date _isdcf_date; /** Number of audio channels to put in the DCP */ int _audio_channels; /** If true, the DCP will be written in 3D mode; otherwise in 2D. diff --git a/src/lib/isdcf_metadata.cc b/src/lib/isdcf_metadata.cc new file mode 100644 index 000000000..ae99280ca --- /dev/null +++ b/src/lib/isdcf_metadata.cc @@ -0,0 +1,74 @@ +/* + Copyright (C) 2012-2014 Carl Hetherington + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include +#include +#include +#include "isdcf_metadata.h" + +#include "i18n.h" + +using std::string; +using boost::shared_ptr; +using libdcp::raw_convert; + +ISDCFMetadata::ISDCFMetadata (shared_ptr node) +{ + content_version = node->number_child ("ContentVersion"); + audio_language = node->string_child ("AudioLanguage"); + subtitle_language = node->string_child ("SubtitleLanguage"); + territory = node->string_child ("Territory"); + rating = node->string_child ("Rating"); + studio = node->string_child ("Studio"); + facility = node->string_child ("Facility"); + package_type = node->string_child ("PackageType"); +} + +void +ISDCFMetadata::as_xml (xmlpp::Node* root) const +{ + root->add_child("ContentVersion")->add_child_text (raw_convert (content_version)); + root->add_child("AudioLanguage")->add_child_text (audio_language); + root->add_child("SubtitleLanguage")->add_child_text (subtitle_language); + root->add_child("Territory")->add_child_text (territory); + root->add_child("Rating")->add_child_text (rating); + root->add_child("Studio")->add_child_text (studio); + root->add_child("Facility")->add_child_text (facility); + root->add_child("PackageType")->add_child_text (package_type); +} + +void +ISDCFMetadata::read_old_metadata (string k, string v) +{ + if (k == N_("audio_language")) { + audio_language = v; + } else if (k == N_("subtitle_language")) { + subtitle_language = v; + } else if (k == N_("territory")) { + territory = v; + } else if (k == N_("rating")) { + rating = v; + } else if (k == N_("studio")) { + studio = v; + } else if (k == N_("facility")) { + facility = v; + } else if (k == N_("package_type")) { + package_type = v; + } +} diff --git a/src/lib/isdcf_metadata.h b/src/lib/isdcf_metadata.h new file mode 100644 index 000000000..cd63ba2ee --- /dev/null +++ b/src/lib/isdcf_metadata.h @@ -0,0 +1,52 @@ +/* + Copyright (C) 2012 Carl Hetherington + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef DCPOMATIC_ISDCF_METADATA_H +#define DCPOMATIC_ISDCF_METADATA_H + +#include +#include + +namespace cxml { + class Node; +} + +class ISDCFMetadata +{ +public: + ISDCFMetadata () + : content_version (1) + {} + + ISDCFMetadata (boost::shared_ptr); + + void as_xml (xmlpp::Node *) const; + void read_old_metadata (std::string, std::string); + + int content_version; + std::string audio_language; + std::string subtitle_language; + std::string territory; + std::string rating; + std::string studio; + std::string facility; + std::string package_type; +}; + +#endif diff --git a/src/lib/ratio.h b/src/lib/ratio.h index f3354f1b6..8b1a1fc71 100644 --- a/src/lib/ratio.h +++ b/src/lib/ratio.h @@ -31,7 +31,7 @@ public: : _ratio (ratio) , _id (id) , _nickname (n) - , _dci_name (d) + , _isdcf_name (d) {} std::string id () const { @@ -42,8 +42,8 @@ public: return _nickname; } - std::string dci_name () const { - return _dci_name; + std::string isdcf_name () const { + return _isdcf_name; } float ratio () const { @@ -62,7 +62,7 @@ private: std::string _id; /** nickname (e.g. Flat, Scope) */ std::string _nickname; - std::string _dci_name; + std::string _isdcf_name; static std::vector _ratios; }; diff --git a/src/lib/wscript b/src/lib/wscript index 517ad7787..933368776 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -14,7 +14,6 @@ sources = """ content.cc content_factory.cc cross.cc - dci_metadata.cc dcp_content_type.cc dcp_video_frame.cc decoder.cc @@ -37,6 +36,7 @@ sources = """ image_decoder.cc image_examiner.cc image_proxy.cc + isdcf_metadata.cc job.cc job_manager.cc kdm.cc diff --git a/src/tools/dcpomatic_create.cc b/src/tools/dcpomatic_create.cc index a49780276..c30f4e51e 100644 --- a/src/tools/dcpomatic_create.cc +++ b/src/tools/dcpomatic_create.cc @@ -74,7 +74,7 @@ main (int argc, char* argv[]) dcpomatic_setup (); string name; - DCPContentType const * dcp_content_type = DCPContentType::from_dci_name ("TST"); + DCPContentType const * dcp_content_type = DCPContentType::from_isdcf_name ("TST"); Ratio const * container_ratio = 0; Ratio const * content_ratio = 0; int still_length = 10; @@ -110,7 +110,7 @@ main (int argc, char* argv[]) name = optarg; break; case 'c': - dcp_content_type = DCPContentType::from_dci_name (optarg); + dcp_content_type = DCPContentType::from_isdcf_name (optarg); if (dcp_content_type == 0) { cerr << "Bad DCP content type.\n"; help (argv[0]); diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 684d2496e..e65e931d0 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -40,7 +40,7 @@ #include "editable_list.h" #include "filter_dialog.h" #include "dir_picker_ctrl.h" -#include "dci_metadata_dialog.h" +#include "isdcf_metadata_dialog.h" #include "preset_colour_conversion_dialog.h" #include "server_dialog.h" @@ -314,9 +314,9 @@ public: #endif table->Add (_directory, 1, wxEXPAND); - add_label_to_sizer (table, panel, _("Default DCI name details"), true); - _dci_metadata_button = new wxButton (panel, wxID_ANY, _("Edit...")); - table->Add (_dci_metadata_button); + add_label_to_sizer (table, panel, _("Default ISDCF name details"), true); + _isdcf_metadata_button = new wxButton (panel, wxID_ANY, _("Edit...")); + table->Add (_isdcf_metadata_button); add_label_to_sizer (table, panel, _("Default container"), true); _container = new wxChoice (panel, wxID_ANY); @@ -361,7 +361,7 @@ public: _directory->SetPath (std_to_wx (config->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ())); _directory->Bind (wxEVT_COMMAND_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::directory_changed, this)); - _dci_metadata_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DefaultsPage::edit_dci_metadata_clicked, this, parent)); + _isdcf_metadata_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DefaultsPage::edit_isdcf_metadata_clicked, this, parent)); vector ratio = Ratio::all (); int n = 0; @@ -419,11 +419,11 @@ private: Config::instance()->set_default_directory (wx_to_std (_directory->GetPath ())); } - void edit_dci_metadata_clicked (wxWindow* parent) + void edit_isdcf_metadata_clicked (wxWindow* parent) { - DCIMetadataDialog* d = new DCIMetadataDialog (parent, Config::instance()->default_dci_metadata ()); + ISDCFMetadataDialog* d = new ISDCFMetadataDialog (parent, Config::instance()->default_isdcf_metadata ()); d->ShowModal (); - Config::instance()->set_default_dci_metadata (d->dci_metadata ()); + Config::instance()->set_default_isdcf_metadata (d->isdcf_metadata ()); d->Destroy (); } @@ -460,7 +460,7 @@ private: wxSpinCtrl* _j2k_bandwidth; wxSpinCtrl* _audio_delay; - wxButton* _dci_metadata_button; + wxButton* _isdcf_metadata_button; wxSpinCtrl* _still_length; #ifdef DCPOMATIC_USE_OWN_DIR_PICKER DirPickerCtrl* _directory; diff --git a/src/wx/dci_metadata_dialog.cc b/src/wx/dci_metadata_dialog.cc deleted file mode 100644 index 700e1b154..000000000 --- a/src/wx/dci_metadata_dialog.cc +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include -#include -#include -#include "lib/film.h" -#include "dci_metadata_dialog.h" -#include "wx_util.h" - -using boost::shared_ptr; - -DCIMetadataDialog::DCIMetadataDialog (wxWindow* parent, DCIMetadata dm) - : TableDialog (parent, _("DCI name"), 2, true) -{ - add (_("Content version"), true); - _content_version = add (new wxSpinCtrl (this, wxID_ANY)); - - add (_("Audio Language (e.g. EN)"), true); - _audio_language = add (new wxTextCtrl (this, wxID_ANY)); - - add (_("Subtitle Language (e.g. FR)"), true); - _subtitle_language = add (new wxTextCtrl (this, wxID_ANY)); - - add (_("Territory (e.g. UK)"), true); - _territory = add (new wxTextCtrl (this, wxID_ANY)); - - add (_("Rating (e.g. 15)"), true); - _rating = add (new wxTextCtrl (this, wxID_ANY)); - - add (_("Studio (e.g. TCF)"), true); - _studio = add (new wxTextCtrl (this, wxID_ANY)); - - add (_("Facility (e.g. DLA)"), true); - _facility = add (new wxTextCtrl (this, wxID_ANY)); - - add (_("Package Type (e.g. OV)"), true); - _package_type = add (new wxTextCtrl (this, wxID_ANY)); - - _content_version->SetRange (1, 1024); - - _content_version->SetValue (dm.content_version); - _audio_language->SetValue (std_to_wx (dm.audio_language)); - _subtitle_language->SetValue (std_to_wx (dm.subtitle_language)); - _territory->SetValue (std_to_wx (dm.territory)); - _rating->SetValue (std_to_wx (dm.rating)); - _studio->SetValue (std_to_wx (dm.studio)); - _facility->SetValue (std_to_wx (dm.facility)); - _package_type->SetValue (std_to_wx (dm.package_type)); - - layout (); -} - -DCIMetadata -DCIMetadataDialog::dci_metadata () const -{ - DCIMetadata dm; - - dm.content_version = _content_version->GetValue (); - dm.audio_language = wx_to_std (_audio_language->GetValue ()); - dm.subtitle_language = wx_to_std (_subtitle_language->GetValue ()); - dm.territory = wx_to_std (_territory->GetValue ()); - dm.rating = wx_to_std (_rating->GetValue ()); - dm.studio = wx_to_std (_studio->GetValue ()); - dm.facility = wx_to_std (_facility->GetValue ()); - dm.package_type = wx_to_std (_package_type->GetValue ()); - - return dm; -} diff --git a/src/wx/dci_metadata_dialog.h b/src/wx/dci_metadata_dialog.h deleted file mode 100644 index 7b93a3ab6..000000000 --- a/src/wx/dci_metadata_dialog.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2012-2014 Carl Hetherington - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include -#include -#include "lib/dci_metadata.h" -#include "table_dialog.h" - -class wxSpinCtrl; -class Film; - -class DCIMetadataDialog : public TableDialog -{ -public: - DCIMetadataDialog (wxWindow *, DCIMetadata); - - DCIMetadata dci_metadata () const; - -private: - wxSpinCtrl* _content_version; - wxTextCtrl* _audio_language; - wxTextCtrl* _subtitle_language; - wxTextCtrl* _territory; - wxTextCtrl* _rating; - wxTextCtrl* _studio; - wxTextCtrl* _facility; - wxTextCtrl* _package_type; -}; diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 7452b985c..9c980b625 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -48,7 +48,7 @@ #include "timecode.h" #include "wx_util.h" #include "film_editor.h" -#include "dci_metadata_dialog.h" +#include "isdcf_metadata_dialog.h" #include "timeline_dialog.h" #include "timing_panel.h" #include "subtitle_panel.h" @@ -125,10 +125,10 @@ FilmEditor::make_dcp_panel () flags |= wxALIGN_RIGHT; #endif - _use_dci_name = new wxCheckBox (_dcp_panel, wxID_ANY, _("Use DCI name")); - grid->Add (_use_dci_name, wxGBPosition (r, 0), wxDefaultSpan, flags); - _edit_dci_button = new wxButton (_dcp_panel, wxID_ANY, _("Details...")); - grid->Add (_edit_dci_button, wxGBPosition (r, 1), wxDefaultSpan); + _use_isdcf_name = new wxCheckBox (_dcp_panel, wxID_ANY, _("Use ISDCF name")); + grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags); + _edit_isdcf_button = new wxButton (_dcp_panel, wxID_ANY, _("Details...")); + grid->Add (_edit_isdcf_button, wxGBPosition (r, 1), wxDefaultSpan); ++r; add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Container"), true, wxGBPosition (r, 0)); @@ -232,8 +232,8 @@ void FilmEditor::connect_to_widgets () { _name->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&FilmEditor::name_changed, this)); - _use_dci_name->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&FilmEditor::use_dci_name_toggled, this)); - _edit_dci_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::edit_dci_button_clicked, this)); + _use_isdcf_name->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&FilmEditor::use_isdcf_name_toggled, this)); + _edit_isdcf_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::edit_isdcf_button_clicked, this)); _container->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::container_changed, this)); _content->Bind (wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind (&FilmEditor::content_selection_changed, this)); _content->Bind (wxEVT_COMMAND_LIST_ITEM_DESELECTED, boost::bind (&FilmEditor::content_selection_changed, this)); @@ -468,11 +468,11 @@ FilmEditor::film_changed (Film::Property p) case Film::J2K_BANDWIDTH: checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000); break; - case Film::USE_DCI_NAME: - checked_set (_use_dci_name, _film->use_dci_name ()); + case Film::USE_ISDCF_NAME: + checked_set (_use_isdcf_name, _film->use_isdcf_name ()); setup_dcp_name (); break; - case Film::DCI_METADATA: + case Film::ISDCF_METADATA: setup_dcp_name (); break; case Film::VIDEO_FRAME_RATE: @@ -609,7 +609,7 @@ FilmEditor::set_film (shared_ptr f) } film_changed (Film::NAME); - film_changed (Film::USE_DCI_NAME); + film_changed (Film::USE_ISDCF_NAME); film_changed (Film::CONTENT); film_changed (Film::DCP_CONTENT_TYPE); film_changed (Film::CONTAINER); @@ -619,7 +619,7 @@ FilmEditor::set_film (shared_ptr f) film_changed (Film::SIGNED); film_changed (Film::ENCRYPTED); film_changed (Film::J2K_BANDWIDTH); - film_changed (Film::DCI_METADATA); + film_changed (Film::ISDCF_METADATA); film_changed (Film::VIDEO_FRAME_RATE); film_changed (Film::AUDIO_CHANNELS); film_changed (Film::SEQUENCE_VIDEO); @@ -640,8 +640,8 @@ FilmEditor::set_general_sensitivity (bool s) /* Stuff in the Content / DCP tabs */ _name->Enable (s); - _use_dci_name->Enable (s); - _edit_dci_button->Enable (s); + _use_isdcf_name->Enable (s); + _edit_isdcf_button->Enable (s); _content->Enable (s); _content_add_file->Enable (s); _content_add_folder->Enable (s); @@ -691,25 +691,25 @@ FilmEditor::scaler_changed () } void -FilmEditor::use_dci_name_toggled () +FilmEditor::use_isdcf_name_toggled () { if (!_film) { return; } - _film->set_use_dci_name (_use_dci_name->GetValue ()); + _film->set_use_isdcf_name (_use_isdcf_name->GetValue ()); } void -FilmEditor::edit_dci_button_clicked () +FilmEditor::edit_isdcf_button_clicked () { if (!_film) { return; } - DCIMetadataDialog* d = new DCIMetadataDialog (this, _film->dci_metadata ()); + ISDCFMetadataDialog* d = new ISDCFMetadataDialog (this, _film->isdcf_metadata ()); d->ShowModal (); - _film->set_dci_metadata (d->dci_metadata ()); + _film->set_isdcf_metadata (d->isdcf_metadata ()); d->Destroy (); } diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h index 56e54734b..96cae3900 100644 --- a/src/wx/film_editor.h +++ b/src/wx/film_editor.h @@ -75,8 +75,8 @@ private: /* Handle changes to the view */ void name_changed (); - void use_dci_name_toggled (); - void edit_dci_button_clicked (); + void use_isdcf_name_toggled (); + void edit_isdcf_button_clicked (); void content_selection_changed (); void content_add_file_clicked (); void content_add_folder_clicked (); @@ -131,7 +131,7 @@ private: boost::shared_ptr _film; wxTextCtrl* _name; wxStaticText* _dcp_name; - wxCheckBox* _use_dci_name; + wxCheckBox* _use_isdcf_name; wxChoice* _container; wxListCtrl* _content; wxButton* _content_add_file; @@ -141,7 +141,7 @@ private: wxButton* _content_later; wxButton* _content_timeline; wxCheckBox* _sequence_video; - wxButton* _edit_dci_button; + wxButton* _edit_isdcf_button; wxChoice* _scaler; wxSpinCtrl* _j2k_bandwidth; wxChoice* _dcp_content_type; diff --git a/src/wx/isdcf_metadata_dialog.cc b/src/wx/isdcf_metadata_dialog.cc new file mode 100644 index 000000000..0fd00ff7a --- /dev/null +++ b/src/wx/isdcf_metadata_dialog.cc @@ -0,0 +1,85 @@ +/* + Copyright (C) 2012 Carl Hetherington + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include +#include +#include +#include "lib/film.h" +#include "isdcf_metadata_dialog.h" +#include "wx_util.h" + +using boost::shared_ptr; + +ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm) + : TableDialog (parent, _("ISDCF name"), 2, true) +{ + add (_("Content version"), true); + _content_version = add (new wxSpinCtrl (this, wxID_ANY)); + + add (_("Audio Language (e.g. EN)"), true); + _audio_language = add (new wxTextCtrl (this, wxID_ANY)); + + add (_("Subtitle Language (e.g. FR)"), true); + _subtitle_language = add (new wxTextCtrl (this, wxID_ANY)); + + add (_("Territory (e.g. UK)"), true); + _territory = add (new wxTextCtrl (this, wxID_ANY)); + + add (_("Rating (e.g. 15)"), true); + _rating = add (new wxTextCtrl (this, wxID_ANY)); + + add (_("Studio (e.g. TCF)"), true); + _studio = add (new wxTextCtrl (this, wxID_ANY)); + + add (_("Facility (e.g. DLA)"), true); + _facility = add (new wxTextCtrl (this, wxID_ANY)); + + add (_("Package Type (e.g. OV)"), true); + _package_type = add (new wxTextCtrl (this, wxID_ANY)); + + _content_version->SetRange (1, 1024); + + _content_version->SetValue (dm.content_version); + _audio_language->SetValue (std_to_wx (dm.audio_language)); + _subtitle_language->SetValue (std_to_wx (dm.subtitle_language)); + _territory->SetValue (std_to_wx (dm.territory)); + _rating->SetValue (std_to_wx (dm.rating)); + _studio->SetValue (std_to_wx (dm.studio)); + _facility->SetValue (std_to_wx (dm.facility)); + _package_type->SetValue (std_to_wx (dm.package_type)); + + layout (); +} + +ISDCFMetadata +ISDCFMetadataDialog::isdcf_metadata () const +{ + ISDCFMetadata dm; + + dm.content_version = _content_version->GetValue (); + dm.audio_language = wx_to_std (_audio_language->GetValue ()); + dm.subtitle_language = wx_to_std (_subtitle_language->GetValue ()); + dm.territory = wx_to_std (_territory->GetValue ()); + dm.rating = wx_to_std (_rating->GetValue ()); + dm.studio = wx_to_std (_studio->GetValue ()); + dm.facility = wx_to_std (_facility->GetValue ()); + dm.package_type = wx_to_std (_package_type->GetValue ()); + + return dm; +} diff --git a/src/wx/isdcf_metadata_dialog.h b/src/wx/isdcf_metadata_dialog.h new file mode 100644 index 000000000..e20dbf5e3 --- /dev/null +++ b/src/wx/isdcf_metadata_dialog.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2012-2014 Carl Hetherington + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include +#include +#include "lib/isdcf_metadata.h" +#include "table_dialog.h" + +class wxSpinCtrl; +class Film; + +class ISDCFMetadataDialog : public TableDialog +{ +public: + ISDCFMetadataDialog (wxWindow *, ISDCFMetadata); + + ISDCFMetadata isdcf_metadata () const; + +private: + wxSpinCtrl* _content_version; + wxTextCtrl* _audio_language; + wxTextCtrl* _subtitle_language; + wxTextCtrl* _territory; + wxTextCtrl* _rating; + wxTextCtrl* _studio; + wxTextCtrl* _facility; + wxTextCtrl* _package_type; +}; diff --git a/src/wx/wscript b/src/wx/wscript index a04df2d41..8c142698b 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -15,7 +15,7 @@ sources = """ config_dialog.cc content_colour_conversion_dialog.cc content_menu.cc - dci_metadata_dialog.cc + isdcf_metadata_dialog.cc dir_picker_ctrl.cc dolby_certificate_dialog.cc doremi_certificate_dialog.cc diff --git a/test/4k_test.cc b/test/4k_test.cc index 5224fae83..e65804aa5 100644 --- a/test/4k_test.cc +++ b/test/4k_test.cc @@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE (fourk_test) shared_ptr c (new FFmpegContent (film, "test/data/test.mp4")); c->set_scale (VideoContentScale (Ratio::from_id ("185"))); film->set_resolution (RESOLUTION_4K); - film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR")); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_container (Ratio::from_id ("185")); film->examine_and_add_content (c); wait_for_jobs (); diff --git a/test/audio_delay_test.cc b/test/audio_delay_test.cc index 77243ea6d..8ac5f746c 100644 --- a/test/audio_delay_test.cc +++ b/test/audio_delay_test.cc @@ -38,7 +38,7 @@ void test_audio_delay (int delay_in_ms) { string const film_name = "audio_delay_test_" + lexical_cast (delay_in_ms); shared_ptr film = new_test_film (film_name); - film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR")); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_container (Ratio::from_id ("185")); film->set_name (film_name); diff --git a/test/black_fill_test.cc b/test/black_fill_test.cc index c2170d891..5c594f68c 100644 --- a/test/black_fill_test.cc +++ b/test/black_fill_test.cc @@ -33,7 +33,7 @@ using boost::shared_ptr; BOOST_AUTO_TEST_CASE (black_fill_test) { shared_ptr film = new_test_film ("black_fill_test"); - film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR")); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_name ("black_fill_test"); film->set_container (Ratio::from_id ("185")); film->set_sequence_video (false); diff --git a/test/film_metadata_test.cc b/test/film_metadata_test.cc index 1f06aa538..7440e4338 100644 --- a/test/film_metadata_test.cc +++ b/test/film_metadata_test.cc @@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE (film_metadata_test) } shared_ptr f (new Film (test_film)); - f->_dci_date = boost::gregorian::from_undelimited_string ("20130211"); + f->_isdcf_date = boost::gregorian::from_undelimited_string ("20130211"); BOOST_CHECK (f->container() == 0); BOOST_CHECK (f->dcp_content_type() == 0); diff --git a/test/play_test.cc b/test/play_test.cc index 92d1a8dce..067f772ff 100644 --- a/test/play_test.cc +++ b/test/play_test.cc @@ -82,7 +82,7 @@ private: BOOST_AUTO_TEST_CASE (play_test) { shared_ptr film = new_test_film ("play_test"); - film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR")); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_container (Ratio::from_id ("185")); film->set_name ("play_test"); diff --git a/test/recover_test.cc b/test/recover_test.cc index d8caf17fa..284895e0a 100644 --- a/test/recover_test.cc +++ b/test/recover_test.cc @@ -39,7 +39,7 @@ note (libdcp::NoteType, string n) BOOST_AUTO_TEST_CASE (recover_test) { shared_ptr film = new_test_film ("recover_test"); - film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR")); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_container (Ratio::from_id ("185")); film->set_name ("recover_test"); film->set_three_d (true); diff --git a/test/scaling_test.cc b/test/scaling_test.cc index f0cf3fe4a..cdf1653cd 100644 --- a/test/scaling_test.cc +++ b/test/scaling_test.cc @@ -56,7 +56,7 @@ static void scaling_test_for (shared_ptr film, shared_ptr co BOOST_AUTO_TEST_CASE (scaling_test) { shared_ptr film = new_test_film ("scaling_test"); - film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR")); + 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")); diff --git a/test/silence_padding_test.cc b/test/silence_padding_test.cc index d5236c144..f1136a3f1 100644 --- a/test/silence_padding_test.cc +++ b/test/silence_padding_test.cc @@ -37,7 +37,7 @@ static void test_silence_padding (int channels) { string const film_name = "silence_padding_test_" + lexical_cast (channels); shared_ptr film = new_test_film (film_name); - film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR")); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_container (Ratio::from_id ("185")); film->set_name (film_name); diff --git a/test/test.cc b/test/test.cc index be2cf1538..0b87b8062 100644 --- a/test/test.cc +++ b/test/test.cc @@ -59,7 +59,7 @@ struct TestConfig Config::instance()->set_num_local_encoding_threads (1); Config::instance()->set_server_port_base (61920); - Config::instance()->set_default_dci_metadata (DCIMetadata ()); + Config::instance()->set_default_isdcf_metadata (ISDCFMetadata ()); Config::instance()->set_default_container (static_cast (0)); Config::instance()->set_default_dcp_content_type (static_cast (0)); -- cgit v1.2.3 From f0cc79a6c34b8198155f6e519d4464385ea30049 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 10 Jun 2014 17:14:17 +0100 Subject: Support ISDCF naming convention version 9. Reported-by: Elia Orselli --- ChangeLog | 2 + src/lib/film.cc | 75 ++++++++++++++++++++++++++---- src/lib/film.h | 3 ++ src/lib/isdcf_metadata.cc | 14 ++++++ src/lib/isdcf_metadata.h | 16 +++++++ src/lib/ratio.cc | 12 ++--- src/wx/isdcf_metadata_dialog.cc | 30 ++++++++++++ src/wx/isdcf_metadata_dialog.h | 6 +++ test/isdcf_name_test.cc | 100 ++++++++++++++++++++++++++++++++++++++++ test/wscript | 1 + 10 files changed, 245 insertions(+), 14 deletions(-) create mode 100644 test/isdcf_name_test.cc (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index d9aeec1fb..26bd287dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-06-10 Carl Hetherington + * Support ISDCF naming convention version 9 (#257). + * Rename DCI to ISDCF when talking about the digital cinema naming convention (#362). diff --git a/src/lib/film.cc b/src/lib/film.cc index fb3026039..fd3e78c35 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -490,14 +490,20 @@ Film::isdcf_name (bool if_created_now) const { stringstream d; - string fixed_name = to_upper_copy (name()); - for (size_t i = 0; i < fixed_name.length(); ++i) { - if (fixed_name[i] == ' ') { - fixed_name[i] = '-'; + string raw_name = name (); + string fixed_name; + bool cap_next = true; + for (size_t i = 0; i < raw_name.length(); ++i) { + if (raw_name[i] == ' ') { + cap_next = true; + } else if (cap_next) { + fixed_name += toupper (raw_name[i]); + cap_next = false; + } else { + fixed_name += tolower (raw_name[i]); } } - /* Spec is that the name part should be maximum 14 characters, as I understand it */ if (fixed_name.length() > 14) { fixed_name = fixed_name.substr (0, 14); } @@ -509,19 +515,60 @@ Film::isdcf_name (bool if_created_now) const d << "-" << isdcf_metadata().content_version; } + ISDCFMetadata const dm = isdcf_metadata (); + + if (dm.temp_version) { + d << "-Temp"; + } + + if (dm.pre_release) { + d << "-Pre"; + } + + if (dm.red_band) { + d << "-RedBand"; + } + + if (!dm.chain.empty ()) { + d << "-" << dm.chain; + } + if (three_d ()) { d << "-3D"; } + if (dm.two_d_version_of_three_d) { + d << "-2D"; + } + + if (!dm.mastered_luminance.empty ()) { + d << "-" << dm.mastered_luminance; + } + if (video_frame_rate() != 24) { d << "-" << video_frame_rate(); } - + if (container()) { d << "_" << container()->isdcf_name(); } - ISDCFMetadata const dm = isdcf_metadata (); + /* XXX: this only works for content which has been scaled to a given ratio, + and uses the first bit of content only. + */ + + ContentList cl = content (); + Ratio const * content_ratio = 0; + for (ContentList::const_iterator i = cl.begin(); i != cl.end(); ++i) { + shared_ptr vc = dynamic_pointer_cast (*i); + if (vc && (content_ratio == 0 || vc->scale().ratio() != content_ratio)) { + content_ratio = vc->scale().ratio(); + } + } + + if (content_ratio && content_ratio != container()) { + d << "-" << content_ratio->isdcf_name(); + } if (!dm.audio_language.empty ()) { d << "_" << dm.audio_language; @@ -560,8 +607,10 @@ Film::isdcf_name (bool if_created_now) const break; } - d << "_" << resolution_to_string (_resolution); + /* XXX: HI/VI */ + d << "_" << resolution_to_string (_resolution); + if (!dm.studio.empty ()) { d << "_" << dm.studio; } @@ -576,6 +625,16 @@ Film::isdcf_name (bool if_created_now) const d << "_" << dm.facility; } + if (_interop) { + d << "_IOP"; + } else { + d << "_SMPTE"; + } + + if (three_d ()) { + d << "-3D"; + } + if (!dm.package_type.empty ()) { d << "_" << dm.package_type; } diff --git a/src/lib/film.h b/src/lib/film.h index f77309862..96ea930cc 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -46,6 +46,7 @@ class Playlist; class AudioContent; class Scaler; class Screen; +class isdcf_name_test; /** @class Film * @@ -282,6 +283,8 @@ public: private: + friend class ::isdcf_name_test; + void signal_changed (Property); std::string video_identifier () const; void playlist_changed (); diff --git a/src/lib/isdcf_metadata.cc b/src/lib/isdcf_metadata.cc index ae99280ca..dfba50a9a 100644 --- a/src/lib/isdcf_metadata.cc +++ b/src/lib/isdcf_metadata.cc @@ -38,6 +38,14 @@ ISDCFMetadata::ISDCFMetadata (shared_ptr node) studio = node->string_child ("Studio"); facility = node->string_child ("Facility"); package_type = node->string_child ("PackageType"); + + /* This stuff was added later */ + temp_version = node->optional_bool_child ("TempVersion").get_value_or (false); + pre_release = node->optional_bool_child ("PreRelease").get_value_or (false); + red_band = node->optional_bool_child ("RedBand").get_value_or (false); + chain = node->optional_string_child ("Chain").get_value_or (""); + two_d_version_of_three_d = node->optional_bool_child ("TwoDVersionOfThreeD").get_value_or (false); + mastered_luminance = node->optional_string_child ("MasteredLuminance").get_value_or (""); } void @@ -51,6 +59,12 @@ ISDCFMetadata::as_xml (xmlpp::Node* root) const root->add_child("Studio")->add_child_text (studio); root->add_child("Facility")->add_child_text (facility); root->add_child("PackageType")->add_child_text (package_type); + root->add_child("TempVersion")->add_child_text (temp_version ? "1" : "0"); + root->add_child("PreRelease")->add_child_text (pre_release ? "1" : "0"); + root->add_child("RedBand")->add_child_text (red_band ? "1" : "0"); + root->add_child("Chain")->add_child_text (chain); + root->add_child("TwoDVersionOfThreeD")->add_child_text (two_d_version_of_three_d ? "1" : "0"); + root->add_child("MasteredLuminance")->add_child_text (mastered_luminance); } void diff --git a/src/lib/isdcf_metadata.h b/src/lib/isdcf_metadata.h index cd63ba2ee..0fb7e7baa 100644 --- a/src/lib/isdcf_metadata.h +++ b/src/lib/isdcf_metadata.h @@ -32,6 +32,10 @@ class ISDCFMetadata public: ISDCFMetadata () : content_version (1) + , temp_version (false) + , pre_release (false) + , red_band (false) + , two_d_version_of_three_d (false) {} ISDCFMetadata (boost::shared_ptr); @@ -47,6 +51,18 @@ public: std::string studio; std::string facility; std::string package_type; + /** true if this is a temporary version (without final picture or sound) */ + bool temp_version; + /** true if this is a pre-release version (final picture and sound, but without accessibility features) */ + bool pre_release; + /** true if this has adult content */ + bool red_band; + /** specific theatre chain or event */ + std::string chain; + /** true if this is a 2D version of content that also exists in 3D */ + bool two_d_version_of_three_d; + /** mastered luminance if there are multiple versions distributed (e.g. 35, 4fl, 6fl etc.) */ + std::string mastered_luminance; }; #endif diff --git a/src/lib/ratio.cc b/src/lib/ratio.cc index a47b2101e..52577d3bb 100644 --- a/src/lib/ratio.cc +++ b/src/lib/ratio.cc @@ -32,12 +32,12 @@ vector Ratio::_ratios; void Ratio::setup_ratios () { - _ratios.push_back (new Ratio (float(1290) / 1080, "119", _("1.19"), "F")); - _ratios.push_back (new Ratio (float(1440) / 1080, "133", _("4:3"), "F")); - _ratios.push_back (new Ratio (float(1480) / 1080, "137", _("Academy"), "F")); - _ratios.push_back (new Ratio (float(1485) / 1080, "138", _("1.375"), "F")); - _ratios.push_back (new Ratio (float(1800) / 1080, "166", _("1.66"), "F")); - _ratios.push_back (new Ratio (float(1920) / 1080, "178", _("16:9"), "F")); + _ratios.push_back (new Ratio (float(1290) / 1080, "119", _("1.19"), "119")); + _ratios.push_back (new Ratio (float(1440) / 1080, "133", _("4:3"), "133")); + _ratios.push_back (new Ratio (float(1480) / 1080, "137", _("Academy"), "137")); + _ratios.push_back (new Ratio (float(1485) / 1080, "138", _("1.375"), "137")); + _ratios.push_back (new Ratio (float(1800) / 1080, "166", _("1.66"), "166")); + _ratios.push_back (new Ratio (float(1920) / 1080, "178", _("16:9"), "178")); _ratios.push_back (new Ratio (float(1998) / 1080, "185", _("Flat"), "F")); _ratios.push_back (new Ratio (float(2048) / 858, "239", _("Scope"), "S")); _ratios.push_back (new Ratio (float(2048) / 1080, "full-frame", _("Full frame"), "C")); diff --git a/src/wx/isdcf_metadata_dialog.cc b/src/wx/isdcf_metadata_dialog.cc index 0fd00ff7a..e47c944d0 100644 --- a/src/wx/isdcf_metadata_dialog.cc +++ b/src/wx/isdcf_metadata_dialog.cc @@ -53,6 +53,24 @@ ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm) add (_("Package Type (e.g. OV)"), true); _package_type = add (new wxTextCtrl (this, wxID_ANY)); + _temp_version = add (new wxCheckBox (this, wxID_ANY, _("Temp version"))); + add_spacer (); + + _pre_release = add (new wxCheckBox (this, wxID_ANY, _("Pre-release"))); + add_spacer (); + + _red_band = add (new wxCheckBox (this, wxID_ANY, _("Red band"))); + add_spacer (); + + add (_("Chain"), true); + _chain = add (new wxTextCtrl (this, wxID_ANY)); + + _two_d_version_of_three_d = add (new wxCheckBox (this, wxID_ANY, _("2D version of content available in 3D"))); + add_spacer (); + + add (_("Mastered luminance (e.g. 4fl)"), true); + _mastered_luminance = add (new wxTextCtrl (this, wxID_ANY)); + _content_version->SetRange (1, 1024); _content_version->SetValue (dm.content_version); @@ -63,6 +81,12 @@ ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm) _studio->SetValue (std_to_wx (dm.studio)); _facility->SetValue (std_to_wx (dm.facility)); _package_type->SetValue (std_to_wx (dm.package_type)); + _temp_version->SetValue (dm.temp_version); + _pre_release->SetValue (dm.pre_release); + _red_band->SetValue (dm.red_band); + _chain->SetValue (std_to_wx (dm.chain)); + _two_d_version_of_three_d->SetValue (dm.two_d_version_of_three_d); + _mastered_luminance->SetValue (std_to_wx (dm.mastered_luminance)); layout (); } @@ -80,6 +104,12 @@ ISDCFMetadataDialog::isdcf_metadata () const dm.studio = wx_to_std (_studio->GetValue ()); dm.facility = wx_to_std (_facility->GetValue ()); dm.package_type = wx_to_std (_package_type->GetValue ()); + dm.temp_version = _temp_version->GetValue (); + dm.pre_release = _pre_release->GetValue (); + dm.red_band = _red_band->GetValue (); + dm.chain = wx_to_std (_chain->GetValue ()); + dm.two_d_version_of_three_d = _two_d_version_of_three_d->GetValue (); + dm.mastered_luminance = wx_to_std (_mastered_luminance->GetValue ()); return dm; } diff --git a/src/wx/isdcf_metadata_dialog.h b/src/wx/isdcf_metadata_dialog.h index e20dbf5e3..516f83231 100644 --- a/src/wx/isdcf_metadata_dialog.h +++ b/src/wx/isdcf_metadata_dialog.h @@ -41,4 +41,10 @@ private: wxTextCtrl* _studio; wxTextCtrl* _facility; wxTextCtrl* _package_type; + wxCheckBox* _temp_version; + wxCheckBox* _pre_release; + wxCheckBox* _red_band; + wxTextCtrl* _chain; + wxCheckBox* _two_d_version_of_three_d; + wxTextCtrl* _mastered_luminance; }; diff --git a/test/isdcf_name_test.cc b/test/isdcf_name_test.cc new file mode 100644 index 000000000..65f89c0f4 --- /dev/null +++ b/test/isdcf_name_test.cc @@ -0,0 +1,100 @@ +/* + Copyright (C) 2014 Carl Hetherington + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include +#include "lib/film.h" +#include "lib/ratio.h" +#include "lib/dcp_content_type.h" +#include "lib/image_content.h" +#include "test.h" + +using std::cout; +using boost::shared_ptr; + +BOOST_AUTO_TEST_CASE (isdcf_name_test) +{ + shared_ptr film = new_test_film ("isdcf_name_test"); + + /* A basic test */ + + film->set_name ("My Nice Film"); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); + film->set_container (Ratio::from_id ("185")); + film->_isdcf_date = boost::gregorian::date (2014, boost::gregorian::Jul, 4); + ISDCFMetadata m; + m.content_version = 1; + m.audio_language = "EN"; + m.subtitle_language = "XX"; + m.territory = "UK"; + m.rating = "PG"; + m.studio = "ST"; + m.facility = "FA"; + m.package_type = "OV"; + film->set_isdcf_metadata (m); + film->set_interop (true); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilm_FTR-1_F_EN-XX_UK-PG_51_2K_ST_20140704_FA_IOP_OV"); + + /* Test a long name and some different data */ + + film->set_name ("My Nice Film With A Very Long Name"); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); + film->set_container (Ratio::from_id ("239")); + film->_isdcf_date = boost::gregorian::date (2014, boost::gregorian::Jul, 4); + film->set_audio_channels (1); + film->set_resolution (RESOLUTION_4K); + m.content_version = 2; + m.audio_language = "DE"; + m.subtitle_language = "FR"; + m.territory = "US"; + m.rating = "R"; + m.studio = "DI"; + m.facility = "PP"; + m.package_type = "VF"; + film->set_isdcf_metadata (m); + film->set_interop (false); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_S_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF"); + + /* Test interior aspect ratio */ + + shared_ptr content (new ImageContent (film, "test/data/simple_testcard_640x480.png")); + film->examine_and_add_content (content); + wait_for_jobs (); + content->set_scale (VideoContentScale (Ratio::from_id ("133"))); + film->set_container (Ratio::from_id ("185")); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF"); + + /* Test 3D */ + + film->set_three_d (true); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2-3D_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE-3D_VF"); + + /* Test content type modifiers */ + + film->set_three_d (false); + m.temp_version = true; + m.pre_release = true; + m.red_band = true; + m.chain = "MyChain"; + m.two_d_version_of_three_d = true; + m.mastered_luminance = "4fl"; + film->set_isdcf_metadata (m); + film->set_video_frame_rate (48); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2-Temp-Pre-RedBand-MyChain-2D-4fl-48_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF"); +} + diff --git a/test/wscript b/test/wscript index 676f47104..09df14673 100644 --- a/test/wscript +++ b/test/wscript @@ -31,6 +31,7 @@ def build(bld): film_metadata_test.cc frame_rate_test.cc image_test.cc + isdcf_name_test.cc job_test.cc make_black_test.cc pixel_formats_test.cc -- cgit v1.2.3 From 4be68e872210db9536ce1997d7fcba1e285765b8 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 12 Jun 2014 10:45:38 +0100 Subject: Incorporate Film::_with_subtitles in the Film::video_identifier Reported-by: Matthias Damm --- ChangeLog | 5 +++++ src/lib/film.cc | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 26bd287dc..55f1dea8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-06-12 Carl Hetherington + + * Fix bug where DCP-o-matic does not recreate video after + subtitles are turned on or off. + 2014-06-10 Carl Hetherington * Support ISDCF naming convention version 9 (#257). diff --git a/src/lib/film.cc b/src/lib/film.cc index 5b709ab1c..609003bba 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -184,6 +184,10 @@ Film::video_identifier () const s << "_3D"; } + if (_with_subtitles) { + s << "_WS"; + } + return s.str (); } -- cgit v1.2.3 From 6cb0cb97a5774a9e71be1bab231b8f7c2d25a6be Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 12 Jun 2014 10:52:11 +0100 Subject: Bump version --- ChangeLog | 4 ++++ debian/changelog | 5 +++-- wscript | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 55f1dea8b..8ad710af2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-06-12 Carl Hetherington + + * Version 1.69.26 released. + 2014-06-12 Carl Hetherington * Fix bug where DCP-o-matic does not recreate video after diff --git a/debian/changelog b/debian/changelog index bba63b12e..182f621b6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -dcpomatic (1.69.25-1) UNRELEASED; urgency=low +dcpomatic (1.69.26-1) UNRELEASED; urgency=low * New upstream release. * New upstream release. @@ -149,8 +149,9 @@ dcpomatic (1.69.25-1) UNRELEASED; urgency=low * New upstream release. * New upstream release. * New upstream release. + * New upstream release. - -- Carl Hetherington Mon, 09 Jun 2014 23:59:02 +0100 + -- Carl Hetherington Thu, 12 Jun 2014 10:52:11 +0100 dcpomatic (0.87-1) UNRELEASED; urgency=low diff --git a/wscript b/wscript index 69c6df9ef..6ecb0f718 100644 --- a/wscript +++ b/wscript @@ -3,7 +3,7 @@ import os import sys APPNAME = 'dcpomatic' -VERSION = '1.69.25devel' +VERSION = '1.69.26' def options(opt): opt.load('compiler_cxx') -- cgit v1.2.3