/xbmc/cores/dvdplayer/DVDDemuxSPU.h

http://github.com/xbmc/xbmc · C Header · 65 lines · 31 code · 11 blank · 23 comment · 0 complexity · 31a0ccf43fcaa8119aaa2fda98d5f897 MD5 · raw file

  1. #pragma once
  2. /*
  3. * Copyright (C) 2005-2013 Team XBMC
  4. * http://xbmc.org
  5. *
  6. * This Program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2, or (at your option)
  9. * any later version.
  10. *
  11. * This Program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with XBMC; see the file COPYING. If not, see
  18. * <http://www.gnu.org/licenses/>.
  19. *
  20. */
  21. #include "DVDCodecs/Video/DVDVideoCodec.h"
  22. #include "DVDCodecs/Overlay/DVDOverlaySpu.h"
  23. struct AVPicture;
  24. typedef struct SPUData
  25. {
  26. uint8_t* data;
  27. unsigned int iSize; // current data size
  28. unsigned int iNeededSize; // wanted packet size
  29. unsigned int iAllocatedSize;
  30. double pts;
  31. }
  32. SPUData;
  33. // upto 32 streams can exist
  34. #define DVD_MAX_SPUSTREAMS 32
  35. class CDVDDemuxSPU
  36. {
  37. public:
  38. CDVDDemuxSPU();
  39. virtual ~CDVDDemuxSPU();
  40. CDVDOverlaySpu* AddData(uint8_t* data, int iSize, double pts); // returns a packet from ParsePacket if possible
  41. CDVDOverlaySpu* ParseRLE(CDVDOverlaySpu* pSPU, uint8_t* pUnparsedData);
  42. static void FindSubtitleColor(int last_color, int stats[4], CDVDOverlaySpu* pSPU);
  43. static bool CanDisplayWithAlphas(int a[4], int stats[4]);
  44. void Reset();
  45. void FlushCurrentPacket(); // flushes current unparsed data
  46. // m_clut set by libdvdnav once in a time
  47. // color lokup table is representing 16 different yuv colors
  48. // [][0] = Y, [][1] = Cr, [][2] = Cb
  49. uint8_t m_clut[16][3];
  50. bool m_bHasClut;
  51. protected:
  52. CDVDOverlaySpu* ParsePacket(SPUData* pSPUData);
  53. SPUData m_spuData;
  54. };