summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-05-16 12:32:04 +0100
committerCarl Hetherington <cth@carlh.net>2014-05-16 12:32:04 +0100
commit308488324dbc4d8b709d3fb1dc9fee0479346c21 (patch)
tree446989a0bea3db683e5200da89c955140b175682 /src
parentcfdd68eb5fb0ef8423e860103ad4e5510994f1da (diff)
parent362ed9ee4f73bee21b3ef8d3b449bb8e8877f501 (diff)
Merge master.
Diffstat (limited to 'src')
-rw-r--r--src/lib/audio_content.cc11
-rw-r--r--src/lib/audio_mapping.cc14
-rw-r--r--src/lib/colour_conversion.cc20
-rw-r--r--src/lib/config.cc24
-rw-r--r--src/lib/config.h11
-rw-r--r--src/lib/content.cc9
-rw-r--r--src/lib/dci_metadata.cc7
-rw-r--r--src/lib/dcp_video_frame.cc18
-rw-r--r--src/lib/ffmpeg.cc7
-rw-r--r--src/lib/ffmpeg_content.cc13
-rw-r--r--src/lib/ffmpeg_content.h1
-rw-r--r--src/lib/ffmpeg_decoder.cc1
-rw-r--r--src/lib/film.cc18
-rw-r--r--src/lib/image_examiner.cc3
-rw-r--r--src/lib/kdm.cc3
-rw-r--r--src/lib/playlist.cc2
-rw-r--r--src/lib/server.cc6
-rw-r--r--src/lib/server_finder.cc5
-rw-r--r--src/lib/sndfile_content.cc9
-rw-r--r--src/lib/subrip_content.cc14
-rw-r--r--src/lib/subtitle_content.cc15
-rw-r--r--src/lib/update.cc7
-rw-r--r--src/lib/util.cc29
-rw-r--r--src/lib/util.h10
-rw-r--r--src/lib/video_content.cc21
-rw-r--r--src/tools/dcpomatic.cc3
-rw-r--r--src/wx/audio_mapping_view.cc5
-rw-r--r--src/wx/config_dialog.cc12
-rw-r--r--src/wx/film_editor.cc64
-rw-r--r--src/wx/film_editor.h8
-rw-r--r--src/wx/kdm_dialog.h4
-rw-r--r--src/wx/po/de_DE.po6
-rw-r--r--src/wx/po/it_IT.po26
-rw-r--r--src/wx/po/sv_SE.po14
34 files changed, 222 insertions, 198 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc
index d9e00ff14..e8fd4bbd3 100644
--- a/src/lib/audio_content.cc
+++ b/src/lib/audio_content.cc
@@ -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));
}
diff --git a/src/lib/audio_mapping.cc b/src/lib/audio_mapping.cc
index 969397b0b..496300b48 100644
--- a/src/lib/audio_mapping.cc
+++ b/src/lib/audio_mapping.cc
@@ -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))));
}
}
}
diff --git a/src/lib/colour_conversion.cc b/src/lib/colour_conversion.cc
index e4a2a84bf..73ee72249 100644
--- a/src/lib/colour_conversion.cc
+++ b/src/lib/colour_conversion.cc
@@ -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>
diff --git a/src/lib/config.cc b/src/lib/config.cc
index ca8d0bc53..754346418 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -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 ());
}
diff --git a/src/lib/config.h b/src/lib/config.h
index ee11dcadb..ffaacf8f1 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -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;
diff --git a/src/lib/content.cc b/src/lib/content.cc
index 0c37d9386..c4836cfa8 100644
--- a/src/lib/content.cc
+++ b/src/lib/content.cc
@@ -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
diff --git a/src/lib/dci_metadata.cc b/src/lib/dci_metadata.cc
index 27306a15e..2c6e43654 100644
--- a/src/lib/dci_metadata.cc
+++ b/src/lib/dci_metadata.cc
@@ -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
@@ -19,13 +19,14 @@
#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);
diff --git a/src/lib/dcp_video_frame.cc b/src/lib/dcp_video_frame.cc
index 2b7a2e18f..59f356a5a 100644
--- a/src/lib/dcp_video_frame.cc
+++ b/src/lib/dcp_video_frame.cc
@@ -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)
diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc
index a98aa9828..316b9614d 100644
--- a/src/lib/ffmpeg.cc
+++ b/src/lib/ffmpeg.cc
@@ -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 ());
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index a51cb3de8..a374bcf3e 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -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"));
}
diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h
index 1ab0a92d0..37746ac9d 100644
--- a/src/lib/ffmpeg_content.h
+++ b/src/lib/ffmpeg_content.h
@@ -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"
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 0a4624569..9ae5f0485 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -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>
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 33cb30460..bdd650437 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -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!"));
}
diff --git a/src/lib/image_examiner.cc b/src/lib/image_examiner.cc
index 3897bbf37..004b89e65 100644
--- a/src/lib/image_examiner.cc
+++ b/src/lib/image_examiner.cc
@@ -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)
diff --git a/src/lib/kdm.cc b/src/lib/kdm.cc
index 793a3fa0e..902f0d333 100644
--- a/src/lib/kdm.cc
+++ b/src/lib/kdm.cc
@@ -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,
diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc
index 1e8a3319c..9a048980c 100644
--- a/src/lib/playlist.cc
+++ b/src/lib/playlist.cc
@@ -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)
diff --git a/src/lib/server.cc b/src/lib/server.cc
index bf7541c33..6bcff7e6e 100644
--- a/src/lib/server.cc
+++ b/src/lib/server.cc
@@ -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");
diff --git a/src/lib/server_finder.cc b/src/lib/server_finder.cc
index 1080d24c4..de8a3852c 100644
--- a/src/lib/server_finder.cc
+++ b/src/lib/server_finder.cc
@@ -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 (...) {
diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc
index 0cf65967f..cad5eb8e7 100644
--- a/src/lib/sndfile_content.cc
+++ b/src/lib/sndfile_content.cc
@@ -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"));
}
diff --git a/src/lib/subrip_content.cc b/src/lib/subrip_content.cc
index eb9c67d9a..8f9c28e29 100644
--- a/src/lib/subrip_content.cc
+++ b/src/lib/subrip_content.cc
@@ -21,12 +21,14 @@
#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 ();
}
diff --git a/src/lib/subtitle_content.cc b/src/lib/subtitle_content.cc
index 4c6e60192..783c73e25 100644
--- a/src/lib/subtitle_content.cc
+++ b/src/lib/subtitle_content.cc
@@ -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
diff --git a/src/lib/update.cc b/src/lib/update.cc
index 019db8e76..c7527ee49 100644
--- a/src/lib/update.cc
+++ b/src/lib/update.cc
@@ -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);
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 0eb14845d..14dfd1fa5 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -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)
{
diff --git a/src/lib/util.h b/src/lib/util.h
index 8e65bbb54..58c2771b7 100644
--- a/src/lib/util.h
+++ b/src/lib/util.h
@@ -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.
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index 9edbc104a..bd24621f7 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -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"));
}
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index 8bb9b230a..f2aff9359 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -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 ()
diff --git a/src/wx/audio_mapping_view.cc b/src/wx/audio_mapping_view.cc
index 937501086..ac85407a2 100644
--- a/src/wx/audio_mapping_view.cc
+++ b/src/wx/audio_mapping_view.cc
@@ -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 ());
}
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index 799067920..f06670dfb 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -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;
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index 3fd63e922..c20a12324 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -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 ();
}
diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h
index a1336ec90..56e54734b 100644
--- a/src/wx/film_editor.h
+++ b/src/wx/film_editor.h
@@ -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;
diff --git a/src/wx/kdm_dialog.h b/src/wx/kdm_dialog.h
index 90354a2d1..db51d6d03 100644
--- a/src/wx/kdm_dialog.h
+++ b/src/wx/kdm_dialog.h
@@ -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;
diff --git a/src/wx/po/de_DE.po b/src/wx/po/de_DE.po
index 1197fdc21..fcae1c83f 100644
--- a/src/wx/po/de_DE.po
+++ b/src/wx/po/de_DE.po
@@ -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
diff --git a/src/wx/po/it_IT.po b/src/wx/po/it_IT.po
index 5d18a5dbc..e4b9d4ff0 100644
--- a/src/wx/po/it_IT.po
+++ b/src/wx/po/it_IT.po
@@ -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"
diff --git a/src/wx/po/sv_SE.po b/src/wx/po/sv_SE.po
index f22f1c625..ecfd78013 100644
--- a/src/wx/po/sv_SE.po
+++ b/src/wx/po/sv_SE.po
@@ -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"