Rialto  0.1
Rialto media pipeline API
IMediaKeys.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 2022 Sky UK
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 FIREBOLT_RIALTO_I_MEDIA_KEYS_H_
21 #define FIREBOLT_RIALTO_I_MEDIA_KEYS_H_
22 
31 #include <memory>
32 #include <string>
33 #include <vector>
34 
35 #include "IMediaKeysClient.h"
36 #include "MediaCommon.h"
37 
38 namespace firebolt::rialto
39 {
40 class IMediaKeys;
41 
46 {
47 public:
48  IMediaKeysFactory() = default;
49  virtual ~IMediaKeysFactory() = default;
50 
56  static std::shared_ptr<IMediaKeysFactory> createFactory();
57 
65  virtual std::unique_ptr<IMediaKeys> createMediaKeys(const std::string &keySystem) const = 0;
66 };
67 
75 {
76 public:
77  IMediaKeys() = default;
78  virtual ~IMediaKeys() = default;
79 
80  IMediaKeys(const IMediaKeys &) = delete;
81  IMediaKeys &operator=(const IMediaKeys &) = delete;
82  IMediaKeys(IMediaKeys &&) = delete;
83  IMediaKeys &operator=(IMediaKeys &&) = delete;
84 
93  virtual MediaKeyErrorStatus selectKeyId(int32_t keySessionId, const std::vector<uint8_t> &keyId) = 0;
94 
103  virtual bool containsKey(int32_t keySessionId, const std::vector<uint8_t> &keyId) = 0;
104 
118  virtual MediaKeyErrorStatus createKeySession(KeySessionType sessionType, std::weak_ptr<IMediaKeysClient> client,
119  bool isLDL, int32_t &keySessionId) = 0;
120 
136  virtual MediaKeyErrorStatus generateRequest(int32_t keySessionId, InitDataType initDataType,
137  const std::vector<uint8_t> &initData) = 0;
138 
153  virtual MediaKeyErrorStatus loadSession(int32_t keySessionId) = 0;
154 
168  virtual MediaKeyErrorStatus updateSession(int32_t keySessionId, const std::vector<uint8_t> &responseData) = 0;
169 
183  virtual MediaKeyErrorStatus setDrmHeader(int32_t keySessionId, const std::vector<uint8_t> &requestData) = 0;
184 
196  virtual MediaKeyErrorStatus closeKeySession(int32_t keySessionId) = 0;
197 
209  virtual MediaKeyErrorStatus removeKeySession(int32_t keySessionId) = 0;
210 
216  virtual MediaKeyErrorStatus deleteDrmStore() = 0;
217 
223  virtual MediaKeyErrorStatus deleteKeyStore() = 0;
224 
232  virtual MediaKeyErrorStatus getDrmStoreHash(std::vector<unsigned char> &drmStoreHash) = 0;
233 
241  virtual MediaKeyErrorStatus getKeyStoreHash(std::vector<unsigned char> &keyStoreHash) = 0;
242 
250  virtual MediaKeyErrorStatus getLdlSessionsLimit(uint32_t &ldlLimit) = 0;
251 
260  virtual MediaKeyErrorStatus getLastDrmError(int32_t keySessionId, uint32_t &errorCode) = 0;
261 
269  virtual MediaKeyErrorStatus getDrmTime(uint64_t &drmTime) = 0;
270 
279  virtual MediaKeyErrorStatus getCdmKeySessionId(int32_t keySessionId, std::string &cdmKeySessionId) = 0;
280 
292  virtual MediaKeyErrorStatus releaseKeySession(int32_t keySessionId) = 0;
293 };
294 
295 }; // namespace firebolt::rialto
296 
297 #endif // FIREBOLT_RIALTO_I_MEDIA_KEYS_H_
firebolt::rialto::IMediaKeys::closeKeySession
virtual MediaKeyErrorStatus closeKeySession(int32_t keySessionId)=0
Closes a key session.
firebolt::rialto::IMediaKeys::updateSession
virtual MediaKeyErrorStatus updateSession(int32_t keySessionId, const std::vector< uint8_t > &responseData)=0
Updates a key session's state.
firebolt::rialto::IMediaKeys::getCdmKeySessionId
virtual MediaKeyErrorStatus getCdmKeySessionId(int32_t keySessionId, std::string &cdmKeySessionId)=0
Get the internal CDM key session ID.
firebolt::rialto::IMediaKeysFactory::createMediaKeys
virtual std::unique_ptr< IMediaKeys > createMediaKeys(const std::string &keySystem) const =0
IMediaKeys factory method, returns a concrete implementation of IMediaKeys.
firebolt::rialto::IMediaKeys::getDrmTime
virtual MediaKeyErrorStatus getDrmTime(uint64_t &drmTime)=0
Get the DRM system time for the object's key system.
firebolt::rialto::IMediaKeys::deleteKeyStore
virtual MediaKeyErrorStatus deleteKeyStore()=0
Delete the key store for the object's key system.
firebolt::rialto::IMediaKeys::getKeyStoreHash
virtual MediaKeyErrorStatus getKeyStoreHash(std::vector< unsigned char > &keyStoreHash)=0
Gets a hash of the Key store for the object's key system.
firebolt::rialto::IMediaKeys::getLdlSessionsLimit
virtual MediaKeyErrorStatus getLdlSessionsLimit(uint32_t &ldlLimit)=0
Get the limit on the number of ldl key sessions for the object's key system.
firebolt::rialto::IMediaKeys::deleteDrmStore
virtual MediaKeyErrorStatus deleteDrmStore()=0
Delete the DRM store for the object's key system.
firebolt::rialto::IMediaKeys::releaseKeySession
virtual MediaKeyErrorStatus releaseKeySession(int32_t keySessionId)=0
Releases a key session.
firebolt::rialto::MediaKeyErrorStatus
MediaKeyErrorStatus
The error return status for session management methods.
Definition: MediaCommon.h:284
firebolt::rialto::IMediaKeys::getLastDrmError
virtual MediaKeyErrorStatus getLastDrmError(int32_t keySessionId, uint32_t &errorCode)=0
Get the last cdm specific DRM error code.
firebolt::rialto::IMediaKeys::containsKey
virtual bool containsKey(int32_t keySessionId, const std::vector< uint8_t > &keyId)=0
Returns true if the Key Session object contains the specified key.
firebolt::rialto::IMediaKeys::loadSession
virtual MediaKeyErrorStatus loadSession(int32_t keySessionId)=0
Loads an existing key session.
firebolt::rialto::KeySessionType
KeySessionType
The media key session type.
Definition: MediaCommon.h:296
firebolt::rialto::IMediaKeys::selectKeyId
virtual MediaKeyErrorStatus selectKeyId(int32_t keySessionId, const std::vector< uint8_t > &keyId)=0
Selects the specified keyId for the key session. Netflix specific API.
firebolt::rialto::IMediaKeysFactory::createFactory
static std::shared_ptr< IMediaKeysFactory > createFactory()
Create a IMediaKeysFactory instance.
firebolt::rialto::IMediaKeys::setDrmHeader
virtual MediaKeyErrorStatus setDrmHeader(int32_t keySessionId, const std::vector< uint8_t > &requestData)=0
Set DRM Header for a key session.
firebolt::rialto::IMediaKeys::getDrmStoreHash
virtual MediaKeyErrorStatus getDrmStoreHash(std::vector< unsigned char > &drmStoreHash)=0
Gets a hash of the DRM store for the object's key system.
IMediaKeysClient.h
MediaCommon.h
firebolt::rialto::InitDataType
InitDataType
The init data type.
Definition: MediaCommon.h:307
firebolt::rialto::IMediaKeys::generateRequest
virtual MediaKeyErrorStatus generateRequest(int32_t keySessionId, InitDataType initDataType, const std::vector< uint8_t > &initData)=0
Generates a licence request.
firebolt::rialto::IMediaKeys
The definition of the IMediaKeys interface.
Definition: IMediaKeys.h:74
firebolt::rialto::IMediaKeys::createKeySession
virtual MediaKeyErrorStatus createKeySession(KeySessionType sessionType, std::weak_ptr< IMediaKeysClient > client, bool isLDL, int32_t &keySessionId)=0
Creates a session and returns the session id.
firebolt::rialto::IMediaKeysFactory
IMediaKeys factory class, returns a concrete implementation of IMediaKeys.
Definition: IMediaKeys.h:45
firebolt::rialto::IMediaKeys::removeKeySession
virtual MediaKeyErrorStatus removeKeySession(int32_t keySessionId)=0
Removes a key session.