+ AVDictionary* options = 0;
+
+#ifdef DCPOMATIC_VARIANT_SWAROOP
+ if (key) {
+ 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);
+ }
+
+ if (id) {
+ if (av_dict_set(&_format_context->metadata, SWAROOP_ID_TAG, id->c_str(), 0) < 0) {
+ throw runtime_error ("Could not write ID to output");
+ }
+ }
+#endif
+
+ if (avformat_write_header (_format_context, &options) < 0) {