RDK Documentation (Open Sourced RDK Components)
AampHlsOcdmBridge.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 2020 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 #ifndef _AAMP_HLS_OCDM_BRIDGE_H_
21 #define _AAMP_HLS_OCDM_BRIDGE_H_
22 
23 /**
24  * @file AampHlsOcdmBridge.h
25  * @brief Handles OCDM bridge to validate DRM License
26  */
27 
28 #include "HlsDrmBase.h"
29 #include "AampDRMutils.h"
30 #include "AampDrmSession.h"
31 
32 #define DECRYPT_WAIT_TIME_MS 3000
33 
34 /**
35  * @class AampHlsOcdmBridge
36  * @brief OCDM bridge to handle DRM key
37  */
38 
40 {
41  DRMState m_drmState;
42 
43  const DrmInfo* m_drmInfo;
44  AampDrmSession* m_drmSession;
45  PrivateInstanceAAMP* m_aampInstance;
46  pthread_mutex_t m_Mutex;
47  AampLogManager* mLogObj;
48 public:
49  AampHlsOcdmBridge(AampLogManager *logObj, AampDrmSession * aampDrmSession);
50 
52 
53  AampHlsOcdmBridge(const AampHlsOcdmBridge&) = delete;
54 
55  AampHlsOcdmBridge& operator=(const AampHlsOcdmBridge&) = delete;
56 
57  /*HlsDrmBase Methods*/
58 
59  virtual DrmReturn SetMetaData( class PrivateInstanceAAMP *aamp, void* metadata,int trackType, AampLogManager *logObj=NULL) override {return eDRM_SUCCESS;};
60 
61  virtual DrmReturn SetDecryptInfo( PrivateInstanceAAMP *aamp, const struct DrmInfo *drmInfoi, AampLogManager *logObj=NULL) override;
62 
63  virtual DrmReturn Decrypt(ProfilerBucketType bucketType, void *encryptedDataPtr, size_t encryptedDataLen, int timeInMs = DECRYPT_WAIT_TIME_MS) override;
64 
65  virtual void Release() override;
66 
67  virtual void CancelKeyWait() override;
68 
69  virtual void RestoreKeyState() override {};
70 
71  virtual void AcquireKey( class PrivateInstanceAAMP *aamp, void *metadata,int trackType, AampLogManager *logObj=NULL) override {};
72 
73  virtual DRMState GetState() override {return m_drmState;}
74 };
75 
76 #endif // _AAMP_HLS_OCDM_BRIDGE_H_
DrmReturn
DrmReturn
Return values of various functions.
Definition: HlsDrmBase.h:35
AampHlsOcdmBridge::GetState
virtual DRMState GetState() override
GetState Function to get current DRM state.
Definition: AampHlsOcdmBridge.h:73
AampHlsOcdmBridge::Decrypt
virtual DrmReturn Decrypt(ProfilerBucketType bucketType, void *encryptedDataPtr, size_t encryptedDataLen, int timeInMs=3000) override
Decrypts an encrypted buffer.
Definition: AampHlsOcdmBridge.cpp:70
AampHlsOcdmBridge::CancelKeyWait
virtual void CancelKeyWait() override
Cancel timed_wait operation drm_Decrypt.
Definition: AampHlsOcdmBridge.cpp:106
AampHlsOcdmBridge::SetMetaData
virtual DrmReturn SetMetaData(class PrivateInstanceAAMP *aamp, void *metadata, int trackType, AampLogManager *logObj=NULL) override
Set DRM specific meta-data.
Definition: AampHlsOcdmBridge.h:59
AampLogManager
AampLogManager Class.
Definition: AampLogManager.h:150
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
AampHlsOcdmBridge::Release
virtual void Release() override
Release drm session.
Definition: AampHlsOcdmBridge.cpp:99
AampHlsOcdmBridge::RestoreKeyState
virtual void RestoreKeyState() override
Restore key state post cleanup of audio/video TrackState in case DRM data is persisted.
Definition: AampHlsOcdmBridge.h:69
AampHlsOcdmBridge
OCDM bridge to handle DRM key.
Definition: AampHlsOcdmBridge.h:39
AampDrmSession
Base class for DRM sessions.
Definition: AampDrmSession.h:69
DRMState
DRMState
States of DRM object.
Definition: HlsDrmBase.h:46
AampDRMutils.h
Context-free common utility functions.
PrivateInstanceAAMP
Class representing the AAMP player's private instance, which is not exposed to outside world.
Definition: priv_aamp.h:640
AampHlsOcdmBridge::SetDecryptInfo
virtual DrmReturn SetDecryptInfo(PrivateInstanceAAMP *aamp, const struct DrmInfo *drmInfoi, AampLogManager *logObj=NULL) override
Set information required for decryption.
Definition: AampHlsOcdmBridge.cpp:50
ProfilerBucketType
ProfilerBucketType
Bucket types of AAMP profiler.
Definition: AampProfiler.h:43
HlsDrmBase.h
Declaration common to various HLS DRM implementations.
AampHlsOcdmBridge::AcquireKey
virtual void AcquireKey(class PrivateInstanceAAMP *aamp, void *metadata, int trackType, AampLogManager *logObj=NULL) override
AcquireKey Function to get DRM Key.
Definition: AampHlsOcdmBridge.h:71
AampDrmSession.h
Header file for AampDrmSession.