|
RDK Documentation (Open Sourced RDK Components)
|
Go to the documentation of this file.
30 #include <uuid/uuid.h>
33 #define KEYID_TAG_START "<KID>"
34 #define KEYID_TAG_END "</KID>"
37 static const std::string PROTOCOL_REGEX =
"^[a-zA-Z0-9\\+\\.-]+://";
38 #define KEY_ID_SZE_INDICATOR 0x12
56 this->data.assign(
reinterpret_cast<const char*
>(
data),dataLength);
85 return (this->
data.length());
93 if(!this->data.empty())
97 this->data.assign(
reinterpret_cast<const char*
>(
data),dataLength);
105 if(this->data.empty())
107 this->
setData(data,dataLength);
112 key.assign(
reinterpret_cast<const char*
>(
data),dataLength);
113 this->data = this->data + key;
126 unsigned char temp = bytes[pos1];
127 bytes[pos1] = bytes[pos2];
136 memcpy(guidBytes, original, 16);
151 uint32_t header = 28;
152 unsigned char* content_id = NULL;
153 std::string metadata;
154 uint32_t content_id_size =
155 (uint32_t)((psshData[header] & 0x000000FFu) << 24 |
156 (psshData[header+1] & 0x000000FFu) << 16 |
157 (psshData[header+2] & 0x000000FFu) << 8 |
158 (psshData[header+3] & 0x000000FFu));
160 AAMPLOG_INFO(
"content meta data length : %d",content_id_size);
161 if ((header + 4 + content_id_size) <= dataLength)
163 metadata = std::string(psshData + header + 4, content_id_size);
167 AAMPLOG_WARN(
"psshData : %d bytes in length, metadata would read past end of buffer", dataLength);
185 if (std::regex_match(uri, results, std::regex(
"(" + PROTOCOL_REGEX +
"[^/]+)/.*")))
187 return originOnly ? results[1].str() : uri.substr(0, uri.rfind(
"/"));
void addData(unsigned char *data, int dataLength)
Appends DrmData with given data.
void setData(unsigned char *data, int dataLength)
Updates DrmData with given data.
void aamp_ConvertEndianness(unsigned char *original, unsigned char *guidBytes)
Convert endianness of 16 byte block.
int getDataLength()
Getter method for dataLength.
base64 source Encoder/Decoder
static void aamp_SwapBytes(unsigned char *bytes, int pos1, int pos2)
Swap the bytes at given positions.
Context-free common utility functions.
static std::string aamp_getBaseUri(std::string uri, bool originOnly)
Get the base URI of a resource.
~DrmData()
Distructor for DrmData. Free memory (if any) allocated for data.
const std::string & getData()
Getter method for data.
DrmData()
Default constructor for DrmData. NULL initialize data and dataLength.
std::string aamp_ExtractWVContentMetadataFromPssh(const char *psshData, int dataLength)
Extract WideVine content meta data from DRM Agnostic PSSH header. Might not work with WideVine PSSH h...