diff options
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/dcpomatic.cc | 60 | ||||
| -rw-r--r-- | src/tools/dcpomatic_cli.cc | 2 | ||||
| -rw-r--r-- | src/tools/dcpomatic_create.cc | 2 | ||||
| -rw-r--r-- | src/tools/dcpomatic_kdm.cc | 30 | ||||
| -rw-r--r-- | src/tools/dcpomatic_server_cli.cc | 2 | ||||
| -rw-r--r-- | src/tools/server_test.cc | 25 | ||||
| -rw-r--r-- | src/tools/wscript | 10 |
7 files changed, 71 insertions, 60 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index fa89a4871..d08a11ea9 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -30,7 +30,7 @@ #include <wx/stdpaths.h> #include <wx/cmdline.h> #include <wx/preferences.h> -#include <libdcp/exceptions.h> +#include <dcp/exceptions.h> #include "wx/film_viewer.h" #include "wx/film_editor.h" #include "wx/job_manager_view.h" @@ -45,6 +45,7 @@ #include "wx/servers_list_dialog.h" #include "wx/hints_dialog.h" #include "wx/update_dialog.h" +#include "wx/content_panel.h" #include "lib/film.h" #include "lib/config.h" #include "lib/util.h" @@ -72,8 +73,6 @@ using std::exception; using boost::shared_ptr; using boost::dynamic_pointer_cast; -// #define DCPOMATIC_WINDOWS_CONSOLE 1 - class FilmChangedDialog { public: @@ -145,20 +144,24 @@ public: , _history_position (0) , _history_separator (0) { -#if defined(DCPOMATIC_WINDOWS) && defined(DCPOMATIC_WINDOWS_CONSOLE) - AllocConsole(); - - HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE); - int hCrt = _open_osfhandle((intptr_t) handle_out, _O_TEXT); - FILE* hf_out = _fdopen(hCrt, "w"); - setvbuf(hf_out, NULL, _IONBF, 1); - *stdout = *hf_out; - - HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE); - hCrt = _open_osfhandle((intptr_t) handle_in, _O_TEXT); - FILE* hf_in = _fdopen(hCrt, "r"); - setvbuf(hf_in, NULL, _IONBF, 128); - *stdin = *hf_in; +#if defined(DCPOMATIC_WINDOWS) + if (Config::instance()->win32_console ()) { + AllocConsole(); + + HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE); + int hCrt = _open_osfhandle((intptr_t) handle_out, _O_TEXT); + FILE* hf_out = _fdopen(hCrt, "w"); + setvbuf(hf_out, NULL, _IONBF, 1); + *stdout = *hf_out; + + HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE); + hCrt = _open_osfhandle((intptr_t) handle_in, _O_TEXT); + FILE* hf_in = _fdopen(hCrt, "r"); + setvbuf(hf_in, NULL, _IONBF, 128); + *stdin = *hf_in; + + cout << "DCP-o-matic is starting." << "\n"; + } #endif wxMenuBar* bar = new wxMenuBar; @@ -188,12 +191,6 @@ public: Bind (wxEVT_CLOSE_WINDOW, boost::bind (&Frame::close, this, _1)); - wxAcceleratorEntry accel[1]; - accel[0].Set (wxACCEL_CTRL, static_cast<int>('A'), ID_add_file); - Bind (wxEVT_MENU, boost::bind (&FilmEditor::content_add_file_clicked, _film_editor), ID_add_file); - wxAcceleratorTable accel_table (1, accel); - SetAcceleratorTable (accel_table); - /* Use a panel as the only child of the Frame so that we avoid the dark-grey background on Windows. */ @@ -219,6 +216,12 @@ public: JobManager::instance()->ActiveJobsChanged.connect (boost::bind (&Frame::set_menu_sensitivity, this)); overall_panel->SetSizer (main_sizer); + + wxAcceleratorEntry accel[1]; + accel[0].Set (wxACCEL_CTRL, static_cast<int>('A'), ID_add_file); + Bind (wxEVT_MENU, boost::bind (&ContentPanel::add_file_clicked, _film_editor->content_panel()), ID_add_file); + wxAcceleratorTable accel_table (1, accel); + SetAcceleratorTable (accel_table); } void new_film (boost::filesystem::path path) @@ -410,7 +413,7 @@ private: shared_ptr<Job> (new SendKDMEmailJob (_film, d->screens (), d->cpl (), d->from (), d->until (), d->formulation ())) ); } - } catch (libdcp::NotEncryptedError& e) { + } catch (dcp::NotEncryptedError& e) { error_dialog (this, _("CPL's content is not encrypted.")); } catch (exception& e) { error_dialog (this, e.what ()); @@ -423,7 +426,7 @@ private: void content_scale_to_fit_width () { - VideoContentList vc = _film_editor->selected_video_content (); + VideoContentList vc = _film_editor->content_panel()->selected_video (); for (VideoContentList::iterator i = vc.begin(); i != vc.end(); ++i) { (*i)->scale_and_crop_to_fit_width (); } @@ -431,7 +434,7 @@ private: void content_scale_to_fit_height () { - VideoContentList vc = _film_editor->selected_video_content (); + VideoContentList vc = _film_editor->content_panel()->selected_video (); for (VideoContentList::iterator i = vc.begin(); i != vc.end(); ++i) { (*i)->scale_and_crop_to_fit_height (); } @@ -542,7 +545,7 @@ private: } bool const dcp_creation = (i != jobs.end ()) && !(*i)->finished (); bool const have_cpl = _film && !_film->cpls().empty (); - bool const have_selected_video_content = !_film_editor->selected_video_content().empty(); + bool const have_selected_video_content = !_film_editor->content_panel()->selected_video().empty(); for (map<wxMenuItem*, int>::iterator j = menu_items.begin(); j != menu_items.end(); ++j) { @@ -707,6 +710,9 @@ static const wxCmdLineEntryDesc command_line_description[] = { { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 } }; +/** @class App + * @brief The magic App class for wxWidgets. + */ class App : public wxApp { bool OnInit () diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc index 5cb05e11d..8c33b7d83 100644 --- a/src/tools/dcpomatic_cli.cc +++ b/src/tools/dcpomatic_cli.cc @@ -20,7 +20,7 @@ #include <iostream> #include <iomanip> #include <getopt.h> -#include <libdcp/version.h> +#include <dcp/version.h> #include "lib/film.h" #include "lib/filter.h" #include "lib/transcode_job.h" diff --git a/src/tools/dcpomatic_create.cc b/src/tools/dcpomatic_create.cc index 26de1c71f..304f4f697 100644 --- a/src/tools/dcpomatic_create.cc +++ b/src/tools/dcpomatic_create.cc @@ -190,7 +190,7 @@ main (int argc, char* argv[]) for (ContentList::iterator i = content.begin(); i != content.end(); ++i) { shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (*i); if (ic) { - ic->set_video_length (still_length * 24); + ic->set_video_length (ContentTime::from_seconds (still_length)); } } diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 758060a08..6257d60af 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -18,7 +18,7 @@ */ #include <getopt.h> -#include <libdcp/certificates.h> +#include <dcp/certificates.h> #include "lib/film.h" #include "lib/cinema.h" #include "lib/kdm.h" @@ -41,8 +41,8 @@ help () cerr << "Syntax: " << program_name << " [OPTION] [<FILM>]\n" " -h, --help show this help\n" " -o, --output output file or directory\n" - " -f, --valid-from valid from time (e.g. \"2013-09-28 01:41:51\") or \"now\"\n" - " -t, --valid-to valid to time (e.g. \"2014-09-28 01:41:51\")\n" + " -f, --valid-from valid from time (in local time zone) (e.g. \"2013-09-28 01:41:51\") or \"now\"\n" + " -t, --valid-to valid to time (in local time zone) (e.g. \"2014-09-28 01:41:51\")\n" " -d, --valid-duration valid duration (e.g. \"1 day\", \"4 hours\", \"2 weeks\")\n" " --formulation modified-transitional-1, dci-any or dci-specific [default modified-transitional-1]\n" " -z, --zip ZIP each cinema's KDMs into its own file\n" @@ -111,7 +111,7 @@ int main (int argc, char* argv[]) bool cinemas = false; string duration_string; bool verbose = false; - libdcp::KDM::Formulation formulation = libdcp::KDM::MODIFIED_TRANSITIONAL_1; + dcp::Formulation formulation = dcp::MODIFIED_TRANSITIONAL_1; program_name = argv[0]; @@ -171,13 +171,13 @@ int main (int argc, char* argv[]) break; case 'C': if (string (optarg) == "modified-transitional-1") { - formulation = libdcp::KDM::MODIFIED_TRANSITIONAL_1; + formulation = dcp::MODIFIED_TRANSITIONAL_1; } else if (string (optarg) == "dci-any") { - formulation = libdcp::KDM::DCI_ANY; + formulation = dcp::DCI_ANY; } else if (string (optarg) == "dci-specific") { - formulation = libdcp::KDM::DCI_SPECIFIC; + formulation = dcp::DCI_SPECIFIC; } else { - error ("unrecognised KDM formulation " + formulation); + error ("unrecognised KDM formulation " + string (optarg)); } } } @@ -248,8 +248,8 @@ int main (int argc, char* argv[]) error ("you must specify --output"); } - shared_ptr<libdcp::Certificate> certificate (new libdcp::Certificate (boost::filesystem::path (certificate_file))); - libdcp::KDM kdm = film->make_kdm (certificate, cpl, valid_from.get(), valid_to.get(), formulation); + dcp::Certificate certificate (dcp::file_to_string (certificate_file)); + dcp::EncryptedKDM kdm = film->make_kdm (certificate, cpl, valid_from.get(), valid_to.get(), formulation); kdm.as_xml (output); if (verbose) { cout << "Generated KDM " << output << " for certificate.\n"; @@ -273,12 +273,18 @@ int main (int argc, char* argv[]) try { if (zip) { - write_kdm_zip_files (film, (*i)->screens(), cpl, valid_from.get(), valid_to.get(), formulation, output); + write_kdm_zip_files ( + film, (*i)->screens(), cpl, dcp::LocalTime (valid_from.get()), dcp::LocalTime (valid_to.get()), formulation, output + ); + if (verbose) { cout << "Wrote ZIP files to " << output << "\n"; } } else { - write_kdm_files (film, (*i)->screens(), cpl, valid_from.get(), valid_to.get(), formulation, output); + write_kdm_files ( + film, (*i)->screens(), cpl, dcp::LocalTime (valid_from.get()), dcp::LocalTime (valid_to.get()), formulation, output + ); + if (verbose) { cout << "Wrote KDM files to " << output << "\n"; } diff --git a/src/tools/dcpomatic_server_cli.cc b/src/tools/dcpomatic_server_cli.cc index f35797954..b816460a3 100644 --- a/src/tools/dcpomatic_server_cli.cc +++ b/src/tools/dcpomatic_server_cli.cc @@ -32,7 +32,7 @@ #include <boost/thread/mutex.hpp> #include <boost/thread/condition.hpp> #include "lib/config.h" -#include "lib/dcp_video_frame.h" +#include "lib/dcp_video.h" #include "lib/exceptions.h" #include "lib/util.h" #include "lib/config.h" diff --git a/src/tools/server_test.cc b/src/tools/server_test.cc index a5d31fc08..9223efb3e 100644 --- a/src/tools/server_test.cc +++ b/src/tools/server_test.cc @@ -27,14 +27,15 @@ #include "lib/util.h" #include "lib/scaler.h" #include "lib/server.h" -#include "lib/dcp_video_frame.h" +#include "lib/dcp_video.h" #include "lib/decoder.h" #include "lib/exceptions.h" #include "lib/scaler.h" #include "lib/log.h" #include "lib/video_decoder.h" #include "lib/player.h" -#include "lib/player_video_frame.h" +#include "lib/player_video.h" +#include "lib/encoded_data.h" using std::cout; using std::cerr; @@ -45,18 +46,18 @@ using boost::shared_ptr; static shared_ptr<Film> film; static ServerDescription* server; static shared_ptr<FileLog> log_ (new FileLog ("servomatictest.log")); -static int frame = 0; +static int frame_count = 0; void -process_video (shared_ptr<PlayerVideoFrame> pvf) +process_video (shared_ptr<PlayerVideo> pvf) { - shared_ptr<DCPVideoFrame> local (new DCPVideoFrame (pvf, frame, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_)); - shared_ptr<DCPVideoFrame> remote (new DCPVideoFrame (pvf, frame, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_)); + shared_ptr<DCPVideo> local (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, true, log_)); + shared_ptr<DCPVideo> remote (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, true, log_)); - cout << "Frame " << frame << ": "; + cout << "Frame " << frame_count << ": "; cout.flush (); - ++frame; + ++frame_count; shared_ptr<EncodedData> local_encoded = local->encode_locally (); shared_ptr<EncodedData> remote_encoded; @@ -144,12 +145,10 @@ main (int argc, char* argv[]) film->read_metadata (); shared_ptr<Player> player = film->make_player (); - player->disable_audio (); - player->Video.connect (boost::bind (process_video, _1)); - bool done = false; - while (!done) { - done = player->pass (); + DCPTime const frame = DCPTime::from_frames (1, film->video_frame_rate ()); + for (DCPTime t; t < film->length(); t += frame) { + process_video (player->get_video(t, true).front ()); } } catch (std::exception& e) { cerr << "Error: " << e.what() << "\n"; diff --git a/src/tools/wscript b/src/tools/wscript index c4ea1530f..34d8be059 100644 --- a/src/tools/wscript +++ b/src/tools/wscript @@ -13,9 +13,9 @@ def build(bld): obj = bld(features = 'cxx cxxprogram') obj.uselib = 'BOOST_THREAD BOOST_DATETIME OPENJPEG DCP CXML AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE POSTPROC WXWIDGETS QUICKMAIL' obj.includes = ['..'] - obj.use = ['libdcpomatic'] + obj.use = ['libdcpomatic2'] obj.source = '%s.cc' % t - obj.target = t + obj.target = t.replace('dcpomatic', 'dcpomatic2') if t == 'server_test': obj.install_path = None @@ -26,13 +26,13 @@ def build(bld): if bld.env.BUILD_STATIC: obj.uselib += ' GTK' obj.includes = ['..'] - obj.use = ['libdcpomatic', 'libdcpomatic-wx'] + obj.use = ['libdcpomatic2', 'libdcpomatic2-wx'] obj.source = '%s.cc' % t if bld.env.TARGET_WINDOWS: obj.source += ' ../../platform/windows/dcpomatic.rc' - obj.target = t + obj.target = t.replace('dcpomatic', 'dcpomatic2') - i18n.po_to_mo(os.path.join('src', 'tools'), 'dcpomatic', bld) + i18n.po_to_mo(os.path.join('src', 'tools'), 'dcpomatic2', bld) def pot(bld): i18n.pot(os.path.join('src', 'tools'), 'dcpomatic.cc dcpomatic_batch.cc', 'dcpomatic') |
