2 * $Id: HdmvSub.h 2786 2010-12-17 16:42:55Z XhmikosR $
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/>.
29 class CHdmvSub
: public CBaseSub
33 static const REFERENCE_TIME INVALID_TIME
= _I64_MIN
;
35 enum HDMV_SEGMENT_TYPE
{
39 PRESENTATION_SEG
= 0x16,
41 INTERACTIVE_SEG
= 0x18,
42 END_OF_DISPLAY
= 0x80,
48 struct VIDEO_DESCRIPTOR
{
51 BYTE bFrameRate
; // <= Frame rate here!
54 struct COMPOSITION_DESCRIPTOR
{
59 struct SEQUENCE_DESCRIPTOR
{
68 HRESULT
ParseSample (IMediaSample
* pSample
);
71 POSITION
GetStartPosition(REFERENCE_TIME rt
, double fps
);
72 POSITION
GetNext(POSITION pos
) {
73 m_pObjects
.GetNext(pos
);
78 virtual REFERENCE_TIME
GetStart(POSITION nPos
) {
79 CompositionObject
* pObject
= m_pObjects
.GetAt(nPos
);
80 return pObject
!=NULL
? pObject
->m_rtStart
: INVALID_TIME
;
82 virtual REFERENCE_TIME
GetStop(POSITION nPos
) {
83 CompositionObject
* pObject
= m_pObjects
.GetAt(nPos
);
84 return pObject
!=NULL
? pObject
->m_rtStop
: INVALID_TIME
;
87 void Render(SubPicDesc
& spd
, REFERENCE_TIME rt
, RECT
& bbox
);
88 HRESULT
GetTextureSize (POSITION pos
, SIZE
& MaxTextureSize
, SIZE
& VideoSize
, POINT
& VideoTopLeft
);
93 HDMV_SEGMENT_TYPE m_nCurSegment
;
95 int m_nTotalSegBuffer
;
99 VIDEO_DESCRIPTOR m_VideoDescriptor
;
101 CompositionObject
* m_pCurrentObject
;
102 CAtlList
<CompositionObject
*> m_pObjects
;
104 HDMV_PALETTE
* m_pDefaultPalette
;
105 int m_nDefaultPaletteNbEntry
;
110 int ParsePresentationSegment(CGolombBuffer
* pGBuffer
);
111 void ParsePalette(CGolombBuffer
* pGBuffer
, USHORT nSize
);
112 void ParseObject(CGolombBuffer
* pGBuffer
, USHORT nUnitSize
);
114 void ParseVideoDescriptor(CGolombBuffer
* pGBuffer
, VIDEO_DESCRIPTOR
* pVideoDescriptor
);
115 void ParseCompositionDescriptor(CGolombBuffer
* pGBuffer
, COMPOSITION_DESCRIPTOR
* pCompositionDescriptor
);
116 void ParseCompositionObject(CGolombBuffer
* pGBuffer
, CompositionObject
* pCompositionObject
);
118 void AllocSegment(int nSize
);
120 CompositionObject
* FindObject(REFERENCE_TIME rt
);