diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-11-23 13:58:33 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-11-23 13:58:33 +0100 |
| commit | a332bd6be323f03dad5b180fb237afe54f1bf81e (patch) | |
| tree | 70cf0da21c95941cda478717b15ea71aca4c0bdb /src/tools | |
| parent | 1c11eaf92c5d592be6df07e2ac77cfcf65e3ed0c (diff) | |
Remove swaroop variant.
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/dcpomatic.cc | 6 | ||||
| -rw-r--r-- | src/tools/dcpomatic_kdm.cc | 84 | ||||
| -rw-r--r-- | src/tools/dcpomatic_kdm_cli.cc | 2 | ||||
| -rw-r--r-- | src/tools/dcpomatic_player.cc | 84 | ||||
| -rw-r--r-- | src/tools/swaroop_dcpomatic_ecinema.cc | 312 | ||||
| -rw-r--r-- | src/tools/swaroop_dcpomatic_playlist.cc | 482 | ||||
| -rw-r--r-- | src/tools/swaroop_dcpomatic_uuid.cc | 40 | ||||
| -rw-r--r-- | src/tools/wscript | 27 |
8 files changed, 11 insertions, 1026 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 3ddf2256e..d66993388 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -985,11 +985,7 @@ private: shared_ptr<TranscodeJob> job (new TranscodeJob (_film)); job->set_encoder ( shared_ptr<FFmpegEncoder> ( - new FFmpegEncoder (_film, job, d->path(), d->format(), d->mixdown_to_stereo(), d->split_reels(), d->split_streams(), d->x264_crf() -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional<dcp::Key>(), optional<string>() -#endif - ) + new FFmpegEncoder (_film, job, d->path(), d->format(), d->mixdown_to_stereo(), d->split_reels(), d->split_streams(), d->x264_crf()) ) ); JobManager::instance()->add (job); diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index cc070b454..aa7cf8340 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -45,9 +45,6 @@ #include "lib/cinema.h" #include "lib/dkdm_wrapper.h" #include "lib/cross.h" -#ifdef DCPOMATIC_VARIANT_SWAROOP -#include "lib/decrypted_ecinema_kdm.h" -#endif #include <dcp/encrypted_kdm.h> #include <dcp/decrypted_kdm.h> #include <dcp/exceptions.h> @@ -311,47 +308,6 @@ private: list<KDMWithMetadataPtr> kdms; string title; -#ifdef DCPOMATIC_VARIANT_SWAROOP - shared_ptr<ECinemaDKDM> ecinema_dkdm = boost::dynamic_pointer_cast<ECinemaDKDM> (dkdm_base); - if (ecinema_dkdm) { - DecryptedECinemaKDM decrypted (ecinema_dkdm->dkdm(), Config::instance()->decryption_chain()->key().get()); - title = decrypted.name (); - - BOOST_FOREACH (shared_ptr<Screen> i, _screens->screens()) { - - if (!i->recipient) { - continue; - } - - dcp::LocalTime begin(_timing->from(), i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()); - dcp::LocalTime end(_timing->until(), i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()); - - DecryptedECinemaKDM kdm ( - decrypted.id(), - decrypted.name(), - decrypted.key(), - begin, - end - ); - - dcp::NameFormat::Map name_values; - name_values['c'] = i->cinema->name; - name_values['s'] = i->name; - name_values['f'] = title; - name_values['b'] = begin.date() + " " + begin.time_of_day(true, false); - name_values['e'] = end.date() + " " + end.time_of_day(true, false); - name_values['i'] = kdm.id(); - - /* Encrypt */ - kdms.push_back ( - KDMWithMetadataPtr( - new ECinemaKDMWithMetadata(name_values, i->cinema, kdm.encrypt(i->recipient.get())) - ) - ); - } - } -#endif - shared_ptr<DKDM> dkdm = boost::dynamic_pointer_cast<DKDM> (dkdm_base); if (dkdm) { @@ -404,7 +360,7 @@ private: /* Encrypt */ kdms.push_back ( KDMWithMetadataPtr( - new DCPKDMWithMetadata(name_values, i->cinema.get(), i->cinema->emails, encrypted) + new KDMWithMetadata(name_values, i->cinema.get(), i->cinema->emails, encrypted) ) ); } @@ -494,44 +450,6 @@ private: shared_ptr<const dcp::CertificateChain> chain = Config::instance()->decryption_chain(); DCPOMATIC_ASSERT (chain->key()); -#ifdef DCPOMATIC_VARIANT_SWAROOP - try { - cxml::Document test_doc; - string const xml_string = dcp::file_to_string (wx_to_std(d->GetPath()), MAX_KDM_SIZE); - test_doc.read_string (xml_string); - if (test_doc.root_name() == "ECinemaSecurityMessage") { - EncryptedECinemaKDM ekdm(xml_string); - /* Decrypt the DKDM to make sure that we can */ - DecryptedECinemaKDM dkdm(ekdm, chain->key().get()); - - shared_ptr<DKDMBase> new_dkdm(new ECinemaDKDM(ekdm)); - shared_ptr<DKDMGroup> group = dynamic_pointer_cast<DKDMGroup> (selected_dkdm()); - if (!group) { - group = Config::instance()->dkdms(); - } - add_dkdm_model (new_dkdm, group); - add_dkdm_view (new_dkdm); - d->Destroy (); - return; - } - } catch (KDMError& e) { - error_dialog ( - this, "Could not read file as a KDM. Perhaps it is badly formatted, created with the wrong certificate, or not a KDM at all.", - std_to_wx(e.what()) - ); - d->Destroy (); - return; - } catch (dcp::MiscError& e) { - error_dialog ( - this, - _("Could not read file as a KDM. It is much too large. Make sure you are loading a DKDM (XML) file."), - std_to_wx(e.what()) - ); - d->Destroy (); - return; - } -#endif - try { dcp::EncryptedKDM ekdm(dcp::file_to_string (wx_to_std (d->GetPath ()), MAX_KDM_SIZE)); /* Decrypt the DKDM to make sure that we can */ diff --git a/src/tools/dcpomatic_kdm_cli.cc b/src/tools/dcpomatic_kdm_cli.cc index b9f73d357..4da0393b0 100644 --- a/src/tools/dcpomatic_kdm_cli.cc +++ b/src/tools/dcpomatic_kdm_cli.cc @@ -354,7 +354,7 @@ from_dkdm ( name_values['e'] = end.date() + " " + end.time_of_day(true, false); name_values['i'] = kdm.cpl_id(); - kdms.push_back (KDMWithMetadataPtr(new DCPKDMWithMetadata(name_values, i->cinema.get(), i->cinema->emails, kdm))); + kdms.push_back (KDMWithMetadataPtr(new KDMWithMetadata(name_values, i->cinema.get(), i->cinema->emails, kdm))); } write_files (kdms, zip, output, container_name_format, filename_format, verbose); } catch (FileError& e) { diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index a82e67b88..9fab8b588 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -29,9 +29,6 @@ #include "wx/verify_dcp_dialog.h" #include "wx/standard_controls.h" #include "wx/playlist_controls.h" -#ifdef DCPOMATIC_VARIANT_SWAROOP -#include "wx/swaroop_controls.h" -#endif #include "wx/timer_display.h" #include "wx/system_information_dialog.h" #include "wx/player_stress_tester.h" @@ -55,8 +52,6 @@ #include "lib/server.h" #include "lib/dcpomatic_socket.h" #include "lib/scoped_temporary.h" -#include "lib/monitor_checker.h" -#include "lib/lock_file_checker.h" #include "lib/ffmpeg_content.h" #include "lib/dcpomatic_log.h" #include "lib/file_log.h" @@ -201,11 +196,6 @@ public: _overall_panel = new wxPanel (this, wxID_ANY); _viewer.reset (new FilmViewer (_overall_panel)); -#ifdef DCPOMATIC_VARIANT_SWAROOP - SwaroopControls* sc = new SwaroopControls (_overall_panel, _viewer); - _controls = sc; - sc->ResetFilm.connect (bind(&DOMFrame::reset_film_weak, this, _1)); -#else if (Config::instance()->player_mode() == Config::PLAYER_MODE_DUAL) { PlaylistControls* pc = new PlaylistControls (_overall_panel, _viewer); _controls = pc; @@ -213,7 +203,6 @@ public: } else { _controls = new StandardControls (_overall_panel, _viewer, false); } -#endif _viewer->set_dcp_decode_reduction (Config::instance()->decode_reduction ()); _viewer->PlaybackPermitted.connect (bind(&DOMFrame::playback_permitted, this)); _viewer->Started.connect (bind(&DOMFrame::playback_started, this, _1)); @@ -262,39 +251,11 @@ public: reset_film (); UpdateChecker::instance()->StateChanged.connect (boost::bind (&DOMFrame::update_checker_state_changed, this)); -#ifdef DCPOMATIC_VARIANT_SWAROOP - MonitorChecker::instance()->StateChanged.connect(boost::bind(&DOMFrame::monitor_checker_state_changed, this)); - MonitorChecker::instance()->run (); - LockFileChecker::instance()->StateChanged.connect(boost::bind(&DOMFrame::lock_checker_state_changed, this)); - LockFileChecker::instance()->run (); -#endif setup_screen (); _stress.LoadDCP.connect (boost::bind(&DOMFrame::load_dcp, this, _1)); - -#ifdef DCPOMATIC_VARIANT_SWAROOP - sc->check_restart (); -#endif - } - -#ifdef DCPOMATIC_VARIANT_SWAROOP - void monitor_checker_state_changed () - { - if (!MonitorChecker::instance()->ok()) { - _viewer->stop (); - error_dialog (this, _("The required display devices are not connected correctly.")); - } } - void lock_checker_state_changed () - { - if (!LockFileChecker::instance()->ok()) { - _viewer->stop (); - error_dialog (this, _("The lock file is not present.")); - } - } -#endif - void setup_main_sizer (Config::PlayerMode mode) { _main_sizer->Detach (_viewer->panel()); @@ -311,16 +272,6 @@ public: bool playback_permitted () { -#ifdef DCPOMATIC_VARIANT_SWAROOP - if (!MonitorChecker::instance()->ok()) { - error_dialog (this, _("The required display devices are not connected correctly.")); - return false; - } - if (!LockFileChecker::instance()->ok()) { - error_dialog (this, _("The lock file is not present.")); - return false; - } -#endif if (!_film || !Config::instance()->respect_kdm_validity_periods()) { return true; } @@ -333,15 +284,6 @@ public: } } -#ifdef DCPOMATIC_VARIANT_SWAROOP - BOOST_FOREACH (shared_ptr<Content> i, _film->content()) { - shared_ptr<FFmpegContent> c = dynamic_pointer_cast<FFmpegContent>(i); - if (c && !c->kdm_timing_window_valid()) { - ok = false; - } - } -#endif - if (!ok) { error_dialog (this, _("The KDM does not allow playback of this content at this time.")); } @@ -391,14 +333,6 @@ public: void playback_stopped (DCPTime time) { -#ifdef DCPOMATIC_VARIANT_SWAROOP - try { - boost::filesystem::remove (Config::path("position")); - } catch (...) { - /* Never mind */ - } -#endif - _controls->log (wxString::Format("playback-stopped %s", time.timecode(_film->video_frame_rate()).c_str())); } @@ -424,9 +358,7 @@ public: if (!ok || !report_errors_from_last_job(this)) { return; } -#ifndef DCPOMATIC_VARIANT_SWAROOP Config::instance()->add_to_player_history (dir); -#endif } catch (dcp::ReadError& e) { error_dialog (this, wxString::Format(_("Could not load a DCP from %s"), std_to_wx(dir.string())), std_to_wx(e.what())); } catch (DCPError& e) { @@ -587,10 +519,8 @@ private: optional<int> c = Config::instance()->decode_reduction(); _view_cpl = view->Append(ID_view_cpl, _("CPL"), _cpl_menu); view->AppendSeparator(); -#ifndef DCPOMATIC_VARIANT_SWAROOP _view_full_screen = view->AppendCheckItem(ID_view_full_screen, _("Full screen\tF11")); _view_dual_screen = view->AppendCheckItem(ID_view_dual_screen, _("Dual screen\tShift+F11")); -#endif setup_menu (); view->AppendSeparator(); view->Append(ID_view_closed_captions, _("Closed captions...")); @@ -702,22 +632,8 @@ private: if (d->ShowModal() == wxID_OK) { DCPOMATIC_ASSERT (_film); -#ifdef DCPOMATIC_VARIANT_SWAROOP - shared_ptr<FFmpegContent> ffmpeg = boost::dynamic_pointer_cast<FFmpegContent>(_film->content().front()); - if (ffmpeg) { - try { - ffmpeg->add_kdm (EncryptedECinemaKDM(dcp::file_to_string(wx_to_std(d->GetPath()), MAX_KDM_SIZE))); - } catch (exception& e) { - error_dialog (this, wxString::Format(_("Could not load KDM.")), std_to_wx(e.what())); - d->Destroy(); - return; - } - } -#endif shared_ptr<DCPContent> dcp = boost::dynamic_pointer_cast<DCPContent>(_film->content().front()); -#ifndef DCPOMATIC_VARIANT_SWAROOP DCPOMATIC_ASSERT (dcp); -#endif try { if (dcp) { dcp->add_kdm (dcp::EncryptedKDM(dcp::file_to_string(wx_to_std(d->GetPath()), MAX_KDM_SIZE))); diff --git a/src/tools/swaroop_dcpomatic_ecinema.cc b/src/tools/swaroop_dcpomatic_ecinema.cc deleted file mode 100644 index 152194c48..000000000 --- a/src/tools/swaroop_dcpomatic_ecinema.cc +++ /dev/null @@ -1,312 +0,0 @@ -/* - Copyright (C) 2018-2019 Carl Hetherington <cth@carlh.net> - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. - -*/ - -#include "lib/version.h" -#include "lib/decrypted_ecinema_kdm.h" -#include "lib/config.h" -#include "lib/util.h" -#include "lib/film.h" -#include "lib/dcp_content.h" -#include "lib/job_manager.h" -#include "lib/cross.h" -#include "lib/transcode_job.h" -#include "lib/ffmpeg_encoder.h" -#include "lib/signal_manager.h" -#include "lib/video_content.h" -#include "lib/ratio.h" -#include <dcp/key.h> -extern "C" { -#include <libavformat/avformat.h> -#include <libavutil/aes_ctr.h> -} -#include <boost/filesystem.hpp> -#include <boost/optional.hpp> -#include <openssl/rand.h> -#include <getopt.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <string> -#include <iostream> - -using std::string; -using std::cerr; -using std::cout; -using std::ofstream; -using boost::optional; -using boost::shared_ptr; - -static void convert_dcp ( - boost::filesystem::path input, - boost::filesystem::path output_file, - boost::optional<boost::filesystem::path> kdm, - int crf - ); -static void convert_ffmpeg (boost::filesystem::path input, boost::filesystem::path output_file, string format); -static void write_kdm (string id, boost::filesystem::path name, dcp::Key key); - -static void -help (string n) -{ - cerr << "Syntax: " << n << " [OPTION] <FILE>|<DIRECTORY>\n" - << " -v, --version show DCP-o-matic version\n" - << " -h, --help show this help\n" - << " -o, --output output directory\n" - << " -f, --format output format (mov or mp4; defaults to mov)\n" - << " -k, --kdm DCP KDM filename (if required)\n" - << " -c, --crf quality (CRF) when transcoding from DCP (0 is best, 51 is worst, defaults to 23)\n" - << "\n" - << "<FILE> is an unencrypted .mp4 file; <DIRECTORY> is a DCP directory.\n"; -} - -int -main (int argc, char* argv[]) -{ - optional<boost::filesystem::path> output; - optional<string> format; - optional<boost::filesystem::path> kdm; - int crf = 23; - - int option_index = 0; - while (true) { - static struct option long_options[] = { - { "version", no_argument, 0, 'v' }, - { "help", no_argument, 0, 'h' }, - { "output", required_argument, 0, 'o' }, - { "format", required_argument, 0, 'f' }, - { "kdm", required_argument, 0, 'k' }, - { "crf", required_argument, 0, 'c' }, - }; - - int c = getopt_long (argc, argv, "vho:f:k:c:", long_options, &option_index); - - if (c == -1) { - break; - } - - switch (c) { - case 'v': - cout << "dcpomatic version " << dcpomatic_version << " " << dcpomatic_git_commit << "\n"; - exit (EXIT_SUCCESS); - case 'h': - help (argv[0]); - exit (EXIT_SUCCESS); - case 'o': - output = optarg; - break; - case 'f': - format = optarg; - break; - case 'k': - kdm = optarg; - break; - case 'c': - crf = atoi(optarg); - break; - } - } - - if (optind >= argc) { - help (argv[0]); - exit (EXIT_FAILURE); - } - - if (!output) { - cerr << "You must specify --output-media or -o\n"; - exit (EXIT_FAILURE); - } - - if (!format) { - format = "mov"; - } - - if (*format != "mov" && *format != "mp4") { - cerr << "Invalid format specified: must be mov or mp4\n"; - exit (EXIT_FAILURE); - } - - dcpomatic_setup_path_encoding (); - dcpomatic_setup (); - signal_manager = new SignalManager (); - - boost::filesystem::path input = argv[optind]; - boost::filesystem::path output_file; - if (boost::filesystem::is_directory(input)) { - output_file = *output / (input.parent_path().filename().string() + ".ecinema"); - } else { - output_file = *output / (input.filename().string() + ".ecinema"); - } - - if (!boost::filesystem::is_directory(*output)) { - boost::filesystem::create_directory (*output); - } - - av_register_all (); - - if (boost::filesystem::is_directory(input)) { - /* Assume input is a DCP */ - convert_dcp (input, output_file, kdm, crf); - } else { - convert_ffmpeg (input, output_file, *format); - } -} - -static void -convert_ffmpeg (boost::filesystem::path input, boost::filesystem::path output_file, string format) -{ - AVFormatContext* input_fc = avformat_alloc_context (); - if (avformat_open_input(&input_fc, input.string().c_str(), 0, 0) < 0) { - cerr << "Could not open input file\n"; - exit (EXIT_FAILURE); - } - - if (avformat_find_stream_info (input_fc, 0) < 0) { - cerr << "Could not read stream information\n"; - exit (EXIT_FAILURE); - } - - AVFormatContext* output_fc; - avformat_alloc_output_context2 (&output_fc, av_guess_format(format.c_str(), 0, 0), 0, 0); - - for (uint32_t i = 0; i < input_fc->nb_streams; ++i) { - AVStream* is = input_fc->streams[i]; - AVStream* os = avformat_new_stream (output_fc, is->codec->codec); - if (avcodec_parameters_copy (os->codecpar, is->codecpar) < 0) { - cerr << "Could not set up output stream.\n"; - exit (EXIT_FAILURE); - } - - os->avg_frame_rate = is->avg_frame_rate; - - switch (is->codec->codec_type) { - case AVMEDIA_TYPE_VIDEO: - os->time_base = is->time_base; - os->r_frame_rate = is->r_frame_rate; - os->sample_aspect_ratio = is->sample_aspect_ratio; - os->codec->time_base = is->codec->time_base; - os->codec->framerate = is->codec->framerate; - os->codec->pix_fmt = is->codec->pix_fmt; - break; - case AVMEDIA_TYPE_AUDIO: - os->codec->sample_fmt = is->codec->sample_fmt; - os->codec->bits_per_raw_sample = is->codec->bits_per_raw_sample; - os->codec->sample_rate = is->codec->sample_rate; - os->codec->channel_layout = is->codec->channel_layout; - os->codec->channels = is->codec->channels; - if (is->codecpar->codec_id == AV_CODEC_ID_PCM_S24LE) { - /* XXX: fix incoming 24-bit files labelled lpcm, which apparently isn't allowed */ - os->codecpar->codec_tag = MKTAG('i', 'n', '2', '4'); - } - break; - default: - /* XXX */ - break; - } - } - - if (avio_open2 (&output_fc->pb, output_file.string().c_str(), AVIO_FLAG_WRITE, 0, 0) < 0) { - cerr << "Could not open output file `" << output_file.string() << "'\n"; - exit (EXIT_FAILURE); - } - - dcp::Key key (AES_CTR_KEY_SIZE); - AVDictionary* options = 0; - av_dict_set (&options, "encryption_key", key.hex().c_str(), 0); - /* XXX: is this OK? */ - av_dict_set (&options, "encryption_kid", "00000000000000000000000000000000", 0); - av_dict_set (&options, "encryption_scheme", "cenc-aes-ctr", 0); - - string id = dcp::make_uuid (); - if (av_dict_set(&output_fc->metadata, SWAROOP_ID_TAG, id.c_str(), 0) < 0) { - cerr << "Could not write ID to output.\n"; - exit (EXIT_FAILURE); - } - - if (avformat_write_header (output_fc, &options) < 0) { - cerr << "Could not write header to output.\n"; - exit (EXIT_FAILURE); - } - - AVPacket packet; - while (av_read_frame(input_fc, &packet) >= 0) { - AVStream* is = input_fc->streams[packet.stream_index]; - AVStream* os = output_fc->streams[packet.stream_index]; - packet.pts = av_rescale_q_rnd(packet.pts, is->time_base, os->time_base, (AVRounding) (AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX)); - packet.dts = av_rescale_q_rnd(packet.dts, is->time_base, os->time_base, (AVRounding) (AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX)); - packet.duration = av_rescale_q(packet.duration, is->time_base, os->time_base); - packet.pos = -1; - if (av_interleaved_write_frame (output_fc, &packet) < 0) { - cerr << "Could not write frame to output.\n"; - exit (EXIT_FAILURE); - } - } - - av_write_trailer (output_fc); - - avformat_free_context (input_fc); - avformat_free_context (output_fc); - - write_kdm (id, output_file, key); -} - -static void -write_kdm (string id, boost::filesystem::path name, dcp::Key key) -{ - DecryptedECinemaKDM decrypted_kdm (id, name.filename().string(), key, optional<dcp::LocalTime>(), optional<dcp::LocalTime>()); - EncryptedECinemaKDM encrypted_kdm = decrypted_kdm.encrypt (Config::instance()->decryption_chain()->leaf()); - - ofstream f(string(name.string() + ".xml").c_str()); - f << encrypted_kdm.as_xml() << "\n"; -} - -static void -convert_dcp ( - boost::filesystem::path input, boost::filesystem::path output_file, optional<boost::filesystem::path> kdm, int crf - ) -{ - shared_ptr<Film> film (new Film(boost::optional<boost::filesystem::path>())); - shared_ptr<DCPContent> dcp (new DCPContent(input)); - film->examine_and_add_content (dcp); - if (kdm) { - dcp->add_kdm (dcp::EncryptedKDM(dcp::file_to_string(*kdm))); - } - - JobManager* jm = JobManager::instance (); - while (jm->work_to_do ()) { - while (signal_manager->ui_idle ()) {} - dcpomatic_sleep_seconds (1); - } - DCPOMATIC_ASSERT (!jm->errors()); - - film->set_container (Ratio::nearest_from_ratio(dcp->video->size().ratio())); - - string id = dcp::make_uuid (); - dcp::Key key (AES_CTR_KEY_SIZE); - - shared_ptr<TranscodeJob> job (new TranscodeJob(film)); - job->set_encoder ( - shared_ptr<FFmpegEncoder>( - new FFmpegEncoder(film, job, output_file, EXPORT_FORMAT_H264_PCM, false, false, crf, key, id) - ) - ); - jm->add (job); - show_jobs_on_console (true); - - write_kdm (id, output_file, key); -} diff --git a/src/tools/swaroop_dcpomatic_playlist.cc b/src/tools/swaroop_dcpomatic_playlist.cc deleted file mode 100644 index e22961240..000000000 --- a/src/tools/swaroop_dcpomatic_playlist.cc +++ /dev/null @@ -1,482 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington <cth@carlh.net> - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. - -*/ - -#include "../wx/wx_util.h" -#include "../wx/wx_signal_manager.h" -#include "../wx/content_view.h" -#include "../wx/dcpomatic_button.h" -#include "../lib/util.h" -#include "../lib/config.h" -#include "../lib/cross.h" -#include "../lib/film.h" -#include "../lib/dcp_content.h" -#include "../lib/swaroop_spl_entry.h" -#include "../lib/swaroop_spl.h" -#include <wx/wx.h> -#include <wx/listctrl.h> -#include <wx/imaglist.h> -#include <wx/spinctrl.h> -#ifdef __WXOSX__ -#include <ApplicationServices/ApplicationServices.h> -#endif - -using std::exception; -using std::cout; -using std::string; -using boost::optional; -using boost::shared_ptr; -using boost::weak_ptr; -using boost::bind; -using boost::dynamic_pointer_cast; -#if BOOST_VERSION >= 106100 -using namespace boost::placeholders; -#endif - - -class ContentDialog : public wxDialog, public ContentStore -{ -public: - ContentDialog (wxWindow* parent) - : wxDialog (parent, wxID_ANY, _("Add content"), wxDefaultPosition, wxSize(800, 640)) - , _content_view (new ContentView(this)) - { - _content_view->update (); - - wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); - SetSizer (overall_sizer); - - overall_sizer->Add (_content_view, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); - - wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL); - if (buttons) { - overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder()); - } - - overall_sizer->Layout (); - } - - shared_ptr<Content> selected () const - { - return _content_view->selected (); - } - - shared_ptr<Content> get (string digest) const - { - return _content_view->get (digest); - } - -private: - ContentView* _content_view; -}; - -class DOMFrame : public wxFrame -{ -public: - explicit DOMFrame (wxString const & title) - : wxFrame (0, -1, title) - , _content_dialog (new ContentDialog(this)) - { - /* Use a panel as the only child of the Frame so that we avoid - the dark-grey background on Windows. - */ - wxPanel* overall_panel = new wxPanel (this, wxID_ANY); - wxBoxSizer* h_sizer = new wxBoxSizer (wxHORIZONTAL); - - _list = new wxListCtrl ( - overall_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL - ); - - _list->AppendColumn (_("Name"), wxLIST_FORMAT_LEFT, 400); - _list->AppendColumn (_("CPL"), wxLIST_FORMAT_LEFT, 350); - _list->AppendColumn (_("Type"), wxLIST_FORMAT_CENTRE, 100); - _list->AppendColumn (_("Format"), wxLIST_FORMAT_CENTRE, 75); - _list->AppendColumn (_("Encrypted"), wxLIST_FORMAT_CENTRE, 90); - _list->AppendColumn (_("Skippable"), wxLIST_FORMAT_CENTRE, 90); - _list->AppendColumn (_("Disable timeline"), wxLIST_FORMAT_CENTRE, 125); - _list->AppendColumn (_("Stop after play"), wxLIST_FORMAT_CENTRE, 125); - - wxImageList* images = new wxImageList (16, 16); - wxIcon tick_icon; - wxIcon no_tick_icon; -#ifdef DCPOMATIX_OSX - tick_icon.LoadFile ("tick.png", wxBITMAP_TYPE_PNG_RESOURCE); - no_tick_icon.LoadFile ("no_tick.png", wxBITMAP_TYPE_PNG_RESOURCE); -#else - boost::filesystem::path tick_path = resources_path() / "tick.png"; - tick_icon.LoadFile (std_to_wx(tick_path.string())); - boost::filesystem::path no_tick_path = resources_path() / "no_tick.png"; - no_tick_icon.LoadFile (std_to_wx(no_tick_path.string())); -#endif - images->Add (tick_icon); - images->Add (no_tick_icon); - - _list->SetImageList (images, wxIMAGE_LIST_SMALL); - - h_sizer->Add (_list, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP); - - wxBoxSizer* button_sizer = new wxBoxSizer (wxVERTICAL); - _up = new Button (overall_panel, _("Up")); - _down = new Button (overall_panel, _("Down")); - _add = new Button (overall_panel, _("Add")); - _remove = new Button (overall_panel, _("Remove")); - _save = new Button (overall_panel, _("Save playlist")); - _load = new Button (overall_panel, _("Load playlist")); - button_sizer->Add (_up, 0, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - button_sizer->Add (_down, 0, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - button_sizer->Add (_add, 0, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - button_sizer->Add (_remove, 0, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - button_sizer->Add (_save, 0, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - button_sizer->Add (_load, 0, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - - h_sizer->Add (button_sizer, 0, wxALL, DCPOMATIC_SIZER_GAP); - - wxBoxSizer* v_sizer = new wxBoxSizer (wxVERTICAL); - - wxBoxSizer* allowed_shows_sizer = new wxBoxSizer (wxHORIZONTAL); - _allowed_shows_enable = new wxCheckBox (overall_panel, wxID_ANY, _("Limit number of shows with this playlist to")); - allowed_shows_sizer->Add (_allowed_shows_enable, 0, wxRIGHT, DCPOMATIC_SIZER_GAP); - _allowed_shows = new wxSpinCtrl (overall_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 65536, 100); - allowed_shows_sizer->Add (_allowed_shows); - - v_sizer->Add (allowed_shows_sizer, 0, wxALL, DCPOMATIC_SIZER_GAP); - v_sizer->Add (h_sizer); - - overall_panel->SetSizer (v_sizer); - - _list->Bind (wxEVT_LEFT_DOWN, bind(&DOMFrame::list_left_click, this, _1)); - _list->Bind (wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind (&DOMFrame::selection_changed, this)); - _list->Bind (wxEVT_COMMAND_LIST_ITEM_DESELECTED, boost::bind (&DOMFrame::selection_changed, this)); - _up->Bind (wxEVT_BUTTON, bind(&DOMFrame::up_clicked, this)); - _down->Bind (wxEVT_BUTTON, bind(&DOMFrame::down_clicked, this)); - _add->Bind (wxEVT_BUTTON, bind(&DOMFrame::add_clicked, this)); - _remove->Bind (wxEVT_BUTTON, bind(&DOMFrame::remove_clicked, this)); - _save->Bind (wxEVT_BUTTON, bind(&DOMFrame::save_clicked, this)); - _load->Bind (wxEVT_BUTTON, bind(&DOMFrame::load_clicked, this)); - _allowed_shows_enable->Bind (wxEVT_CHECKBOX, bind(&DOMFrame::allowed_shows_changed, this)); - _allowed_shows->Bind (wxEVT_SPINCTRL, bind(&DOMFrame::allowed_shows_changed, this)); - - setup_sensitivity (); - } - -private: - - void allowed_shows_changed () - { - if (_allowed_shows_enable->GetValue()) { - _playlist.set_allowed_shows (_allowed_shows->GetValue()); - } else { - _playlist.unset_allowed_shows (); - } - setup_sensitivity (); - } - - void add (SPLEntry e) - { - wxListItem item; - item.SetId (_list->GetItemCount()); - long const N = _list->InsertItem (item); - set_item (N, e); - } - - void selection_changed () - { - setup_sensitivity (); - } - - void set_item (long N, SPLEntry e) - { - _list->SetItem (N, 0, std_to_wx(e.name)); - _list->SetItem (N, 1, std_to_wx(e.id)); - _list->SetItem (N, 2, std_to_wx(dcp::content_kind_to_string(e.kind))); - _list->SetItem (N, 3, e.type == SPLEntry::DCP ? _("DCP") : _("E-cinema")); - _list->SetItem (N, 4, e.encrypted ? S_("Question|Y") : S_("Question|N")); - _list->SetItem (N, COLUMN_SKIPPABLE, wxEmptyString, e.skippable ? 0 : 1); - _list->SetItem (N, COLUMN_DISABLE_TIMELINE, wxEmptyString, e.disable_timeline ? 0 : 1); - _list->SetItem (N, COLUMN_STOP_AFTER_PLAY, wxEmptyString, e.stop_after_play ? 0 : 1); - } - - void setup_sensitivity () - { - int const num_selected = _list->GetSelectedItemCount (); - long int selected = _list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - _up->Enable (selected > 0); - _down->Enable (selected != -1 && selected < (_list->GetItemCount() - 1)); - _remove->Enable (num_selected > 0); - _allowed_shows->Enable (_allowed_shows_enable->GetValue()); - } - - void list_left_click (wxMouseEvent& ev) - { - int flags; - long item = _list->HitTest (ev.GetPosition(), flags, 0); - int x = ev.GetPosition().x; - optional<int> column; - for (int i = 0; i < _list->GetColumnCount(); ++i) { - x -= _list->GetColumnWidth (i); - if (x < 0) { - column = i; - break; - } - } - - if (item != -1 && column) { - switch (*column) { - case COLUMN_SKIPPABLE: - _playlist[item].skippable = !_playlist[item].skippable; - break; - case COLUMN_DISABLE_TIMELINE: - _playlist[item].disable_timeline = !_playlist[item].disable_timeline; - break; - case COLUMN_STOP_AFTER_PLAY: - _playlist[item].stop_after_play = !_playlist[item].stop_after_play; - break; - default: - ev.Skip (); - } - set_item (item, _playlist[item]); - } else { - ev.Skip (); - } - } - - void add_clicked () - { - int const r = _content_dialog->ShowModal (); - if (r == wxID_OK) { - shared_ptr<Content> content = _content_dialog->selected (); - if (content) { - SPLEntry e (content); - add (e); - _playlist.add (e); - } - } - } - - void up_clicked () - { - long int s = _list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (s < 1) { - return; - } - - SPLEntry tmp = _playlist[s]; - _playlist[s] = _playlist[s-1]; - _playlist[s-1] = tmp; - - set_item (s - 1, _playlist[s-1]); - set_item (s, _playlist[s]); - } - - void down_clicked () - { - long int s = _list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (s > (_list->GetItemCount() - 1)) { - return; - } - - SPLEntry tmp = _playlist[s]; - _playlist[s] = _playlist[s+1]; - _playlist[s+1] = tmp; - - set_item (s + 1, _playlist[s+1]); - set_item (s, _playlist[s]); - } - - void remove_clicked () - { - long int s = _list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (s == -1) { - return; - } - - _playlist.remove (s); - _list->DeleteItem (s); - } - - void save_clicked () - { - Config* c = Config::instance (); - wxString default_dir = c->player_playlist_directory() ? std_to_wx(c->player_playlist_directory()->string()) : wxString(wxEmptyString); - wxFileDialog* d = new wxFileDialog (this, _("Select playlist file"), default_dir, wxEmptyString, wxT("XML files (*.xml)|*.xml"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT); - if (d->ShowModal() == wxID_OK) { - boost::filesystem::path file = wx_to_std (d->GetPath()); - file.replace_extension (".xml"); - _playlist.write (file); - } - } - - void load_clicked () - { - Config* c = Config::instance (); - wxString default_dir = c->player_playlist_directory() ? std_to_wx(c->player_playlist_directory()->string()) : wxString(wxEmptyString); - wxFileDialog* d = new wxFileDialog (this, _("Select playlist file"), default_dir, wxEmptyString, wxT("XML files (*.xml)|*.xml")); - if (d->ShowModal() == wxID_OK) { - _list->DeleteAllItems (); - _playlist.read (wx_to_std(d->GetPath()), _content_dialog); - if (!_playlist.missing()) { - _list->DeleteAllItems (); - BOOST_FOREACH (SPLEntry i, _playlist.get()) { - add (i); - } - } else { - error_dialog (this, _("Some content in this playlist was not found.")); - } - optional<int> allowed_shows = _playlist.allowed_shows (); - _allowed_shows_enable->SetValue (static_cast<bool>(allowed_shows)); - if (allowed_shows) { - _allowed_shows->SetValue (*allowed_shows); - } else { - _allowed_shows->SetValue (65536); - } - setup_sensitivity (); - } - } - - wxListCtrl* _list; - wxButton* _up; - wxButton* _down; - wxButton* _add; - wxButton* _remove; - wxButton* _save; - wxButton* _load; - wxCheckBox* _allowed_shows_enable; - wxSpinCtrl* _allowed_shows; - SPL _playlist; - ContentDialog* _content_dialog; - - enum { - COLUMN_SKIPPABLE = 5, - COLUMN_DISABLE_TIMELINE = 6, - COLUMN_STOP_AFTER_PLAY = 7 - }; -}; - -/** @class App - * @brief The magic App class for wxWidgets. - */ -class App : public wxApp -{ -public: - App () - : wxApp () - , _frame (0) - {} - -private: - - bool OnInit () - try - { - SetAppName (_("DCP-o-matic KDM Creator")); - - if (!wxApp::OnInit()) { - return false; - } - -#ifdef DCPOMATIC_LINUX - unsetenv ("UBUNTU_MENUPROXY"); -#endif - -#ifdef __WXOSX__ - ProcessSerialNumber serial; - GetCurrentProcess (&serial); - TransformProcessType (&serial, kProcessTransformToForegroundApplication); -#endif - - dcpomatic_setup_path_encoding (); - - /* Enable i18n; this will create a Config object - to look for a force-configured language. This Config - object will be wrong, however, because dcpomatic_setup - hasn't yet been called and there aren't any filters etc. - set up yet. - */ - dcpomatic_setup_i18n (); - - /* Set things up, including filters etc. - which will now be internationalised correctly. - */ - dcpomatic_setup (); - - /* Force the configuration to be re-loaded correctly next - time it is needed. - */ - Config::drop (); - - _frame = new DOMFrame (_("DCP-o-matic Playlist Editor")); - SetTopWindow (_frame); - _frame->Maximize (); - _frame->Show (); - - signal_manager = new wxSignalManager (this); - Bind (wxEVT_IDLE, boost::bind (&App::idle, this)); - - return true; - } - catch (exception& e) - { - error_dialog (0, _("DCP-o-matic could not start"), std_to_wx(e.what())); - return true; - } - - /* An unhandled exception has occurred inside the main event loop */ - bool OnExceptionInMainLoop () - { - try { - throw; - } catch (FileError& e) { - error_dialog ( - 0, - wxString::Format ( - _("An exception occurred: %s (%s)\n\n") + REPORT_PROBLEM, - std_to_wx (e.what()), - std_to_wx (e.file().string().c_str ()) - ) - ); - } catch (exception& e) { - error_dialog ( - 0, - wxString::Format ( - _("An exception occurred: %s.\n\n") + " " + REPORT_PROBLEM, - std_to_wx (e.what ()) - ) - ); - } catch (...) { - error_dialog (0, _("An unknown exception occurred.") + " " + REPORT_PROBLEM); - } - - /* This will terminate the program */ - return false; - } - - void OnUnhandledException () - { - error_dialog (0, _("An unknown exception occurred.") + " " + REPORT_PROBLEM); - } - - void idle () - { - signal_manager->ui_idle (); - } - - DOMFrame* _frame; -}; - -IMPLEMENT_APP (App) diff --git a/src/tools/swaroop_dcpomatic_uuid.cc b/src/tools/swaroop_dcpomatic_uuid.cc deleted file mode 100644 index 65582ac0c..000000000 --- a/src/tools/swaroop_dcpomatic_uuid.cc +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington <cth@carlh.net> - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. - -*/ - -#include <cstdio> - -int main () -{ -#ifdef DCPOMATIC_LINUX - FILE* f = fopen ("/sys/class/dmi/id/product_uuid", "r"); - if (!f) { - printf ("unknown"); - return 1; - } - char buffer[256]; - int const N = fread (buffer, 1, 255, f); - buffer[N] = '\0'; - printf ("%s", buffer); - fclose (f); - return 0; -#endif - printf ("unknown"); - return 1; -} diff --git a/src/tools/wscript b/src/tools/wscript index 49b339218..81575c5dc 100644 --- a/src/tools/wscript +++ b/src/tools/wscript @@ -42,15 +42,9 @@ def build(bld): if bld.env.TARGET_LINUX: uselib += 'DL ' - cli_tools = [] - if bld.env.VARIANT == 'swaroop-theater': - cli_tools = ['swaroop_dcpomatic_uuid'] - elif bld.env.VARIANT == 'swaroop-studio': - cli_tools = ['dcpomatic_cli', 'dcpomatic_server_cli', 'server_test', 'dcpomatic_kdm_cli', 'dcpomatic_create', 'swaroop_dcpomatic_ecinema', 'swaroop_dcpomatic_uuid'] - else: - cli_tools = ['dcpomatic_cli', 'dcpomatic_server_cli', 'server_test', 'dcpomatic_kdm_cli', 'dcpomatic_create'] - if bld.env.ENABLE_DISK: - cli_tools.append('dcpomatic_disk_writer') + cli_tools = ['dcpomatic_cli', 'dcpomatic_server_cli', 'server_test', 'dcpomatic_kdm_cli', 'dcpomatic_create'] + if bld.env.ENABLE_DISK: + cli_tools.append('dcpomatic_disk_writer') for t in cli_tools: obj = bld(features='cxx cxxprogram') @@ -62,20 +56,15 @@ def build(bld): obj.source += ' ../../platform/windows/%s.rc' % t # Prevent a console window opening when we start dcpomatic2_disk_writer obj.env.append_value('LINKFLAGS', '-Wl,-subsystem,windows') - obj.target = t.replace('dcpomatic', 'dcpomatic2').replace('swaroop_', '') + obj.target = t.replace('dcpomatic', 'dcpomatic2') if t == 'server_test': obj.install_path = None gui_tools = [] if not bld.env.DISABLE_GUI: - if bld.env.VARIANT == 'swaroop-theater': - gui_tools = ['dcpomatic_player', 'swaroop_dcpomatic_playlist'] - elif bld.env.VARIANT == 'swaroop-studio': - gui_tools = ['dcpomatic', 'dcpomatic_batch', 'dcpomatic_server', 'dcpomatic_kdm', 'dcpomatic_player', 'swaroop_dcpomatic_playlist'] - else: - gui_tools = ['dcpomatic', 'dcpomatic_batch', 'dcpomatic_server', 'dcpomatic_kdm', 'dcpomatic_player', 'dcpomatic_playlist', 'dcpomatic_combiner'] - if bld.env.ENABLE_DISK: - gui_tools.append('dcpomatic_disk') + gui_tools = ['dcpomatic', 'dcpomatic_batch', 'dcpomatic_server', 'dcpomatic_kdm', 'dcpomatic_player', 'dcpomatic_playlist', 'dcpomatic_combiner'] + if bld.env.ENABLE_DISK: + gui_tools.append('dcpomatic_disk') for t in gui_tools: obj = bld(features='cxx cxxprogram') @@ -92,7 +81,7 @@ def build(bld): obj.source = '%s.cc' % t if bld.env.TARGET_WINDOWS: obj.source += ' ../../platform/windows/%s.rc' % t - obj.target = t.replace('dcpomatic', 'dcpomatic2').replace('swaroop_', '') + obj.target = t.replace('dcpomatic', 'dcpomatic2') i18n.po_to_mo(os.path.join('src', 'tools'), 'dcpomatic2', bld) |
