/xbmc/cores/VideoRenderers/OverlayRenderer.h

http://github.com/xbmc/xbmc · C Header · 132 lines · 88 code · 24 blank · 20 comment · 0 complexity · c7fa62d61abc15d51407369fc160d896 MD5 · raw file

  1. /*
  2. * Initial code sponsored by: Voddler Inc (voddler.com)
  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. #pragma once
  22. #include "threads/CriticalSection.h"
  23. #include "BaseRenderer.h"
  24. #include <vector>
  25. class CDVDOverlay;
  26. class CDVDOverlayImage;
  27. class CDVDOverlaySpu;
  28. class CDVDOverlaySSA;
  29. namespace OVERLAY {
  30. struct SRenderState
  31. {
  32. float x;
  33. float y;
  34. float width;
  35. float height;
  36. };
  37. class COverlay
  38. {
  39. public:
  40. COverlay();
  41. virtual ~COverlay();
  42. virtual COverlay* Acquire();
  43. virtual long Release();
  44. virtual void Render(SRenderState& state) = 0;
  45. enum EType
  46. { TYPE_NONE
  47. , TYPE_TEXTURE
  48. , TYPE_GUITEXT
  49. } m_type;
  50. enum EAlign
  51. { ALIGN_SCREEN
  52. , ALIGN_VIDEO
  53. , ALIGN_SUBTITLE
  54. } m_align;
  55. enum EPosition
  56. { POSITION_ABSOLUTE
  57. , POSITION_RELATIVE
  58. } m_pos;
  59. float m_x;
  60. float m_y;
  61. float m_width;
  62. float m_height;
  63. protected:
  64. long m_references;
  65. };
  66. class COverlayMainThread
  67. : public COverlay
  68. {
  69. public:
  70. virtual ~COverlayMainThread() {}
  71. virtual long Release();
  72. };
  73. class CRenderer
  74. {
  75. public:
  76. CRenderer();
  77. ~CRenderer();
  78. void AddOverlay(CDVDOverlay* o, double pts, int index);
  79. void AddOverlay(COverlay* o, double pts, int index);
  80. void AddCleanup(COverlay* o);
  81. void Render(int idx);
  82. void Flush();
  83. void Release(int idx);
  84. protected:
  85. struct SElement
  86. {
  87. SElement()
  88. {
  89. overlay_dvd = NULL;
  90. overlay = NULL;
  91. pts = 0.0;
  92. }
  93. double pts;
  94. CDVDOverlay* overlay_dvd;
  95. COverlay* overlay;
  96. };
  97. typedef std::vector<COverlay*> COverlayV;
  98. typedef std::vector<SElement> SElementV;
  99. void Render(COverlay* o);
  100. COverlay* Convert(CDVDOverlay* o, double pts);
  101. COverlay* Convert(CDVDOverlaySSA* o, double pts);
  102. void Release(COverlayV& list);
  103. void Release(SElementV& list);
  104. CCriticalSection m_section;
  105. SElementV m_buffers[NUM_BUFFERS];
  106. COverlayV m_cleanup;
  107. };
  108. }