Minor fix.
[xy_vsfilter.git] / src / subtitles / HdmvSub.h
blob858eadff2f769af68c93dc2a83f5b7c863821b7b
1 /*
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/>.
23 #pragma once
25 #include "BaseSub.h"
27 class CGolombBuffer;
29 class CHdmvSub : public CBaseSub
31 public:
33 static const REFERENCE_TIME INVALID_TIME = _I64_MIN;
35 enum HDMV_SEGMENT_TYPE {
36 NO_SEGMENT = 0xFFFF,
37 PALETTE = 0x14,
38 OBJECT = 0x15,
39 PRESENTATION_SEG = 0x16,
40 WINDOW_DEF = 0x17,
41 INTERACTIVE_SEG = 0x18,
42 END_OF_DISPLAY = 0x80,
43 HDMV_SUB1 = 0x81,
44 HDMV_SUB2 = 0x82
48 struct VIDEO_DESCRIPTOR {
49 SHORT nVideoWidth;
50 SHORT nVideoHeight;
51 BYTE bFrameRate; // <= Frame rate here!
54 struct COMPOSITION_DESCRIPTOR {
55 SHORT nNumber;
56 BYTE bState;
59 struct SEQUENCE_DESCRIPTOR {
60 BYTE bFirstIn : 1;
61 BYTE bLastIn : 1;
62 BYTE bReserved : 8;
65 CHdmvSub();
66 ~CHdmvSub();
68 HRESULT ParseSample (IMediaSample* pSample);
71 POSITION GetStartPosition(REFERENCE_TIME rt, double fps);
72 POSITION GetNext(POSITION pos) {
73 m_pObjects.GetNext(pos);
74 return 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);
89 void Reset();
91 private :
93 HDMV_SEGMENT_TYPE m_nCurSegment;
94 BYTE* m_pSegBuffer;
95 int m_nTotalSegBuffer;
96 int m_nSegBufferPos;
97 int m_nSegSize;
99 VIDEO_DESCRIPTOR m_VideoDescriptor;
101 CompositionObject* m_pCurrentObject;
102 CAtlList<CompositionObject*> m_pObjects;
104 HDMV_PALETTE* m_pDefaultPalette;
105 int m_nDefaultPaletteNbEntry;
107 int m_nColorNumber;
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);