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, see <https://www.gnu.org/licenses/>.
20 #ifndef DVBSUBTITLES_H
21 #define DVBSUBTITLES_H
30 #include <condition_variable>
34 typedef unsigned long long uint64_t;
48 void setEntry(int bpp, u4 index, u1 Y, u1 Cr, u1 Cb, u1 T);
49 const Palette& getPalette(int bpp) const;
54 const static u4 defaultPalette2[4];
55 const static u4 defaultPalette4[16];
56 const static u4 defaultPalette8[256];
59 class DVBSubtitleRegion : public Bitmap
70 u4 horizontalPosition;
73 typedef std::vector<struct ObjectRef> ObjectList;
87 typedef std::map<u1, DVBSubtitleCLUT> CLUTMap;
89 typedef std::map<u1, DVBSubtitleRegion> RegionMap;
91 struct Coords { u4 x; u4 y; };
92 typedef std::map<u1, Coords> DisplayMap;
93 DisplayMap currentDisplay;
94 DisplayMap pendingDisplay;
97 void updateRegionPalettes(const DVBSubtitleCLUT&);
100 class DVBSubtitleDisplayDefinition: public DisplayRegion
103 DVBSubtitleDisplayDefinition();
113 DVBSubtitles(OSDReceiver* tosd = NULL);
114 virtual ~DVBSubtitles() {}
115 void put(const PESPacket& packet);
122 void setOSDMenuVisibility(bool visible);
123 bool isShowing() { return showing; }
127 std::deque<PESPacket> worklist;
128 typedef std::map<u4, DVBSubtitlePage> PageMap;
131 bool decodePacket(const PESPacket&);
132 void finishPage(const DVBSubtitlePage&);
133 void clearDisplayedPages();
134 DVBSubtitleDisplayDefinition dds;
140 std::chrono::time_point<std::chrono::system_clock> subtitleTimeoutPoint;
141 bool subtitleTimeoutPointActive{};
144 std::mutex input_mutex; // Also use as thread/cond/signal mutex, master loop etc.
145 std::mutex output_mutex;
147 std::thread dvbsThread;
148 std::condition_variable dvbsCond;
150 bool signalRecalcWLTO{};