#include "server.h"
#include "scaler.h"
#include "filter.h"
+#include "format.h"
+#include "dcp_content_type.h"
#include "sound_processor.h"
#include "i18n.h"
, _tms_path (N_("."))
, _sound_processor (SoundProcessor::from_id (N_("dolby_cp750")))
, _default_still_length (10)
+ , _default_format (0)
+ , _default_dcp_content_type (0)
{
_allowed_dcp_frame_rates.push_back (24);
_allowed_dcp_frame_rates.push_back (25);
}
_language = f.optional_string_child ("Language");
+
+ c = f.optional_string_child ("DefaultFormat");
+ if (c) {
+ _default_format = Format::from_id (c.get ());
+ }
+
+ c = f.optional_string_child ("DefaultDCPContentType");
+ if (c) {
+ _default_dcp_content_type = DCPContentType::from_dci_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"));
_default_still_length = f.optional_number_child<int>("DefaultStillLength").get_value_or (10);
}
_sound_processor = SoundProcessor::from_id (v);
} else if (k == "language") {
_language = v;
+ } else if (k == "default_format") {
+ _default_format = Format::from_id (v);
+ } else if (k == "default_dcp_content_type") {
+ _default_dcp_content_type = DCPContentType::from_dci_name (v);
+ } else if (k == "dcp_metadata_issuer") {
+ _dcp_metadata.issuer = v;
+ } else if (k == "dcp_metadata_creator") {
+ _dcp_metadata.creator = v;
+ } else if (k == "dcp_metadata_issue_date") {
+ _dcp_metadata.issue_date = v;
}
_default_dci_metadata.read_old_metadata (k, v);
if (_language) {
root->add_child("Language")->add_child_text (_language.get());
}
+ if (_default_format) {
+ root->add_child("DefaultFormat")->add_child_text (_default_format->id ());
+ }
+ if (_default_dcp_content_type) {
+ root->add_child("DefaultDCPContentType")->add_child_text (_default_dcp_content_type->dci_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"));
#include <vector>
#include <boost/shared_ptr.hpp>
#include <boost/signals2.hpp>
+#include <libdcp/metadata.h>
#include "dci_metadata.h"
class ServerDescription;
class Scaler;
class Filter;
class SoundProcessor;
+class Format;
+class DCPContentType;
/** @class Config
* @brief A singleton class holding configuration.
return _default_still_length;
}
+ Format const * default_format () const {
+ return _default_format;
+ }
+
+ DCPContentType const * default_dcp_content_type () const {
+ return _default_dcp_content_type;
+ }
+
+ libdcp::XMLMetadata dcp_metadata () const {
+ return _dcp_metadata;
+ }
+
/** @param n New number of local encoding threads */
void set_num_local_encoding_threads (int n) {
_num_local_encoding_threads = n;
_default_still_length = s;
}
+ void set_default_format (Format const * f) {
+ _default_format = f;
+ }
+
+ void set_default_dcp_content_type (DCPContentType const * t) {
+ _default_dcp_content_type = t;
+ }
+
+ void set_dcp_metadata (libdcp::XMLMetadata m) {
+ _dcp_metadata = m;
+ }
+
void write () const;
static Config* instance ();
DCIMetadata _default_dci_metadata;
boost::optional<std::string> _language;
int _default_still_length;
+ Format const * _default_format;
+ DCPContentType const * _default_dcp_content_type;
+ libdcp::XMLMetadata _dcp_metadata;
/** Singleton instance, or 0 */
static Config* _instance;
: _playlist (new Playlist)
, _use_dci_name (true)
, _trust_content_headers (true)
- , _dcp_content_type (0)
- , _format (Format::from_id ("185"))
+ , _dcp_content_type (Config::instance()->default_dcp_content_type ())
+ , _format (Config::instance()->default_format ())
, _scaler (Scaler::from_id ("bicubic"))
, _trim_start (0)
, _trim_end (0)
return s.str ();
}
-/** @return Identifier for this format as metadata for a Film's metadata file */
-string
-Format::as_metadata () const
-{
- return _id;
-}
-
/** Fill our _formats vector with all available formats */
void
Format::setup_formats ()
return *j;
}
-
-/** @param m Metadata, as returned from as_metadata().
- * @return Matching Format, or 0.
- */
-Format const *
-Format::from_metadata (string m)
-{
- return from_id (m);
-}
-
/** @return All available formats */
vector<Format const *>
Format::all ()
return _dci_name;
}
- std::string as_metadata () const;
-
static Format const * from_nickname (std::string n);
- static Format const * from_metadata (std::string m);
static Format const * from_id (std::string i);
static std::vector<Format const *> all ();
static void setup_formats ();
#include <libdcp/picture_frame.h>
#include <libdcp/reel.h>
#include <libdcp/dcp.h>
+#include <libdcp/cpl.h>
#include "writer.h"
#include "compose.hpp"
#include "film.h"
#include "dcp_content_type.h"
#include "player.h"
#include "audio_mapping.h"
+#include "config.h"
#include "i18n.h"
)
));
- dcp.write_xml ();
+ libdcp::XMLMetadata meta = Config::instance()->dcp_metadata ();
+ meta.set_issue_date_now ();
+ dcp.write_xml (meta);
_film->log()->log (String::compose (N_("Wrote %1 FULL, %2 FAKE, %3 REPEAT; %4 pushed to disk"), _full_written, _fake_written, _repeat_written, _pushed_to_disk));
}
#include <iostream>
#include <iomanip>
#include <getopt.h>
-#include <libdcp/test_mode.h>
#include <libdcp/version.h>
#include "format.h"
#include "film.h"
<< " -v, --version show DCP-o-matic version\n"
<< " -h, --help show this help\n"
<< " -d, --deps list DCP-o-matic dependency details and quit\n"
- << " -t, --test run in test mode (repeatable UUID generation, timestamps etc.)\n"
<< " -n, --no-progress do not print progress to stdout\n"
<< " -r, --no-remote do not use any remote servers\n"
<< "\n"
main (int argc, char* argv[])
{
string film_dir;
- bool test_mode = false;
bool progress = true;
bool no_remote = false;
int log_level = 0;
{ "version", no_argument, 0, 'v'},
{ "help", no_argument, 0, 'h'},
{ "deps", no_argument, 0, 'd'},
- { "test", no_argument, 0, 't'},
{ "no-progress", no_argument, 0, 'n'},
{ "no-remote", no_argument, 0, 'r'},
{ "log-level", required_argument, 0, 'l' },
{ 0, 0, 0, 0 }
};
- int c = getopt_long (argc, argv, "vhdtnrl:", long_options, &option_index);
+ int c = getopt_long (argc, argv, "vhdnrl:", long_options, &option_index);
if (c == -1) {
break;
case 'd':
cout << dependency_version_summary () << "\n";
exit (EXIT_SUCCESS);
- case 't':
- test_mode = true;
- break;
case 'n':
progress = false;
break;
}
cout << "\n";
- if (test_mode) {
- libdcp::enable_test_mode ();
- cout << dependency_version_summary() << "\n";
- }
-
shared_ptr<Film> film;
try {
film.reset (new Film (film_dir, true));
cout << "A/B ";
}
cout << "DCP for " << film->name() << "\n";
- cout << "Test mode: " << (test_mode ? "yes" : "no") << "\n";
// cout << "Content: " << film->content() << "\n";
pair<string, string> const f = Filter::ffmpeg_strings (film->filters ());
cout << "Filters: " << f.first << " " << f.second << "\n";
#include "lib/format.h"
#include "lib/scaler.h"
#include "lib/filter.h"
+#include "lib/dcp_content_type.h"
#include "config_dialog.h"
#include "wx_util.h"
#include "filter_dialog.h"
_notebook->AddPage (_misc_panel, _("Miscellaneous"), true);
make_servers_panel ();
_notebook->AddPage (_servers_panel, _("Encoding servers"), false);
+ make_metadata_panel ();
+ _notebook->AddPage (_metadata_panel, _("Metadata"), false);
make_tms_panel ();
_notebook->AddPage (_tms_panel, _("TMS"), false);
make_ab_panel ();
table->Add (_default_dci_metadata_button);
table->AddSpacer (1);
+ add_label_to_sizer (table, _misc_panel, _("Default format"));
+ _default_format = new wxChoice (_misc_panel, wxID_ANY);
+ table->Add (_default_format);
+ table->AddSpacer (1);
+
+ add_label_to_sizer (table, _misc_panel, _("Default content type"));
+ _default_dcp_content_type = new wxChoice (_misc_panel, wxID_ANY);
+ table->Add (_default_dcp_content_type);
+ table->AddSpacer (1);
+
Config* config = Config::instance ();
_set_language->SetValue (config->language ());
_default_dci_metadata_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (ConfigDialog::edit_default_dci_metadata_clicked), 0, this);
+ vector<Format const *> fmt = Format::all ();
+ int n = 0;
+ for (vector<Format const *>::iterator i = fmt.begin(); i != fmt.end(); ++i) {
+ _default_format->Append (std_to_wx ((*i)->name ()));
+ if (*i == config->default_format ()) {
+ _default_format->SetSelection (n);
+ }
+ ++n;
+ }
+
+ _default_format->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (ConfigDialog::default_format_changed), 0, this);
+
+ vector<DCPContentType const *> const ct = DCPContentType::all ();
+ n = 0;
+ for (vector<DCPContentType const *>::const_iterator i = ct.begin(); i != ct.end(); ++i) {
+ _default_dcp_content_type->Append (std_to_wx ((*i)->pretty_name ()));
+ if (*i == config->default_dcp_content_type ()) {
+ _default_dcp_content_type->SetSelection (n);
+ }
+ ++n;
+ }
+
+ _default_dcp_content_type->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (ConfigDialog::default_dcp_content_type_changed), 0, this);
}
void
table->Add (s, 1, wxEXPAND);
table->AddSpacer (0);
}
+}
+
+void
+ConfigDialog::make_metadata_panel ()
+{
+ _metadata_panel = new wxPanel (_notebook);
+ wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
+ _metadata_panel->SetSizer (s);
+
+ wxFlexGridSizer* table = new wxFlexGridSizer (2, 6, 6);
+ table->AddGrowableCol (1, 1);
+ s->Add (table, 1, wxALL | wxEXPAND, 8);
+
+ add_label_to_sizer (table, _metadata_panel, _("Issuer"));
+ _issuer = new wxTextCtrl (_metadata_panel, wxID_ANY);
+ table->Add (_issuer, 1, wxEXPAND);
+
+ add_label_to_sizer (table, _metadata_panel, _("Creator"));
+ _creator = new wxTextCtrl (_metadata_panel, wxID_ANY);
+ table->Add (_creator, 1, wxEXPAND);
Config* config = Config::instance ();
-
- _reference_scaler->SetSelection (Scaler::as_index (config->reference_scaler ()));
- _reference_scaler->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (ConfigDialog::reference_scaler_changed), 0, this);
- pair<string, string> p = Filter::ffmpeg_strings (config->reference_filters ());
- _reference_filters->SetLabel (std_to_wx (p.first) + N_(" ") + std_to_wx (p.second));
- _reference_filters_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (ConfigDialog::edit_reference_filters_clicked), 0, this);
+ _issuer->SetValue (std_to_wx (config->dcp_metadata().issuer));
+ _issuer->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (ConfigDialog::issuer_changed), 0, this);
+ _creator->SetValue (std_to_wx (config->dcp_metadata().creator));
+ _creator->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (ConfigDialog::creator_changed), 0, this);
}
void
{
Config::instance()->set_default_still_length (_default_still_length->GetValue ());
}
+
+void
+ConfigDialog::default_format_changed (wxCommandEvent &)
+{
+ vector<Format const *> fmt = Format::all ();
+ Config::instance()->set_default_format (fmt[_default_format->GetSelection()]);
+}
+
+void
+ConfigDialog::default_dcp_content_type_changed (wxCommandEvent &)
+{
+ vector<DCPContentType const *> ct = DCPContentType::all ();
+ Config::instance()->set_default_dcp_content_type (ct[_default_dcp_content_type->GetSelection()]);
+}
+
+void
+ConfigDialog::issuer_changed (wxCommandEvent &)
+{
+ libdcp::XMLMetadata m = Config::instance()->dcp_metadata ();
+ m.issuer = wx_to_std (_issuer->GetValue ());
+ Config::instance()->set_dcp_metadata (m);
+}
+
+void
+ConfigDialog::creator_changed (wxCommandEvent &)
+{
+ libdcp::XMLMetadata m = Config::instance()->dcp_metadata ();
+ m.creator = wx_to_std (_creator->GetValue ());
+ Config::instance()->set_dcp_metadata (m);
+}
void edit_server_clicked (wxCommandEvent &);
void remove_server_clicked (wxCommandEvent &);
void server_selection_changed (wxListEvent &);
+ void default_format_changed (wxCommandEvent &);
+ void default_dcp_content_type_changed (wxCommandEvent &);
+ void issuer_changed (wxCommandEvent &);
+ void creator_changed (wxCommandEvent &);
void add_server_to_control (ServerDescription *);
void setup_language_sensitivity ();
void make_misc_panel ();
void make_tms_panel ();
+ void make_metadata_panel ();
void make_ab_panel ();
void make_servers_panel ();
wxPanel* _tms_panel;
wxPanel* _ab_panel;
wxPanel* _servers_panel;
+ wxPanel* _metadata_panel;
wxCheckBox* _set_language;
wxChoice* _language;
+ wxChoice* _default_format;
+ wxChoice* _default_dcp_content_type;
wxTextCtrl* _tms_ip;
wxTextCtrl* _tms_path;
wxTextCtrl* _tms_user;
wxButton* _add_server;
wxButton* _edit_server;
wxButton* _remove_server;
+ wxTextCtrl* _issuer;
+ wxTextCtrl* _creator;
};