Kodi Development 19.0
for Binary and Script based Add-Ons
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 "../../c-api/addon-instance/inputstream/stream_crypto.h"
12#include "../../AddonBase.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace addon
19{
20
21class CInstanceInputStream;
22class InputstreamInfo;
23class VideoCodecInitdata;
24
25//==============================================================================
41class ATTRIBUTE_HIDDEN 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) {}
65
70 void SetKeySystem(STREAM_CRYPTO_KEY_SYSTEM keySystem) { m_cStructure->keySystem = keySystem; }
71
73 STREAM_CRYPTO_KEY_SYSTEM GetKeySystem() const { return m_cStructure->keySystem; }
74
77 void SetFlags(uint8_t flags) { m_cStructure->flags = flags; }
78
80 uint8_t GetFlags() const { return m_cStructure->flags; }
81
83 void SetSessionId(const std::string& sessionId)
84 {
85 strncpy(m_cStructure->sessionId, sessionId.c_str(), sizeof(m_cStructure->sessionId) - 1);
86 }
87
89 std::string GetSessionId() const { return m_cStructure->sessionId; }
90
91private:
92 StreamCryptoSession(const STREAM_CRYPTO_SESSION* session) : CStructHdl(session) {}
93 StreamCryptoSession(STREAM_CRYPTO_SESSION* session) : CStructHdl(session) {}
94};
95
96} /* namespace addon */
97} /* namespace kodi */
98
99#endif /* __cplusplus */
Definition: Inputstream.h:1154
Definition: AddonBase.h:250
Definition: Inputstream.h:508
Definition: StreamCrypto.h:43
Definition: VideoCodec.h:38
STREAM_CRYPTO_KEY_SYSTEM
Definition: stream_crypto.h:34
std::string GetSessionId() const
To get the crypto session key identifier.
Definition: StreamCrypto.h:89
void SetFlags(uint8_t flags)
Set bit flags to use special conditions, see STREAM_CRYPTO_FLAGS for available flags.
Definition: StreamCrypto.h:77
void SetSessionId(const std::string &sessionId)
To set the crypto session key identifier.
Definition: StreamCrypto.h:83
STREAM_CRYPTO_KEY_SYSTEM GetKeySystem() const
Get keysystem for encrypted media.
Definition: StreamCrypto.h:73
void SetKeySystem(STREAM_CRYPTO_KEY_SYSTEM keySystem)
To set keysystem for encrypted media, STREAM_CRYPTO_KEY_SYSTEM_NONE for unencrypted media.
Definition: StreamCrypto.h:70
uint8_t GetFlags() const
Get flags for special conditions.
Definition: StreamCrypto.h:80
Definition: stream_crypto.h:109