Merge some MPC-HC Rev.3895 code to get HdmvSub and DVBSub support.
[xy_vsfilter.git] / src / subtitles / CompositionObject.h
blob926eb58e17f88ccd6f7276b19573115c1279485b
1 /*
2 * $Id: CompositionObject.h 3720 2011-09-12 00:30:00Z aleksoid $
4 * (C) 2006-2010 see AUTHORS
6 * This file is part of mplayerc.
8 * Mplayerc is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * Mplayerc is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #pragma once
26 #include "Rasterizer.h"
29 struct HDMV_PALETTE {
30 BYTE entry_id;
31 BYTE Y;
32 BYTE Cr;
33 BYTE Cb;
34 BYTE T; // HDMV rule : 0 transparent, 255 opaque (compatible DirectX)
37 class CGolombBuffer;
39 class CompositionObject : Rasterizer
41 public :
42 SHORT m_object_id_ref;
43 BYTE m_window_id_ref;
44 bool m_object_cropped_flag;
45 bool m_forced_on_flag;
46 BYTE m_version_number;
47 BYTE m_nObjectNumber;
49 SHORT m_horizontal_position;
50 SHORT m_vertical_position;
51 SHORT m_width;
52 SHORT m_height;
54 SHORT m_cropping_horizontal_position;
55 SHORT m_cropping_vertical_position;
56 SHORT m_cropping_width;
57 SHORT m_cropping_height;
59 REFERENCE_TIME m_rtStart;
60 REFERENCE_TIME m_rtStop;
62 CompositionObject();
63 ~CompositionObject();
65 void SetRLEData(BYTE* pBuffer, int nSize, int nTotalSize);
66 void AppendRLEData(BYTE* pBuffer, int nSize);
67 int GetRLEDataSize() {
68 return m_nRLEDataSize;
70 bool IsRLEComplete() {
71 return m_nRLEPos >= m_nRLEDataSize;
73 void RenderHdmv(SubPicDesc& spd);
74 void RenderDvb(SubPicDesc& spd, SHORT nX, SHORT nY);
75 void WriteSeg (SubPicDesc& spd, SHORT nX, SHORT nY, SHORT nCount, SHORT nPaletteIndex);
76 void SetPalette (int nNbEntry, HDMV_PALETTE* pPalette, bool bIsHD);
77 void SetPalette (int nNbEntry, DWORD* dwColors);
78 bool HavePalette() {
79 return m_nColorNumber>0;
82 private :
83 BYTE* m_pRLEData;
84 int m_nRLEDataSize;
85 int m_nRLEPos;
86 int m_nColorNumber;
87 DWORD m_Colors[256];
89 void DvbRenderField(SubPicDesc& spd, CGolombBuffer& gb, SHORT nXStart, SHORT nYStart, SHORT nLength);
90 void Dvb2PixelsCodeString(SubPicDesc& spd, CGolombBuffer& gb, SHORT& nX, SHORT& nY);
91 void Dvb4PixelsCodeString(SubPicDesc& spd, CGolombBuffer& gb, SHORT& nX, SHORT& nY);
92 void Dvb8PixelsCodeString(SubPicDesc& spd, CGolombBuffer& gb, SHORT& nX, SHORT& nY);