RDK Documentation (Open Sourced RDK Components)
AampDRMutils.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's license file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2018 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 
21 /**
22 * @file AampDRMutils.h
23 * @brief Data structures to help with DRM sessions.
24 */
25 
26 #ifndef AampDRMutils_h
27 #define AampDRMutils_h
28 
29 #include <stdio.h>
30 #include <assert.h>
31 #include <stdlib.h>
32 #include <string.h>
33 #include <sstream>
34 
35 #include "AampDrmMediaFormat.h"
36 #include "AampDrmData.h"
37 #include "AampDrmInfo.h"
38 #include "AampDrmSystems.h"
39 #include "AampUtils.h"
40 
41 /**
42  * @brief Macros to track the value of API success or failure
43  */
44 #define DRM_API_SUCCESS (0)
45 #define DRM_API_FAILED (-1)
46 
47 /**
48  * @brief start and end tags for DRM policy
49  */
50 #define DRM_METADATA_TAG_START "<ckm:policy xmlns:ckm=\"urn:ccp:ckm\">"
51 #define DRM_METADATA_TAG_END "</ckm:policy>"
52 
53 #ifdef USE_SECMANAGER
54 #define AAMP_SECMGR_INVALID_SESSION_ID (-1)
55 #endif
56 
57 /**
58  * @brief Convert endianness of 16 byte block.
59  *
60  * @param[in] original - Pointer to source byte block.
61  * @param[out] guidBytes - Pointer to destination byte block.
62  * @return void.
63  */
64 void aamp_ConvertEndianness(unsigned char *original, unsigned char *guidBytes);
65 /**
66  * @fn aamp_ExtractDataFromPssh
67  * @param[in] psshData - Pointer to PSSH data.
68  * @param[in] dataLength - Length of PSSH data.
69  * @param[in] startStr, endStr - Pointer to delimiter strings.
70  * @param[in] verStr - Pointer to version delimiter string.
71  * @param[out] len - Gets updated with length of content meta data.
72  * @return Extracted data between delimiters; NULL if not found.
73  */
74 unsigned char *aamp_ExtractDataFromPssh(const char* psshData, int dataLength, const char* startStr, const char* endStr, int *len, const char* verStr);
75 /**
76  * @fn aamp_ExtractWVContentMetadataFromPssh
77  * @param[in] psshData - Pointer to PSSH data.
78  * @param[in] dataLength - pssh data length
79  * @return Extracted ContentMetaData.
80  */
81 std::string aamp_ExtractWVContentMetadataFromPssh(const char* psshData, int dataLength);
82 
83 unsigned char * aamp_ExtractKeyIdFromPssh(const char* psshData, int dataLength, int *len, DRMSystems drmSystem);
84 
85 #endif
AampDrmData.h
File holds DRM License data.
AampDrmSystems.h
Define DRM types.
AampDrmInfo.h
DRM license information for Aamp.
aamp_ExtractWVContentMetadataFromPssh
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...
Definition: AampDRMutils.cpp:148
AampDrmMediaFormat.h
Types of Media.
aamp_ConvertEndianness
void aamp_ConvertEndianness(unsigned char *original, unsigned char *guidBytes)
Convert endianness of 16 byte block.
Definition: AampDRMutils.cpp:134
DRMSystems
DRMSystems
DRM system types.
Definition: AampDrmSystems.h:33