1 /*
2  * Copyright 2015, Mozilla Foundation and contributors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __ClearKeySession_h__
18 #define __ClearKeySession_h__
19 
20 // This include is required in order for content_decryption_module to work
21 // on Unix systems.
22 #include <stddef.h>
23 
24 #include <string>
25 #include <vector>
26 
27 #include "content_decryption_module.h"
28 
29 #include "ClearKeyUtils.h"
30 
31 class ClearKeySession {
32  public:
33   explicit ClearKeySession(const std::string& aSessionId,
34                            cdm::SessionType aSessionType);
35 
36   ~ClearKeySession();
37 
GetKeyIds()38   const std::vector<KeyId>& GetKeyIds() const { return mKeyIds; }
39 
40   bool Init(cdm::InitDataType aInitDataType, const uint8_t* aInitData,
41             uint32_t aInitDataSize);
42 
43   cdm::SessionType Type() const;
44 
45   void AddKeyId(const KeyId& aKeyId);
46 
Id()47   const std::string& Id() const { return mSessionId; }
48 
49  private:
50   const std::string mSessionId;
51   std::vector<KeyId> mKeyIds;
52 
53   const cdm::SessionType mSessionType;
54 };
55 
56 #endif  // __ClearKeySession_h__
57