Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
StreamCrypto.h
1/*
2 * Copyright (C) 2005-2020 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "../../AddonBase.h"
12#include "../../c-api/addon-instance/inputstream/stream_crypto.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace addon
19{
20
21class CInstanceInputStream;
22class InputstreamInfo;
23class VideoCodecInitdata;
24
25//==============================================================================
41class ATTR_DLL_LOCAL StreamCryptoSession
42 : public CStructHdl<StreamCryptoSession, STREAM_CRYPTO_SESSION>
43{
45 friend class CInstanceInputStream;
46 friend class InputstreamInfo;
47 friend class VideoCodecInitdata;
50public:
52 StreamCryptoSession() { memset(m_cStructure, 0, sizeof(STREAM_CRYPTO_SESSION)); }
53 StreamCryptoSession(const StreamCryptoSession& session) : CStructHdl(session) {}
54 StreamCryptoSession& operator=(const StreamCryptoSession&) = default;
66
71 void SetKeySystem(STREAM_CRYPTO_KEY_SYSTEM keySystem) { m_cStructure->keySystem = keySystem; }
72
74 STREAM_CRYPTO_KEY_SYSTEM GetKeySystem() const { return m_cStructure->keySystem; }
75
78 void SetFlags(uint8_t flags) { m_cStructure->flags = flags; }
79
81 uint8_t GetFlags() const { return m_cStructure->flags; }
82
84 void SetSessionId(const std::string& sessionId)
85 {
86 strncpy(m_cStructure->sessionId, sessionId.c_str(), sizeof(m_cStructure->sessionId) - 1);
87 }
88
90 std::string GetSessionId() const { return m_cStructure->sessionId; }
91
92private:
93 StreamCryptoSession(const STREAM_CRYPTO_SESSION* session) : CStructHdl(session) {}
94 StreamCryptoSession(STREAM_CRYPTO_SESSION* session) : CStructHdl(session) {}
95};
96
97} /* namespace addon */
98} /* namespace kodi */
99
100#endif /* __cplusplus */
Definition Inputstream.h:1148
Definition AddonBase.h:206
Definition Inputstream.h:508
Definition StreamCrypto.h:43
Definition VideoCodec.h:37
STREAM_CRYPTO_KEY_SYSTEM
Definition stream_crypto.h:34
std::string GetSessionId() const
To get the crypto session key identifier.
Definition StreamCrypto.h:90
void SetFlags(uint8_t flags)
Set bit flags to use special conditions, see STREAM_CRYPTO_FLAGS for available flags.
Definition StreamCrypto.h:78
void SetSessionId(const std::string &sessionId)
To set the crypto session key identifier.
Definition StreamCrypto.h:84
STREAM_CRYPTO_KEY_SYSTEM GetKeySystem() const
Get keysystem for encrypted media.
Definition StreamCrypto.h:74
void SetKeySystem(STREAM_CRYPTO_KEY_SYSTEM keySystem)
To set keysystem for encrypted media, STREAM_CRYPTO_KEY_SYSTEM_NONE for unencrypted media.
Definition StreamCrypto.h:71
uint8_t GetFlags() const
Get flags for special conditions.
Definition StreamCrypto.h:81
Definition stream_crypto.h:121