Merge master.
authorCarl Hetherington <cth@carlh.net>
Fri, 16 May 2014 11:32:04 +0000 (12:32 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 16 May 2014 11:32:04 +0000 (12:32 +0100)
37 files changed:
ChangeLog
debian/changelog
src/lib/audio_content.cc
src/lib/audio_mapping.cc
src/lib/colour_conversion.cc
src/lib/config.cc
src/lib/config.h
src/lib/content.cc
src/lib/dci_metadata.cc
src/lib/dcp_video_frame.cc
src/lib/ffmpeg.cc
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_content.h
src/lib/ffmpeg_decoder.cc
src/lib/film.cc
src/lib/image_examiner.cc
src/lib/kdm.cc
src/lib/playlist.cc
src/lib/server.cc
src/lib/server_finder.cc
src/lib/sndfile_content.cc
src/lib/subrip_content.cc
src/lib/subtitle_content.cc
src/lib/update.cc
src/lib/util.cc
src/lib/util.h
src/lib/video_content.cc
src/tools/dcpomatic.cc
src/wx/audio_mapping_view.cc
src/wx/config_dialog.cc
src/wx/film_editor.cc
src/wx/film_editor.h
src/wx/kdm_dialog.h
src/wx/po/de_DE.po
src/wx/po/it_IT.po
src/wx/po/sv_SE.po
test/ratio_test.cc

index 662983a74a4598610f8752a66c8dc5d800c8c61c..33b7e2e2122049f2fdb9bc98245bce6f6b3d9c6b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,54 @@
 
        * Add subtitle view.
 
+2014-05-16  Carl Hetherington  <cth@carlh.net>
+
+       * Version 1.69.8 released.
+
+2014-05-16  Carl Hetherington  <cth@carlh.net>
+
+       * Fix various confusions in translations of abbreviated
+       channel names (Lc, Rc etc.)
+
+2014-05-14  Carl Hetherington  <cth@carlh.net>
+
+       * Version 1.69.7 released.
+
+2014-05-14  Carl Hetherington  <cth@carlh.net>
+
+       * Bump libdcp to remove checks on PCM MXF edit rates,
+       so we can generate strange ones in DCP-o-matic.
+
+2014-05-13  Carl Hetherington  <cth@carlh.net>
+
+       * Version 1.69.6 released.
+
+2014-05-13  Carl Hetherington  <cth@carlh.net>
+
+       * Remove artificial 100fps limit when using
+       "any" DCP frame rate.
+
+2014-05-12  Carl Hetherington  <cth@carlh.net>
+
+       * Version 1.69.5 released.
+
+2014-05-12  Carl Hetherington  <cth@carlh.net>
+
+       * Add option to use any DCP frame rate, rather than just
+       the "allowed" set.
+
+       * Version 1.69.4 released.
+
+2014-05-12  Carl Hetherington  <cth@carlh.net>
+
+       * Version 1.69.3 released.
+
+2014-05-12  Carl Hetherington  <cth@carlh.net>
+
+       * Use libdcp::raw_convert instead of boost::lexical_cast and
+       LocaleGuard, hopefully to fix large numbers being written with
+       thousands separators on some locales.
+
 2014-05-10  Carl Hetherington  <cth@carlh.net>
 
        * Version 1.69.2 released.
index 418ef9fa4966fe1009e5733c90db27ea441bd7dc..eb01ffe49ae4603375951ef90844a4a86b445c97 100644 (file)
@@ -1,4 +1,4 @@
-dcpomatic (1.69.2-1) UNRELEASED; urgency=low
+dcpomatic (1.69.8-1) UNRELEASED; urgency=low
 
   * New upstream release.
   * New upstream release.
@@ -126,8 +126,14 @@ dcpomatic (1.69.2-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>  Sat, 10 May 2014 13:40:32 +0100
+ -- Carl Hetherington <carl@d1stkfactory>  Fri, 16 May 2014 11:45:03 +0100
 
 dcpomatic (0.87-1) UNRELEASED; urgency=low
 
index d9e00ff1401ca4e3335ea51c2944aff404a94fae..e8fd4bbd39d0e93813bd78b325624307e60e4750 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include <libcxml/cxml.h>
+#include <dcp/raw_convert.h>
 #include "audio_content.h"
 #include "analyse_audio_job.h"
 #include "job_manager.h"
@@ -30,8 +31,8 @@
 using std::string;
 using std::vector;
 using boost::shared_ptr;
-using boost::lexical_cast;
 using boost::dynamic_pointer_cast;
+using dcp::raw_convert;
 
 int const AudioContentProperty::AUDIO_CHANNELS = 200;
 int const AudioContentProperty::AUDIO_LENGTH = 201;
@@ -59,8 +60,6 @@ AudioContent::AudioContent (shared_ptr<const Film> f, boost::filesystem::path p)
 AudioContent::AudioContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node)
        : Content (f, node)
 {
-       LocaleGuard lg;
-       
        _audio_gain = node->number_child<float> ("AudioGain");
        _audio_delay = node->number_child<int> ("AudioDelay");
 }
@@ -90,11 +89,9 @@ AudioContent::AudioContent (shared_ptr<const Film> f, vector<shared_ptr<Content>
 void
 AudioContent::as_xml (xmlpp::Node* node) const
 {
-       LocaleGuard lg;
-       
        boost::mutex::scoped_lock lm (_mutex);
-       node->add_child("AudioGain")->add_child_text (lexical_cast<string> (_audio_gain));
-       node->add_child("AudioDelay")->add_child_text (lexical_cast<string> (_audio_delay));
+       node->add_child("AudioGain")->add_child_text (raw_convert<string> (_audio_gain));
+       node->add_child("AudioDelay")->add_child_text (raw_convert<string> (_audio_delay));
 }
 
 
index 969397b0bdf9a1a43f696cfc9d4b22ac04e125ef..496300b48a746931f419748231f24f70364f4493 100644 (file)
@@ -17,9 +17,9 @@
 
 */
 
-#include <boost/lexical_cast.hpp>
 #include <libxml++/libxml++.h>
 #include <libcxml/cxml.h>
+#include <dcp/raw_convert.h>
 #include "audio_mapping.h"
 #include "util.h"
 
@@ -30,8 +30,8 @@ using std::pair;
 using std::string;
 using std::min;
 using boost::shared_ptr;
-using boost::lexical_cast;
 using boost::dynamic_pointer_cast;
+using dcp::raw_convert;
 
 AudioMapping::AudioMapping ()
        : _content_channels (0)
@@ -94,7 +94,7 @@ AudioMapping::AudioMapping (shared_ptr<const cxml::Node> node, int state_version
                        set (
                                (*i)->number_attribute<int> ("Content"),
                                static_cast<dcp::Channel> ((*i)->number_attribute<int> ("DCP")),
-                               lexical_cast<float> ((*i)->content ())
+                               raw_convert<float> ((*i)->content ())
                                );
                }
        }
@@ -115,14 +115,14 @@ AudioMapping::get (int c, dcp::Channel d) const
 void
 AudioMapping::as_xml (xmlpp::Node* node) const
 {
-       node->add_child ("ContentChannels")->add_child_text (lexical_cast<string> (_content_channels));
+       node->add_child ("ContentChannels")->add_child_text (raw_convert<string> (_content_channels));
 
        for (int c = 0; c < _content_channels; ++c) {
                for (int d = 0; d < MAX_DCP_AUDIO_CHANNELS; ++d) {
                        xmlpp::Element* t = node->add_child ("Gain");
-                       t->set_attribute ("Content", lexical_cast<string> (c));
-                       t->set_attribute ("DCP", lexical_cast<string> (d));
-                       t->add_child_text (lexical_cast<string> (get (c, static_cast<dcp::Channel> (d))));
+                       t->set_attribute ("Content", raw_convert<string> (c));
+                       t->set_attribute ("DCP", raw_convert<string> (d));
+                       t->add_child_text (raw_convert<string> (get (c, static_cast<dcp::Channel> (d))));
                }
        }
 }
index e4a2a84bff4bc826355d0d20c60bbba4eb9b49e0..73ee722490eaa33a7b46c1182459f9ea0164d67a 100644 (file)
@@ -17,9 +17,9 @@
 
 */
 
-#include <boost/lexical_cast.hpp>
 #include <libxml++/libxml++.h>
 #include <dcp/colour_matrix.h>
+#include <dcp/raw_convert.h>
 #include <libcxml/cxml.h>
 #include "config.h"
 #include "colour_conversion.h"
@@ -32,8 +32,8 @@ using std::string;
 using std::cout;
 using std::vector;
 using boost::shared_ptr;
-using boost::lexical_cast;
 using boost::optional;
+using dcp::raw_convert;
 
 ColourConversion::ColourConversion ()
        : input_gamma (2.4)
@@ -64,8 +64,6 @@ ColourConversion::ColourConversion (double i, bool il, double const m[3][3], dou
 ColourConversion::ColourConversion (cxml::NodePtr node)
        : matrix (3, 3)
 {
-       LocaleGuard lg;
-       
        input_gamma = node->number_child<double> ("InputGamma");
        input_gamma_linearised = node->bool_child ("InputGammaLinearised");
 
@@ -79,7 +77,7 @@ ColourConversion::ColourConversion (cxml::NodePtr node)
        for (list<cxml::NodePtr>::iterator i = m.begin(); i != m.end(); ++i) {
                int const ti = (*i)->number_attribute<int> ("i");
                int const tj = (*i)->number_attribute<int> ("j");
-               matrix(ti, tj) = lexical_cast<double> ((*i)->content ());
+               matrix(ti, tj) = raw_convert<double> ((*i)->content ());
        }
 
        output_gamma = node->number_child<double> ("OutputGamma");
@@ -88,21 +86,19 @@ ColourConversion::ColourConversion (cxml::NodePtr node)
 void
 ColourConversion::as_xml (xmlpp::Node* node) const
 {
-       LocaleGuard lg;
-       
-       node->add_child("InputGamma")->add_child_text (lexical_cast<string> (input_gamma));
+       node->add_child("InputGamma")->add_child_text (raw_convert<string> (input_gamma));
        node->add_child("InputGammaLinearised")->add_child_text (input_gamma_linearised ? "1" : "0");
 
        for (int i = 0; i < 3; ++i) {
                for (int j = 0; j < 3; ++j) {
                        xmlpp::Element* m = node->add_child("Matrix");
-                       m->set_attribute ("i", lexical_cast<string> (i));
-                       m->set_attribute ("j", lexical_cast<string> (j));
-                       m->add_child_text (lexical_cast<string> (matrix (i, j)));
+                       m->set_attribute ("i", raw_convert<string> (i));
+                       m->set_attribute ("j", raw_convert<string> (j));
+                       m->add_child_text (raw_convert<string> (matrix (i, j)));
                }
        }
 
-       node->add_child("OutputGamma")->add_child_text (lexical_cast<string> (output_gamma));
+       node->add_child("OutputGamma")->add_child_text (raw_convert<string> (output_gamma));
 }
 
 optional<size_t>
index ca8d0bc53c407182c8b39dc0770648574f1d9e51..754346418e2f4c83b66b0972a1e7868497620fd5 100644 (file)
@@ -24,6 +24,7 @@
 #include <boost/filesystem.hpp>
 #include <boost/algorithm/string.hpp>
 #include <dcp/colour_matrix.h>
+#include <dcp/raw_convert.h>
 #include <libcxml/cxml.h>
 #include "config.h"
 #include "server.h"
@@ -46,10 +47,10 @@ using std::max;
 using std::exception;
 using std::cerr;
 using boost::shared_ptr;
-using boost::lexical_cast;
 using boost::optional;
 using boost::algorithm::is_any_of;
 using boost::algorithm::split;
+using dcp::raw_convert;
 
 Config* Config::_instance = 0;
 
@@ -60,6 +61,7 @@ Config::Config ()
        , _use_any_servers (true)
        , _tms_path (".")
        , _sound_processor (SoundProcessor::from_id (N_("dolby_cp750")))
+       , _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"))
@@ -87,8 +89,6 @@ Config::Config ()
 void
 Config::read ()
 {
-       LocaleGuard lg;
-       
        if (!boost::filesystem::exists (file (false))) {
                read_old_metadata ();
                return;
@@ -188,6 +188,7 @@ Config::read ()
        _check_for_test_updates = f.optional_bool_child("CheckForTestUpdates").get_value_or (false);
 
        _maximum_j2k_bandwidth = f.optional_number_child<int> ("MaximumJ2KBandwidth").get_value_or (250000000);
+       _allow_any_dcp_frame_rate = f.optional_bool_child ("AllowAnyDCPFrameRate");
 }
 
 void
@@ -308,15 +309,13 @@ Config::instance ()
 void
 Config::write () const
 {
-       LocaleGuard lg;
-       
        xmlpp::Document doc;
        xmlpp::Element* root = doc.create_root_node ("Config");
 
        root->add_child("Version")->add_child_text ("1");
-       root->add_child("NumLocalEncodingThreads")->add_child_text (lexical_cast<string> (_num_local_encoding_threads));
+       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 (lexical_cast<string> (_server_port_base));
+       root->add_child("ServerPortBase")->add_child_text (raw_convert<string> (_server_port_base));
        root->add_child("UseAnyServers")->add_child_text (_use_any_servers ? "1" : "0");
        
        for (vector<string>::const_iterator i = _servers.begin(); i != _servers.end(); ++i) {
@@ -344,9 +343,9 @@ Config::write () const
 
        _default_dci_metadata.as_xml (root->add_child ("DCIMetadata"));
 
-       root->add_child("DefaultStillLength")->add_child_text (lexical_cast<string> (_default_still_length));
-       root->add_child("DefaultJ2KBandwidth")->add_child_text (lexical_cast<string> (_default_j2k_bandwidth));
-       root->add_child("DefaultAudioDelay")->add_child_text (lexical_cast<string> (_default_audio_delay));
+       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));
+       root->add_child("DefaultAudioDelay")->add_child_text (raw_convert<string> (_default_audio_delay));
 
        for (vector<PresetColourConversion>::const_iterator i = _colour_conversions.begin(); i != _colour_conversions.end(); ++i) {
                i->as_xml (root->add_child ("ColourConversion"));
@@ -365,8 +364,9 @@ Config::write () const
        root->add_child("CheckForUpdates")->add_child_text (_check_for_updates ? "1" : "0");
        root->add_child("CheckForTestUpdates")->add_child_text (_check_for_test_updates ? "1" : "0");
 
-       root->add_child("MaximumJ2KBandwidth")->add_child_text (lexical_cast<string> (_maximum_j2k_bandwidth));
-
+       root->add_child("MaximumJ2KBandwidth")->add_child_text (raw_convert<string> (_maximum_j2k_bandwidth));
+       root->add_child("AllowAnyDCPFrameRate")->add_child_text (_allow_any_dcp_frame_rate ? "1" : "0");
+       
        doc.write_to_file_formatted (file(false).string ());
 }
 
index ee11dcadbefb071cf606a07e9114275a5974c469..ffaacf8f17870fcfc559732d7b41c9b39b7b29ec 100644 (file)
@@ -116,6 +116,10 @@ public:
        std::list<int> allowed_dcp_frame_rates () const {
                return _allowed_dcp_frame_rates;
        }
+
+       bool allow_any_dcp_frame_rate () const {
+               return _allow_any_dcp_frame_rate;
+       }
        
        DCIMetadata default_dci_metadata () const {
                return _default_dci_metadata;
@@ -241,6 +245,11 @@ public:
                changed ();
        }
 
+       void set_allow_any_dcp_frame_rate (bool a) {
+               _allow_any_dcp_frame_rate = a;
+               changed ();
+       }
+
        void set_default_dci_metadata (DCIMetadata d) {
                _default_dci_metadata = d;
                changed ();
@@ -369,6 +378,8 @@ private:
        /** Our sound processor */
        SoundProcessor const * _sound_processor;
        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;
        boost::optional<std::string> _language;
index 0c37d938637cd8af26ad8e9db32b5f7bce0f9409..c4836cfa89a643c1838bc94ef302a99c661d9418 100644 (file)
@@ -24,6 +24,7 @@
 #include <boost/thread/mutex.hpp>
 #include <libxml++/libxml++.h>
 #include <libcxml/cxml.h>
+#include <dcp/raw_convert.h>
 #include "content.h"
 #include "util.h"
 #include "content_factory.h"
@@ -40,7 +41,7 @@ using std::list;
 using std::cout;
 using std::vector;
 using boost::shared_ptr;
-using boost::lexical_cast;
+using dcp::raw_convert;
 
 int const ContentProperty::PATH = 400;
 int const ContentProperty::POSITION = 401;
@@ -123,9 +124,9 @@ Content::as_xml (xmlpp::Node* node) const
                node->add_child("Path")->add_child_text (i->string ());
        }
        node->add_child("Digest")->add_child_text (_digest);
-       node->add_child("Position")->add_child_text (lexical_cast<string> (_position.get ()));
-       node->add_child("TrimStart")->add_child_text (lexical_cast<string> (_trim_start.get ()));
-       node->add_child("TrimEnd")->add_child_text (lexical_cast<string> (_trim_end.get ()));
+       node->add_child("Position")->add_child_text (raw_convert<string> (_position.get ()));
+       node->add_child("TrimStart")->add_child_text (raw_convert<string> (_trim_start.get ()));
+       node->add_child("TrimEnd")->add_child_text (raw_convert<string> (_trim_end.get ()));
 }
 
 void
index 27306a15e48f2c1f6c44c7eb10bf90867a98a7f2..2c6e43654915b239d94f4ff6acb61df9389d42fa 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+    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
 
 #include <iostream>
 #include <libcxml/cxml.h>
+#include <dcp/raw_convert.h>
 #include "dci_metadata.h"
 
 #include "i18n.h"
 
 using std::string;
-using boost::lexical_cast;
 using boost::shared_ptr;
+using dcp::raw_convert;
 
 DCIMetadata::DCIMetadata (shared_ptr<const cxml::Node> node)
 {
@@ -42,7 +43,7 @@ DCIMetadata::DCIMetadata (shared_ptr<const cxml::Node> node)
 void
 DCIMetadata::as_xml (xmlpp::Node* root) const
 {
-       root->add_child("ContentVersion")->add_child_text (lexical_cast<string> (content_version));
+       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);
index 2b7a2e18f6b2ff712ba6baf47b9e074f44681676..59f356a5a78b297e0f54da14143a8ef43e2345a1 100644 (file)
@@ -47,6 +47,7 @@
 #include <dcp/xyz_frame.h>
 #include <dcp/rgb_xyz.h>
 #include <dcp/colour_matrix.h>
+#include <dcp/raw_convert.h>
 #include <libcxml/cxml.h>
 #include "film.h"
 #include "dcp_video_frame.h"
@@ -67,6 +68,7 @@ using std::cout;
 using boost::shared_ptr;
 using boost::lexical_cast;
 using dcp::Size;
+using dcp::raw_convert;
 
 #define DCI_COEFFICENT (48.0 / 52.37)
 
@@ -270,7 +272,7 @@ DCPVideoFrame::encode_remotely (ServerDescription serv)
 {
        boost::asio::io_service io_service;
        boost::asio::ip::tcp::resolver resolver (io_service);
-       boost::asio::ip::tcp::resolver::query query (serv.host_name(), boost::lexical_cast<string> (Config::instance()->server_port_base ()));
+       boost::asio::ip::tcp::resolver::query query (serv.host_name(), raw_convert<string> (Config::instance()->server_port_base ()));
        boost::asio::ip::tcp::resolver::iterator endpoint_iterator = resolver.resolve (query);
 
        shared_ptr<Socket> socket (new Socket);
@@ -280,9 +282,9 @@ DCPVideoFrame::encode_remotely (ServerDescription serv)
        xmlpp::Document doc;
        xmlpp::Element* root = doc.create_root_node ("EncodingRequest");
 
-       root->add_child("Version")->add_child_text (lexical_cast<string> (SERVER_LINK_VERSION));
-       root->add_child("Width")->add_child_text (lexical_cast<string> (_image->size().width));
-       root->add_child("Height")->add_child_text (lexical_cast<string> (_image->size().height));
+       root->add_child("Version")->add_child_text (raw_convert<string> (SERVER_LINK_VERSION));
+       root->add_child("Width")->add_child_text (raw_convert<string> (_image->size().width));
+       root->add_child("Height")->add_child_text (raw_convert<string> (_image->size().height));
        add_metadata (root);
 
        stringstream xml;
@@ -306,7 +308,7 @@ DCPVideoFrame::encode_remotely (ServerDescription serv)
 void
 DCPVideoFrame::add_metadata (xmlpp::Element* el) const
 {
-       el->add_child("Frame")->add_child_text (lexical_cast<string> (_frame));
+       el->add_child("Frame")->add_child_text (raw_convert<string> (_frame));
 
        switch (_eyes) {
        case EYES_BOTH:
@@ -324,9 +326,9 @@ DCPVideoFrame::add_metadata (xmlpp::Element* el) const
        
        _conversion.as_xml (el->add_child("ColourConversion"));
 
-       el->add_child("FramesPerSecond")->add_child_text (lexical_cast<string> (_frames_per_second));
-       el->add_child("J2KBandwidth")->add_child_text (lexical_cast<string> (_j2k_bandwidth));
-       el->add_child("Resolution")->add_child_text (lexical_cast<string> (int (_resolution)));
+       el->add_child("FramesPerSecond")->add_child_text (raw_convert<string> (_frames_per_second));
+       el->add_child("J2KBandwidth")->add_child_text (raw_convert<string> (_j2k_bandwidth));
+       el->add_child("Resolution")->add_child_text (raw_convert<string> (int (_resolution)));
 }
 
 EncodedData::EncodedData (int s)
index a98aa98289e6839dedf04ccc557c33b68d1e9c71..316b9614de6f27bb18b26278e2fd21006e65d95f 100644 (file)
@@ -22,6 +22,7 @@ extern "C" {
 #include <libavformat/avformat.h>
 #include <libswscale/swscale.h>
 }
+#include <dcp/raw_convert.h>
 #include "ffmpeg.h"
 #include "ffmpeg_content.h"
 #include "exceptions.h"
@@ -33,7 +34,7 @@ using std::string;
 using std::cout;
 using std::stringstream;
 using boost::shared_ptr;
-using boost::lexical_cast;
+using dcp::raw_convert;
 
 boost::mutex FFmpeg::_mutex;
 
@@ -94,8 +95,8 @@ FFmpeg::setup_general ()
        /* These durations are in microseconds, and represent how far into the content file
           we will look for streams.
        */
-       av_dict_set (&options, "analyzeduration", lexical_cast<string> (5 * 60 * 1e6).c_str(), 0);
-       av_dict_set (&options, "probesize", lexical_cast<string> (5 * 60 * 1e6).c_str(), 0);
+       av_dict_set (&options, "analyzeduration", raw_convert<string> (5 * 60 * 1000000).c_str(), 0);
+       av_dict_set (&options, "probesize", raw_convert<string> (5 * 60 * 1000000).c_str(), 0);
        
        if (avformat_open_input (&_format_context, 0, 0, &options) < 0) {
                throw OpenFileError (_ffmpeg_content->path(0).string ());
index a51cb3de805cdcdefe8910e9c8bade812601441d..a374bcf3e7496932b5f843c16e4b07458286a4fa 100644 (file)
@@ -21,6 +21,7 @@ extern "C" {
 #include <libavformat/avformat.h>
 }
 #include <libcxml/cxml.h>
+#include <libdcp/raw_convert.h>
 #include "ffmpeg_content.h"
 #include "ffmpeg_examiner.h"
 #include "compose.hpp"
@@ -40,8 +41,8 @@ using std::list;
 using std::cout;
 using std::pair;
 using boost::shared_ptr;
-using boost::lexical_cast;
 using boost::dynamic_pointer_cast;
+using libdcp::raw_convert;
 
 int const FFmpegContentProperty::SUBTITLE_STREAMS = 100;
 int const FFmpegContentProperty::SUBTITLE_STREAM = 101;
@@ -152,7 +153,7 @@ FFmpegContent::as_xml (xmlpp::Node* node) const
        }
 
        if (_first_video) {
-               node->add_child("FirstVideo")->add_child_text (lexical_cast<string> (_first_video.get().get()));
+               node->add_child("FirstVideo")->add_child_text (raw_convert<string> (_first_video.get().get()));
        }
 }
 
@@ -322,7 +323,7 @@ void
 FFmpegStream::as_xml (xmlpp::Node* root) const
 {
        root->add_child("Name")->add_child_text (name);
-       root->add_child("Id")->add_child_text (lexical_cast<string> (_id));
+       root->add_child("Id")->add_child_text (raw_convert<string> (_id));
 }
 
 FFmpegAudioStream::FFmpegAudioStream (shared_ptr<const cxml::Node> node, int version)
@@ -338,10 +339,10 @@ void
 FFmpegAudioStream::as_xml (xmlpp::Node* root) const
 {
        FFmpegStream::as_xml (root);
-       root->add_child("FrameRate")->add_child_text (lexical_cast<string> (frame_rate));
-       root->add_child("Channels")->add_child_text (lexical_cast<string> (channels));
+       root->add_child("FrameRate")->add_child_text (raw_convert<string> (frame_rate));
+       root->add_child("Channels")->add_child_text (raw_convert<string> (channels));
        if (first_audio) {
-               root->add_child("FirstAudio")->add_child_text (lexical_cast<string> (first_audio.get().get()));
+               root->add_child("FirstAudio")->add_child_text (raw_convert<string> (first_audio.get().get()));
        }
        mapping.as_xml (root->add_child("Mapping"));
 }
index 1ab0a92d0ed2f89dc329d66a0b392581a499af5c..37746ac9db213ed73ec9a63931347c3ed2475360 100644 (file)
@@ -21,6 +21,7 @@
 #define DCPOMATIC_FFMPEG_CONTENT_H
 
 #include <boost/enable_shared_from_this.hpp>
+#include <boost/lexical_cast.hpp>
 #include "video_content.h"
 #include "audio_content.h"
 #include "subtitle_content.h"
index 0a4624569f9239a952ca0c6824a5adf09f16ab55..9ae5f0485246d2f88b42432adcfcf479a1eb711a 100644 (file)
@@ -27,7 +27,6 @@
 #include <iomanip>
 #include <iostream>
 #include <stdint.h>
-#include <boost/lexical_cast.hpp>
 #include <sndfile.h>
 extern "C" {
 #include <libavcodec/avcodec.h>
index 33cb304600cda8146deb44a6d1ada1e214925729..bdd650437568cd62ce2702ac931383384cc20666 100644 (file)
@@ -35,6 +35,7 @@
 #include <dcp/signer.h>
 #include <dcp/util.h>
 #include <dcp/local_time.h>
+#include <dcp/raw_convert.h>
 #include "film.h"
 #include "job.h"
 #include "util.h"
@@ -71,7 +72,6 @@ using std::cout;
 using std::list;
 using boost::shared_ptr;
 using boost::weak_ptr;
-using boost::lexical_cast;
 using boost::dynamic_pointer_cast;
 using boost::to_upper_copy;
 using boost::ends_with;
@@ -79,6 +79,7 @@ using boost::starts_with;
 using boost::optional;
 using dcp::Size;
 using dcp::Signer;
+using dcp::raw_convert;
 
 /* 5 -> 6
  * AudioMapping XML changed.
@@ -151,9 +152,10 @@ string
 Film::video_identifier () const
 {
        assert (container ());
-       LocaleGuard lg;
 
        stringstream s;
+       s.imbue (std::locale::classic ());
+       
        s << container()->id()
          << "_" << resolution_to_string (_resolution)
          << "_" << _playlist->video_identifier()
@@ -339,12 +341,10 @@ Film::encoded_frames () const
 shared_ptr<xmlpp::Document>
 Film::metadata () const
 {
-       LocaleGuard lg;
-
        shared_ptr<xmlpp::Document> doc (new xmlpp::Document);
        xmlpp::Element* root = doc->create_root_node ("Metadata");
 
-       root->add_child("Version")->add_child_text (lexical_cast<string> (current_state_version));
+       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");
 
@@ -359,11 +359,11 @@ Film::metadata () const
        root->add_child("Resolution")->add_child_text (resolution_to_string (_resolution));
        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 (lexical_cast<string> (_j2k_bandwidth));
+       root->add_child("J2KBandwidth")->add_child_text (raw_convert<string> (_j2k_bandwidth));
        _dci_metadata.as_xml (root->add_child ("DCIMetadata"));
-       root->add_child("VideoFrameRate")->add_child_text (lexical_cast<string> (_video_frame_rate));
+       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("AudioChannels")->add_child_text (lexical_cast<string> (_audio_channels));
+       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");
        root->add_child("Interop")->add_child_text (_interop ? "1" : "0");
@@ -391,8 +391,6 @@ Film::write_metadata () const
 list<string>
 Film::read_metadata ()
 {
-       LocaleGuard lg;
-
        if (boost::filesystem::exists (file ("metadata")) && !boost::filesystem::exists (file ("metadata.xml"))) {
                throw StringError (_("This film was created with an older version of DCP-o-matic, and unfortunately it cannot be loaded into this version.  You will need to create a new Film, re-add your content and set it up again.  Sorry!"));
        }
index 3897bbf37b0a5f4c2fc219e0b47c12712ae3708e..004b89e659d47ebd24cb594bc06848d2651585d4 100644 (file)
@@ -18,7 +18,6 @@
 */
 
 #include <iostream>
-#include <boost/lexical_cast.hpp>
 #include <Magick++.h>
 #include "image_content.h"
 #include "image_examiner.h"
@@ -33,8 +32,6 @@ using std::cout;
 using std::list;
 using std::sort;
 using boost::shared_ptr;
-using boost::lexical_cast;
-using boost::bad_lexical_cast;
 
 ImageExaminer::ImageExaminer (shared_ptr<const Film> film, shared_ptr<const ImageContent> content, shared_ptr<Job>)
        : _film (film)
index 793a3fa0eb5c0cea99d0edc60424742490ea3fae..902f0d33322a48617e71e193801780704a46ca39 100644 (file)
@@ -164,6 +164,9 @@ make_cinema_kdms (
        return cinema_kdms;
 }
 
+/** @param from KDM from time in local time.
+ *  @param to KDM to time in local time.
+ */
 void
 write_kdm_files (
        shared_ptr<const Film> film,
index 1e8a3319c54ed0569f0d555902d973eb61155d81..9a048980c0b02aebadd481db236149df8544de8e 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <libcxml/cxml.h>
 #include <boost/shared_ptr.hpp>
-#include <boost/lexical_cast.hpp>
 #include "playlist.h"
 #include "sndfile_content.h"
 #include "sndfile_decoder.h"
@@ -46,7 +45,6 @@ using boost::optional;
 using boost::shared_ptr;
 using boost::weak_ptr;
 using boost::dynamic_pointer_cast;
-using boost::lexical_cast;
 
 Playlist::Playlist ()
        : _sequence_video (true)
index bf7541c3379f1f294f735f4c130b06994b0311d8..6bcff7e6e93db1204cfc2d2ec73c7179a99b55ce 100644 (file)
@@ -27,9 +27,9 @@
 #include <sstream>
 #include <iostream>
 #include <boost/algorithm/string.hpp>
-#include <boost/lexical_cast.hpp>
 #include <boost/scoped_array.hpp>
 #include <libcxml/cxml.h>
+#include <dcp/raw_convert.h>
 #include "server.h"
 #include "util.h"
 #include "scaler.h"
@@ -56,8 +56,8 @@ using boost::thread;
 using boost::bind;
 using boost::scoped_array;
 using boost::optional;
-using boost::lexical_cast;
 using dcp::Size;
+using dcp::raw_convert;
 
 Server::Server (shared_ptr<Log> log, bool verbose)
        : _log (log)
@@ -246,7 +246,7 @@ Server::broadcast_received ()
                /* Reply to the client saying what we can do */
                xmlpp::Document doc;
                xmlpp::Element* root = doc.create_root_node ("ServerAvailable");
-               root->add_child("Threads")->add_child_text (lexical_cast<string> (_worker_threads.size ()));
+               root->add_child("Threads")->add_child_text (raw_convert<string> (_worker_threads.size ()));
                stringstream xml;
                doc.write_to_stream (xml, "UTF-8");
 
index 1080d24c4103765fce705019b177c19b4a415275..de8a3852c5cf45c0abd52faaf94b4f08ee24e94c 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include <libcxml/cxml.h>
+#include <dcp/raw_convert.h>
 #include "server_finder.h"
 #include "exceptions.h"
 #include "util.h"
@@ -32,7 +33,7 @@ using std::vector;
 using std::cout;
 using boost::shared_ptr;
 using boost::scoped_array;
-using boost::lexical_cast;
+using dcp::raw_convert;
 
 ServerFinder* ServerFinder::_instance = 0;
 
@@ -82,7 +83,7 @@ try
                        }
                        try {
                                boost::asio::ip::udp::resolver resolver (io_service);
-                               boost::asio::ip::udp::resolver::query query (*i, lexical_cast<string> (Config::instance()->server_port_base() + 1));
+                               boost::asio::ip::udp::resolver::query query (*i, raw_convert<string> (Config::instance()->server_port_base() + 1));
                                boost::asio::ip::udp::endpoint end_point (*resolver.resolve (query));
                                socket.send_to (boost::asio::buffer (data.c_str(), data.size() + 1), end_point);
                        } catch (...) {
index 0cf65967f2172ac1f8ad7d57a6a648cfcd05a45d..cad5eb8e73704d2ba15bdf6d2b0a58210c112ade 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include <libcxml/cxml.h>
+#include <dcp/raw_convert.h>
 #include "sndfile_content.h"
 #include "sndfile_decoder.h"
 #include "film.h"
@@ -31,7 +32,7 @@ using std::string;
 using std::stringstream;
 using std::cout;
 using boost::shared_ptr;
-using boost::lexical_cast;
+using dcp::raw_convert;
 
 SndfileContent::SndfileContent (shared_ptr<const Film> f, boost::filesystem::path p)
        : Content (f, p)
@@ -132,9 +133,9 @@ SndfileContent::as_xml (xmlpp::Node* node) const
        Content::as_xml (node);
        AudioContent::as_xml (node);
 
-       node->add_child("AudioChannels")->add_child_text (lexical_cast<string> (audio_channels ()));
-       node->add_child("AudioLength")->add_child_text (lexical_cast<string> (audio_length().get ()));
-       node->add_child("AudioFrameRate")->add_child_text (lexical_cast<string> (audio_frame_rate ()));
+       node->add_child("AudioChannels")->add_child_text (raw_convert<string> (audio_channels ()));
+       node->add_child("AudioLength")->add_child_text (raw_convert<string> (audio_length().get ()));
+       node->add_child("AudioFrameRate")->add_child_text (raw_convert<string> (audio_frame_rate ()));
        _audio_mapping.as_xml (node->add_child("AudioMapping"));
 }
 
index eb9c67d9a1948b709544c9cee4588e7e431545ce..8f9c28e293c15bfe9335e0f9f7fe9bc24edca1de 100644 (file)
 #include "util.h"
 #include "subrip.h"
 #include "film.h"
+#include <dcp/raw_convert.h>
 
 #include "i18n.h"
 
 using std::stringstream;
 using std::string;
 using std::cout;
+using dcp::raw_convert;
 using boost::shared_ptr;
 using boost::lexical_cast;
 
@@ -81,12 +83,10 @@ SubRipContent::information () const
 void
 SubRipContent::as_xml (xmlpp::Node* node) const
 {
-       LocaleGuard lg;
-       
        node->add_child("Type")->add_child_text ("SubRip");
        Content::as_xml (node);
        SubtitleContent::as_xml (node);
-       node->add_child("Length")->add_child_text (lexical_cast<string> (_length.get ()));
+       node->add_child("Length")->add_child_text (raw_convert<string> (_length.get ()));
 }
 
 DCPTime
@@ -101,13 +101,11 @@ SubRipContent::full_length () const
 string
 SubRipContent::identifier () const
 {
-       LocaleGuard lg;
-
        stringstream s;
        s << Content::identifier()
-         << "_" << subtitle_scale()
-         << "_" << subtitle_x_offset()
-         << "_" << subtitle_y_offset();
+         << "_" << raw_convert<string> (subtitle_scale())
+         << "_" << raw_convert<string> (subtitle_x_offset())
+         << "_" << raw_convert<string> (subtitle_y_offset());
 
        return s.str ();
 }
index 4c6e601926d2ebf096450a443ee7560bda152fba..783c73e254aaa75b743adae6b5c5851b84d4b3b7 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-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
@@ -18,6 +18,7 @@
 */
 
 #include <libcxml/cxml.h>
+#include <dcp/raw_convert.h>
 #include "subtitle_content.h"
 #include "util.h"
 #include "exceptions.h"
@@ -28,8 +29,8 @@ using std::string;
 using std::vector;
 using std::cout;
 using boost::shared_ptr;
-using boost::lexical_cast;
 using boost::dynamic_pointer_cast;
+using dcp::raw_convert;
 
 int const SubtitleContentProperty::SUBTITLE_X_OFFSET = 500;
 int const SubtitleContentProperty::SUBTITLE_Y_OFFSET = 501;
@@ -50,8 +51,6 @@ SubtitleContent::SubtitleContent (shared_ptr<const Film> f, shared_ptr<const cxm
        , _subtitle_y_offset (0)
        , _subtitle_scale (1)
 {
-       LocaleGuard lg;
-
        if (version >= 7) {
                _subtitle_x_offset = node->number_child<float> ("SubtitleXOffset");
                _subtitle_y_offset = node->number_child<float> ("SubtitleYOffset");
@@ -92,11 +91,9 @@ SubtitleContent::SubtitleContent (shared_ptr<const Film> f, vector<shared_ptr<Co
 void
 SubtitleContent::as_xml (xmlpp::Node* root) const
 {
-       LocaleGuard lg;
-       
-       root->add_child("SubtitleXOffset")->add_child_text (lexical_cast<string> (_subtitle_x_offset));
-       root->add_child("SubtitleYOffset")->add_child_text (lexical_cast<string> (_subtitle_y_offset));
-       root->add_child("SubtitleScale")->add_child_text (lexical_cast<string> (_subtitle_scale));
+       root->add_child("SubtitleXOffset")->add_child_text (raw_convert<string> (_subtitle_x_offset));
+       root->add_child("SubtitleYOffset")->add_child_text (raw_convert<string> (_subtitle_y_offset));
+       root->add_child("SubtitleScale")->add_child_text (raw_convert<string> (_subtitle_scale));
 }
 
 void
index 019db8e761ea619c26848ec822c16b517f363ea1..c7527ee493624247468b365cde6b2363acb5496f 100644 (file)
@@ -22,6 +22,7 @@
 #include <boost/algorithm/string.hpp>
 #include <curl/curl.h>
 #include <libcxml/cxml.h>
+#include <dcp/raw_convert.h>
 #include "update.h"
 #include "version.h"
 #include "ui_signaller.h"
@@ -32,7 +33,7 @@ using std::cout;
 using std::min;
 using std::string;
 using std::stringstream;
-using boost::lexical_cast;
+using dcp::raw_convert;
 
 /** Singleton instance */
 UpdateChecker* UpdateChecker::_instance = 0;
@@ -130,12 +131,12 @@ UpdateChecker::thread ()
                                current_pre = true;
                        }
                        
-                       float current_float = lexical_cast<float> (current);
+                       float current_float = raw_convert<float> (current);
                        if (current_pre) {
                                current_float -= 0.005;
                        }
                        
-                       if (current_float < lexical_cast<float> (_stable)) {
+                       if (current_float < raw_convert<float> (_stable)) {
                                set_state (YES);
                        } else {
                                set_state (NO);
index 0eb14845d7da6dba601412a34c72544cd590db4b..14dfd1fa558b6afa86c7dc03a2b05b139d9bce4d 100644 (file)
@@ -37,7 +37,6 @@
 #include <boost/algorithm/string.hpp>
 #include <boost/bind.hpp>
 #include <boost/lambda/lambda.hpp>
-#include <boost/lexical_cast.hpp>
 #include <boost/thread.hpp>
 #include <boost/filesystem.hpp>
 #ifdef DCPOMATIC_WINDOWS
@@ -53,6 +52,7 @@
 #include <dcp/util.h>
 #include <dcp/signer_chain.h>
 #include <dcp/signer.h>
+#include <dcp/raw_convert.h>
 extern "C" {
 #include <libavcodec/avcodec.h>
 #include <libavformat/avformat.h>
@@ -101,9 +101,9 @@ using std::streampos;
 using std::set_terminate;
 using boost::shared_ptr;
 using boost::thread;
-using boost::lexical_cast;
 using boost::optional;
 using dcp::Size;
+using dcp::raw_convert;
 
 static boost::thread::id ui_thread;
 static boost::filesystem::path backtrace_file;
@@ -687,14 +687,14 @@ int
 get_required_int (multimap<string, string> const & kv, string k)
 {
        string const v = get_required_string (kv, k);
-       return lexical_cast<int> (v);
+       return raw_convert<int> (v);
 }
 
 float
 get_required_float (multimap<string, string> const & kv, string k)
 {
        string const v = get_required_string (kv, k);
-       return lexical_cast<float> (v);
+       return raw_convert<float> (v);
 }
 
 string
@@ -724,7 +724,7 @@ get_optional_int (multimap<string, string> const & kv, string k)
                return 0;
        }
 
-       return lexical_cast<int> (i->second);
+       return raw_convert<int> (i->second);
 }
 
 /** Trip an assert if the caller is not in the UI thread */
@@ -761,25 +761,6 @@ audio_channel_name (int c)
        return channels[c];
 }
 
-LocaleGuard::LocaleGuard ()
-       : _old (0)
-{
-       char const * old = setlocale (LC_NUMERIC, 0);
-
-       if (old) {
-               _old = strdup (old);
-               if (strcmp (_old, "C")) {
-                       setlocale (LC_NUMERIC, "C");
-               }
-       }
-}
-
-LocaleGuard::~LocaleGuard ()
-{
-       setlocale (LC_NUMERIC, _old);
-       free (_old);
-}
-
 bool
 valid_image_file (boost::filesystem::path f)
 {
index 8e65bbb5415cc236e496e56a83b92dbd45503082..58c2771b7cebd8e46b9d700c3218041abd3dadd4 100644 (file)
@@ -131,15 +131,7 @@ private:
        int _timeout;
 };
 
-class LocaleGuard
-{
-public:
-       LocaleGuard ();
-       ~LocaleGuard ();
-       
-private:
-       char* _old;
-};
+extern int64_t video_frames_to_audio_frames (VideoContent::Frame v, float audio_sample_rate, float frames_per_second);
 
 /** @class ScopedTemporary
  *  @brief A temporary file which is deleted when the ScopedTemporary object goes out of scope.
index 9edbc104a92d3daa77a0a19b46dd18d55317c14e..bd24621f79fe72c144d04bf33edaf908cadb61b8 100644 (file)
@@ -20,6 +20,7 @@
 #include <iomanip>
 #include <libcxml/cxml.h>
 #include <dcp/colour_matrix.h>
+#include <dcp/raw_convert.h>
 #include "video_content.h"
 #include "video_examiner.h"
 #include "compose.hpp"
@@ -45,9 +46,9 @@ using std::setprecision;
 using std::cout;
 using std::vector;
 using boost::shared_ptr;
-using boost::lexical_cast;
 using boost::optional;
 using boost::dynamic_pointer_cast;
+using dcp::raw_convert;
 
 vector<VideoContentScale> VideoContentScale::_scales;
 
@@ -155,15 +156,15 @@ void
 VideoContent::as_xml (xmlpp::Node* node) const
 {
        boost::mutex::scoped_lock lm (_mutex);
-       node->add_child("VideoLength")->add_child_text (lexical_cast<string> (_video_length.get ()));
-       node->add_child("VideoWidth")->add_child_text (lexical_cast<string> (_video_size.width));
-       node->add_child("VideoHeight")->add_child_text (lexical_cast<string> (_video_size.height));
-       node->add_child("VideoFrameRate")->add_child_text (lexical_cast<string> (_video_frame_rate));
-       node->add_child("VideoFrameType")->add_child_text (lexical_cast<string> (static_cast<int> (_video_frame_type)));
-       node->add_child("LeftCrop")->add_child_text (boost::lexical_cast<string> (_crop.left));
-       node->add_child("RightCrop")->add_child_text (boost::lexical_cast<string> (_crop.right));
-       node->add_child("TopCrop")->add_child_text (boost::lexical_cast<string> (_crop.top));
-       node->add_child("BottomCrop")->add_child_text (boost::lexical_cast<string> (_crop.bottom));
+       node->add_child("VideoLength")->add_child_text (raw_convert<string> (_video_length.get ()));
+       node->add_child("VideoWidth")->add_child_text (raw_convert<string> (_video_size.width));
+       node->add_child("VideoHeight")->add_child_text (raw_convert<string> (_video_size.height));
+       node->add_child("VideoFrameRate")->add_child_text (raw_convert<string> (_video_frame_rate));
+       node->add_child("VideoFrameType")->add_child_text (raw_convert<string> (static_cast<int> (_video_frame_type)));
+       node->add_child("LeftCrop")->add_child_text (raw_convert<string> (_crop.left));
+       node->add_child("RightCrop")->add_child_text (raw_convert<string> (_crop.right));
+       node->add_child("TopCrop")->add_child_text (raw_convert<string> (_crop.top));
+       node->add_child("BottomCrop")->add_child_text (raw_convert<string> (_crop.bottom));
        _scale.as_xml (node->add_child("Scale"));
        _colour_conversion.as_xml (node->add_child("ColourConversion"));
 }
index 8bb9b230a2a3d9540fa2620be50db554770358f1..f2aff9359a35412684f4262bbfe7afdd9c6aa110 100644 (file)
@@ -457,7 +457,8 @@ private:
        
        void file_exit ()
        {
-               Close (true);
+               /* false here allows the close handler to veto the close request */
+               Close (false);
        }
 
        void edit_preferences ()
index 9375010865dbc0cc2a9c0dd34834edd97d53934f..ac85407a2f4a5938fb9fd2538a022189f98d87ca 100644 (file)
@@ -30,6 +30,7 @@
 #include "audio_mapping_view.h"
 #include "wx_util.h"
 #include "audio_gain_dialog.h"
+#include <boost/lexical_cast.hpp>
 
 using std::cout;
 using std::list;
@@ -65,8 +66,6 @@ public:
 
        void Draw (wxGrid& grid, wxGridCellAttr &, wxDC& dc, const wxRect& rect, int row, int col, bool)
        {
-               LocaleGuard lg;
-       
                dc.SetPen (*wxThePenList->FindOrCreatePen (wxColour (255, 255, 255), 1, wxPENSTYLE_SOLID));
                dc.SetBrush (*wxTheBrushList->FindOrCreateBrush (wxColour (255, 255, 255), wxBRUSHSTYLE_SOLID));
                dc.DrawRectangle (rect);
@@ -231,8 +230,6 @@ AudioMappingView::set (AudioMapping map)
 void
 AudioMappingView::update_cells ()
 {
-       LocaleGuard lg;
-       
        if (_grid->GetNumberRows ()) {
                _grid->DeleteRows (0, _grid->GetNumberRows ());
        }
index 799067920d0fbed4aad634dc484eb4c53ce1645b..f06670dfb222c7d2e613b48ae7055cfd41e335c3 100644 (file)
@@ -109,6 +109,10 @@ public:
                add_label_to_sizer (table, panel, _("Maximum JPEG2000 bandwidth"), true);
                _maximum_j2k_bandwidth = new wxSpinCtrl (panel);
                table->Add (_maximum_j2k_bandwidth, 1);
+
+               _allow_any_dcp_frame_rate = new wxCheckBox (panel, wxID_ANY, _("Allow any DCP frame rate"));
+               table->Add (_allow_any_dcp_frame_rate, 1, wxEXPAND | wxALL);
+               table->AddSpacer (0);
                
                add_label_to_sizer (table, panel, _("Outgoing mail server"), true);
                _mail_server = new wxTextCtrl (panel, wxID_ANY);
@@ -183,6 +187,8 @@ public:
                _check_for_updates->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::check_for_updates_changed, this));
                _check_for_test_updates->SetValue (config->check_for_test_updates ());
                _check_for_test_updates->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::check_for_test_updates_changed, this));
+               _allow_any_dcp_frame_rate->SetValue (config->allow_any_dcp_frame_rate ());
+               _allow_any_dcp_frame_rate->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::allow_any_dcp_frame_rate_changed, this));
                
                return panel;
        }
@@ -269,11 +275,17 @@ private:
        {
                Config::instance()->set_maximum_j2k_bandwidth (_maximum_j2k_bandwidth->GetValue() * 1000000);
        }
+
+       void allow_any_dcp_frame_rate_changed ()
+       {
+               Config::instance()->set_allow_any_dcp_frame_rate (_allow_any_dcp_frame_rate->GetValue ());
+       }
        
        wxCheckBox* _set_language;
        wxChoice* _language;
        wxSpinCtrl* _num_local_encoding_threads;
        wxSpinCtrl* _maximum_j2k_bandwidth;
+       wxCheckBox* _allow_any_dcp_frame_rate;
        wxTextCtrl* _mail_server;
        wxTextCtrl* _mail_user;
        wxTextCtrl* _mail_password;
index 3fd63e9224c6e363e74027f5371f17840bb2d41c..c20a1232402f1b4f5bc337aa9b724219d40f3fb7 100644 (file)
@@ -143,12 +143,15 @@ FilmEditor::make_dcp_panel ()
 
        {
                add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Frame Rate"), true, wxGBPosition (r, 0));
-               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-               _frame_rate = new wxChoice (_dcp_panel, wxID_ANY);
-               s->Add (_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
+               _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
+               _frame_rate_choice = new wxChoice (_dcp_panel, wxID_ANY);
+               _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
+               _frame_rate_spin = new wxSpinCtrl (_dcp_panel, wxID_ANY);
+               _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
+               setup_frame_rate_widget ();
                _best_frame_rate = new wxButton (_dcp_panel, wxID_ANY, _("Use best"));
-               s->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL | wxEXPAND);
-               grid->Add (s, wxGBPosition (r, 1));
+               _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL | wxEXPAND);
+               grid->Add (_frame_rate_sizer, wxGBPosition (r, 1));
        }
        ++r;
 
@@ -211,11 +214,12 @@ FilmEditor::make_dcp_panel ()
 
        list<int> const dfr = Config::instance()->allowed_dcp_frame_rates ();
        for (list<int>::const_iterator i = dfr.begin(); i != dfr.end(); ++i) {
-               _frame_rate->Append (std_to_wx (boost::lexical_cast<string> (*i)));
+               _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (*i)));
        }
 
        _audio_channels->SetRange (0, MAX_DCP_AUDIO_CHANNELS);
        _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
+       _frame_rate_spin->SetRange (1, 480);
 
        _resolution->Append (_("2K"));
        _resolution->Append (_("4K"));
@@ -242,7 +246,8 @@ FilmEditor::connect_to_widgets ()
        _content_timeline->Bind (wxEVT_COMMAND_BUTTON_CLICKED,        boost::bind (&FilmEditor::content_timeline_clicked, this));
        _scaler->Bind           (wxEVT_COMMAND_CHOICE_SELECTED,       boost::bind (&FilmEditor::scaler_changed, this));
        _dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED,       boost::bind (&FilmEditor::dcp_content_type_changed, this));
-       _frame_rate->Bind       (wxEVT_COMMAND_CHOICE_SELECTED,       boost::bind (&FilmEditor::frame_rate_changed, this));
+       _frame_rate_choice->Bind(wxEVT_COMMAND_CHOICE_SELECTED,       boost::bind (&FilmEditor::frame_rate_choice_changed, this));
+       _frame_rate_spin->Bind  (wxEVT_COMMAND_SPINCTRL_UPDATED,      boost::bind (&FilmEditor::frame_rate_spin_changed, this));
        _best_frame_rate->Bind  (wxEVT_COMMAND_BUTTON_CLICKED,        boost::bind (&FilmEditor::best_frame_rate_clicked, this));
        _signed->Bind           (wxEVT_COMMAND_CHECKBOX_CLICKED,      boost::bind (&FilmEditor::signed_toggled, this));
        _encrypted->Bind        (wxEVT_COMMAND_CHECKBOX_CLICKED,      boost::bind (&FilmEditor::encrypted_toggled, this));
@@ -352,9 +357,9 @@ FilmEditor::encrypted_toggled ()
        _film->set_encrypted (_encrypted->GetValue ());
 }
                               
-/** Called when the name widget has been changed */
+/** Called when the frame rate choice widget has been changed */
 void
-FilmEditor::frame_rate_changed ()
+FilmEditor::frame_rate_choice_changed ()
 {
        if (!_film) {
                return;
@@ -362,11 +367,22 @@ FilmEditor::frame_rate_changed ()
 
        _film->set_video_frame_rate (
                boost::lexical_cast<int> (
-                       wx_to_std (_frame_rate->GetString (_frame_rate->GetSelection ()))
+                       wx_to_std (_frame_rate_choice->GetString (_frame_rate_choice->GetSelection ()))
                        )
                );
 }
 
+/** Called when the frame rate spin widget has been changed */
+void
+FilmEditor::frame_rate_spin_changed ()
+{
+       if (!_film) {
+               return;
+       }
+
+       _film->set_video_frame_rate (_frame_rate_spin->GetValue ());
+}
+
 void
 FilmEditor::audio_channels_changed ()
 {
@@ -468,18 +484,20 @@ FilmEditor::film_changed (Film::Property p)
        case Film::VIDEO_FRAME_RATE:
        {
                bool done = false;
-               for (unsigned int i = 0; i < _frame_rate->GetCount(); ++i) {
-                       if (wx_to_std (_frame_rate->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) {
-                               checked_set (_frame_rate, i);
+               for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) {
+                       if (wx_to_std (_frame_rate_choice->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) {
+                               checked_set (_frame_rate_choice, i);
                                done = true;
                                break;
                        }
                }
 
                if (!done) {
-                       checked_set (_frame_rate, -1);
+                       checked_set (_frame_rate_choice, -1);
                }
 
+               _frame_rate_spin->SetValue (_film->video_frame_rate ());
+
                _best_frame_rate->Enable (_film->best_video_frame_rate () != _film->video_frame_rate ());
                break;
        }
@@ -646,7 +664,8 @@ FilmEditor::set_general_sensitivity (bool s)
        _signed->Enable (si);
        
        _encrypted->Enable (s);
-       _frame_rate->Enable (s);
+       _frame_rate_choice->Enable (s);
+       _frame_rate_spin->Enable (s);
        _audio_channels->Enable (s);
        _j2k_bandwidth->Enable (s);
        _container->Enable (s);
@@ -1016,4 +1035,19 @@ void
 FilmEditor::config_changed ()
 {
        _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
+       setup_frame_rate_widget ();
+}
+
+void
+FilmEditor::setup_frame_rate_widget ()
+{
+       if (Config::instance()->allow_any_dcp_frame_rate ()) {
+               _frame_rate_choice->Hide ();
+               _frame_rate_spin->Show ();
+       } else {
+               _frame_rate_choice->Show ();
+               _frame_rate_spin->Hide ();
+       }
+
+       _frame_rate_sizer->Layout ();
 }
index a1336ec900a6434b540ebd210a7c00a6f0bf742c..56e54734b7dcac54e0a3ebad1317be4f6febdf13 100644 (file)
@@ -87,7 +87,8 @@ private:
        void dcp_content_type_changed ();
        void scaler_changed ();
        void j2k_bandwidth_changed ();
-       void frame_rate_changed ();
+       void frame_rate_choice_changed ();
+       void frame_rate_spin_changed ();
        void best_frame_rate_clicked ();
        void content_timeline_clicked ();
        void audio_channels_changed ();
@@ -108,6 +109,7 @@ private:
        void setup_content ();
        void setup_container ();
        void setup_content_sensitivity ();
+       void setup_frame_rate_widget ();
        
        void active_jobs_changed (bool);
        void config_changed ();
@@ -143,7 +145,9 @@ private:
        wxChoice* _scaler;
        wxSpinCtrl* _j2k_bandwidth;
        wxChoice* _dcp_content_type;
-       wxChoice* _frame_rate;
+       wxChoice* _frame_rate_choice;
+       wxSpinCtrl* _frame_rate_spin;
+       wxSizer* _frame_rate_sizer;
        wxSpinCtrl* _audio_channels;
        wxButton* _best_frame_rate;
        wxCheckBox* _three_d;
index 90354a2d1310dfc2e7f50138ab34f7bc4aea3336..db51d6d0380baf0dba4c8f510d5625396cac0c46 100644 (file)
@@ -39,8 +39,12 @@ public:
        KDMDialog (wxWindow *, boost::shared_ptr<const Film>);
 
        std::list<boost::shared_ptr<Screen> > screens () const;
+
+       /** @return KDM from time in local time */
        boost::posix_time::ptime from () const;
+       /** @return KDM until time in local time */
        boost::posix_time::ptime until () const;
+       
        boost::filesystem::path dcp () const;
        boost::filesystem::path directory () const;
        bool write_to () const;
index 1197fdc2182ee560e92a9ff11436fb33ab7bb5d1..fcae1c83faff98f428727f7e188bf1befbff36fd 100644 (file)
@@ -568,9 +568,8 @@ msgid "L"
 msgstr "L"
 
 #: src/wx/audio_mapping_view.cc:312
-#, fuzzy
 msgid "Lc"
-msgstr "L"
+msgstr "Lc"
 
 #: src/wx/video_panel.cc:87
 msgid "Left crop"
@@ -717,9 +716,8 @@ msgid "Rating (e.g. 15)"
 msgstr "FSK (z.B. 12)"
 
 #: src/wx/audio_mapping_view.cc:316
-#, fuzzy
 msgid "Rc"
-msgstr "R"
+msgstr "Rc"
 
 #: src/wx/content_menu.cc:54 src/wx/film_editor.cc:284
 #: src/wx/editable_list.h:66
index 5d18a5dbc4c5420eb69f0b34db932a75cc886d34..e4b9d4ff0cd44d976c7628c76c146b6f39345128 100644 (file)
@@ -170,11 +170,11 @@ msgstr "Sfoglia..."
 
 #: src/wx/audio_mapping_view.cc:320
 msgid "BsL"
-msgstr ""
+msgstr "BsL"
 
 #: src/wx/audio_mapping_view.cc:324
 msgid "BsR"
-msgstr ""
+msgstr "BsR"
 
 #: src/wx/gain_calculator_dialog.cc:32
 msgid "But I have to use fader"
@@ -182,7 +182,7 @@ msgstr "Ma dovrò riprodurre con il fader a"
 
 #: src/wx/audio_mapping_view.cc:288
 msgid "C"
-msgstr ""
+msgstr "C"
 
 #: src/wx/audio_panel.cc:63
 msgid "Calculate..."
@@ -506,7 +506,7 @@ msgstr "Gb"
 
 #: src/wx/audio_mapping_view.cc:304
 msgid "HI"
-msgstr ""
+msgstr "HI"
 
 #: src/wx/hints_dialog.cc:26
 msgid "Hints"
@@ -563,11 +563,11 @@ msgstr "Tieni i video in sequenza"
 
 #: src/wx/audio_mapping_view.cc:280
 msgid "L"
-msgstr ""
+msgstr "L"
 
 #: src/wx/audio_mapping_view.cc:312
 msgid "Lc"
-msgstr ""
+msgstr "Lc"
 
 #: src/wx/video_panel.cc:87
 msgid "Left crop"
@@ -575,7 +575,7 @@ msgstr "Taglio a sinistra"
 
 #: src/wx/audio_mapping_view.cc:292
 msgid "Lfe"
-msgstr ""
+msgstr "Lfe"
 
 #: src/wx/colour_conversion_editor.cc:49
 msgid "Linearise input gamma curve for low values"
@@ -586,9 +586,8 @@ msgid "Load from file..."
 msgstr ""
 
 #: src/wx/audio_mapping_view.cc:296
-#, fuzzy
 msgid "Ls"
-msgstr "s"
+msgstr "Ls"
 
 #: src/wx/film_editor.cc:749
 msgid "MISSING: "
@@ -707,7 +706,7 @@ msgstr "Posizione"
 
 #: src/wx/audio_mapping_view.cc:284
 msgid "R"
-msgstr ""
+msgstr "R"
 
 #: src/wx/audio_dialog.cc:61
 msgid "RMS"
@@ -719,7 +718,7 @@ msgstr "Classificazione (es. 15)"
 
 #: src/wx/audio_mapping_view.cc:316
 msgid "Rc"
-msgstr ""
+msgstr "Rc"
 
 #: src/wx/content_menu.cc:54 src/wx/film_editor.cc:284
 #: src/wx/editable_list.h:66
@@ -763,9 +762,8 @@ msgid "Right crop"
 msgstr "Taglio a destra"
 
 #: src/wx/audio_mapping_view.cc:300
-#, fuzzy
 msgid "Rs"
-msgstr "s"
+msgstr "Rs"
 
 #: src/wx/film_editor.cc:223
 msgid "SMPTE"
@@ -999,7 +997,7 @@ msgstr "Nome utente"
 
 #: src/wx/audio_mapping_view.cc:308
 msgid "VI"
-msgstr ""
+msgstr "VI"
 
 #: src/wx/video_panel.cc:67
 msgid "Video"
index f22f1c6250b88d6bc5ec7b40ee66da28330067fa..ecfd78013a642790e2b0d9fb91d492c0fd38a9d7 100644 (file)
@@ -173,11 +173,11 @@ msgstr "Bläddra..."
 
 #: src/wx/audio_mapping_view.cc:320
 msgid "BsL"
-msgstr ""
+msgstr "BsL"
 
 #: src/wx/audio_mapping_view.cc:324
 msgid "BsR"
-msgstr ""
+msgstr "BsR"
 
 #: src/wx/gain_calculator_dialog.cc:32
 msgid "But I have to use fader"
@@ -510,7 +510,7 @@ msgstr "Gb"
 
 #: src/wx/audio_mapping_view.cc:304
 msgid "HI"
-msgstr ""
+msgstr "HI"
 
 #: src/wx/hints_dialog.cc:26
 msgid "Hints"
@@ -571,9 +571,8 @@ msgid "L"
 msgstr "V"
 
 #: src/wx/audio_mapping_view.cc:312
-#, fuzzy
 msgid "Lc"
-msgstr "V"
+msgstr "Vc"
 
 #: src/wx/video_panel.cc:87
 msgid "Left crop"
@@ -723,9 +722,8 @@ msgid "Rating (e.g. 15)"
 msgstr "Klassificering (ex. 15)"
 
 #: src/wx/audio_mapping_view.cc:316
-#, fuzzy
 msgid "Rc"
-msgstr "H"
+msgstr "Hc"
 
 #: src/wx/content_menu.cc:54 src/wx/film_editor.cc:284
 #: src/wx/editable_list.h:66
@@ -1010,7 +1008,7 @@ msgstr "Användarnamn"
 
 #: src/wx/audio_mapping_view.cc:308
 msgid "VI"
-msgstr ""
+msgstr "VI"
 
 #: src/wx/video_panel.cc:67
 msgid "Video"
index f5ac3ca64bff3f2b39bc939233b1c29c7aabafe9..c941248bf01fa485302d070c54b6a48ea7bb261a 100644 (file)
@@ -29,7 +29,7 @@
 
 using std::ostream;
 
-namespace libdcp {
+namespace dcp {
        
 ostream&
 operator<< (ostream& s, dcp::Size const & t)