Shaka Player Embedded
implementation.h
Go to the documentation of this file.
1 // Copyright 2017 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SHAKA_EMBEDDED_EME_IMPLEMENTATION_H_
16 #define SHAKA_EMBEDDED_EME_IMPLEMENTATION_H_
17 
18 #include <functional>
19 #include <string>
20 #include <vector>
21 
22 #include "../macros.h"
23 #include "configuration.h"
24 #include "data.h"
25 #include "eme_promise.h"
26 
27 namespace shaka {
28 namespace eme {
29 
35  KeyStatusInfo();
36  KeyStatusInfo(const std::vector<uint8_t>& key_id, MediaKeyStatus status);
37 
38  // Needed to satisfy Chromium-style.
39  KeyStatusInfo(KeyStatusInfo&&);
40  KeyStatusInfo(const KeyStatusInfo&);
41  KeyStatusInfo& operator=(KeyStatusInfo&&);
42  KeyStatusInfo& operator=(const KeyStatusInfo&);
43  ~KeyStatusInfo();
44 
45  std::vector<uint8_t> key_id;
47 };
48 
50 inline KeyStatusInfo::KeyStatusInfo(const std::vector<uint8_t>& key_id,
52  : key_id(std::move(key_id)), status(status) {}
53 
55 inline KeyStatusInfo::KeyStatusInfo(const KeyStatusInfo&) = default;
57 inline KeyStatusInfo& KeyStatusInfo::operator=(const KeyStatusInfo&) = default;
59 
60 
87  public:
88  // Since this is intended to be subclassed by the app, this type cannot be
89  // changed without breaking ABI compatibility. This includes adding
90  // new virtual methods.
91 
93 
94 
103  virtual bool GetExpiration(const std::string& session_id,
104  int64_t* expiration) const = 0;
105 
115  virtual bool GetKeyStatuses(const std::string& session_id,
116  std::vector<KeyStatusInfo>* statuses) const = 0;
117 
118 
129  virtual void SetServerCertificate(EmePromise promise, Data cert) = 0;
130 
157  virtual void CreateSessionAndGenerateRequest(
158  EmePromise promise,
159  std::function<void(const std::string&)> set_session_id,
160  MediaKeySessionType session_type, MediaKeyInitDataType init_data_type,
161  Data data) = 0;
162 
172  virtual void Load(const std::string& session_id, EmePromise promise) = 0;
173 
181  virtual void Update(const std::string& session_id, EmePromise promise,
182  Data data) = 0;
183 
191  virtual void Close(const std::string& session_id, EmePromise promise) = 0;
192 
203  virtual void Remove(const std::string& session_id, EmePromise promise) = 0;
204 
205 
223  virtual DecryptStatus Decrypt(const FrameEncryptionInfo* info,
224  const uint8_t* data, size_t data_size,
225  uint8_t* dest) const = 0;
226 };
227 
228 } // namespace eme
229 } // namespace shaka
230 
231 #endif // SHAKA_EMBEDDED_EME_IMPLEMENTATION_H_
const char * dest
Definition: media_utils.cc:31
#define SHAKA_EXPORT
Definition: macros.h:30
std::vector< uint8_t > key_id
#define SHAKA_DECLARE_INTERFACE_METHODS(Type)
Definition: macros.h:55
KeyStatusInfo & operator=(KeyStatusInfo &&)