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"
31 typedef unsigned long long uint64_t;
44 ///< Creates a timer with ms resolution and an initial timeout of Ms.
45 ///< If Ms is negative the timer is not initialized with the current
47 static uint64_t Now(void);
50 uint64_t Elapsed(void);
62 void setEntry(int bpp, UINT index, UCHAR Y, UCHAR Cr, UCHAR Cb, UCHAR T);
63 const Palette& getPalette(int bpp) const;
68 const static ULONG defaultPalette2[4];
69 const static ULONG defaultPalette4[16];
70 const static ULONG defaultPalette8[256];
73 class DVBSubtitleRegion : public Bitmap
84 UINT horizontalPosition;
85 UINT verticalPosition;
87 typedef std::vector<struct ObjectRef> ObjectList;
100 bool serviceAcquired;
101 typedef std::map<UCHAR, DVBSubtitleCLUT> CLUTMap;
103 typedef std::map<UCHAR, DVBSubtitleRegion> RegionMap;
105 struct Coords { UINT x; UINT y; };
106 typedef std::map<UCHAR, Coords> DisplayMap;
107 DisplayMap currentDisplay;
108 DisplayMap pendingDisplay;
110 void setState(UCHAR s);
111 void updateRegionPalettes(const DVBSubtitleCLUT&);
114 class DVBSubtitleDisplayDefinition: public DisplayRegion
117 DVBSubtitleDisplayDefinition();
124 class DVBSubtitles : public Thread_TYPE
127 DVBSubtitles(OSDReceiver* tosd = NULL);
128 virtual ~DVBSubtitles() {}
129 void put(const PESPacket& packet);
134 void setOSDMenuVisibility(bool visible);
138 std::deque<PESPacket> worklist;
139 typedef std::map<UINT, DVBSubtitlePage> PageMap;
142 bool decodePacket(const PESPacket&);
143 void finishPage(const DVBSubtitlePage&);
144 DVBSubtitleDisplayDefinition dds;
150 cTimeMs SubtitleTimeout;
158 void threadPostStopCleanup() {};
160 pthread_mutex_t input_mutex;
161 pthread_mutex_t output_mutex;