RDK Documentation (Open Sourced RDK Components)
AampVerimatrixHelper.h
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 #ifndef _AAMP_VERIMATRIX_DRM_HELPER_H
20 #define _AAMP_VERIMATRIX_DRM_HELPER_H
21 
22 #include <memory>
23 
24 #include "AampDrmHelper.h"
25 
27 {
28 public:
29  friend class AampVerimatrixHelperFactory;
30 
31  virtual const std::string& ocdmSystemId() const;
32 
33  void createInitData(std::vector<uint8_t>& initData) const;
34 
35  bool parsePssh(const uint8_t* initData, uint32_t initDataLen);
36 
37  bool isClearDecrypt() const { return false; }
38 
39  bool isExternalLicense() const { return true; };
40 
41  void getKey(std::vector<uint8_t>& keyID) const;
42 
43  const std::string& getDrmMetaData() const {return mContentMetadata;}
44 
45  void setDrmMetaData(const std::string& metaData);
46 
47  virtual int getDrmCodecType() const { return CODEC_TYPE; }
48 
49  void generateLicenseRequest(const AampChallengeInfo& challengeInfo, AampLicenseRequest& licenseRequest) const;
50 
51  void transformLicenseResponse(std::shared_ptr<DrmData> licenseResponse) const;
52 
53  virtual const std::string& friendlyName() const override { return FRIENDLY_NAME; };
54 
55  AampVerimatrixHelper(const struct DrmInfo& drmInfo, AampLogManager *logObj) : AampDrmHelper(drmInfo, logObj), FRIENDLY_NAME("Verimatrix"),
56  CODEC_TYPE(1), VERIMATRIX_PSSH_DATA_POSITION(52),
57  mInitData(), mKeyID(), mContentMetadata()
58  {}
59 
61 
62 private:
63  static const std::string VERIMATRIX_OCDM_ID;
64  const std::string FRIENDLY_NAME;
65  const int CODEC_TYPE;
66  const uint8_t VERIMATRIX_PSSH_DATA_POSITION;
67 
68  std::vector<uint8_t> mInitData;
69  std::vector<uint8_t> mKeyID;
70  std::string mContentMetadata;
71 };
72 
74 {
75  std::shared_ptr<AampDrmHelper> createHelper(const struct DrmInfo& drmInfo, AampLogManager *logObj=NULL) const;
76 
77  void appendSystemId(std::vector<std::string>& systemIds) const;
78 
79  bool isDRM(const struct DrmInfo& drmInfo) const;
80 };
81 
82 
83 #endif //_AAMP_VERIMATRIX_DRM_HELPER_H
AampVerimatrixHelperFactory
Definition: AampVerimatrixHelper.h:73
AampVerimatrixHelper::parsePssh
bool parsePssh(const uint8_t *initData, uint32_t initDataLen)
Parse the optional PSSH data.
Definition: AampVerimatrixHelper.cpp:35
AampVerimatrixHelper::isClearDecrypt
bool isClearDecrypt() const
Determine if the DRM system needs to be in the clear or encrypted.
Definition: AampVerimatrixHelper.h:37
AampVerimatrixHelperFactory::isDRM
bool isDRM(const struct DrmInfo &drmInfo) const
Determines if a helper class provides the identified DRM.
Definition: AampVerimatrixHelper.cpp:133
AampDrmHelper.h
Implented DRM helper functionalities.
AampVerimatrixHelper::isExternalLicense
bool isExternalLicense() const
Determines if the DRM itself fetches the license or if AAMP should use its own internal HTTP client t...
Definition: AampVerimatrixHelper.h:39
AampVerimatrixHelperFactory::appendSystemId
void appendSystemId(std::vector< std::string > &systemIds) const
Adds the system IDs supported by the DRM to a vector Used by the GStreamer plugins to advertise the D...
Definition: AampVerimatrixHelper.cpp:149
AampVerimatrixHelper::transformLicenseResponse
void transformLicenseResponse(std::shared_ptr< DrmData > licenseResponse) const
Transform the license response from the server into the necessary format for OCDM.
Definition: AampVerimatrixHelper.cpp:123
AampVerimatrixHelper::getDrmCodecType
virtual int getDrmCodecType() const
Returns the DRM codec type for the helper, used in trace.
Definition: AampVerimatrixHelper.h:47
AampVerimatrixHelper::getDrmMetaData
const std::string & getDrmMetaData() const
Returns the content specific DRM metadata.
Definition: AampVerimatrixHelper.h:43
AampVerimatrixHelperFactory::createHelper
std::shared_ptr< AampDrmHelper > createHelper(const struct DrmInfo &drmInfo, AampLogManager *logObj=NULL) const
Build a helper class to support the identified DRM.
Definition: AampVerimatrixHelper.cpp:140
AampLogManager
AampLogManager Class.
Definition: AampLogManager.h:150
AampVerimatrixHelper::ocdmSystemId
virtual const std::string & ocdmSystemId() const
Returns the OCDM system ID of the helper.
Definition: AampVerimatrixHelper.cpp:86
AampVerimatrixHelper::createInitData
void createInitData(std::vector< uint8_t > &initData) const
Definition: AampVerimatrixHelper.cpp:91
AampLicenseRequest
Holds the data to get the License.
Definition: AampDrmHelper.h:57
DrmInfo
DRM information required to decrypt.
Definition: AampDrmInfo.h:47
AampVerimatrixHelper::generateLicenseRequest
void generateLicenseRequest(const AampChallengeInfo &challengeInfo, AampLicenseRequest &licenseRequest) const
Generate the request details for the DRM license.
Definition: AampVerimatrixHelper.cpp:116
AampDrmHelperFactory
Helper class to Maintain DRM data.
Definition: AampDrmHelper.h:250
AampVerimatrixHelper::friendlyName
virtual const std::string & friendlyName() const override
Gets the friendly display name of the DRM.
Definition: AampVerimatrixHelper.h:53
AampVerimatrixHelper::setDrmMetaData
void setDrmMetaData(const std::string &metaData)
Sets the content specific DRM metadata.
Definition: AampVerimatrixHelper.cpp:81
AampVerimatrixHelper
Definition: AampVerimatrixHelper.h:26
AampDrmHelper
AampDRM helper to handle DRM operations.
Definition: AampDrmHelper.h:79
AampChallengeInfo
Aamp challenge info to get the License.
Definition: AampDrmHelper.h:44
AampVerimatrixHelper::getKey
void getKey(std::vector< uint8_t > &keyID) const
Get the key ID.
Definition: AampVerimatrixHelper.cpp:105