xbmc
DVDDemuxSPU.h
1 /*
2  * Copyright (C) 2005-2018 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 <memory>
12 #include <stdint.h>
13 
14 struct AVFrame;
15 class CDVDOverlaySpu;
16 
17 typedef struct SPUData
18 {
19  uint8_t* data;
20  unsigned int iSize; // current data size
21  unsigned int iNeededSize; // wanted packet size
22  unsigned int iAllocatedSize;
23  double pts;
24 }
25 SPUData;
26 
27 // upto 32 streams can exist
28 #define DVD_MAX_SPUSTREAMS 32
29 
30 class CDVDDemuxSPU final
31 {
32 public:
33  CDVDDemuxSPU();
34  ~CDVDDemuxSPU();
35 
36  std::shared_ptr<CDVDOverlaySpu> AddData(
37  uint8_t* data, int iSize, double pts); // returns a packet from ParsePacket if possible
38 
39  std::shared_ptr<CDVDOverlaySpu> ParseRLE(std::shared_ptr<CDVDOverlaySpu> pSPU,
40  uint8_t* pUnparsedData);
41  static void FindSubtitleColor(int last_color, int stats[4], CDVDOverlaySpu& pSPU);
42  static bool CanDisplayWithAlphas(const int a[4], const int stats[4]);
43 
44  void Reset();
45  void FlushCurrentPacket(); // flushes current unparsed data
46 
47  // m_clut set by libdvdnav once in a time
48  // color lookup table is representing 16 different yuv colors
49  // [][0] = Y, [][1] = Cr, [][2] = Cb
50  uint8_t m_clut[16][3];
51  bool m_bHasClut;
52 
53 protected:
54  std::shared_ptr<CDVDOverlaySpu> ParsePacket(SPUData* pSPUData);
55 
56  SPUData m_spuData;
57 };
Definition: DVDDemuxSPU.h:30
Definition: DVDDemuxSPU.h:17
Definition: DVDOverlaySpu.h:16