swaroop: beginning of encrypted MP4 / .ecinema. v2.13.65
authorCarl Hetherington <cth@carlh.net>
Wed, 31 Oct 2018 20:36:04 +0000 (20:36 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 31 Oct 2018 20:36:04 +0000 (20:36 +0000)
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_content.h
src/wx/controls.cc

index 70b86717266edeffe91f4da54b088f714ae7402e..c7a15619dd0e12d6c4eed919af2567d03932467d 100644 (file)
@@ -65,6 +65,7 @@ int const FFmpegContentProperty::FILTERS = 102;
 
 FFmpegContent::FFmpegContent (shared_ptr<const Film> film, boost::filesystem::path p)
        : Content (film, p)
+       , _encrypted (false)
 {
 
 }
@@ -126,6 +127,7 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, cxml::ConstNodePtr no
        _colorspace = get_optional_enum<AVColorSpace>(node, "Colorspace");
        _bits_per_pixel = node->optional_number_child<int> ("BitsPerPixel");
        _decryption_key = node->optional_string_child ("DecryptionKey");
+       _encrypted = node->optional_bool_child("Encrypted").get_value_or(false);
 }
 
 FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
@@ -187,6 +189,7 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<shared_ptr<Con
        _color_trc = ref->_color_trc;
        _colorspace = ref->_colorspace;
        _bits_per_pixel = ref->_bits_per_pixel;
+       _encrypted = ref->_encrypted;
 }
 
 void
@@ -249,6 +252,9 @@ FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const
        if (_decryption_key) {
                node->add_child("DecryptionKey")->add_child_text (_decryption_key.get());
        }
+       if (_encrypted) {
+               node->add_child("Encypted")->add_child_text ("1");
+       }
 }
 
 void
@@ -314,6 +320,7 @@ FFmpegContent::examine (shared_ptr<Job> job)
                        _subtitle_stream = _subtitle_streams.front ();
                }
 
+               _encrypted = first_path.extension() == ".ecinema";
        }
 
        if (examiner->has_video ()) {
index 87a892e68a81fa4ce5f4d3a67af145afc4e1e480..d2e164f1d5352e4ce844b7e4dbaa5dfa4f783f5f 100644 (file)
@@ -98,6 +98,11 @@ public:
                return _decryption_key;
        }
 
+       bool encrypted () const {
+               boost::mutex::scoped_lock lm (_mutex);
+               return _encrypted;
+       }
+
 private:
        void add_properties (std::list<UserProperty> &) const;
 
@@ -116,6 +121,7 @@ private:
        boost::optional<AVColorSpace> _colorspace;
        boost::optional<int> _bits_per_pixel;
        boost::optional<std::string> _decryption_key;
+       bool _encrypted;
 };
 
 #endif
index 62f75fde395db6ec80b94b58da3711f62826bf4c..8b2a17b09a5aa5f23ac757acd61fd52d592b0350 100644 (file)
@@ -667,7 +667,7 @@ Controls::update_content_directory ()
                        shared_ptr<Content> content;
                        if (is_directory(*i) && (is_regular_file(*i / "ASSETMAP") || is_regular_file(*i / "ASSETMAP.xml"))) {
                                content.reset (new DCPContent(_film, *i));
-                       } else if (i->path().extension() == ".mp4") {
+                       } else if (i->path().extension() == ".mp4" || i->path().extension() == ".ecinema") {
                                content = content_factory(_film, *i).front();
                        }