summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-06-12 22:27:11 +0100
committerCarl Hetherington <cth@carlh.net>2014-06-12 22:27:11 +0100
commit4e411ea97b4dab8a5fa282d1d4cf7971ef1e24ad (patch)
tree06db8731e77dfeaf537f2814d73c7a599035b95c /src/lib
parent8102046b2f29e0c7b234c29bf204b056cb30e64f (diff)
parent66162217d93baa3fd50594bb013a44bbd779d02a (diff)
Merge master.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/audio_content.cc3
-rw-r--r--src/lib/audio_content.h6
-rw-r--r--src/lib/config.cc21
-rw-r--r--src/lib/config.h14
-rw-r--r--src/lib/content.cc3
-rw-r--r--src/lib/dcp_content_type.cc6
-rw-r--r--src/lib/dcp_content_type.h8
-rw-r--r--src/lib/ffmpeg_content.cc4
-rw-r--r--src/lib/film.cc146
-rw-r--r--src/lib/film.h38
-rw-r--r--src/lib/frame_rate_change.h5
-rw-r--r--src/lib/image_content.cc1
-rw-r--r--src/lib/image_proxy.cc19
-rw-r--r--src/lib/image_proxy.h3
-rw-r--r--src/lib/isdcf_metadata.cc (renamed from src/lib/dci_metadata.cc)22
-rw-r--r--src/lib/isdcf_metadata.h (renamed from src/lib/dci_metadata.h)26
-rw-r--r--src/lib/log.cc2
-rw-r--r--src/lib/log.h8
-rw-r--r--src/lib/player.cc1
-rw-r--r--src/lib/playlist.h1
-rw-r--r--src/lib/ratio.cc12
-rw-r--r--src/lib/ratio.h8
-rw-r--r--src/lib/server.cc2
-rw-r--r--src/lib/sndfile_content.cc1
-rw-r--r--src/lib/util.cc3
-rw-r--r--src/lib/video_content.cc1
-rw-r--r--src/lib/wscript2
27 files changed, 245 insertions, 121 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc
index 03bfe9630..9f0d26573 100644
--- a/src/lib/audio_content.cc
+++ b/src/lib/audio_content.cc
@@ -25,6 +25,7 @@
#include "film.h"
#include "exceptions.h"
#include "config.h"
+#include "frame_rate_change.h"
#include "i18n.h"
@@ -97,7 +98,7 @@ AudioContent::as_xml (xmlpp::Node* node) const
void
-AudioContent::set_audio_gain (float g)
+AudioContent::set_audio_gain (double g)
{
{
boost::mutex::scoped_lock lm (_mutex);
diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h
index 1ceb01f78..336a98629 100644
--- a/src/lib/audio_content.h
+++ b/src/lib/audio_content.h
@@ -72,10 +72,10 @@ public:
boost::signals2::connection analyse_audio (boost::function<void()>);
- void set_audio_gain (float);
+ void set_audio_gain (double);
void set_audio_delay (int);
- float audio_gain () const {
+ double audio_gain () const {
boost::mutex::scoped_lock lm (_mutex);
return _audio_gain;
}
@@ -87,7 +87,7 @@ public:
private:
/** Gain to apply to audio in dB */
- float _audio_gain;
+ double _audio_gain;
/** Delay to apply to audio (positive moves audio later) in milliseconds */
int _audio_delay;
};
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 8be31a329..a0211386b 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -64,7 +64,7 @@ Config::Config ()
, _allow_any_dcp_frame_rate (false)
, _default_still_length (10)
, _default_container (Ratio::from_id ("185"))
- , _default_dcp_content_type (DCPContentType::from_dci_name ("TST"))
+ , _default_dcp_content_type (DCPContentType::from_isdcf_name ("TST"))
, _default_j2k_bandwidth (100000000)
, _default_audio_delay (0)
, _kdm_email (
@@ -141,13 +141,18 @@ Config::read ()
c = f.optional_string_child ("DefaultDCPContentType");
if (c) {
- _default_dcp_content_type = DCPContentType::from_dci_name (c.get ());
+ _default_dcp_content_type = DCPContentType::from_isdcf_name (c.get ());
}
_dcp_metadata.issuer = f.optional_string_child ("DCPMetadataIssuer").get_value_or ("");
_dcp_metadata.creator = f.optional_string_child ("DCPMetadataCreator").get_value_or ("");
- _default_dci_metadata = DCIMetadata (f.node_child ("DCIMetadata"));
+ if (version && version.get() >= 2) {
+ _default_isdcf_metadata = ISDCFMetadata (f.node_child ("ISDCFMetadata"));
+ } else {
+ _default_isdcf_metadata = ISDCFMetadata (f.node_child ("DCIMetadata"));
+ }
+
_default_still_length = f.optional_number_child<int>("DefaultStillLength").get_value_or (10);
_default_j2k_bandwidth = f.optional_number_child<int>("DefaultJ2KBandwidth").get_value_or (200000000);
_default_audio_delay = f.optional_number_child<int>("DefaultAudioDelay").get_value_or (0);
@@ -245,7 +250,7 @@ Config::read_old_metadata ()
} else if (k == "default_container") {
_default_container = Ratio::from_id (v);
} else if (k == "default_dcp_content_type") {
- _default_dcp_content_type = DCPContentType::from_dci_name (v);
+ _default_dcp_content_type = DCPContentType::from_isdcf_name (v);
} else if (k == "dcp_metadata_issuer") {
_dcp_metadata.issuer = v;
} else if (k == "dcp_metadata_creator") {
@@ -254,7 +259,7 @@ Config::read_old_metadata ()
_dcp_metadata.issue_date = v;
}
- _default_dci_metadata.read_old_metadata (k, v);
+ _default_isdcf_metadata.read_old_metadata (k, v);
}
}
@@ -315,7 +320,7 @@ Config::write () const
xmlpp::Document doc;
xmlpp::Element* root = doc.create_root_node ("Config");
- root->add_child("Version")->add_child_text ("1");
+ root->add_child("Version")->add_child_text ("2");
root->add_child("NumLocalEncodingThreads")->add_child_text (raw_convert<string> (_num_local_encoding_threads));
root->add_child("DefaultDirectory")->add_child_text (_default_directory.string ());
root->add_child("ServerPortBase")->add_child_text (raw_convert<string> (_server_port_base));
@@ -339,12 +344,12 @@ Config::write () const
root->add_child("DefaultContainer")->add_child_text (_default_container->id ());
}
if (_default_dcp_content_type) {
- root->add_child("DefaultDCPContentType")->add_child_text (_default_dcp_content_type->dci_name ());
+ root->add_child("DefaultDCPContentType")->add_child_text (_default_dcp_content_type->isdcf_name ());
}
root->add_child("DCPMetadataIssuer")->add_child_text (_dcp_metadata.issuer);
root->add_child("DCPMetadataCreator")->add_child_text (_dcp_metadata.creator);
- _default_dci_metadata.as_xml (root->add_child ("DCIMetadata"));
+ _default_isdcf_metadata.as_xml (root->add_child ("ISDCFMetadata"));
root->add_child("DefaultStillLength")->add_child_text (raw_convert<string> (_default_still_length));
root->add_child("DefaultJ2KBandwidth")->add_child_text (raw_convert<string> (_default_j2k_bandwidth));
diff --git a/src/lib/config.h b/src/lib/config.h
index ccd37ec1e..f0d2630d0 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -29,7 +29,7 @@
#include <boost/signals2.hpp>
#include <boost/filesystem.hpp>
#include <dcp/metadata.h>
-#include "dci_metadata.h"
+#include "isdcf_metadata.h"
#include "colour_conversion.h"
#include "server.h"
@@ -121,8 +121,8 @@ public:
return _allow_any_dcp_frame_rate;
}
- DCIMetadata default_dci_metadata () const {
- return _default_dci_metadata;
+ ISDCFMetadata default_isdcf_metadata () const {
+ return _default_isdcf_metadata;
}
boost::optional<std::string> language () const {
@@ -254,8 +254,8 @@ public:
changed ();
}
- void set_default_dci_metadata (DCIMetadata d) {
- _default_dci_metadata = d;
+ void set_default_isdcf_metadata (ISDCFMetadata d) {
+ _default_isdcf_metadata = d;
changed ();
}
@@ -389,8 +389,8 @@ private:
std::list<int> _allowed_dcp_frame_rates;
/** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
bool _allow_any_dcp_frame_rate;
- /** Default DCI metadata for newly-created Films */
- DCIMetadata _default_dci_metadata;
+ /** Default ISDCF metadata for newly-created Films */
+ ISDCFMetadata _default_isdcf_metadata;
boost::optional<std::string> _language;
int _default_still_length;
Ratio const * _default_container;
diff --git a/src/lib/content.cc b/src/lib/content.cc
index b6678cb4d..bbbe9b6ce 100644
--- a/src/lib/content.cc
+++ b/src/lib/content.cc
@@ -40,6 +40,7 @@ using std::set;
using std::list;
using std::cout;
using std::vector;
+using std::max;
using boost::shared_ptr;
using dcp::raw_convert;
@@ -215,7 +216,7 @@ Content::technical_summary () const
DCPTime
Content::length_after_trim () const
{
- return full_length() - trim_start() - trim_end();
+ return max (DCPTime (), full_length() - trim_start() - trim_end());
}
/** @return string which includes everything about how this content affects
diff --git a/src/lib/dcp_content_type.cc b/src/lib/dcp_content_type.cc
index b3a45e40e..e5466e139 100644
--- a/src/lib/dcp_content_type.cc
+++ b/src/lib/dcp_content_type.cc
@@ -33,7 +33,7 @@ vector<DCPContentType const *> DCPContentType::_dcp_content_types;
DCPContentType::DCPContentType (string p, dcp::ContentKind k, string d)
: _pretty_name (p)
, _libdcp_kind (k)
- , _dci_name (d)
+ , _isdcf_name (d)
{
}
@@ -66,10 +66,10 @@ DCPContentType::from_pretty_name (string n)
}
DCPContentType const *
-DCPContentType::from_dci_name (string n)
+DCPContentType::from_isdcf_name (string n)
{
for (vector<DCPContentType const *>::const_iterator i = _dcp_content_types.begin(); i != _dcp_content_types.end(); ++i) {
- if ((*i)->dci_name() == n) {
+ if ((*i)->isdcf_name() == n) {
return *i;
}
}
diff --git a/src/lib/dcp_content_type.h b/src/lib/dcp_content_type.h
index 05f30af55..ebfe09518 100644
--- a/src/lib/dcp_content_type.h
+++ b/src/lib/dcp_content_type.h
@@ -45,12 +45,12 @@ public:
return _libdcp_kind;
}
- std::string dci_name () const {
- return _dci_name;
+ std::string isdcf_name () const {
+ return _isdcf_name;
}
static DCPContentType const * from_pretty_name (std::string);
- static DCPContentType const * from_dci_name (std::string);
+ static DCPContentType const * from_isdcf_name (std::string);
static DCPContentType const * from_index (int);
static int as_index (DCPContentType const *);
static std::vector<DCPContentType const *> all ();
@@ -59,7 +59,7 @@ public:
private:
std::string _pretty_name;
dcp::ContentKind _libdcp_kind;
- std::string _dci_name;
+ std::string _isdcf_name;
/** All available DCP content types */
static std::vector<DCPContentType const *> _dcp_content_types;
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index 9889d511c..d3e0fa7b2 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -33,6 +33,7 @@ extern "C" {
#include "film.h"
#include "log.h"
#include "exceptions.h"
+#include "frame_rate_change.h"
#include "i18n.h"
@@ -399,6 +400,9 @@ bool
FFmpegContent::has_subtitle_during (ContentTimePeriod period) const
{
shared_ptr<FFmpegSubtitleStream> stream = subtitle_stream ();
+ if (!stream) {
+ return false;
+ }
/* XXX: inefficient */
for (vector<ContentTimePeriod>::const_iterator i = stream->periods.begin(); i != stream->periods.end(); ++i) {
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 25730ae1c..14735d1b1 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -90,6 +90,8 @@ using dcp::raw_convert;
* Subtitle offset changed to subtitle y offset, and subtitle x offset added.
* 7 -> 8
* Use <Scale> tag in <VideoContent> rather than <Ratio>.
+ * 8 -> 9
+ * DCI -> ISDCF
*
* Bumped to 32 for 2.0 branch; some times are expressed in Times rather
* than frames now.
@@ -103,7 +105,7 @@ int const Film::current_state_version = 32;
Film::Film (boost::filesystem::path dir, bool log)
: _playlist (new Playlist)
- , _use_dci_name (true)
+ , _use_isdcf_name (true)
, _dcp_content_type (Config::instance()->default_dcp_content_type ())
, _container (Config::instance()->default_container ())
, _resolution (RESOLUTION_2K)
@@ -112,7 +114,7 @@ Film::Film (boost::filesystem::path dir, bool log)
, _signed (true)
, _encrypted (false)
, _j2k_bandwidth (Config::instance()->default_j2k_bandwidth ())
- , _dci_metadata (Config::instance()->default_dci_metadata ())
+ , _isdcf_metadata (Config::instance()->default_isdcf_metadata ())
, _video_frame_rate (24)
, _audio_channels (6)
, _three_d (false)
@@ -121,7 +123,7 @@ Film::Film (boost::filesystem::path dir, bool log)
, _state_version (current_state_version)
, _dirty (false)
{
- set_dci_date_today ();
+ set_isdcf_date_today ();
_playlist->Changed.connect (bind (&Film::playlist_changed, this));
_playlist->ContentChanged.connect (bind (&Film::playlist_content_changed, this, _1, _2));
@@ -185,6 +187,10 @@ Film::video_identifier () const
s << "_3D";
}
+ if (_with_subtitles) {
+ s << "_WS";
+ }
+
return s.str ();
}
@@ -248,7 +254,7 @@ Film::audio_analysis_dir () const
void
Film::make_dcp ()
{
- set_dci_date_today ();
+ set_isdcf_date_today ();
if (dcp_name().find ("/") != string::npos) {
throw BadSettingError (_("name"), _("cannot contain slashes"));
@@ -352,10 +358,10 @@ Film::metadata () const
root->add_child("Version")->add_child_text (raw_convert<string> (current_state_version));
root->add_child("Name")->add_child_text (_name);
- root->add_child("UseDCIName")->add_child_text (_use_dci_name ? "1" : "0");
+ root->add_child("UseISDCFName")->add_child_text (_use_isdcf_name ? "1" : "0");
if (_dcp_content_type) {
- root->add_child("DCPContentType")->add_child_text (_dcp_content_type->dci_name ());
+ root->add_child("DCPContentType")->add_child_text (_dcp_content_type->isdcf_name ());
}
if (_container) {
@@ -366,9 +372,9 @@ Film::metadata () const
root->add_child("Scaler")->add_child_text (_scaler->id ());
root->add_child("WithSubtitles")->add_child_text (_with_subtitles ? "1" : "0");
root->add_child("J2KBandwidth")->add_child_text (raw_convert<string> (_j2k_bandwidth));
- _dci_metadata.as_xml (root->add_child ("DCIMetadata"));
+ _isdcf_metadata.as_xml (root->add_child ("ISDCFMetadata"));
root->add_child("VideoFrameRate")->add_child_text (raw_convert<string> (_video_frame_rate));
- root->add_child("DCIDate")->add_child_text (boost::gregorian::to_iso_string (_dci_date));
+ root->add_child("ISDCFDate")->add_child_text (boost::gregorian::to_iso_string (_isdcf_date));
root->add_child("AudioChannels")->add_child_text (raw_convert<string> (_audio_channels));
root->add_child("ThreeD")->add_child_text (_three_d ? "1" : "0");
root->add_child("SequenceVideo")->add_child_text (_sequence_video ? "1" : "0");
@@ -410,12 +416,20 @@ Film::read_metadata ()
}
_name = f.string_child ("Name");
- _use_dci_name = f.bool_child ("UseDCIName");
+ if (_state_version >= 9) {
+ _use_isdcf_name = f.bool_child ("UseISDCFName");
+ _isdcf_metadata = ISDCFMetadata (f.node_child ("ISDCFMetadata"));
+ _isdcf_date = boost::gregorian::from_undelimited_string (f.string_child ("ISDCFDate"));
+ } else {
+ _use_isdcf_name = f.bool_child ("UseDCIName");
+ _isdcf_metadata = ISDCFMetadata (f.node_child ("DCIMetadata"));
+ _isdcf_date = boost::gregorian::from_undelimited_string (f.string_child ("DCIDate"));
+ }
{
optional<string> c = f.optional_string_child ("DCPContentType");
if (c) {
- _dcp_content_type = DCPContentType::from_dci_name (c.get ());
+ _dcp_content_type = DCPContentType::from_isdcf_name (c.get ());
}
}
@@ -430,9 +444,7 @@ Film::read_metadata ()
_scaler = Scaler::from_id (f.string_child ("Scaler"));
_with_subtitles = f.bool_child ("WithSubtitles");
_j2k_bandwidth = f.number_child<int> ("J2KBandwidth");
- _dci_metadata = DCIMetadata (f.node_child ("DCIMetadata"));
_video_frame_rate = f.number_child<int> ("VideoFrameRate");
- _dci_date = boost::gregorian::from_undelimited_string (f.string_child ("DCIDate"));
_signed = f.optional_bool_child("Signed").get_value_or (true);
_encrypted = f.bool_child ("Encrypted");
_audio_channels = f.number_child<int> ("AudioChannels");
@@ -479,20 +491,26 @@ Film::file (boost::filesystem::path f) const
return p;
}
-/** @return a DCI-compliant name for a DCP of this film */
+/** @return a ISDCF-compliant name for a DCP of this film */
string
-Film::dci_name (bool if_created_now) const
+Film::isdcf_name (bool if_created_now) const
{
stringstream d;
- string fixed_name = to_upper_copy (name());
- for (size_t i = 0; i < fixed_name.length(); ++i) {
- if (fixed_name[i] == ' ') {
- fixed_name[i] = '-';
+ string raw_name = name ();
+ string fixed_name;
+ bool cap_next = true;
+ for (size_t i = 0; i < raw_name.length(); ++i) {
+ if (raw_name[i] == ' ') {
+ cap_next = true;
+ } else if (cap_next) {
+ fixed_name += toupper (raw_name[i]);
+ cap_next = false;
+ } else {
+ fixed_name += tolower (raw_name[i]);
}
}
- /* Spec is that the name part should be maximum 14 characters, as I understand it */
if (fixed_name.length() > 14) {
fixed_name = fixed_name.substr (0, 14);
}
@@ -500,23 +518,67 @@ Film::dci_name (bool if_created_now) const
d << fixed_name;
if (dcp_content_type()) {
- d << "_" << dcp_content_type()->dci_name();
- d << "-" << dci_metadata().content_version;
+ d << "_" << dcp_content_type()->isdcf_name();
+ d << "-" << isdcf_metadata().content_version;
+ }
+
+ ISDCFMetadata const dm = isdcf_metadata ();
+
+ if (dm.temp_version) {
+ d << "-Temp";
+ }
+
+ if (dm.pre_release) {
+ d << "-Pre";
+ }
+
+ if (dm.red_band) {
+ d << "-RedBand";
+ }
+
+ if (!dm.chain.empty ()) {
+ d << "-" << dm.chain;
}
if (three_d ()) {
d << "-3D";
}
+ if (dm.two_d_version_of_three_d) {
+ d << "-2D";
+ }
+
+ if (!dm.mastered_luminance.empty ()) {
+ d << "-" << dm.mastered_luminance;
+ }
+
if (video_frame_rate() != 24) {
d << "-" << video_frame_rate();
}
-
+
if (container()) {
- d << "_" << container()->dci_name();
+ d << "_" << container()->isdcf_name();
}
- DCIMetadata const dm = dci_metadata ();
+ /* XXX: this only works for content which has been scaled to a given ratio,
+ and uses the first bit of content only.
+ */
+
+ /* The standard says we don't do this for trailers, for some strange reason */
+ if (dcp_content_type() && dcp_content_type()->libdcp_kind() != dcp::TRAILER) {
+ ContentList cl = content ();
+ Ratio const * content_ratio = 0;
+ for (ContentList::const_iterator i = cl.begin(); i != cl.end(); ++i) {
+ shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (*i);
+ if (vc && (content_ratio == 0 || vc->scale().ratio() != content_ratio)) {
+ content_ratio = vc->scale().ratio();
+ }
+ }
+
+ if (content_ratio && content_ratio != container()) {
+ d << "-" << content_ratio->isdcf_name();
+ }
+ }
if (!dm.audio_language.empty ()) {
d << "_" << dm.audio_language;
@@ -555,8 +617,10 @@ Film::dci_name (bool if_created_now) const
break;
}
- d << "_" << resolution_to_string (_resolution);
+ /* XXX: HI/VI */
+ d << "_" << resolution_to_string (_resolution);
+
if (!dm.studio.empty ()) {
d << "_" << dm.studio;
}
@@ -564,13 +628,23 @@ Film::dci_name (bool if_created_now) const
if (if_created_now) {
d << "_" << boost::gregorian::to_iso_string (boost::gregorian::day_clock::local_day ());
} else {
- d << "_" << boost::gregorian::to_iso_string (_dci_date);
+ d << "_" << boost::gregorian::to_iso_string (_isdcf_date);
}
if (!dm.facility.empty ()) {
d << "_" << dm.facility;
}
+ if (_interop) {
+ d << "_IOP";
+ } else {
+ d << "_SMPTE";
+ }
+
+ if (three_d ()) {
+ d << "-3D";
+ }
+
if (!dm.package_type.empty ()) {
d << "_" << dm.package_type;
}
@@ -582,8 +656,8 @@ Film::dci_name (bool if_created_now) const
string
Film::dcp_name (bool if_created_now) const
{
- if (use_dci_name()) {
- return dci_name (if_created_now);
+ if (use_isdcf_name()) {
+ return isdcf_name (if_created_now);
}
return name();
@@ -605,10 +679,10 @@ Film::set_name (string n)
}
void
-Film::set_use_dci_name (bool u)
+Film::set_use_isdcf_name (bool u)
{
- _use_dci_name = u;
- signal_changed (USE_DCI_NAME);
+ _use_isdcf_name = u;
+ signal_changed (USE_ISDCF_NAME);
}
void
@@ -654,10 +728,10 @@ Film::set_j2k_bandwidth (int b)
}
void
-Film::set_dci_metadata (DCIMetadata m)
+Film::set_isdcf_metadata (ISDCFMetadata m)
{
- _dci_metadata = m;
- signal_changed (DCI_METADATA);
+ _isdcf_metadata = m;
+ signal_changed (ISDCF_METADATA);
}
void
@@ -711,9 +785,9 @@ Film::signal_changed (Property p)
}
void
-Film::set_dci_date_today ()
+Film::set_isdcf_date_today ()
{
- _dci_date = boost::gregorian::day_clock::local_day ();
+ _isdcf_date = boost::gregorian::day_clock::local_day ();
}
boost::filesystem::path
diff --git a/src/lib/film.h b/src/lib/film.h
index d9d7e82fd..067588fa3 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -36,7 +36,8 @@
#include <dcp/encrypted_kdm.h>
#include "util.h"
#include "types.h"
-#include "dci_metadata.h"
+#include "isdcf_metadata.h"
+#include "frame_rate_change.h"
class DCPContentType;
class Log;
@@ -46,6 +47,7 @@ class Playlist;
class AudioContent;
class Scaler;
class Screen;
+class isdcf_name_test;
/** @class Film
*
@@ -88,7 +90,7 @@ public:
void write_metadata () const;
boost::shared_ptr<xmlpp::Document> metadata () const;
- std::string dci_name (bool if_created_now) const;
+ std::string isdcf_name (bool if_created_now) const;
std::string dcp_name (bool if_created_now = false) const;
/** @return true if our state has changed since we last saved it */
@@ -146,7 +148,7 @@ public:
enum Property {
NONE,
NAME,
- USE_DCI_NAME,
+ USE_ISDCF_NAME,
/** The playlist's content list has changed (i.e. content has been added, moved around or removed) */
CONTENT,
DCP_CONTENT_TYPE,
@@ -157,7 +159,7 @@ public:
SIGNED,
ENCRYPTED,
J2K_BANDWIDTH,
- DCI_METADATA,
+ ISDCF_METADATA,
VIDEO_FRAME_RATE,
AUDIO_CHANNELS,
/** The setting of _three_d has been changed */
@@ -177,8 +179,8 @@ public:
return _name;
}
- bool use_dci_name () const {
- return _use_dci_name;
+ bool use_isdcf_name () const {
+ return _use_isdcf_name;
}
DCPContentType const * dcp_content_type () const {
@@ -214,8 +216,8 @@ public:
return _j2k_bandwidth;
}
- DCIMetadata dci_metadata () const {
- return _dci_metadata;
+ ISDCFMetadata isdcf_metadata () const {
+ return _isdcf_metadata;
}
/** @return The frame rate of the DCP */
@@ -244,7 +246,7 @@ public:
void set_directory (boost::filesystem::path);
void set_name (std::string);
- void set_use_dci_name (bool);
+ void set_use_isdcf_name (bool);
void examine_and_add_content (boost::shared_ptr<Content>);
void add_content (boost::shared_ptr<Content>);
void remove_content (boost::shared_ptr<Content>);
@@ -258,11 +260,11 @@ public:
void set_signed (bool);
void set_encrypted (bool);
void set_j2k_bandwidth (int);
- void set_dci_metadata (DCIMetadata);
+ void set_isdcf_metadata (ISDCFMetadata);
void set_video_frame_rate (int);
void set_audio_channels (int);
void set_three_d (bool);
- void set_dci_date_today ();
+ void set_isdcf_date_today ();
void set_sequence_video (bool);
void set_interop (bool);
@@ -277,6 +279,8 @@ public:
private:
+ friend class ::isdcf_name_test;
+
void signal_changed (Property);
std::string video_identifier () const;
void playlist_changed ();
@@ -295,8 +299,8 @@ private:
/** Name for DCP-o-matic */
std::string _name;
- /** True if a auto-generated DCI-compliant name should be used for our DCP */
- bool _use_dci_name;
+ /** True if a auto-generated ISDCF-compliant name should be used for our DCP */
+ bool _use_isdcf_name;
/** The type of content that this Film represents (feature, trailer etc.) */
DCPContentType const * _dcp_content_type;
/** The container to put this Film in (flat, scope, etc.) */
@@ -311,12 +315,12 @@ private:
bool _encrypted;
/** bandwidth for J2K files in bits per second */
int _j2k_bandwidth;
- /** DCI naming stuff */
- DCIMetadata _dci_metadata;
+ /** ISDCF naming stuff */
+ ISDCFMetadata _isdcf_metadata;
/** Frames per second to run our DCP at */
int _video_frame_rate;
- /** The date that we should use in a DCI name */
- boost::gregorian::date _dci_date;
+ /** The date that we should use in a ISDCF name */
+ boost::gregorian::date _isdcf_date;
/** Number of audio channels to put in the DCP */
int _audio_channels;
/** If true, the DCP will be written in 3D mode; otherwise in 2D.
diff --git a/src/lib/frame_rate_change.h b/src/lib/frame_rate_change.h
index 6165f6840..92af0ec01 100644
--- a/src/lib/frame_rate_change.h
+++ b/src/lib/frame_rate_change.h
@@ -17,6 +17,9 @@
*/
+#ifndef DCPOMATIC_FRAME_RATE_CHANGE_H
+#define DCPOMATIC_FRAME_RATE_CHANGE_H
+
#include <string>
struct FrameRateChange
@@ -56,3 +59,5 @@ struct FrameRateChange
std::string description;
};
+
+#endif
diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc
index 07f047ddd..8909240dc 100644
--- a/src/lib/image_content.cc
+++ b/src/lib/image_content.cc
@@ -24,6 +24,7 @@
#include "compose.hpp"
#include "film.h"
#include "job.h"
+#include "frame_rate_change.h"
#include "i18n.h"
diff --git a/src/lib/image_proxy.cc b/src/lib/image_proxy.cc
index 16bd92f6e..1eb9c169c 100644
--- a/src/lib/image_proxy.cc
+++ b/src/lib/image_proxy.cc
@@ -55,7 +55,7 @@ RawImageProxy::RawImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> soc
xml->number_child<int> ("Width"), xml->number_child<int> ("Height")
);
- _image.reset (new Image (PIX_FMT_RGB24, size, true));
+ _image.reset (new Image (static_cast<AVPixelFormat> (xml->number_child<int> ("PixelFormat")), size, true));
_image->read_from_socket (socket);
}
@@ -71,6 +71,7 @@ RawImageProxy::add_metadata (xmlpp::Node* node) const
node->add_child("Type")->add_child_text (N_("Raw"));
node->add_child("Width")->add_child_text (dcp::raw_convert<string> (_image->size().width));
node->add_child("Height")->add_child_text (dcp::raw_convert<string> (_image->size().height));
+ node->add_child("PixelFormat")->add_child_text (dcp::raw_convert<string> (_image->pixel_format ()));
}
void
@@ -132,22 +133,14 @@ MagickImageProxy::image () const
_image.reset (new Image (PIX_FMT_RGB24, size, true));
- using namespace MagickCore;
-
+ /* Write line-by-line here as _image must be aligned, and write() cannot be told about strides */
uint8_t* p = _image->data()[0];
- for (int y = 0; y < size.height; ++y) {
- uint8_t* q = p;
- for (int x = 0; x < size.width; ++x) {
- Magick::Color c = magick_image->pixelColor (x, y);
- *q++ = c.redQuantum() * 255 / QuantumRange;
- *q++ = c.greenQuantum() * 255 / QuantumRange;
- *q++ = c.blueQuantum() * 255 / QuantumRange;
- }
+ for (int i = 0; i < size.height; ++i) {
+ using namespace MagickCore;
+ magick_image->write (0, i, size.width, 1, "RGB", CharPixel, p);
p += _image->stride()[0];
}
- delete magick_image;
-
LOG_TIMING ("[%1] MagickImageProxy completes decode and convert of %2 bytes", boost::this_thread::get_id(), _blob.length());
return _image;
diff --git a/src/lib/image_proxy.h b/src/lib/image_proxy.h
index b499b3292..f6212e54f 100644
--- a/src/lib/image_proxy.h
+++ b/src/lib/image_proxy.h
@@ -49,7 +49,8 @@ class ImageProxy : public boost::noncopyable
{
public:
ImageProxy (boost::shared_ptr<Log> log);
-
+
+ /** @return Image (which must be aligned) */
virtual boost::shared_ptr<Image> image () const = 0;
virtual void add_metadata (xmlpp::Node *) const = 0;
virtual void send_binary (boost::shared_ptr<Socket>) const = 0;
diff --git a/src/lib/dci_metadata.cc b/src/lib/isdcf_metadata.cc
index c80d91305..7d960b6ac 100644
--- a/src/lib/dci_metadata.cc
+++ b/src/lib/isdcf_metadata.cc
@@ -20,7 +20,7 @@
#include <iostream>
#include <libcxml/cxml.h>
#include <dcp/raw_convert.h>
-#include "dci_metadata.h"
+#include "isdcf_metadata.h"
#include "i18n.h"
@@ -28,7 +28,7 @@ using std::string;
using boost::shared_ptr;
using dcp::raw_convert;
-DCIMetadata::DCIMetadata (cxml::ConstNodePtr node)
+ISDCFMetadata::ISDCFMetadata (cxml::ConstNodePtr node)
{
content_version = node->number_child<int> ("ContentVersion");
audio_language = node->string_child ("AudioLanguage");
@@ -38,10 +38,18 @@ DCIMetadata::DCIMetadata (cxml::ConstNodePtr node)
studio = node->string_child ("Studio");
facility = node->string_child ("Facility");
package_type = node->string_child ("PackageType");
+
+ /* This stuff was added later */
+ temp_version = node->optional_bool_child ("TempVersion").get_value_or (false);
+ pre_release = node->optional_bool_child ("PreRelease").get_value_or (false);
+ red_band = node->optional_bool_child ("RedBand").get_value_or (false);
+ chain = node->optional_string_child ("Chain").get_value_or ("");
+ two_d_version_of_three_d = node->optional_bool_child ("TwoDVersionOfThreeD").get_value_or (false);
+ mastered_luminance = node->optional_string_child ("MasteredLuminance").get_value_or ("");
}
void
-DCIMetadata::as_xml (xmlpp::Node* root) const
+ISDCFMetadata::as_xml (xmlpp::Node* root) const
{
root->add_child("ContentVersion")->add_child_text (raw_convert<string> (content_version));
root->add_child("AudioLanguage")->add_child_text (audio_language);
@@ -51,10 +59,16 @@ DCIMetadata::as_xml (xmlpp::Node* root) const
root->add_child("Studio")->add_child_text (studio);
root->add_child("Facility")->add_child_text (facility);
root->add_child("PackageType")->add_child_text (package_type);
+ root->add_child("TempVersion")->add_child_text (temp_version ? "1" : "0");
+ root->add_child("PreRelease")->add_child_text (pre_release ? "1" : "0");
+ root->add_child("RedBand")->add_child_text (red_band ? "1" : "0");
+ root->add_child("Chain")->add_child_text (chain);
+ root->add_child("TwoDVersionOfThreeD")->add_child_text (two_d_version_of_three_d ? "1" : "0");
+ root->add_child("MasteredLuminance")->add_child_text (mastered_luminance);
}
void
-DCIMetadata::read_old_metadata (string k, string v)
+ISDCFMetadata::read_old_metadata (string k, string v)
{
if (k == N_("audio_language")) {
audio_language = v;
diff --git a/src/lib/dci_metadata.h b/src/lib/isdcf_metadata.h
index 6563ff95c..e63f290e4 100644
--- a/src/lib/dci_metadata.h
+++ b/src/lib/isdcf_metadata.h
@@ -17,21 +17,25 @@
*/
-#ifndef DCPOMATIC_DCI_METADATA_H
-#define DCPOMATIC_DCI_METADATA_H
+#ifndef DCPOMATIC_ISDCF_METADATA_H
+#define DCPOMATIC_ISDCF_METADATA_H
#include <string>
#include <libxml++/libxml++.h>
#include <libcxml/cxml.h>
-class DCIMetadata
+class ISDCFMetadata
{
public:
- DCIMetadata ()
+ ISDCFMetadata ()
: content_version (1)
+ , temp_version (false)
+ , pre_release (false)
+ , red_band (false)
+ , two_d_version_of_three_d (false)
{}
- DCIMetadata (cxml::ConstNodePtr);
+ ISDCFMetadata (cxml::ConstNodePtr);
void as_xml (xmlpp::Node *) const;
void read_old_metadata (std::string, std::string);
@@ -44,6 +48,18 @@ public:
std::string studio;
std::string facility;
std::string package_type;
+ /** true if this is a temporary version (without final picture or sound) */
+ bool temp_version;
+ /** true if this is a pre-release version (final picture and sound, but without accessibility features) */
+ bool pre_release;
+ /** true if this has adult content */
+ bool red_band;
+ /** specific theatre chain or event */
+ std::string chain;
+ /** true if this is a 2D version of content that also exists in 3D */
+ bool two_d_version_of_three_d;
+ /** mastered luminance if there are multiple versions distributed (e.g. 35, 4fl, 6fl etc.) */
+ std::string mastered_luminance;
};
#endif
diff --git a/src/lib/log.cc b/src/lib/log.cc
index 52dff2982..4de6bd874 100644
--- a/src/lib/log.cc
+++ b/src/lib/log.cc
@@ -39,7 +39,7 @@ int const Log::TYPE_TIMING = 0x8;
Log::Log ()
: _types (0)
{
- Config::instance()->Changed.connect (boost::bind (&Log::config_changed, this));
+ _config_connection = Config::instance()->Changed.connect (boost::bind (&Log::config_changed, this));
config_changed ();
}
diff --git a/src/lib/log.h b/src/lib/log.h
index 2ba273b44..94d30de4e 100644
--- a/src/lib/log.h
+++ b/src/lib/log.h
@@ -27,6 +27,7 @@
#include <string>
#include <boost/thread/mutex.hpp>
#include <boost/filesystem.hpp>
+#include <boost/signals2.hpp>
/** @class Log
* @brief A very simple logging class.
@@ -47,16 +48,15 @@ public:
void set_types (int types);
-protected:
- /** mutex to protect the log */
- boost::mutex _mutex;
-
private:
virtual void do_log (std::string m) = 0;
void config_changed ();
+ /** mutex to protect the log */
+ boost::mutex _mutex;
/** bit-field of log types which should be put into the log (others are ignored) */
int _types;
+ boost::signals2::scoped_connection _config_connection;
};
class FileLog : public Log
diff --git a/src/lib/player.cc b/src/lib/player.cc
index c3489b7e1..d0eb27aa3 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -42,6 +42,7 @@
#include "config.h"
#include "content_video.h"
#include "player_video_frame.h"
+#include "frame_rate_change.h"
#define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL);
diff --git a/src/lib/playlist.h b/src/lib/playlist.h
index 6280b1219..7c29b8588 100644
--- a/src/lib/playlist.h
+++ b/src/lib/playlist.h
@@ -26,6 +26,7 @@
#include "ffmpeg_content.h"
#include "audio_mapping.h"
#include "util.h"
+#include "frame_rate_change.h"
class Content;
class FFmpegContent;
diff --git a/src/lib/ratio.cc b/src/lib/ratio.cc
index 275f4ef15..fbd702232 100644
--- a/src/lib/ratio.cc
+++ b/src/lib/ratio.cc
@@ -32,12 +32,12 @@ vector<Ratio const *> Ratio::_ratios;
void
Ratio::setup_ratios ()
{
- _ratios.push_back (new Ratio (float(1290) / 1080, "119", _("1.19"), "F"));
- _ratios.push_back (new Ratio (float(1440) / 1080, "133", _("4:3"), "F"));
- _ratios.push_back (new Ratio (float(1480) / 1080, "137", _("Academy"), "F"));
- _ratios.push_back (new Ratio (float(1485) / 1080, "138", _("1.375"), "F"));
- _ratios.push_back (new Ratio (float(1800) / 1080, "166", _("1.66"), "F"));
- _ratios.push_back (new Ratio (float(1920) / 1080, "178", _("16:9"), "F"));
+ _ratios.push_back (new Ratio (float(1290) / 1080, "119", _("1.19"), "119"));
+ _ratios.push_back (new Ratio (float(1440) / 1080, "133", _("4:3"), "133"));
+ _ratios.push_back (new Ratio (float(1480) / 1080, "137", _("Academy"), "137"));
+ _ratios.push_back (new Ratio (float(1485) / 1080, "138", _("1.375"), "137"));
+ _ratios.push_back (new Ratio (float(1800) / 1080, "166", _("1.66"), "166"));
+ _ratios.push_back (new Ratio (float(1920) / 1080, "178", _("16:9"), "178"));
_ratios.push_back (new Ratio (float(1998) / 1080, "185", _("Flat"), "F"));
_ratios.push_back (new Ratio (float(2048) / 858, "239", _("Scope"), "S"));
_ratios.push_back (new Ratio (float(2048) / 1080, "full-frame", _("Full frame"), "C"));
diff --git a/src/lib/ratio.h b/src/lib/ratio.h
index cd7d0d6e4..22fc7662c 100644
--- a/src/lib/ratio.h
+++ b/src/lib/ratio.h
@@ -31,7 +31,7 @@ public:
: _ratio (ratio)
, _id (id)
, _nickname (n)
- , _dci_name (d)
+ , _isdcf_name (d)
{}
std::string id () const {
@@ -42,8 +42,8 @@ public:
return _nickname;
}
- std::string dci_name () const {
- return _dci_name;
+ std::string isdcf_name () const {
+ return _isdcf_name;
}
float ratio () const {
@@ -62,7 +62,7 @@ private:
std::string _id;
/** nickname (e.g. Flat, Scope) */
std::string _nickname;
- std::string _dci_name;
+ std::string _isdcf_name;
static std::vector<Ratio const *> _ratios;
};
diff --git a/src/lib/server.cc b/src/lib/server.cc
index 507ff2ae5..59364fadd 100644
--- a/src/lib/server.cc
+++ b/src/lib/server.cc
@@ -104,6 +104,7 @@ Server::process (shared_ptr<Socket> socket, struct timeval& after_read, struct t
try {
encoded->send (socket);
} catch (std::exception& e) {
+ cerr << "Send failed; frame " << dcp_video_frame.index() << "\n";
LOG_ERROR ("Send failed; frame %1", dcp_video_frame.index());
throw;
}
@@ -139,6 +140,7 @@ Server::worker_thread ()
frame = process (socket, after_read, after_encode);
ip = socket->socket().remote_endpoint().address().to_string();
} catch (std::exception& e) {
+ cerr << "Error: " << e.what() << "\n";
LOG_ERROR ("Error: %1", e.what());
}
diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc
index ed4f8ffd5..37f205535 100644
--- a/src/lib/sndfile_content.cc
+++ b/src/lib/sndfile_content.cc
@@ -157,4 +157,3 @@ SndfileContent::set_audio_mapping (AudioMapping m)
AudioContent::set_audio_mapping (m);
}
-
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 074e08cb7..55df5cc83 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -267,7 +267,8 @@ terminate ()
try {
// try once to re-throw currently active exception
- if (!tried_throw++) {
+ if (!tried_throw) {
+ tried_throw = true;
throw;
}
}
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index 58053c822..f871f2df6 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -30,6 +30,7 @@
#include "util.h"
#include "film.h"
#include "exceptions.h"
+#include "frame_rate_change.h"
#include "i18n.h"
diff --git a/src/lib/wscript b/src/lib/wscript
index 51aadb83f..407d9cde4 100644
--- a/src/lib/wscript
+++ b/src/lib/wscript
@@ -15,7 +15,6 @@ sources = """
content_factory.cc
content_subtitle.cc
cross.cc
- dci_metadata.cc
dcp_content_type.cc
dcp_video_frame.cc
dcpomatic_time.cc
@@ -41,6 +40,7 @@ sources = """
image_decoder.cc
image_examiner.cc
image_proxy.cc
+ isdcf_metadata.cc
job.cc
job_manager.cc
kdm.cc