2 Copyright 2008 Mark Calderbank
4 This file is part of VOMP.
6 VOMP 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 2 of the License, or
9 (at your option) any later version.
11 VOMP 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 VOMP; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef DVBSUBTITLES_H
22 #define DVBSUBTITLES_H
24 #include "threadsystem.h"
40 ///< Creates a timer with ms resolution and an initial timeout of Ms.
41 ///< If Ms is negative the timer is not initialized with the current
43 static uint64_t Now(void);
46 uint64_t Elapsed(void);
57 void setEntry(int bpp, UINT index, UCHAR Y, UCHAR Cr, UCHAR Cb, UCHAR T);
58 const Palette& getPalette(int bpp) const;
63 const static ULONG defaultPalette2[4];
64 const static ULONG defaultPalette4[16];
65 const static ULONG defaultPalette8[256];
68 class DVBSubtitleRegion : public Bitmap
79 UINT horizontalPosition;
80 UINT verticalPosition;
82 typedef std::vector<struct ObjectRef> ObjectList;
96 typedef std::map<UCHAR, DVBSubtitleCLUT> CLUTMap;
98 typedef std::map<UCHAR, DVBSubtitleRegion> RegionMap;
100 struct Coords { UINT x; UINT y; };
101 typedef std::map<UCHAR, Coords> DisplayMap;
102 DisplayMap currentDisplay;
103 DisplayMap pendingDisplay;
105 void setState(UCHAR s);
106 void updateRegionPalettes(const DVBSubtitleCLUT&);
109 class DVBSubtitleDisplayDefinition: public DisplayRegion
112 DVBSubtitleDisplayDefinition();
119 class DVBSubtitles : public Thread_TYPE
122 DVBSubtitles(OSDReceiver* tosd = NULL);
123 virtual ~DVBSubtitles() {}
124 void put(const PESPacket& packet);
132 std::deque<PESPacket> worklist;
133 typedef std::map<UINT, DVBSubtitlePage> PageMap;
136 bool decodePacket(const PESPacket&);
137 void finishPage(const DVBSubtitlePage&);
138 DVBSubtitleDisplayDefinition dds;
149 void threadPostStopCleanup() {};
151 pthread_mutex_t input_mutex;
152 pthread_mutex_t output_mutex;