RDK Documentation (Open Sourced RDK Components)
HlsDrmBase.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  * @file HlsDrmBase.h
22  * @brief Declaration common to various HLS DRM implementations
23  */
24 
25 
26 #ifndef _DRM_HLSDRMBASE_H_
27 #define _DRM_HLSDRMBASE_H_
28 
29 #include "priv_aamp.h"
30 
31 /**
32  * @enum DrmReturn
33  * @brief Return values of various functions
34  */
36 {
37  eDRM_SUCCESS, /**< DRM is success */
38  eDRM_ERROR, /**< DRM Failed */
39  eDRM_KEY_ACQUSITION_TIMEOUT /**< DRM key Acqusition timed out */
40 };
41 
42 /**
43  * @enum DRMState
44  * @brief States of DRM object
45  */
47 {
48  eDRM_INITIALIZED, /**< DRM is initialized */
49  eDRM_ACQUIRING_KEY, /**< DRM Acquiring key in progress */
50  eDRM_KEY_ACQUIRED, /**< DRM key is Acquired */
51  eDRM_KEY_FAILED, /**< DRM Acquiring key is failed */
52  eDRM_KEY_FLUSH /**< DRM key is flushed */
53 };
54 
55 /**
56  * @class HlsDrmBase
57  * @brief Base class of HLS DRM implementations
58  */
60 {
61 public:
62 
63  /**
64  * @brief Set DRM specific meta-data
65  *
66  * @param aamp AAMP instance to be associated with this decryptor
67  * @param metadata DRM specific metadata
68  * @retval 0 on success
69  */
70  virtual DrmReturn SetMetaData( class PrivateInstanceAAMP *aamp, void* metadata,int trackType, AampLogManager *logObj=NULL) = 0;
71 
72  /**
73  * @brief Set information required for decryption
74  *
75  * @param aamp AAMP instance to be associated with this decryptor
76  * @param drmInfo Drm information
77  * @retval eDRM_SUCCESS on success
78  */
79  virtual DrmReturn SetDecryptInfo( PrivateInstanceAAMP *aamp, const struct DrmInfo *drmInfo, AampLogManager *logObj=NULL) = 0;
80 
81 
82  /**
83  * @brief Decrypts an encrypted buffer
84  * @param bucketType Type of bucket for profiling
85  * @param encryptedDataPtr pointer to encyrpted payload
86  * @param encryptedDataLen length in bytes of data pointed to by encryptedDataPtr
87  * @param timeInMs wait time
88  * @retval eDRM_SUCCESS on success
89  */
90  virtual DrmReturn Decrypt(ProfilerBucketType bucketType, void *encryptedDataPtr, size_t encryptedDataLen, int timeInMs = 3000) = 0;
91 
92  /**
93  * @brief Release drm session
94  */
95  virtual void Release() = 0;
96 
97  /**
98  * @brief Cancel timed_wait operation drm_Decrypt
99  */
100  virtual void CancelKeyWait() = 0;
101 
102  /**
103  * @brief Restore key state post cleanup of
104  * audio/video TrackState in case DRM data is persisted
105  */
106  virtual void RestoreKeyState() = 0;
107  /**
108  * @brief AcquireKey Function to get DRM Key
109  *
110  */
111  virtual void AcquireKey( class PrivateInstanceAAMP *aamp, void *metadata,int trackType, AampLogManager *logObj=NULL) = 0;
112  /**
113  * @brief GetState Function to get current DRM state
114  *
115  */
116  virtual DRMState GetState() = 0;
117  /**
118  * @brief HlsDrmBase Destructor
119  */
120  virtual ~HlsDrmBase(){};
121 
122 };
123 #endif /* _DRM_HLSDRMBASE_H_ */
eDRM_KEY_FLUSH
@ eDRM_KEY_FLUSH
Definition: HlsDrmBase.h:52
DrmReturn
DrmReturn
Return values of various functions.
Definition: HlsDrmBase.h:35
HlsDrmBase::GetState
virtual DRMState GetState()=0
GetState Function to get current DRM state.
eDRM_KEY_ACQUIRED
@ eDRM_KEY_ACQUIRED
Definition: HlsDrmBase.h:50
eDRM_ACQUIRING_KEY
@ eDRM_ACQUIRING_KEY
Definition: HlsDrmBase.h:49
AampLogManager
AampLogManager Class.
Definition: AampLogManager.h:150
eDRM_KEY_ACQUSITION_TIMEOUT
@ eDRM_KEY_ACQUSITION_TIMEOUT
Definition: HlsDrmBase.h:39
HlsDrmBase::CancelKeyWait
virtual void CancelKeyWait()=0
Cancel timed_wait operation drm_Decrypt.
HlsDrmBase
Base class of HLS DRM implementations.
Definition: HlsDrmBase.h:59
eDRM_SUCCESS
@ eDRM_SUCCESS
Definition: HlsDrmBase.h:37
DrmInfo
DRM information required to decrypt.
Definition: AampDrmInfo.h:47
HlsDrmBase::~HlsDrmBase
virtual ~HlsDrmBase()
HlsDrmBase Destructor.
Definition: HlsDrmBase.h:120
HlsDrmBase::Release
virtual void Release()=0
Release drm session.
DRMState
DRMState
States of DRM object.
Definition: HlsDrmBase.h:46
HlsDrmBase::AcquireKey
virtual void AcquireKey(class PrivateInstanceAAMP *aamp, void *metadata, int trackType, AampLogManager *logObj=NULL)=0
AcquireKey Function to get DRM Key.
priv_aamp.h
Private functions and types used internally by AAMP.
eDRM_INITIALIZED
@ eDRM_INITIALIZED
Definition: HlsDrmBase.h:48
PrivateInstanceAAMP
Class representing the AAMP player's private instance, which is not exposed to outside world.
Definition: priv_aamp.h:640
ProfilerBucketType
ProfilerBucketType
Bucket types of AAMP profiler.
Definition: AampProfiler.h:43
eDRM_KEY_FAILED
@ eDRM_KEY_FAILED
Definition: HlsDrmBase.h:51
HlsDrmBase::RestoreKeyState
virtual void RestoreKeyState()=0
Restore key state post cleanup of audio/video TrackState in case DRM data is persisted.
HlsDrmBase::Decrypt
virtual DrmReturn Decrypt(ProfilerBucketType bucketType, void *encryptedDataPtr, size_t encryptedDataLen, int timeInMs=3000)=0
Decrypts an encrypted buffer.
HlsDrmBase::SetMetaData
virtual DrmReturn SetMetaData(class PrivateInstanceAAMP *aamp, void *metadata, int trackType, AampLogManager *logObj=NULL)=0
Set DRM specific meta-data.
eDRM_ERROR
@ eDRM_ERROR
Definition: HlsDrmBase.h:38
HlsDrmBase::SetDecryptInfo
virtual DrmReturn SetDecryptInfo(PrivateInstanceAAMP *aamp, const struct DrmInfo *drmInfo, AampLogManager *logObj=NULL)=0
Set information required for decryption.