diff --git a/example/wv_cas_ecm_example b/example/wv_cas_ecm_example index 79875b3..05ef129 100644 Binary files a/example/wv_cas_ecm_example and b/example/wv_cas_ecm_example differ diff --git a/libmedia_cas_packager_sdk.so b/libmedia_cas_packager_sdk.so index ed55d66..ba29909 100755 Binary files a/libmedia_cas_packager_sdk.so and b/libmedia_cas_packager_sdk.so differ diff --git a/media_cas_packager_sdk/public/wv_cas_types.h b/media_cas_packager_sdk/public/wv_cas_types.h index 3acd30e..2d42894 100644 --- a/media_cas_packager_sdk/public/wv_cas_types.h +++ b/media_cas_packager_sdk/public/wv_cas_types.h @@ -10,6 +10,9 @@ #define MEDIA_CAS_PACKAGER_SDK_PUBLIC_WV_CAS_TYPES_H_ #include +#include + +#include "common/status.h" namespace widevine { namespace cas { @@ -64,6 +67,63 @@ bool CryptoModeToString(CryptoMode mode, std::string* str); // Returns false if str is not a valid CryptoMode. bool StringToCryptoMode(const std::string& str, CryptoMode* mode); +struct WvCasEncryptionRequest { + std::string content_id; + std::string provider; + // Track types such as "AUDIO", SD" or "HD". + std::vector track_types; + // Indicates if the client is using key rotation. If true, the server will + // return one key for EVEN and one key for ODD, otherwise only a single key is + // returned. + bool key_rotation = true; +}; + +struct WvCasEncryptionResponse { + enum class Status { + STATUS_UNSPECIFIED = 0, + OK = 1, + SIGNATURE_FAILED = 2, + ACCESS_DENIED = 3, + INTERNAL_ERROR = 4, + INVALID_ARGUMENT = 5, + PROVIDER_ID_MISSING = 6, + CONTENT_ID_MISSING = 7, + TRACK_TYPE_MISSING = 8 + }; + struct KeyInfo { + enum class KeySlot { + KEY_SLOT_UNSPECIFIED = 0, + SINGLE = 1, + EVEN = 2, + ODD = 3 + }; + std::string key_id; + std::string key; + // Optional label used for the key. + std::string track_type; + KeySlot key_slot; + }; + Status status; + std::string status_message; + std::string content_id; + std::vector entitlement_keys; +}; + +// Returns a WvCasEncryptionRequest in JSON format. +// This request JSON can be later put into the 'request' field of a signed +// request JSON message. +// And that signed JSON message can be sent to Widevine license server for +// aquiring entitlement keys. +Status CreateWvCasEncryptionRequestJson(const WvCasEncryptionRequest& request, + std::string* request_json); + +// Parses a WvCasEncryptionResponse in JSON format, returns a +// WvCasEncryptionResponse. +// |response_json| is supposed to be the 'response' field in the signed +// response from Widevine license server. +Status ParseWvCasEncryptionResponseJson(const std::string& response_json, + WvCasEncryptionResponse* response); + } // namespace cas } // namespace widevine diff --git a/media_cas_packager_sdk/public/wv_ecmg b/media_cas_packager_sdk/public/wv_ecmg index 50ed297..3995c47 100644 Binary files a/media_cas_packager_sdk/public/wv_ecmg and b/media_cas_packager_sdk/public/wv_ecmg differ