diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-05-13 16:08:33 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-05-13 16:08:33 +0100 |
| commit | 257fce15e8b4dfa112d039e7888e3ec04e523198 (patch) | |
| tree | 3afe5047010bb71aaa3851ef3b2f438509bccad3 /src/tools | |
| parent | 5de2fd90b92829cea8ab297c6fce81c582332cb7 (diff) | |
swaroop: basics of encrypted MP4 playback.
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/dcpomatic_ecinema.cc | 12 | ||||
| -rw-r--r-- | src/tools/dcpomatic_player.cc | 20 |
2 files changed, 29 insertions, 3 deletions
diff --git a/src/tools/dcpomatic_ecinema.cc b/src/tools/dcpomatic_ecinema.cc index a3f2288e3..6c4b2a8c7 100644 --- a/src/tools/dcpomatic_ecinema.cc +++ b/src/tools/dcpomatic_ecinema.cc @@ -21,6 +21,7 @@ #include "lib/version.h" #include "lib/decrypted_ecinema_kdm.h" #include "lib/config.h" +#include "lib/util.h" #include <dcp/key.h> extern "C" { #include <libavformat/avformat.h> @@ -155,6 +156,15 @@ main (int argc, char* argv[]) 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"; @@ -180,7 +190,7 @@ main (int argc, char* argv[]) avformat_free_context (input_fc); avformat_free_context (output_fc); - DecryptedECinemaKDM decrypted_kdm (key); + DecryptedECinemaKDM decrypted_kdm (id, key); EncryptedECinemaKDM encrypted_kdm = decrypted_kdm.encrypt (Config::instance()->decryption_chain()->leaf()); cout << encrypted_kdm.as_xml() << "\n"; } diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 3ba63379b..cd941e935 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -599,11 +599,27 @@ 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 { - dcp->add_kdm (dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (d->GetPath ()), MAX_KDM_SIZE))); - dcp->examine (_film, shared_ptr<Job>()); + if (dcp) { + dcp->add_kdm (dcp::EncryptedKDM(dcp::file_to_string(wx_to_std(d->GetPath()), MAX_KDM_SIZE))); + dcp->examine (_film, shared_ptr<Job>()); + } } catch (exception& e) { error_dialog (this, wxString::Format (_("Could not load KDM.")), std_to_wx(e.what())); d->Destroy (); |
