summaryrefslogtreecommitdiffstats
path: root/xbmc/cores/VideoPlayer/Interface
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /xbmc/cores/VideoPlayer/Interface
parentInitial commit. (diff)
downloadkodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz
kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/cores/VideoPlayer/Interface')
-rw-r--r--xbmc/cores/VideoPlayer/Interface/DemuxCrypto.h69
-rw-r--r--xbmc/cores/VideoPlayer/Interface/DemuxPacket.h50
-rw-r--r--xbmc/cores/VideoPlayer/Interface/InputStreamConstants.h11
-rw-r--r--xbmc/cores/VideoPlayer/Interface/StreamInfo.h83
-rw-r--r--xbmc/cores/VideoPlayer/Interface/TimingConstants.h24
5 files changed, 237 insertions, 0 deletions
diff --git a/xbmc/cores/VideoPlayer/Interface/DemuxCrypto.h b/xbmc/cores/VideoPlayer/Interface/DemuxCrypto.h
new file mode 100644
index 0000000..4d2a859
--- /dev/null
+++ b/xbmc/cores/VideoPlayer/Interface/DemuxCrypto.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "addons/kodi-dev-kit/include/kodi/c-api/addon-instance/inputstream/stream_crypto.h"
+
+#include <string>
+
+//CryptoSession is usually obtained once per stream, but could change if an key expires
+
+enum CryptoSessionSystem : uint8_t
+{
+ CRYPTO_SESSION_SYSTEM_NONE,
+ CRYPTO_SESSION_SYSTEM_WIDEVINE,
+ CRYPTO_SESSION_SYSTEM_PLAYREADY,
+ CRYPTO_SESSION_SYSTEM_WISEPLAY,
+};
+
+struct DemuxCryptoSession
+{
+ DemuxCryptoSession(const CryptoSessionSystem sys, const char* sData, const uint8_t flags)
+ : sessionId(sData), keySystem(sys), flags(flags)
+ {
+ }
+
+ bool operator == (const DemuxCryptoSession &other) const
+ {
+ return keySystem == other.keySystem && sessionId == other.sessionId;
+ };
+
+ // encryped stream infos
+ std::string sessionId;
+ CryptoSessionSystem keySystem;
+
+ static const uint8_t FLAG_SECURE_DECODER = 1;
+ uint8_t flags;
+private:
+ DemuxCryptoSession(const DemuxCryptoSession&) = delete;
+ DemuxCryptoSession& operator=(const DemuxCryptoSession&) = delete;
+};
+
+//CryptoInfo stores the information to decrypt a sample
+
+struct DemuxCryptoInfo : DEMUX_CRYPTO_INFO
+{
+ explicit DemuxCryptoInfo(const unsigned int numSubs)
+ {
+ numSubSamples = numSubs;
+ flags = 0;
+ clearBytes = new uint16_t[numSubs];
+ cipherBytes = new uint32_t[numSubs];
+ };
+
+ ~DemuxCryptoInfo()
+ {
+ delete[] clearBytes;
+ delete[] cipherBytes;
+ }
+
+private:
+ DemuxCryptoInfo(const DemuxCryptoInfo&) = delete;
+ DemuxCryptoInfo& operator=(const DemuxCryptoInfo&) = delete;
+};
diff --git a/xbmc/cores/VideoPlayer/Interface/DemuxPacket.h b/xbmc/cores/VideoPlayer/Interface/DemuxPacket.h
new file mode 100644
index 0000000..a8ffb98
--- /dev/null
+++ b/xbmc/cores/VideoPlayer/Interface/DemuxPacket.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "TimingConstants.h"
+#include "addons/kodi-dev-kit/include/kodi/c-api/addon-instance/inputstream/demux_packet.h"
+
+#define DMX_SPECIALID_STREAMINFO DEMUX_SPECIALID_STREAMINFO
+#define DMX_SPECIALID_STREAMCHANGE DEMUX_SPECIALID_STREAMCHANGE
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+ struct DemuxPacket : DEMUX_PACKET
+ {
+ DemuxPacket()
+ {
+ pData = nullptr;
+ iSize = 0;
+ iStreamId = -1;
+ demuxerId = -1;
+ iGroupId = -1;
+
+ pSideData = nullptr;
+ iSideDataElems = 0;
+
+ pts = DVD_NOPTS_VALUE;
+ dts = DVD_NOPTS_VALUE;
+ duration = 0;
+ dispTime = 0;
+ recoveryPoint = false;
+
+ cryptoInfo = nullptr;
+ }
+
+ //! @brief PTS offset correction applied to the PTS and DTS.
+ double m_ptsOffsetCorrection{0};
+ };
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
diff --git a/xbmc/cores/VideoPlayer/Interface/InputStreamConstants.h b/xbmc/cores/VideoPlayer/Interface/InputStreamConstants.h
new file mode 100644
index 0000000..93eabc5
--- /dev/null
+++ b/xbmc/cores/VideoPlayer/Interface/InputStreamConstants.h
@@ -0,0 +1,11 @@
+/*
+ * Copyright (C) 2017-2019 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "addons/kodi-dev-kit/include/kodi/c-api/addon-instance/inputstream/stream_constants.h"
diff --git a/xbmc/cores/VideoPlayer/Interface/StreamInfo.h b/xbmc/cores/VideoPlayer/Interface/StreamInfo.h
new file mode 100644
index 0000000..df67662
--- /dev/null
+++ b/xbmc/cores/VideoPlayer/Interface/StreamInfo.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2016-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "utils/Geometry.h"
+
+#include <string>
+
+template <typename T> class CRectGen;
+typedef CRectGen<float> CRect;
+
+enum StreamFlags
+{
+ FLAG_NONE = 0x0000,
+ FLAG_DEFAULT = 0x0001,
+ FLAG_DUB = 0x0002,
+ FLAG_ORIGINAL = 0x0004,
+ FLAG_COMMENT = 0x0008,
+ FLAG_LYRICS = 0x0010,
+ FLAG_KARAOKE = 0x0020,
+ FLAG_FORCED = 0x0040,
+ FLAG_HEARING_IMPAIRED = 0x0080,
+ FLAG_VISUAL_IMPAIRED = 0x0100,
+ FLAG_STILL_IMAGES = 0x100000
+};
+
+enum class StreamHdrType
+{
+ HDR_TYPE_NONE, ///< <b>None</b>, returns an empty string when used in infolabels
+ HDR_TYPE_HDR10, ///< <b>HDR10</b>, returns `hdr10` when used in infolabels
+ HDR_TYPE_DOLBYVISION, ///< <b>Dolby Vision</b>, returns `dolbyvision` when used in infolabels
+ HDR_TYPE_HLG ///< <b>HLG</b>, returns `hlg` when used in infolabels
+};
+
+struct StreamInfo
+{
+ bool valid = false;
+ int bitrate = 0;
+ std::string language;
+ std::string name;
+ std::string codecName;
+ StreamFlags flags = StreamFlags::FLAG_NONE;
+
+protected:
+ StreamInfo() = default;
+ virtual ~StreamInfo() = default;
+};
+
+struct AudioStreamInfo : StreamInfo
+{
+ int channels = 0;
+ int samplerate = 0;
+ int bitspersample = 0;
+};
+
+struct SubtitleStreamInfo : StreamInfo
+{};
+
+struct VideoStreamInfo : StreamInfo
+{
+ float videoAspectRatio = 0.0f;
+ int height = 0;
+ int width = 0;
+ CRect SrcRect;
+ CRect DestRect;
+ CRect VideoRect;
+ std::string stereoMode;
+ int angles = 0;
+ StreamHdrType hdrType = StreamHdrType::HDR_TYPE_NONE;
+};
+
+struct ProgramInfo
+{
+ int id = -1;
+ bool playing = false;
+ std::string name;
+};
diff --git a/xbmc/cores/VideoPlayer/Interface/TimingConstants.h b/xbmc/cores/VideoPlayer/Interface/TimingConstants.h
new file mode 100644
index 0000000..3f526cc
--- /dev/null
+++ b/xbmc/cores/VideoPlayer/Interface/TimingConstants.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2017-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include <cstdint>
+
+#define DVD_TIME_BASE 1000000
+#define DVD_NOPTS_VALUE 0xFFF0000000000000
+
+constexpr int64_t DVD_TIME_TO_MSEC(double x)
+{
+ return static_cast<int64_t>(x * 1000 / DVD_TIME_BASE);
+}
+constexpr double DVD_SEC_TO_TIME(double x) { return x * DVD_TIME_BASE; }
+constexpr double DVD_MSEC_TO_TIME(double x) { return x * DVD_TIME_BASE / 1000; }
+
+#define DVD_PLAYSPEED_PAUSE 0 // frame stepping
+#define DVD_PLAYSPEED_NORMAL 1000