Merge master.
authorCarl Hetherington <cth@carlh.net>
Thu, 12 Jun 2014 21:27:11 +0000 (22:27 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 12 Jun 2014 21:27:11 +0000 (22:27 +0100)
70 files changed:
ChangeLog
cscript
debian/changelog
hacks/analog.py [new file with mode: 0644]
src/lib/audio_content.cc
src/lib/audio_content.h
src/lib/config.cc
src/lib/config.h
src/lib/content.cc
src/lib/dci_metadata.cc [deleted file]
src/lib/dci_metadata.h [deleted file]
src/lib/dcp_content_type.cc
src/lib/dcp_content_type.h
src/lib/ffmpeg_content.cc
src/lib/film.cc
src/lib/film.h
src/lib/frame_rate_change.h
src/lib/image_content.cc
src/lib/image_proxy.cc
src/lib/image_proxy.h
src/lib/isdcf_metadata.cc [new file with mode: 0644]
src/lib/isdcf_metadata.h [new file with mode: 0644]
src/lib/log.cc
src/lib/log.h
src/lib/player.cc
src/lib/playlist.h
src/lib/ratio.cc
src/lib/ratio.h
src/lib/server.cc
src/lib/sndfile_content.cc
src/lib/util.cc
src/lib/video_content.cc
src/lib/wscript
src/tools/dcpomatic_create.cc
src/tools/dcpomatic_server_cli.cc
src/tools/update_dialog.cc [deleted file]
src/tools/update_dialog.h [deleted file]
src/wx/about_dialog.cc
src/wx/audio_panel.cc
src/wx/audio_panel.h
src/wx/config_dialog.cc
src/wx/content_widget.h
src/wx/dci_metadata_dialog.cc [deleted file]
src/wx/dci_metadata_dialog.h [deleted file]
src/wx/film_editor.cc
src/wx/film_editor.h
src/wx/isdcf_metadata_dialog.cc [new file with mode: 0644]
src/wx/isdcf_metadata_dialog.h [new file with mode: 0644]
src/wx/timeline.cc
src/wx/timeline.h
src/wx/timing_panel.cc
src/wx/video_panel.cc
src/wx/wscript
src/wx/wx_util.cc
src/wx/wx_util.h
suppressions [new file with mode: 0644]
test/4k_test.cc
test/audio_delay_test.cc
test/black_fill_test.cc
test/client_server_test.cc
test/colour_conversion_test.cc
test/film_metadata_test.cc
test/frame_rate_test.cc
test/isdcf_name_test.cc [new file with mode: 0644]
test/play_test.cc
test/recover_test.cc
test/scaling_test.cc
test/silence_padding_test.cc
test/test.cc
test/wscript

index 78954c82da4b1fe42918bf5e7af6ddcc255d87ee..126730e27f8e232e481b470e7fda00549606f49e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,58 @@
 
        * Add subtitle view.
 
+2014-06-12  Carl Hetherington  <cth@carlh.net>
+
+       * Version 1.69.26 released.
+
+2014-06-12  Carl Hetherington  <cth@carlh.net>
+
+       * Fix bug where DCP-o-matic does not recreate video after
+       subtitles are turned on or off.
+
+2014-06-10  Carl Hetherington  <cth@carlh.net>
+
+       * Support ISDCF naming convention version 9 (#257).
+
+       * 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  <cth@carlh.net>
+
+       * Fix server/client with non-RGB24 sources.
+
+       * Version 1.69.25 released.
+
+2014-06-09  Carl Hetherington  <cth@carlh.net>
+
+       * 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.
+
+2014-06-06  Carl Hetherington  <cth@carlh.net>
+
+       * Version 1.69.23 released.
+
+2014-06-05  Carl Hetherington  <cth@carlh.net>
+
+       * Version 1.69.22 released.
+
+2014-06-05  Carl Hetherington  <cth@carlh.net>
+
+       * 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.
+
+2014-06-03  Carl Hetherington  <cth@carlh.net>
+
+       * Version 1.69.21 released.
+
 2014-06-03  Carl Hetherington  <cth@carlh.net>
 
        * Fix bad resampling of separate sound file sources that
diff --git a/cscript b/cscript
index e1a987fdec0f73b13aa222b682ee0178d0ad5412..adc4da639a2be9ad4e3ca8e7e093f5b9b38604ba 100644 (file)
--- a/cscript
+++ b/cscript
@@ -7,8 +7,6 @@ deb_build_depends = {'debhelper': '8.0.0',
                      'g++': '4:4.6.3',
                      'pkg-config': '0.26',
                      'libssh-dev': '0.5.2',
-                     'libboost-filesystem-dev': '1.46.0',
-                     'libboost-thread-dev': '1.46.0',
                      'libsndfile1-dev': '1.0.25',
                      'libmagick++-dev': '8:6.6.9.7',
                      'libgtk2.0-dev': '2.24.10'}
@@ -17,15 +15,15 @@ deb_depends = dict()
 
 deb_depends['12.04'] = {'libc6': '2.15',
                         'libssh-4': '0.5.2',
-                        'libboost-filesystem1.46.1': '1.46.1',
-                        'libboost-thread1.46.1': '1.46.1',
+                        'libboost-filesystem1.48.0': '1.48.0-3',
+                        'libboost-thread1.48.0': '1.48.0-3',
                         'libsndfile1': '1.0.25',
                         'libmagick++4': '8:6.6.9.7',
                         'libxml++2.6-2': '2.34.1',
                         'libgtk2.0-0': '2.24.10',
                         'libxmlsec1': '1.2.14-1.2build1',
                         'libxmlsec1-openssl': '1.2.14-1.2build1',
-                        'libboost-date-time1.46.1': '1.46.1',
+                        'libboost-date-time1.48.0': '1.48.0-3',
                         'libcurl3': '7.22.0-3ubuntu4',
                         'libzip2': '0.10-1ubuntu1'}
 
index 4b144629d4ceba22a388309addda9f4f07dffe98..182f621b6f81a8684af464c1eccb7b1d58030d3a 100644 (file)
@@ -1,4 +1,4 @@
-dcpomatic (1.69.20-1) UNRELEASED; urgency=low
+dcpomatic (1.69.26-1) UNRELEASED; urgency=low
 
   * New upstream release.
   * New upstream release.
@@ -144,8 +144,14 @@ dcpomatic (1.69.20-1) UNRELEASED; urgency=low
   * New upstream release.
   * New upstream release.
   * New upstream release.
+  * New upstream release.
+  * New upstream release.
+  * New upstream release.
+  * New upstream release.
+  * New upstream release.
+  * New upstream release.
 
- -- Carl Hetherington <carl@d1stkfactory>  Tue, 03 Jun 2014 15:32:33 +0100
+ -- Carl Hetherington <carl@d1stkfactory>  Thu, 12 Jun 2014 10:52:11 +0100
 
 dcpomatic (0.87-1) UNRELEASED; urgency=low
 
diff --git a/hacks/analog.py b/hacks/analog.py
new file mode 100644 (file)
index 0000000..c74cf1b
--- /dev/null
@@ -0,0 +1,227 @@
+#!/usr/bin/python
+
+import sys
+import time
+import argparse
+import matplotlib.pyplot as plt
+
+parser = argparse.ArgumentParser()
+parser.add_argument('log_file')
+parser.add_argument('-q', '--queue', help='plot queue size', action='store_true')
+parser.add_argument('-e', '--encoder-threads', help='plot encoder thread activity', action='store_true')
+parser.add_argument('-f', '--plot-first-encoder', help='plot more detailed activity of the first encoder thread', action='store_true')
+parser.add_argument('-s', '--fps-stats', help='frames-per-second stats', action='store_true')
+parser.add_argument('--dump-first-encoder', help='dump activity of the first encoder thread', action='store_true')
+parser.add_argument('--from', help='time in seconds to start at', type=int, dest='from_time')
+parser.add_argument('--to', help='time in seconds to stop at', type=int, dest='to_time')
+args = parser.parse_args()
+
+def find_nth(haystack, needle, n):
+    start = haystack.find(needle)
+    while start >= 0 and n > 1:
+        start = haystack.find(needle, start+len(needle))
+        n -= 1
+    return start
+
+class Time:
+    def __init__(self, s, m = 0):
+        self.seconds = s
+        self.microseconds = m
+
+    def __str__(self):
+        return '%d:%d' % (self.seconds, self.microseconds)
+
+    def float_seconds(self):
+        return self.seconds + self.microseconds / 1000000.0
+
+    def __sub__(self, x):
+        m = self.microseconds - x.microseconds
+        if m < 0:
+            return Time(self.seconds - x.seconds - 1, m + 1000000)
+        else:
+            return Time(self.seconds - x.seconds, m)
+
+queue_size = []
+general_events = []
+encoder_thread_events = dict()
+
+def add_encoder_thread_event(thread, time, event):
+    global encoder_thread_events
+    if thread in encoder_thread_events:
+        encoder_thread_events[thread].append((time, event))
+    else:
+        encoder_thread_events[thread] = [(time, event)]
+
+def add_general_event(time, event):
+    global general_events
+    general_events.append((time, event))
+
+f = open(args.log_file)
+start = None
+while True:
+    l = f.readline()
+    if l == '':
+        break
+
+    l = l.strip()
+    p = l.split()
+
+    if len(p) == 0:
+        continue
+
+    if len(p[0].split(':')) == 2:
+        # s:us timestamp
+        x = p[0].split(':')
+        T = Time(int(x[0]), int(x[1]))
+        message = l[l.find(' ')+1:]
+    else:
+        # Date/time timestamp
+        s = find_nth(l, ':', 3)
+        T = Time(time.mktime(time.strptime(l[:s])))
+        message = l[s+2:]
+
+    if start is None:
+        start = T
+    else:
+        T = T - start
+
+    thread = None
+    if message.startswith('['):
+        thread = message.split()[0][1:-1]
+        message = message[message.find(' ')+1:]
+
+    if message.startswith('adding to queue of '):
+        queue_size.append((T, int(message.split()[4])))
+    elif message.startswith('encoder thread sleeps'):
+        add_encoder_thread_event(thread, T, 'sleep')
+    elif message.startswith('encoder thread wakes'):
+        add_encoder_thread_event(thread, T, 'wake')
+    elif message.startswith('encoder thread begins local encode'):
+        add_encoder_thread_event(thread, T, 'begin_encode')
+    elif message.startswith('MagickImageProxy begins decode and convert') or message.startswith('MagickImageProxy begins read and decode'):
+        add_encoder_thread_event(thread, T, 'magick_begin_decode')
+    elif message.startswith('MagickImageProxy decode finished'):
+        add_encoder_thread_event(thread, T, 'magick_end_decode')
+    elif message.startswith('MagickImageProxy completes decode and convert'):
+        add_encoder_thread_event(thread, T, 'magick_end_unpack')
+    elif message.startswith('encoder thread finishes local encode'):
+        add_encoder_thread_event(thread, T, 'end_encode')
+    elif message.startswith('Finished locally-encoded'):
+        add_general_event(T, 'end_local_encode')
+    elif message.startswith('Finished remotely-encoded'):
+        add_general_event(T, 'end_remote_encode')
+    elif message.startswith('Transcode job starting'):
+        add_general_event(T, 'begin_transcode')
+    elif message.startswith('Transcode job completed successfully'):
+        add_general_event(T, 'end_transcode')
+
+if args.queue:
+    plt.figure()
+    x = []
+    y = []
+    for q in queue_size:
+        x.append(q[0].seconds)
+        y.append(q[1])
+
+    plt.plot(x, y)
+    plt.show()
+
+elif args.encoder_threads:
+    plt.figure()
+    N = len(encoder_thread_events)
+    n = 1
+    for thread, events in encoder_thread_events.iteritems():
+        plt.subplot(N, 1, n)
+        x = []
+        y = []
+        previous = 0
+        for e in events:
+            if args.from_time is not None and e[0].float_seconds() <= args.from_time:
+                continue
+            if args.to_time is not None and e[0].float_seconds() >= args.to_time:
+                continue
+            x.append(e[0].float_seconds())
+            x.append(e[0].float_seconds())
+            y.append(previous)
+            if e[1] == 'sleep':
+                y.append(0)
+            elif e[1] == 'wake':
+                y.append(1)
+            elif e[1] == 'begin_encode':
+                y.append(2)
+            elif e[1] == 'end_encode':
+                y.append(1)
+            elif e[1] == 'magick_begin_decode':
+                y.append(3)
+            elif e[1] == 'magick_end_decode':
+                y.append(2)
+
+            previous = y[-1]
+
+        plt.plot(x, y)
+        n += 1
+
+    plt.show()
+
+elif args.plot_first_encoder:
+    plt.figure()
+    N = len(encoder_thread_events)
+    n = 1
+    events = encoder_thread_events.itervalues().next()
+
+    N = 6
+    n = 1
+    for t in ['sleep', 'wake', 'begin_encode', 'magick_begin_decode', 'magick_end_decode', 'end_encode']:
+        plt.subplot(N, 1, n)
+        x = []
+        y = []
+        for e in events:
+            if args.from_time is not None and e[0].float_seconds() <= args.from_time:
+                continue
+            if args.to_time is not None and e[0].float_seconds() >= args.to_time:
+                continue
+            if e[1] == t:
+                x.append(e[0].float_seconds())
+                x.append(e[0].float_seconds())
+                x.append(e[0].float_seconds())
+                y.append(0)
+                y.append(1)
+                y.append(0)
+                
+        plt.plot(x, y)
+        plt.title(t)
+        n += 1
+
+    plt.show()
+
+elif args.dump_first_encoder:
+    events = encoder_thread_events.itervalues().next()
+    last = 0
+    for e in events:
+        print e[0].float_seconds(), (e[0].float_seconds() - last), e[1]
+        last = e[0].float_seconds()
+
+elif args.fps_stats:
+    local = 0
+    remote = 0
+    start = None
+    end = None
+    for e in general_events:
+        if e[1] == 'begin_transcode':
+            start = e[0]
+        elif e[1] == 'end_transcode':
+            end = e[0]
+        elif e[1] == 'end_local_encode':
+            local += 1
+        elif e[1] == 'end_remote_encode':
+            remote += 1
+
+    if end == None:
+        print 'Job did not appear to end'
+        sys.exit(1)
+
+    duration = end - start
+
+    print 'Job ran for %fs' % duration.float_seconds()
+    print '%d local and %d remote' % (local, remote)
+    print '%.2f fps local and %.2f fps remote' % (local / duration.float_seconds(), remote / duration.float_seconds())
index 03bfe9630a9cb304de9d23c54456c7cf432c1fcc..9f0d26573453c347873237e21e195df9b53aab36 100644 (file)
@@ -25,6 +25,7 @@
 #include "film.h"
 #include "exceptions.h"
 #include "config.h"
+#include "frame_rate_change.h"
 
 #include "i18n.h"
 
@@ -97,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);
index 1ceb01f780edd20cb91fc4849527e9d27df64d5a..336a98629bae47b103cdb0d3d88e15ced581cfaa 100644 (file)
@@ -72,10 +72,10 @@ public:
 
        boost::signals2::connection analyse_audio (boost::function<void()>);
 
-       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;
        }
@@ -87,7 +87,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;
 };
index 8be31a329645151bd424c4b77f7f52b13d74cc60..a0211386baf224d248543f13848f9fb3aaac58a4 100644 (file)
@@ -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<int>("DefaultStillLength").get_value_or (10);
        _default_j2k_bandwidth = f.optional_number_child<int>("DefaultJ2KBandwidth").get_value_or (200000000);
        _default_audio_delay = f.optional_number_child<int>("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<string> (_num_local_encoding_threads));
        root->add_child("DefaultDirectory")->add_child_text (_default_directory.string ());
        root->add_child("ServerPortBase")->add_child_text (raw_convert<string> (_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<string> (_default_still_length));
        root->add_child("DefaultJ2KBandwidth")->add_child_text (raw_convert<string> (_default_j2k_bandwidth));
index ccd37ec1e22a2bc2d133b82138bf0a6268428196..f0d2630d0c893b22edf39c7a041d52e5d30ba2f4 100644 (file)
@@ -29,7 +29,7 @@
 #include <boost/signals2.hpp>
 #include <boost/filesystem.hpp>
 #include <dcp/metadata.h>
-#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<std::string> 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<int> _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<std::string> _language;
        int _default_still_length;
        Ratio const * _default_container;
index b6678cb4d9e7e9555773beb8746754755f0673e9..bbbe9b6ce4bdd4dd5ff6b8dcf231c8d08126e253 100644 (file)
@@ -40,6 +40,7 @@ using std::set;
 using std::list;
 using std::cout;
 using std::vector;
+using std::max;
 using boost::shared_ptr;
 using dcp::raw_convert;
 
@@ -215,7 +216,7 @@ Content::technical_summary () const
 DCPTime
 Content::length_after_trim () const
 {
-       return full_length() - trim_start() - trim_end();
+       return max (DCPTime (), full_length() - trim_start() - trim_end());
 }
 
 /** @return string which includes everything about how this content affects
diff --git a/src/lib/dci_metadata.cc b/src/lib/dci_metadata.cc
deleted file mode 100644 (file)
index c80d913..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
-
-    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 <iostream>
-#include <libcxml/cxml.h>
-#include <dcp/raw_convert.h>
-#include "dci_metadata.h"
-
-#include "i18n.h"
-
-using std::string;
-using boost::shared_ptr;
-using dcp::raw_convert;
-
-DCIMetadata::DCIMetadata (cxml::ConstNodePtr node)
-{
-       content_version = node->number_child<int> ("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<string> (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 (file)
index 6563ff9..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
-    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 <string>
-#include <libxml++/libxml++.h>
-#include <libcxml/cxml.h>
-
-class DCIMetadata
-{
-public:
-       DCIMetadata ()
-               : content_version (1)
-       {}
-       
-       DCIMetadata (cxml::ConstNodePtr);
-
-       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
index b3a45e40e410e156d5e4b94ff6032ee2e0011d77..e5466e1398936c1e4917efe11e95fa1cf5b12472 100644 (file)
@@ -33,7 +33,7 @@ vector<DCPContentType const *> DCPContentType::_dcp_content_types;
 DCPContentType::DCPContentType (string p, dcp::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<DCPContentType const *>::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;
                }
        }
index 05f30af5515d5c4ad1cd5713fb59d6200164a562..ebfe09518a5577189e745d05d0a37bfd6d1ce04c 100644 (file)
@@ -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<DCPContentType const *> all ();
@@ -59,7 +59,7 @@ public:
 private:
        std::string _pretty_name;
        dcp::ContentKind _libdcp_kind;
-       std::string _dci_name;
+       std::string _isdcf_name;
 
        /** All available DCP content types */
        static std::vector<DCPContentType const *> _dcp_content_types;
index 9889d511cd45016c97b08746bce15856a953e265..d3e0fa7b25687010a18cc2797db9aa9a76df3483 100644 (file)
@@ -33,6 +33,7 @@ extern "C" {
 #include "film.h"
 #include "log.h"
 #include "exceptions.h"
+#include "frame_rate_change.h"
 
 #include "i18n.h"
 
@@ -399,6 +400,9 @@ bool
 FFmpegContent::has_subtitle_during (ContentTimePeriod period) const
 {
        shared_ptr<FFmpegSubtitleStream> stream = subtitle_stream ();
+       if (!stream) {
+               return false;
+       }
 
        /* XXX: inefficient */
        for (vector<ContentTimePeriod>::const_iterator i = stream->periods.begin(); i != stream->periods.end(); ++i) {
index 25730ae1cbe8bff7e07da16c6eced81e099c7c79..14735d1b1048be4fa5c507e1fcf2f968eb4f6800 100644 (file)
@@ -90,6 +90,8 @@ using dcp::raw_convert;
  * Subtitle offset changed to subtitle y offset, and subtitle x offset added.
  * 7 -> 8
  * Use <Scale> tag in <VideoContent> rather than <Ratio>.
+ * 8 -> 9
+ * DCI -> ISDCF
  *
  * Bumped to 32 for 2.0 branch; some times are expressed in Times rather
  * than frames now.
@@ -103,7 +105,7 @@ int const Film::current_state_version = 32;
 
 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)
@@ -112,7 +114,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)
@@ -121,7 +123,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));
@@ -185,6 +187,10 @@ Film::video_identifier () const
                s << "_3D";
        }
 
+       if (_with_subtitles) {
+               s << "_WS";
+       }
+
        return s.str ();
 }
          
@@ -248,7 +254,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"));
@@ -352,10 +358,10 @@ Film::metadata () const
 
        root->add_child("Version")->add_child_text (raw_convert<string> (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) {
@@ -366,9 +372,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<string> (_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<string> (_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<string> (_audio_channels));
        root->add_child("ThreeD")->add_child_text (_three_d ? "1" : "0");
        root->add_child("SequenceVideo")->add_child_text (_sequence_video ? "1" : "0");
@@ -410,12 +416,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<string> 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 ());
                }
        }
 
@@ -430,9 +444,7 @@ Film::read_metadata ()
        _scaler = Scaler::from_id (f.string_child ("Scaler"));
        _with_subtitles = f.bool_child ("WithSubtitles");
        _j2k_bandwidth = f.number_child<int> ("J2KBandwidth");
-       _dci_metadata = DCIMetadata (f.node_child ("DCIMetadata"));
        _video_frame_rate = f.number_child<int> ("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<int> ("AudioChannels");
@@ -479,20 +491,26 @@ 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;
 
-       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);
        }
@@ -500,23 +518,67 @@ 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;
+       }
+
+       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()->dci_name();
+               d << "_" << container()->isdcf_name();
        }
 
-       DCIMetadata const dm = dci_metadata ();
+       /* XXX: this only works for content which has been scaled to a given ratio,
+          and uses the first bit of content only.
+       */
+
+       /* The standard says we don't do this for trailers, for some strange reason */
+       if (dcp_content_type() && dcp_content_type()->libdcp_kind() != dcp::TRAILER) {
+               ContentList cl = content ();
+               Ratio const * content_ratio = 0;
+               for (ContentList::const_iterator i = cl.begin(); i != cl.end(); ++i) {
+                       shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (*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;
@@ -555,8 +617,10 @@ Film::dci_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;
        }
@@ -564,13 +628,23 @@ 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 ()) {
                d << "_" << dm.facility;
        }
 
+       if (_interop) {
+               d << "_IOP";
+       } else {
+               d << "_SMPTE";
+       }
+       
+       if (three_d ()) {
+               d << "-3D";
+       }
+
        if (!dm.package_type.empty ()) {
                d << "_" << dm.package_type;
        }
@@ -582,8 +656,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();
@@ -605,10 +679,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
@@ -654,10 +728,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
@@ -711,9 +785,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
index d9d7e82fd2140a4cbf9fae20c69ea9e6badd4db6..067588fa3f42a52d7988aa930840f6d0a7b31863 100644 (file)
@@ -36,7 +36,8 @@
 #include <dcp/encrypted_kdm.h>
 #include "util.h"
 #include "types.h"
-#include "dci_metadata.h"
+#include "isdcf_metadata.h"
+#include "frame_rate_change.h"
 
 class DCPContentType;
 class Log;
@@ -46,6 +47,7 @@ class Playlist;
 class AudioContent;
 class Scaler;
 class Screen;
+class isdcf_name_test;
 
 /** @class Film
  *
@@ -88,7 +90,7 @@ public:
        void write_metadata () const;
        boost::shared_ptr<xmlpp::Document> 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 */
@@ -146,7 +148,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,
@@ -157,7 +159,7 @@ public:
                SIGNED,
                ENCRYPTED,
                J2K_BANDWIDTH,
-               DCI_METADATA,
+               ISDCF_METADATA,
                VIDEO_FRAME_RATE,
                AUDIO_CHANNELS,
                /** The setting of _three_d has been changed */
@@ -177,8 +179,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 {
@@ -214,8 +216,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 */
@@ -244,7 +246,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<Content>);
        void add_content (boost::shared_ptr<Content>);
        void remove_content (boost::shared_ptr<Content>);
@@ -258,11 +260,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);
 
@@ -277,6 +279,8 @@ public:
 
 private:
 
+       friend class ::isdcf_name_test;
+
        void signal_changed (Property);
        std::string video_identifier () const;
        void playlist_changed ();
@@ -295,8 +299,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.) */
@@ -311,12 +315,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.
index 6165f684010473e59f458d61ac656eb222ec23e5..92af0ec0174635586161726426ed0295a7e512e7 100644 (file)
@@ -17,6 +17,9 @@
 
 */
 
+#ifndef DCPOMATIC_FRAME_RATE_CHANGE_H
+#define DCPOMATIC_FRAME_RATE_CHANGE_H
+
 #include <string>
 
 struct FrameRateChange
@@ -56,3 +59,5 @@ struct FrameRateChange
 
        std::string description;
 };
+
+#endif
index 07f047ddd53bfc9c4651dca19d2b1b12fe8f753d..8909240dc334e3d793e2ff64cc7d8b4922c8a1f1 100644 (file)
@@ -24,6 +24,7 @@
 #include "compose.hpp"
 #include "film.h"
 #include "job.h"
+#include "frame_rate_change.h"
 
 #include "i18n.h"
 
index 16bd92f6ece1ea0f933cc0b09ec8a168533c0ece..1eb9c169c5c3b375d4677b61f6b19bdc58af71db 100644 (file)
@@ -55,7 +55,7 @@ RawImageProxy::RawImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> soc
                xml->number_child<int> ("Width"), xml->number_child<int> ("Height")
                );
 
-       _image.reset (new Image (PIX_FMT_RGB24, size, true));
+       _image.reset (new Image (static_cast<AVPixelFormat> (xml->number_child<int> ("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 (dcp::raw_convert<string> (_image->size().width));
        node->add_child("Height")->add_child_text (dcp::raw_convert<string> (_image->size().height));
+       node->add_child("PixelFormat")->add_child_text (dcp::raw_convert<string> (_image->pixel_format ()));
 }
 
 void
@@ -132,22 +133,14 @@ MagickImageProxy::image () const
 
        _image.reset (new Image (PIX_FMT_RGB24, size, true));
 
-       using namespace MagickCore;
-       
+       /* Write line-by-line here as _image must be aligned, and write() cannot be told about strides */
        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;
-               }
+       for (int i = 0; i < size.height; ++i) {
+               using namespace MagickCore;
+               magick_image->write (0, i, size.width, 1, "RGB", CharPixel, p);
                p += _image->stride()[0];
        }
 
-       delete magick_image;
-
        LOG_TIMING ("[%1] MagickImageProxy completes decode and convert of %2 bytes", boost::this_thread::get_id(), _blob.length());
 
        return _image;
index b499b329283362788c778b40ccb33769f3e36ea8..f6212e54f59bc11a5c679b4551bfc8d8d57cd72f 100644 (file)
@@ -49,7 +49,8 @@ class ImageProxy : public boost::noncopyable
 {
 public:
        ImageProxy (boost::shared_ptr<Log> log);
-       
+
+       /** @return Image (which must be aligned) */
        virtual boost::shared_ptr<Image> image () const = 0;
        virtual void add_metadata (xmlpp::Node *) const = 0;
        virtual void send_binary (boost::shared_ptr<Socket>) const = 0;
diff --git a/src/lib/isdcf_metadata.cc b/src/lib/isdcf_metadata.cc
new file mode 100644 (file)
index 0000000..7d960b6
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+
+    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 <iostream>
+#include <libcxml/cxml.h>
+#include <dcp/raw_convert.h>
+#include "isdcf_metadata.h"
+
+#include "i18n.h"
+
+using std::string;
+using boost::shared_ptr;
+using dcp::raw_convert;
+
+ISDCFMetadata::ISDCFMetadata (cxml::ConstNodePtr node)
+{
+       content_version = node->number_child<int> ("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");
+
+       /* 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
+ISDCFMetadata::as_xml (xmlpp::Node* root) const
+{
+       root->add_child("ContentVersion")->add_child_text (raw_convert<string> (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);
+       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
+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 (file)
index 0000000..e63f290
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+
+    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 <string>
+#include <libxml++/libxml++.h>
+#include <libcxml/cxml.h>
+
+class ISDCFMetadata
+{
+public:
+       ISDCFMetadata ()
+               : content_version (1)
+               , temp_version (false)
+               , pre_release (false)
+               , red_band (false)
+               , two_d_version_of_three_d (false)
+       {}
+       
+       ISDCFMetadata (cxml::ConstNodePtr);
+
+       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;
+       /** 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
index 52dff2982222620d81a9b7426c13c2a32beb523e..4de6bd874e94c4c97feed165a210de7b10169936 100644 (file)
@@ -39,7 +39,7 @@ int const Log::TYPE_TIMING  = 0x8;
 Log::Log ()
        : _types (0)
 {
-       Config::instance()->Changed.connect (boost::bind (&Log::config_changed, this));
+       _config_connection = Config::instance()->Changed.connect (boost::bind (&Log::config_changed, this));
        config_changed ();
 }
 
index 2ba273b44dd09e2e254c3a914ce16d2829959cee..94d30de4ecbb109a8b557bc145041c2517685899 100644 (file)
@@ -27,6 +27,7 @@
 #include <string>
 #include <boost/thread/mutex.hpp>
 #include <boost/filesystem.hpp>
+#include <boost/signals2.hpp>
 
 /** @class Log
  *  @brief A very simple logging class.
@@ -47,16 +48,15 @@ public:
 
        void set_types (int types);
 
-protected:     
-       /** mutex to protect the log */
-       boost::mutex _mutex;
-       
 private:
        virtual void do_log (std::string m) = 0;
        void config_changed ();
        
+       /** mutex to protect the log */
+       boost::mutex _mutex;
        /** bit-field of log types which should be put into the log (others are ignored) */
        int _types;
+       boost::signals2::scoped_connection _config_connection;
 };
 
 class FileLog : public Log
index c3489b7e1f227d3c6645cce9ab65fcf06348f51c..d0eb27aa31cc4ab0eb404deec5ac47157dbf330f 100644 (file)
@@ -42,6 +42,7 @@
 #include "config.h"
 #include "content_video.h"
 #include "player_video_frame.h"
+#include "frame_rate_change.h"
 
 #define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL);
 
index 6280b1219057d0e2b00e2200ca8a9e08b7692946..7c29b85887c82e55791fdc85209125adc198ac53 100644 (file)
@@ -26,6 +26,7 @@
 #include "ffmpeg_content.h"
 #include "audio_mapping.h"
 #include "util.h"
+#include "frame_rate_change.h"
 
 class Content;
 class FFmpegContent;
index 275f4ef15ab5215a14b6679b6e52ed58b01b77dd..fbd7022322c5b0e9e02d8e94785baaa54e23c4c5 100644 (file)
@@ -32,12 +32,12 @@ vector<Ratio const *> 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"));
index cd7d0d6e4de276b138f92733b3bbcee99ad5d10a..22fc7662c9c9cf28d2a625d45256f8cfcaf789a7 100644 (file)
@@ -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<Ratio const *> _ratios;      
 };
index 507ff2ae593ae2bfa5c15e818d16d561281e83de..59364fadd65aba787d1bfac5579c581eeba9a4c2 100644 (file)
@@ -104,6 +104,7 @@ Server::process (shared_ptr<Socket> socket, struct timeval& after_read, struct t
        try {
                encoded->send (socket);
        } catch (std::exception& e) {
+               cerr << "Send failed; frame " << dcp_video_frame.index() << "\n";
                LOG_ERROR ("Send failed; frame %1", dcp_video_frame.index());
                throw;
        }
@@ -139,6 +140,7 @@ Server::worker_thread ()
                        frame = process (socket, after_read, after_encode);
                        ip = socket->socket().remote_endpoint().address().to_string();
                } catch (std::exception& e) {
+                       cerr << "Error: " << e.what() << "\n";
                        LOG_ERROR ("Error: %1", e.what());
                }
 
index ed4f8ffd527ebde2358319d8344456829d25448c..37f2055359aa8a9d39dcced316a5476cd57bcec8 100644 (file)
@@ -157,4 +157,3 @@ SndfileContent::set_audio_mapping (AudioMapping m)
 
        AudioContent::set_audio_mapping (m);
 }
-
index 074e08cb70e819617391f5c4a6115e830d6444cc..55df5cc83798ba126eeebc82a0e9ca0d7f71aa34 100644 (file)
@@ -267,7 +267,8 @@ terminate ()
 
        try {
                // try once to re-throw currently active exception
-               if (!tried_throw++) {
+               if (!tried_throw) {
+                       tried_throw = true;
                        throw;
                }
        }
index 58053c822b9a61f5c08e643d50bd007f8ef94f45..f871f2df666438a1846d465642f8cb991e729723 100644 (file)
@@ -30,6 +30,7 @@
 #include "util.h"
 #include "film.h"
 #include "exceptions.h"
+#include "frame_rate_change.h"
 
 #include "i18n.h"
 
index 51aadb83f40718a549eac9e222bce49395bd69bb..407d9cde41551abab31aa43179de352b1ea26561 100644 (file)
@@ -15,7 +15,6 @@ sources = """
           content_factory.cc
           content_subtitle.cc
           cross.cc
-          dci_metadata.cc
           dcp_content_type.cc
           dcp_video_frame.cc
           dcpomatic_time.cc
@@ -41,6 +40,7 @@ sources = """
           image_decoder.cc
           image_examiner.cc
           image_proxy.cc
+          isdcf_metadata.cc
           job.cc
           job_manager.cc
           kdm.cc
index c75f8f9539ffe9f06d9b4d61936304ae038a7301..b0a67c6d93d5630fc919731ff251114c292f2690 100644 (file)
@@ -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]);
index f43dd10bc4e09a2c8689de4c11aa24f6e78c88ec..56802d8aef07a43b357c8371767d5d83eea33826 100644 (file)
@@ -52,7 +52,7 @@ help (string n)
 {
        cerr << "Syntax: " << n << " [OPTION]\n"
             << "  -v, --version      show DCP-o-matic version\n"
-            << "  -h, --help         show this help\n"
+            << "  -h, --help         show this help\n"
             << "  -t, --threads      number of parallel encoding threads to use\n"
             << "  --verbose          be verbose to stdout\n"
             << "  --log              write a log file of activity\n";
diff --git a/src/tools/update_dialog.cc b/src/tools/update_dialog.cc
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/src/tools/update_dialog.h b/src/tools/update_dialog.h
deleted file mode 100644 (file)
index 8b499eb..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
-
-    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.
-
-*/
-
-class UpdateDialog
-{
-public:
-       UpdateDialog (wxWindow *);
-
-private:
-       wxGauge* _gauge;
-       wxStaticText* _message;
-       boost::thread* _thread;
-       boost::optional<UpdateChecker::Result> _result;
-       std::string _stable;
-};
index 105831014eccc81354e7910b3fd0b76fce86c717..bd4a39811e158e235d34a62a8f836efb28ed6ab9 100644 (file)
@@ -114,6 +114,7 @@ AboutDialog::AboutDialog (wxWindow* parent)
        wxArrayString supported_by;
        supported_by.Add (wxT ("Manual AC"));
        supported_by.Add (wxT ("Kambiz Afshar"));
+       supported_by.Add (wxT ("Louis Belloisy"));
        supported_by.Add (wxT ("Jeff Boot"));
        supported_by.Add (wxT ("Kieran Carroll"));
        supported_by.Add (wxT ("Frank Cianciolo"));
@@ -141,6 +142,7 @@ AboutDialog::AboutDialog (wxWindow* parent)
        supported_by.Add (wxT ("Lindsay Morris"));
        supported_by.Add (wxT ("Tim O'Brien"));
        supported_by.Add (wxT ("Ivan Pullman"));
+       supported_by.Add (wxT ("Mark Rolfe"));
        supported_by.Add (wxT ("Andrä Steiner"));
        supported_by.Add (wxT ("Jussi Siponen"));
        supported_by.Add (wxT ("Lasse Salling"));
index ad1990cdcd2104a9528a2219e882390a0385eafd..26237db31d3e2aaf57552356bc3823cd62b5462a 100644 (file)
@@ -51,9 +51,9 @@ AudioPanel::AudioPanel (FilmEditor* e)
        ++r;
 
        add_label_to_grid_bag_sizer (grid, this, _("Audio Gain"), true, wxGBPosition (r, 0));
-       _gain = new ContentSpinCtrl<AudioContent> (
+       _gain = new ContentSpinCtrlDouble<AudioContent> (
                this,
-               new wxSpinCtrl (this),
+               new wxSpinCtrlDouble (this),
                AudioContentProperty::AUDIO_GAIN,
                boost::mem_fn (&AudioContent::audio_gain),
                boost::mem_fn (&AudioContent::set_audio_gain)
@@ -89,6 +89,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));
index f1b932e7cee2602d1421f32b593e855206e6e365..2ba5a9ffc051de25e29200d4b28f952cdaff9db8 100644 (file)
@@ -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<AudioContent>* _gain;
+       ContentSpinCtrlDouble<AudioContent>* _gain;
        wxButton* _gain_calculate_button;
        wxButton* _show;
        ContentSpinCtrl<AudioContent>* _delay;
index 631628e1d1d0a13163a0800107d75fe9f2a55b9c..68fbc3f1b391b05a0bc1d97de2a42282254e817a 100644 (file)
@@ -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 const *> 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;
index 8b76160443fd0cf31fe34e75e710ec0faf5a3d64..9e1338b7c880eda03c5bfbeed58e00110d4fe94b 100644 (file)
@@ -227,6 +227,30 @@ public:
        }
 };
 
+template <class S>
+class ContentSpinCtrlDouble : public ContentWidget<S, wxSpinCtrlDouble, double, double>
+{
+public:
+       ContentSpinCtrlDouble (
+               wxWindow* parent,
+               wxSpinCtrlDouble* wrapped,
+               int property,
+               boost::function<double (S*)> getter,
+               boost::function<void (S*, double)> setter
+               )
+               : ContentWidget<S, wxSpinCtrlDouble, double, double> (
+                       parent,
+                       wrapped,
+                       property,
+                       getter, setter,
+                       &caster<double, double>,
+                       &caster<double, double>
+                       )
+       {
+               wrapped->Bind (wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, boost::bind (&ContentWidget<S, wxSpinCtrlDouble, double, double>::view_changed, this));
+       }
+};
+
 template <class S, class U>
 class ContentChoice : public ContentWidget<S, wxChoice, U, int>
 {
diff --git a/src/wx/dci_metadata_dialog.cc b/src/wx/dci_metadata_dialog.cc
deleted file mode 100644 (file)
index 700e1b1..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
-    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 <wx/wx.h>
-#include <wx/sizer.h>
-#include <wx/spinctrl.h>
-#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 (file)
index 7b93a3a..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
-
-    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 <wx/textctrl.h>
-#include <boost/shared_ptr.hpp>
-#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;
-};
index a6cb77f8561cf36de0aed3594e62a5a8b058acc6..252a89719a5a718d832a807a1d45226118f41426 100644 (file)
@@ -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<Film> 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<Film> 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 ();
 }
 
@@ -863,7 +863,7 @@ FilmEditor::setup_content_sensitivity ()
        _content_remove->Enable   (selection.size() == 1 && _generally_sensitive);
        _content_earlier->Enable  (selection.size() == 1 && _generally_sensitive);
        _content_later->Enable    (selection.size() == 1 && _generally_sensitive);
-       _content_timeline->Enable (_generally_sensitive);
+       _content_timeline->Enable (!_film->content().empty() && _generally_sensitive);
 
        _video_panel->Enable    (video_selection.size() > 0 && _generally_sensitive);
        _audio_panel->Enable    (audio_selection.size() > 0 && _generally_sensitive);
index 56e54734b7dcac54e0a3ebad1317be4f6febdf13..96cae3900d66d1b9aea29a4043e285f28dc81f2a 100644 (file)
@@ -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> _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 (file)
index 0000000..e47c944
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+
+    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 <wx/wx.h>
+#include <wx/sizer.h>
+#include <wx/spinctrl.h>
+#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));
+
+       _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);
+       _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));
+       _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 ();
+}
+
+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 ());
+       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
new file mode 100644 (file)
index 0000000..516f832
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+
+    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 <wx/textctrl.h>
+#include <boost/shared_ptr.hpp>
+#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;
+       wxCheckBox* _temp_version;
+       wxCheckBox* _pre_release;
+       wxCheckBox* _red_band;
+       wxTextCtrl* _chain;
+       wxCheckBox* _two_d_version_of_three_d;
+       wxTextCtrl* _mastered_luminance;
+};
index d5643b556db5747c7e80099165217886435f0b87..4b56168a1d0636be5d56642d212b8050e19b61ce 100644 (file)
@@ -68,7 +68,7 @@ protected:
        
        int time_x (DCPTime t) const
        {
-               return _timeline.tracks_position().x + t.seconds() * _timeline.pixels_per_second ();
+               return _timeline.tracks_position().x + t.seconds() * _timeline.pixels_per_second().get_value_or (0);
        }
        
        Timeline& _timeline;
@@ -105,7 +105,7 @@ public:
                return dcpomatic::Rect<int> (
                        time_x (content->position ()) - 8,
                        y_pos (_track.get()) - 8,
-                       content->length_after_trim().seconds() * _timeline.pixels_per_second() + 16,
+                       content->length_after_trim().seconds() * _timeline.pixels_per_second().get_value_or(0) + 16,
                        _timeline.track_height() + 16
                        );
        }
@@ -176,7 +176,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.seconds() * _timeline.pixels_per_second(), _timeline.track_height()));
+               gc->Clip (wxRegion (time_x (position), y_pos (_track.get()), len.seconds() * _timeline.pixels_per_second().get_value_or(0), _timeline.track_height()));
                gc->DrawText (name, time_x (position) + 12, y_pos (_track.get() + 1) - name_height - 4);
                gc->ResetClip ();
        }
@@ -292,9 +292,15 @@ private:
 
        void do_paint (wxGraphicsContext* gc)
        {
+               if (!_timeline.pixels_per_second()) {
+                       return;
+               }
+
+               double const pps = _timeline.pixels_per_second().get ();
+               
                gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 1, wxPENSTYLE_SOLID));
                
-               double mark_interval = rint (128 / _timeline.pixels_per_second ());
+               double mark_interval = rint (128 / pps);
                if (mark_interval > 5) {
                        mark_interval -= int (rint (mark_interval)) % 5;
                }
@@ -319,7 +325,7 @@ private:
 
                /* Time in seconds */
                DCPTime t;
-               while ((t.seconds() * _timeline.pixels_per_second()) < _timeline.width()) {
+               while ((t.seconds() * pps) < _timeline.width()) {
                        wxGraphicsPath path = gc->CreatePath ();
                        path.MoveToPoint (time_x (t), _y - 4);
                        path.AddLineToPoint (time_x (t), _y + 4);
@@ -339,7 +345,7 @@ private:
                        wxDouble str_leading;
                        gc->GetTextExtent (str, &str_width, &str_height, &str_descent, &str_leading);
                        
-                       int const tx = _timeline.x_offset() + t.seconds() * _timeline.pixels_per_second();
+                       int const tx = _timeline.x_offset() + t.seconds() * pps;
                        if ((tx + str_width) < _timeline.width()) {
                                gc->DrawText (str, time_x (t), _y + 16);
                        }
@@ -359,7 +365,6 @@ Timeline::Timeline (wxWindow* parent, FilmEditor* ed, shared_ptr<Film> film)
        , _film (film)
        , _time_axis_view (new TimeAxisView (*this, 32))
        , _tracks (0)
-       , _pixels_per_second (0)
        , _left_down (false)
        , _down_view_position (0)
        , _first_move (false)
@@ -602,6 +607,12 @@ Timeline::right_down (wxMouseEvent& ev)
 void
 Timeline::set_position_from_event (wxMouseEvent& ev)
 {
+       if (!_pixels_per_second) {
+               return;
+       }
+
+       double const pps = _pixels_per_second.get ();
+
        wxPoint const p = ev.GetPosition();
 
        if (!_first_move) {
@@ -619,7 +630,7 @@ Timeline::set_position_from_event (wxMouseEvent& ev)
                return;
        }
        
-       DCPTime new_position = _down_view_position + DCPTime::from_seconds ((p.x - _down_point.x) / _pixels_per_second);
+       DCPTime new_position = _down_view_position + DCPTime::from_seconds ((p.x - _down_point.x) / pps);
        
        if (_snap) {
                
@@ -660,7 +671,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 < DCPTime::from_seconds ((width() / pixels_per_second()) / 32)) {
+                       if (nearest_distance < DCPTime::from_seconds ((width() / pps) / 32)) {
                                new_position = nearest_new_position;
                        }
                }
index 35153dd175d4c13aa4f510656c3810a2a1bd38fc..4ba1cc425f022b6fe11d634052f7915a5c012ee8 100644 (file)
@@ -52,7 +52,7 @@ public:
                return 48;
        }
 
-       double pixels_per_second () const {
+       boost::optional<double> pixels_per_second () const {
                return _pixels_per_second;
        }
 
@@ -96,7 +96,7 @@ private:
        ViewList _views;
        boost::shared_ptr<TimeAxisView> _time_axis_view;
        int _tracks;
-       double _pixels_per_second;
+       boost::optional<double> _pixels_per_second;
        bool _left_down;
        wxPoint _down_point;
        boost::shared_ptr<ContentView> _down_view;
index f33e052a1ad41dad2f2adea9b0b7aa39f7823ceb..cc0639b4ccfd500609c879e41c36df016d4b1b36 100644 (file)
@@ -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"
@@ -134,10 +133,9 @@ TimingPanel::film_content_changed (int property)
        }
 
        shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (content);
-       shared_ptr<SndfileContent> sc = dynamic_pointer_cast<SndfileContent> (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);
 }
 
index 399e71aac26edba4d752847d0faa4240bb2ead69..2a5577bc19574f46628ba38e5028d345b8a9ac72 100644 (file)
@@ -24,6 +24,7 @@
 #include "lib/config.h"
 #include "lib/util.h"
 #include "lib/ratio.h"
+#include "lib/frame_rate_change.h"
 #include "filter_dialog.h"
 #include "video_panel.h"
 #include "wx_util.h"
index cd78f064920081a7bbee364035af9f3f2e0c753b..0c87c09be0d9ac321fac36ed57d9c31b39c969f0 100644 (file)
@@ -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
index 048f87908e8c72770e973f0450a36767c1b747f3..aac35e97a4a1a2b2eb4ba5b78b81f0eeb1b3a697 100644 (file)
@@ -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 ()
 {
index 56ed500f6887974a2e0c1f7af60bef4ca43fcdff..12a7115d5b3d472e8be9394435df884ff7d19b97 100644 (file)
@@ -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.
diff --git a/suppressions b/suppressions
new file mode 100644 (file)
index 0000000..50ce940
--- /dev/null
@@ -0,0 +1,7 @@
+{
+   libcrypto.so use of uninitialised
+   Memcheck:Value8
+   obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
+   obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
+   obj:*
+}
index 1e0b42697aa297cb84891039e05327993afddfb1..fa5b33bb921feb348e4a0d6ad83fda54c40411b7 100644 (file)
@@ -39,7 +39,7 @@ BOOST_AUTO_TEST_CASE (fourk_test)
        shared_ptr<FFmpegContent> 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 ();
index 87e6071a08bdb7e8717ce9726ed6301e8846365a..68e14ff3ca353f470d9f09f8c14112f6713b34a4 100644 (file)
@@ -45,7 +45,7 @@ void test_audio_delay (int delay_in_ms)
 {
        string const film_name = "audio_delay_test_" + lexical_cast<string> (delay_in_ms);
        shared_ptr<Film> 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);
 
index 7741277a595e753cacd76ffdff1b5a2f67b3cf0f..148ec9738c74329c9c126506488fac020ff41037 100644 (file)
@@ -33,7 +33,7 @@ using boost::shared_ptr;
 BOOST_AUTO_TEST_CASE (black_fill_test)
 {
        shared_ptr<Film> 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);
index c0eddd8f6a7f8eee16dcbbef3d27119a2cf45898..1816de8e693df8a1a4fac0bf29e324a12efede53 100644 (file)
@@ -50,7 +50,7 @@ do_remote_encode (shared_ptr<DCPVideoFrame> frame, ServerDescription description
        BOOST_CHECK_EQUAL (memcmp (locally_encoded->data(), remotely_encoded->data(), locally_encoded->size()), 0);
 }
 
-BOOST_AUTO_TEST_CASE (client_server_test)
+BOOST_AUTO_TEST_CASE (client_server_test_rgb)
 {
        shared_ptr<Image> image (new Image (PIX_FMT_RGB24, dcp::Size (1998, 1080), true));
        uint8_t* p = image->data()[0];
@@ -78,7 +78,86 @@ BOOST_AUTO_TEST_CASE (client_server_test)
                p += sub_image->stride()[0];
        }
 
-       shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test.log"));
+       shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test_rgb.log"));
+
+       shared_ptr<PlayerVideoFrame> pvf (
+               new PlayerVideoFrame (
+                       shared_ptr<ImageProxy> (new RawImageProxy (image, log)),
+                       Crop (),
+                       dcp::Size (1998, 1080),
+                       dcp::Size (1998, 1080),
+                       Scaler::from_id ("bicubic"),
+                       EYES_BOTH,
+                       PART_WHOLE,
+                       ColourConversion ()
+                       )
+               );
+
+       pvf->set_subtitle (PositionImage (sub_image, Position<int> (50, 60)));
+
+       shared_ptr<DCPVideoFrame> frame (
+               new DCPVideoFrame (
+                       pvf,
+                       0,
+                       24,
+                       200000000,
+                       RESOLUTION_2K,
+                       log
+                       )
+               );
+
+       shared_ptr<EncodedData> locally_encoded = frame->encode_locally ();
+       BOOST_ASSERT (locally_encoded);
+       
+       Server* server = new Server (log, true);
+
+       new thread (boost::bind (&Server::run, server, 2));
+
+       /* Let the server get itself ready */
+       dcpomatic_sleep (1);
+
+       ServerDescription description ("localhost", 2);
+
+       list<thread*> threads;
+       for (int i = 0; i < 8; ++i) {
+               threads.push_back (new thread (boost::bind (do_remote_encode, frame, description, locally_encoded)));
+       }
+
+       for (list<thread*>::iterator i = threads.begin(); i != threads.end(); ++i) {
+               (*i)->join ();
+       }
+
+       for (list<thread*>::iterator i = threads.begin(); i != threads.end(); ++i) {
+               delete *i;
+       }
+}
+
+BOOST_AUTO_TEST_CASE (client_server_test_yuv)
+{
+       shared_ptr<Image> image (new Image (PIX_FMT_YUV420P, dcp::Size (1998, 1080), true));
+       uint8_t* p = image->data()[0];
+
+       for (int i = 0; i < image->components(); ++i) {
+               uint8_t* p = image->data()[i];
+               for (int j = 0; j < image->line_size()[i]; ++j) {
+                       *p++ = j % 256;
+               }
+       }
+
+       shared_ptr<Image> sub_image (new Image (PIX_FMT_RGBA, dcp::Size (100, 200), true));
+       p = sub_image->data()[0];
+       for (int y = 0; y < 200; ++y) {
+               uint8_t* q = p;
+               for (int x = 0; x < 100; ++x) {
+                       *q++ = y % 256;
+                       *q++ = x % 256;
+                       *q++ = (x + y) % 256;
+                       *q++ = 1;
+               }
+               p += sub_image->stride()[0];
+       }
+
+       shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test_yuv.log"));
 
        shared_ptr<PlayerVideoFrame> pvf (
                new PlayerVideoFrame (
index 6dba4b71cf43531a0a9a4be690f34d1508b0da7d..7de169dd3e305ad23d76dbaf12b756ef80ccaebb 100644 (file)
@@ -32,6 +32,6 @@ BOOST_AUTO_TEST_CASE (colour_conversion_test)
        ColourConversion A (2.4, true, dcp::colour_matrix::srgb_to_xyz, 2.6);
        ColourConversion B (2.4, false, dcp::colour_matrix::srgb_to_xyz, 2.6);
 
-       BOOST_CHECK_EQUAL (A.identifier(), "246ff9b7dc32c0488948a32a713924b3");
-       BOOST_CHECK_EQUAL (B.identifier(), "a8d1da30f96a121d8db06a03409758b3");
+       BOOST_CHECK_EQUAL (A.identifier(), "1e720d2d99add654d7816f3b72da815e");
+       BOOST_CHECK_EQUAL (B.identifier(), "18751a247b22682b725bf9c4caf71522");
 }
index cc29f4472193255f0e5acc2020b5bf7df802975b..70f29b998933d355df2b793797ad36d38c9a0205 100644 (file)
@@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE (film_metadata_test)
        shared_ptr<Film> f = new_test_film ("film_metadata_test");
        boost::filesystem::path dir = test_film_dir ("film_metadata_test");
 
-       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);
 
index e1d4e43701270b8aeb99b8ec57e4d1fe5993e4db..e8ebcea3b959833ccb1009c561c7b99f4394bbf5 100644 (file)
@@ -28,6 +28,7 @@
 #include "lib/ffmpeg_content.h"
 #include "lib/playlist.h"
 #include "lib/ffmpeg_audio_stream.h"
+#include "lib/frame_rate_change.h"
 #include "test.h"
 
 using boost::shared_ptr;
diff --git a/test/isdcf_name_test.cc b/test/isdcf_name_test.cc
new file mode 100644 (file)
index 0000000..dd1b641
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+
+    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 <boost/test/unit_test.hpp>
+#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> 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: shouldn't be shown with trailers */
+
+       shared_ptr<ImageContent> 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_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF");
+
+       /* But should be shown for anything else */
+
+       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("XSN"));
+       BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-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_XSN-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_XSN-2-Temp-Pre-RedBand-MyChain-2D-4fl-48_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF");
+}
+
index 1ba2e7d88338179e0f698d7aafae2304a34c4e27..067f772ff1f4af6bcaa3541f1ba9f53f64efa383 100644 (file)
@@ -82,7 +82,7 @@ private:
 BOOST_AUTO_TEST_CASE (play_test)
 {
        shared_ptr<Film> 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");
 
@@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE (play_test)
                }
        }
 
-       player->seek (10 * TIME_HZ / 25, true);
+       wrap.seek (10 * TIME_HZ / 25, true);
        optional<Video> v = wrap.get_video ();
        BOOST_CHECK (v);
        BOOST_CHECK_EQUAL (v.get().time, 10 * TIME_HZ / 25);
index 31b882a2eaeeeb81ca4e99450c594f96fad73798..ae1009ea7bfc6d28b3af3e6030f10ecfba92be37 100644 (file)
@@ -44,7 +44,7 @@ note (dcp::NoteType t, string n)
 BOOST_AUTO_TEST_CASE (recover_test)
 {
        shared_ptr<Film> 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);
index 704c2c7dab65086829bb19e271879cd40cd8e313..441af6bf30514ecb2eaaafa58ae7deea3ffdaa16 100644 (file)
@@ -56,7 +56,7 @@ static void scaling_test_for (shared_ptr<Film> film, shared_ptr<VideoContent> co
 BOOST_AUTO_TEST_CASE (scaling_test)
 {
        shared_ptr<Film> 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<ImageContent> imc (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
 
index 82b9def0e12f3ccbfa471f7e977d1272576b0eca..d876a0228d7acafa9cd7ab0bb8319097c127869d 100644 (file)
@@ -43,7 +43,7 @@ test_silence_padding (int channels)
 {
        string const film_name = "silence_padding_test_" + lexical_cast<string> (channels);
        shared_ptr<Film> 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);
 
index f57023836bcf5d38a2dbc4b23b8f635a26d76b5c..1d8041656cf05e2acaf76081e327c00f7621661b 100644 (file)
@@ -67,7 +67,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<Ratio*> (0));
                Config::instance()->set_default_dcp_content_type (static_cast<DCPContentType*> (0));
                Config::instance()->set_default_audio_delay (0);
index c825506fb601999b1c1995247fdbe2027e3346a9..380d40d84e265d47a1fd7afc09c0903628c8178d 100644 (file)
@@ -34,6 +34,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
                  player_test.cc