1111#include " Stream.h"
1212#include " common/AdaptiveStream.h"
1313#include " common/AdaptiveTree.h"
14+ #include " decrypters/DrmEngine.h"
1415#include " decrypters/IDecrypter.h"
1516
1617#if defined(ANDROID)
@@ -40,21 +41,7 @@ class ATTR_DLL_LOCAL CSession : public adaptive::AdaptiveStreamObserver
4041 /*
4142 * \brief Check HDCP parameters to remove unplayable representations
4243 */
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();
5845
5946 /* ! \brief Initialize adaptive tree period
6047 * \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
9380 * \brief Update stream's InputstreamInfo
9481 * \param stream The stream to prepare
9582 */
96- void PrepareStream (CStream* stream);
83+ bool PrepareStream (CStream* stream, uint64_t startPts );
9784
9885 /* ! \brief Get a stream by index (starting at 1)
9986 * \param sid The one-indexed stream id
@@ -115,50 +102,11 @@ class ATTR_DLL_LOCAL CSession : public adaptive::AdaptiveStreamObserver
115102 */
116103 unsigned int GetStreamCount () const { return static_cast <unsigned int >(m_streams.size ()); }
117104
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-
130105 /* ! \brief Get the media type mask
131106 * \return The media type mask
132107 */
133108 uint8_t GetMediaTypeMask () const { return m_mediaTypeMask; }
134109
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-
162110 /* ! \brief Get the total time in ms of the stream
163111 * \return The total time in ms of the stream
164112 */
@@ -324,13 +272,9 @@ class ATTR_DLL_LOCAL CSession : public adaptive::AdaptiveStreamObserver
324272 */
325273 bool OnGetStream (int streamid, kodi::addon::InputstreamInfo& info);
326274
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; }
333276
277+ protected:
334278 /* ! \brief Destroy all CencSingleSampleDecrypter instances
335279 */
336280 void DisposeSampleDecrypter ();
@@ -339,21 +283,8 @@ class ATTR_DLL_LOCAL CSession : public adaptive::AdaptiveStreamObserver
339283 */
340284 void DisposeDecrypter ();
341285
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-
347286private:
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;
357288
358289 adaptive::AdaptiveTree* m_adaptiveTree{nullptr };
359290 CHOOSER::IRepresentationChooser* m_reprChooser{nullptr };
0 commit comments