- if (avio_open2 (&output_fc->pb, output_mp4.string().c_str(), AVIO_FLAG_WRITE, 0, 0) < 0) {
- cerr << "Could not open output file `" << output_mp4.string() << "'\n";
+ 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";