11
11
#include " Stream.h"
12
12
#include " common/AdaptiveStream.h"
13
13
#include " common/AdaptiveTree.h"
14
+ #include " decrypters/DrmEngine.h"
14
15
#include " decrypters/IDecrypter.h"
15
16
16
17
#if defined(ANDROID)
@@ -40,21 +41,7 @@ class ATTR_DLL_LOCAL CSession : public adaptive::AdaptiveStreamObserver
40
41
/*
41
42
* \brief Check HDCP parameters to remove unplayable representations
42
43
*/
43
- void CheckHDCP ();
44
-
45
- /* ! \brief Pre-Initialize the DRM
46
- * \param challengeB64 [OUT] Provide the challenge data as base64
47
- * \param sessionId [OUT] Provide the session ID
48
- * \param isSessionOpened [OUT] Will be true if the DRM session has been opened
49
- * \return True if has success, false otherwise
50
- */
51
- bool PreInitializeDRM (std::string& challengeB64, std::string& sessionId, bool & isSessionOpened);
52
-
53
- /* ! \brief Initialize the DRM
54
- * \param addDefaultKID Set True to add the default KID to the first session
55
- * \return True if has success, false otherwise
56
- */
57
- bool InitializeDRM (bool addDefaultKID = false );
44
+ // void CheckHDCP();
58
45
59
46
/* ! \brief Initialize adaptive tree period
60
47
* \param isSessionOpened Set True to kept and re-use the DRM session opened,
@@ -93,7 +80,7 @@ class ATTR_DLL_LOCAL CSession : public adaptive::AdaptiveStreamObserver
93
80
* \brief Update stream's InputstreamInfo
94
81
* \param stream The stream to prepare
95
82
*/
96
- void PrepareStream (CStream* stream);
83
+ bool PrepareStream (CStream* stream, uint64_t startPts );
97
84
98
85
/* ! \brief Get a stream by index (starting at 1)
99
86
* \param sid The one-indexed stream id
@@ -115,50 +102,11 @@ class ATTR_DLL_LOCAL CSession : public adaptive::AdaptiveStreamObserver
115
102
*/
116
103
unsigned int GetStreamCount () const { return static_cast <unsigned int >(m_streams.size ()); }
117
104
118
- /* !
119
- * \brief Determines if the CDM session at specified index require Secure Path (TEE).
120
- * \return True if Secure Path is required, otherwise false.
121
- */
122
- bool IsCDMSessionSecurePath (size_t index);
123
-
124
- /* ! \brief Get a session string (session id) by index from the cdm sessions
125
- * \param index The index (psshSet number) of the cdm session
126
- * \return The session string
127
- */
128
- std::string GetCDMSession (unsigned int index);
129
-
130
105
/* ! \brief Get the media type mask
131
106
* \return The media type mask
132
107
*/
133
108
uint8_t GetMediaTypeMask () const { return m_mediaTypeMask; }
134
109
135
- /* ! \brief Get a single sample decrypter by index from the cdm sessions
136
- * \param index The index (psshSet number) of the cdm session
137
- * \return The single sample decrypter
138
- */
139
- std::shared_ptr<Adaptive_CencSingleSampleDecrypter> GetSingleSampleDecryptor (
140
- unsigned int index) const ;
141
-
142
- /* ! \brief Get the decrypter (DRM lib)
143
- * \return The decrypter
144
- */
145
- DRM::IDecrypter* GetDecrypter () { return m_decrypter.get (); }
146
-
147
- /* ! \brief Get a single sample decrypter matching the session id provided
148
- * \param sessionId The session id string to match
149
- * \return The single sample decrypter
150
- */
151
- std::shared_ptr<Adaptive_CencSingleSampleDecrypter> GetSingleSampleDecrypter (std::string sessionId);
152
-
153
- /* ! \brief Get decrypter capabilities for a single sample decrypter
154
- * \param index The index (psshSet number) of the cdm session
155
- * \return The single sample decrypter capabilities
156
- */
157
- const DRM::DecrypterCapabilites& GetDecrypterCaps (unsigned int index) const
158
- {
159
- return m_cdmSessions[index ].m_decrypterCaps ;
160
- };
161
-
162
110
/* ! \brief Get the total time in ms of the stream
163
111
* \return The total time in ms of the stream
164
112
*/
@@ -324,13 +272,9 @@ class ATTR_DLL_LOCAL CSession : public adaptive::AdaptiveStreamObserver
324
272
*/
325
273
bool OnGetStream (int streamid, kodi::addon::InputstreamInfo& info);
326
274
327
- protected:
328
- /* ! \brief Check for and load decrypter module matching the supplied key system
329
- * \param key_system [OUT] Will be assigned to if a decrypter is found matching
330
- * the set license type
331
- */
332
- void SetSupportedDecrypterURN (std::vector<std::string_view>& keySystems);
275
+ const DRM::CDRMEngine& GetDRMEngine () const { return m_drmEngine; }
333
276
277
+ protected:
334
278
/* ! \brief Destroy all CencSingleSampleDecrypter instances
335
279
*/
336
280
void DisposeSampleDecrypter ();
@@ -339,21 +283,8 @@ class ATTR_DLL_LOCAL CSession : public adaptive::AdaptiveStreamObserver
339
283
*/
340
284
void DisposeDecrypter ();
341
285
342
- void ExtractStreamProtectionData (const PLAYLIST::CPeriod::PSSHSet& psshSet,
343
- std::string& defaultKid,
344
- std::vector<uint8_t >& initData,
345
- const std::vector<std::string_view>& keySystems);
346
-
347
286
private:
348
- std::shared_ptr<DRM::IDecrypter> m_decrypter;
349
-
350
- struct CCdmSession
351
- {
352
- DRM::DecrypterCapabilites m_decrypterCaps;
353
- std::shared_ptr<Adaptive_CencSingleSampleDecrypter> m_cencSingleSampleDecrypter;
354
- std::string m_sessionId;
355
- };
356
- std::vector<CCdmSession> m_cdmSessions;
287
+ DRM::CDRMEngine m_drmEngine;
357
288
358
289
adaptive::AdaptiveTree* m_adaptiveTree{nullptr };
359
290
CHOOSER::IRepresentationChooser* m_reprChooser{nullptr };
0 commit comments