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
);
45 // EN 300-743, table 2
46 enum DVB_SEGMENT_TYPE
{
56 // EN 300-743, table 6
57 enum DVB_OBJECT_TYPE
{
58 OT_BASIC_BITMAP
= 0x00,
60 OT_COMPOSITE_STRING
= 0x02
65 DPS_ACQUISITION
= 0x01,
75 HDMV_PALETTE palette
[256];
77 DVB_CLUT() { memset(palette
, 0, sizeof(palette
)); }
82 BYTE display_window_flag
;
85 short horizontal_position_minimun
;
86 short horizontal_position_maximum
;
87 short vertical_position_minimun
;
88 short vertical_position_maximum
;
91 // Default value (§5.1.3)
101 BYTE object_provider_flag
;
102 short object_horizontal_position
;
103 short object_vertical_position
;
104 BYTE foreground_pixel_code
;
105 BYTE background_pixel_code
;
110 object_provider_flag
= 0;
111 object_horizontal_position
= 0;
112 object_vertical_position
= 0;
113 foreground_pixel_code
= 0;
114 background_pixel_code
= 0;
126 BYTE level_of_compatibility
;
129 BYTE _8_bit_pixel_code
;
130 BYTE _4_bit_pixel_code
;
131 BYTE _2_bit_pixel_code
;
133 DVB_OBJECT objects
[MAX_OBJECTS
];
143 level_of_compatibility
= 0;
146 _8_bit_pixel_code
= 0;
147 _4_bit_pixel_code
= 0;
148 _2_bit_pixel_code
= 0;
155 REFERENCE_TIME rtStart
;
156 REFERENCE_TIME rtStop
;
158 BYTE pageVersionNumber
;
161 DVB_REGION regions
[MAX_REGIONS
];
162 CAtlList
<CompositionObject
*> objects
;
163 CAtlList
<DVB_CLUT
*> CLUTs
;
168 pageVersionNumber
= 0;
175 CompositionObject
* pObject
;
176 while (objects
.GetCount() > 0) {
177 pObject
= objects
.RemoveHead();
182 while (CLUTs
.GetCount() > 0) {
183 pCLUT
= CLUTs
.RemoveHead();
190 static const REFERENCE_TIME INVALID_TIME
= _I64_MIN
;
193 int m_nBufferReadPos
;
194 int m_nBufferWritePos
;
196 CAtlList
<DVB_PAGE
*> m_Pages
;
197 CAutoPtr
<DVB_PAGE
> m_pCurrentPage
;
198 DVB_DISPLAY m_Display
;
199 REFERENCE_TIME m_rtStart
;
200 REFERENCE_TIME m_rtStop
;
202 HRESULT
AddToBuffer(BYTE
* pData
, int nSize
);
203 DVB_PAGE
* FindPage(REFERENCE_TIME rt
);
204 DVB_REGION
* FindRegion(DVB_PAGE
* pPage
, BYTE bRegionId
);
205 DVB_CLUT
* FindClut(DVB_PAGE
* pPage
, BYTE bClutId
);
206 CompositionObject
* FindObject(DVB_PAGE
* pPage
, short sObjectId
);
208 HRESULT
ParsePage(CGolombBuffer
& gb
, WORD wSegLength
, CAutoPtr
<DVB_PAGE
>& pPage
);
209 HRESULT
ParseDisplay(CGolombBuffer
& gb
, WORD wSegLength
);
210 HRESULT
ParseRegion(CGolombBuffer
& gb
, WORD wSegLength
);
211 HRESULT
ParseClut(CGolombBuffer
& gb
, WORD wSegLength
);
212 HRESULT
ParseObject(CGolombBuffer
& gb
, WORD wSegLength
);
214 HRESULT
UpdateTimeStamp(REFERENCE_TIME rtStop
);