Create a WvCasStatus to be used as return type of libraries in media_cas_packager_sdk.
Following example: []/video/widevine/export/provisioning_sdk/public/provisioning_status.h and []/video/widevine/export/exported_root/util/status.h ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=218918745
This commit is contained in:
@@ -47,7 +47,8 @@ cc_binary(
|
||||
name = "wv_cas_ecm_example",
|
||||
srcs = ["wv_cas_ecm_example.cc"],
|
||||
deps = [
|
||||
"//base",
|
||||
"@abseil_repo//absl/base:core_headers",
|
||||
"//media_cas_packager_sdk/public:wv_cas_ecm",
|
||||
"//media_cas_packager_sdk/public:wv_cas_status",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "media_cas_packager_sdk/public/wv_cas_ecm.h"
|
||||
#include "media_cas_packager_sdk/public/wv_cas_status.h"
|
||||
|
||||
const int kContentIvSize = 16;
|
||||
const bool kKeyRotationEnabled = true;
|
||||
@@ -27,17 +28,21 @@ const char kEntitlementKey[] = "entitlement_key................."; // 32 bytes
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
widevine::cas::WvCasEcm wv_cas_ecm;
|
||||
bool status =
|
||||
widevine::cas::WvCasStatus status =
|
||||
wv_cas_ecm.Initialize(kContentIvSize, kKeyRotationEnabled, kCryptoMode);
|
||||
if (!status) {
|
||||
std::cerr << "Failed to initialize WV CAS ECM, error." << std::endl;
|
||||
if (status != widevine::cas::OK) {
|
||||
std::cerr << "Failed to initialize WV CAS ECM, error: "
|
||||
<< widevine::cas::GetWvCasStatusMessage(status)
|
||||
<< std::endl;
|
||||
}
|
||||
std::string ecm;
|
||||
status = wv_cas_ecm.GenerateEcm(kEvenKey, kEvenContentIv16Bytes, kOddKey,
|
||||
kOddContentIv16Bytes, kEntitlementKeyId,
|
||||
kEntitlementKey, &ecm);
|
||||
if (!status) {
|
||||
std::cerr << "Failed to generate WV CAS ECM, error" << std::endl;
|
||||
if (status != widevine::cas::OK) {
|
||||
std::cerr << "Failed to generate WV CAS ECM, error: "
|
||||
<< widevine::cas::GetWvCasStatusMessage(status)
|
||||
<< std::endl;
|
||||
} else {
|
||||
std::cout << "ECM size: " << ecm.size() << std::endl;
|
||||
std::cout << "ECM bytes: ";
|
||||
|
||||
Reference in New Issue
Block a user