Add decryption support. v2.13.63
authorCarl Hetherington <cth@carlh.net>
Fri, 19 Oct 2018 21:50:47 +0000 (22:50 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 19 Oct 2018 21:50:47 +0000 (22:50 +0100)
src/lib/ffmpeg.cc
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_content.h

index 5171166d5f0e9aeea6ea9ae60cbe5dd391cf79df..1502b3de96148d76a94b4d1a8d5f2fb4ea3dd082 100644 (file)
@@ -128,6 +128,9 @@ FFmpeg::setup_general ()
        */
        av_dict_set (&options, "analyzeduration", raw_convert<string> (5 * 60 * 1000000).c_str(), 0);
        av_dict_set (&options, "probesize", raw_convert<string> (5 * 60 * 1000000).c_str(), 0);
+       if (_ffmpeg_content->decryption_key()) {
+               av_dict_set (&options, "decryption_key", _ffmpeg_content->decryption_key()->c_str(), 0);
+       }
 
        int e = avformat_open_input (&_format_context, 0, 0, &options);
        if (e < 0) {
index 961c0b0a39c77d9a63372f4fb34b870fa98fdc33..70b86717266edeffe91f4da54b088f714ae7402e 100644 (file)
@@ -125,7 +125,7 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, cxml::ConstNodePtr no
        _color_trc = get_optional_enum<AVColorTransferCharacteristic>(node, "ColorTransferCharacteristic");
        _colorspace = get_optional_enum<AVColorSpace>(node, "Colorspace");
        _bits_per_pixel = node->optional_number_child<int> ("BitsPerPixel");
-
+       _decryption_key = node->optional_string_child ("DecryptionKey");
 }
 
 FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
@@ -246,6 +246,9 @@ FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const
        if (_bits_per_pixel) {
                node->add_child("BitsPerPixel")->add_child_text (raw_convert<string> (*_bits_per_pixel));
        }
+       if (_decryption_key) {
+               node->add_child("DecryptionKey")->add_child_text (_decryption_key.get());
+       }
 }
 
 void
index 64f6f9ff8632a275cf05f2233b2faf344a2aadf6..87a892e68a81fa4ce5f4d3a67af145afc4e1e480 100644 (file)
@@ -93,6 +93,11 @@ public:
 
        void signal_subtitle_stream_changed ();
 
+       boost::optional<std::string> decryption_key () const {
+               boost::mutex::scoped_lock lm (_mutex);
+               return _decryption_key;
+       }
+
 private:
        void add_properties (std::list<UserProperty> &) const;
 
@@ -110,6 +115,7 @@ private:
        boost::optional<AVColorTransferCharacteristic> _color_trc;
        boost::optional<AVColorSpace> _colorspace;
        boost::optional<int> _bits_per_pixel;
+       boost::optional<std::string> _decryption_key;
 };
 
 #endif