23 #include "AampVerimatrixHelper.h"
28 #define KEYURL_TAG_START "<KeyUrl><![CDATA["
29 #define KEYURL_TAG_END "]]></KeyUrl>"
33 const std::string AampVerimatrixHelper::VERIMATRIX_OCDM_ID =
"com.verimatrix.ott";
37 this->mInitData.assign(initData, initData+initDataLen);
45 if(initDataLen < VERIMATRIX_PSSH_DATA_POSITION)
47 logprintf(
"initDataLen less than %d", VERIMATRIX_PSSH_DATA_POSITION);
51 initData += VERIMATRIX_PSSH_DATA_POSITION;
52 initDataLen -= VERIMATRIX_PSSH_DATA_POSITION;
53 char *init =
new char[initDataLen + 1];
54 memcpy(init, initData, initDataLen);
55 init[initDataLen] = 0;
57 std::string pssh(init);
62 size_t sp = pssh.find(KEYURL_TAG_START);
63 size_t ep = pssh.find(KEYURL_TAG_END);
64 if((sp == std::string::npos) || (ep == std::string::npos))
70 sp += strlen(KEYURL_TAG_START);
72 std::string keyfile = pssh.substr(sp, ep - sp);
75 mKeyID.assign((uint8_t *)keyfile.c_str(), (uint8_t *)keyfile.c_str() + keyfile.length());
83 mContentMetadata = metaData;
88 return VERIMATRIX_OCDM_ID;
96 init =
"{\"contentType\" : \"HLS\"}";
98 init =
"{\"contentType\" : \"DASH\"}";
102 initData.assign((uint8_t *)init, (uint8_t *)init + strlen(init));
109 keyID.insert(keyID.begin(), mDrmInfo.
keyURI.begin(), mDrmInfo.
keyURI.end());
111 keyID.insert(keyID.begin(), mKeyID.begin(), mKeyID.end());
119 licenseRequest.url =
"";
120 licenseRequest.payload =
"";
126 licenseResponse->setData((
unsigned char*)mDrmInfo.
keyURI.c_str(), mDrmInfo.
keyURI.length());
128 licenseResponse->setData((
unsigned char*)mKeyID.data(), mKeyID.size());
135 return (((VERIMATRIX_UUID == drmInfo.
systemUUID) || (AampVerimatrixHelper::VERIMATRIX_OCDM_ID == drmInfo.
keyFormat))
144 return std::make_shared<AampVerimatrixHelper>(drmInfo, logObj);
151 systemIds.push_back(VERIMATRIX_UUID);