2 * (C) 2006-2012 see Authors.txt
4 * This file is part of MPC-HC.
6 * MPC-HC 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 3 of the License, or
9 * (at your option) any later version.
11 * MPC-HC 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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #define MAX_REGIONS 10
26 #define MAX_OBJECTS 10 // Max number of objects per region
30 class CDVBSub
: public CBaseSub
36 virtual HRESULT
ParseSample(IMediaSample
* pSample
);
37 virtual void Render(SubPicDesc
& spd
, REFERENCE_TIME rt
, RECT
& bbox
);
38 virtual HRESULT
GetTextureSize(POSITION pos
, SIZE
& MaxTextureSize
, SIZE
& VideoSize
, POINT
& VideoTopLeft
);
39 virtual POSITION
GetStartPosition(REFERENCE_TIME rt
, double fps
);
40 virtual POSITION
GetNext(POSITION pos
);
41 virtual REFERENCE_TIME
GetStart(POSITION nPos
);
42 virtual REFERENCE_TIME
GetStop(POSITION nPos
);
44 virtual HRESULT
SetYuvType(ColorType colorType
, YuvRangeType yuvRangeType
);
46 // EN 300-743, table 2
47 enum DVB_SEGMENT_TYPE
{
57 // EN 300-743, table 6
58 enum DVB_OBJECT_TYPE
{
59 OT_BASIC_BITMAP
= 0x00,
61 OT_COMPOSITE_STRING
= 0x02
66 DPS_ACQUISITION
= 0x01,
76 HDMV_PALETTE palette
[256];
78 DVB_CLUT() { memset(palette
, 0, sizeof(palette
)); }
83 BYTE display_window_flag
;
86 short horizontal_position_minimun
;
87 short horizontal_position_maximum
;
88 short vertical_position_minimun
;
89 short vertical_position_maximum
;
92 // Default value (§5.1.3)
102 BYTE object_provider_flag
;
103 short object_horizontal_position
;
104 short object_vertical_position
;
105 BYTE foreground_pixel_code
;
106 BYTE background_pixel_code
;
111 object_provider_flag
= 0;
112 object_horizontal_position
= 0;
113 object_vertical_position
= 0;
114 foreground_pixel_code
= 0;
115 background_pixel_code
= 0;
127 BYTE level_of_compatibility
;
130 BYTE _8_bit_pixel_code
;
131 BYTE _4_bit_pixel_code
;
132 BYTE _2_bit_pixel_code
;
134 DVB_OBJECT objects
[MAX_OBJECTS
];
144 level_of_compatibility
= 0;
147 _8_bit_pixel_code
= 0;
148 _4_bit_pixel_code
= 0;
149 _2_bit_pixel_code
= 0;
156 REFERENCE_TIME rtStart
;
157 REFERENCE_TIME rtStop
;
159 BYTE pageVersionNumber
;
162 DVB_REGION regions
[MAX_REGIONS
];
163 CAtlList
<CompositionObject
*> objects
;
164 CAtlList
<DVB_CLUT
*> CLUTs
;
169 pageVersionNumber
= 0;
176 CompositionObject
* pObject
;
177 while (objects
.GetCount() > 0) {
178 pObject
= objects
.RemoveHead();
183 while (CLUTs
.GetCount() > 0) {
184 pCLUT
= CLUTs
.RemoveHead();
191 static const REFERENCE_TIME INVALID_TIME
= _I64_MIN
;
194 int m_nBufferReadPos
;
195 int m_nBufferWritePos
;
197 CAtlList
<DVB_PAGE
*> m_Pages
;
198 CAutoPtr
<DVB_PAGE
> m_pCurrentPage
;
199 DVB_DISPLAY m_Display
;
200 REFERENCE_TIME m_rtStart
;
201 REFERENCE_TIME m_rtStop
;
203 HRESULT
AddToBuffer(BYTE
* pData
, int nSize
);
204 DVB_PAGE
* FindPage(REFERENCE_TIME rt
);
205 DVB_REGION
* FindRegion(DVB_PAGE
* pPage
, BYTE bRegionId
);
206 DVB_CLUT
* FindClut(DVB_PAGE
* pPage
, BYTE bClutId
);
207 CompositionObject
* FindObject(DVB_PAGE
* pPage
, short sObjectId
);
209 HRESULT
ParsePage(CGolombBuffer
& gb
, WORD wSegLength
, CAutoPtr
<DVB_PAGE
>& pPage
);
210 HRESULT
ParseDisplay(CGolombBuffer
& gb
, WORD wSegLength
);
211 HRESULT
ParseRegion(CGolombBuffer
& gb
, WORD wSegLength
);
212 HRESULT
ParseClut(CGolombBuffer
& gb
, WORD wSegLength
);
213 HRESULT
ParseObject(CGolombBuffer
& gb
, WORD wSegLength
);
215 HRESULT
UpdateTimeStamp(REFERENCE_TIME rtStop
);