summaryrefslogtreecommitdiffstats
path: root/xbmc/cores/VideoPlayer/DVDDemuxSPU.h
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/DVDDemuxSPU.h
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/DVDDemuxSPU.h')
-rw-r--r--xbmc/cores/VideoPlayer/DVDDemuxSPU.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxSPU.h b/xbmc/cores/VideoPlayer/DVDDemuxSPU.h
new file mode 100644
index 0000000..8f1bcc1
--- /dev/null
+++ b/xbmc/cores/VideoPlayer/DVDDemuxSPU.h
@@ -0,0 +1,54 @@
+/*
+ * 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 <stdint.h>
+
+struct AVFrame;
+class CDVDOverlaySpu;
+
+typedef struct SPUData
+{
+ uint8_t* data;
+ unsigned int iSize; // current data size
+ unsigned int iNeededSize; // wanted packet size
+ unsigned int iAllocatedSize;
+ double pts;
+}
+SPUData;
+
+// upto 32 streams can exist
+#define DVD_MAX_SPUSTREAMS 32
+
+class CDVDDemuxSPU final
+{
+public:
+ CDVDDemuxSPU();
+ ~CDVDDemuxSPU();
+
+ CDVDOverlaySpu* AddData(uint8_t* data, int iSize, double pts); // returns a packet from ParsePacket if possible
+
+ CDVDOverlaySpu* ParseRLE(CDVDOverlaySpu* pSPU, uint8_t* pUnparsedData);
+ static void FindSubtitleColor(int last_color, int stats[4], CDVDOverlaySpu* pSPU);
+ static bool CanDisplayWithAlphas(const int a[4], const int stats[4]);
+
+ void Reset();
+ void FlushCurrentPacket(); // flushes current unparsed data
+
+ // m_clut set by libdvdnav once in a time
+ // color lookup table is representing 16 different yuv colors
+ // [][0] = Y, [][1] = Cr, [][2] = Cb
+ uint8_t m_clut[16][3];
+ bool m_bHasClut;
+
+protected:
+ CDVDOverlaySpu* ParsePacket(SPUData* pSPUData);
+
+ SPUData m_spuData;
+};