RDK Documentation (Open Sourced RDK Components)
AampDrmHelper.cpp
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 
21 /**
22  * @file AampDrmHelper.cpp
23  * @brief Drm Helper file to handle DRM operation
24  */
25 
26 #include <algorithm>
27 #include <regex>
28 
29 #include "AampDrmHelper.h"
30 
31 /**
32  * @brief Compare against another helper instance
33  */
34 bool AampDrmHelper::compare(std::shared_ptr<AampDrmHelper> other)
35 {
36  if (other == nullptr) return false;
37  if (mDrmInfo.systemUUID != other->mDrmInfo.systemUUID) return false;
38  if (mDrmInfo.mediaFormat != other->mDrmInfo.mediaFormat) return false;
39  if (ocdmSystemId() != other->ocdmSystemId()) return false;
40  if (getDrmMetaData() != other->getDrmMetaData()) return false;
41 
42  std::vector<uint8_t> thisKeyId;
43  getKey(thisKeyId);
44 
45  std::vector<uint8_t> otherKeyId;
46  other->getKey(otherKeyId);
47 
48  if (thisKeyId != otherKeyId) return false;
49 
50  return true;
51 }
AampDrmHelper::compare
virtual bool compare(std::shared_ptr< AampDrmHelper > other)
Compare against another helper instance.
Definition: AampDrmHelper.cpp:34
AampDrmHelper.h
Implented DRM helper functionalities.
DrmInfo::systemUUID
std::string systemUUID
Definition: AampDrmInfo.h:89
AampDrmHelper::ocdmSystemId
virtual const std::string & ocdmSystemId() const =0
Returns the OCDM system ID of the helper.
AampDrmHelper::getDrmMetaData
virtual const std::string & getDrmMetaData() const
Returns the content specific DRM metadata.
Definition: AampDrmHelper.h:127
AampDrmHelper::getKey
virtual void getKey(std::vector< uint8_t > &keyID) const =0
Get the key ID.
DrmInfo::mediaFormat
MediaFormat mediaFormat
Definition: AampDrmInfo.h:80