]> git.vomp.tv Git - vompclient.git/blob - src/osd.h
WIP: Build system tweaks to enable cross/distcc/clang/mold
[vompclient.git] / src / osd.h
1 /*
2     Copyright 2004-2021 Chris Tallon
3
4     This file is part of VOMP.
5
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.
10
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.
15
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/>.
18 */
19
20 #ifndef OSD_H
21 #define OSD_H
22
23 #include <memory>
24 #include <mutex>
25 #include <vector>
26
27 // See image.h for docs
28
29 class OsdImageBase;
30 using OsdImage = std::shared_ptr<OsdImageBase>;
31 class OsdImageBase {};
32
33 class Surface;
34
35 class Osd
36 {
37   public:
38     Osd();
39     virtual ~Osd();
40     static Osd* getInstance();
41
42     virtual int init()=0;
43     virtual int shutdown()=0;
44     virtual int restore() { return 1; };
45     virtual int stopUpdate() { return 1; };
46
47     virtual Surface* createNewSurface()=0; // For Boxx
48     virtual int charSet() { return 1; };
49
50     bool isInitted() { return initted; };
51
52     virtual bool screenShot(const char* fileName)=0;
53
54     virtual int getFontNames(const char*** /* names */,const char*** /* names_keys */) { return 0; };
55     virtual void setFont(const char* /* fontname */) {};
56
57     virtual float getPixelAspect() { return 1.f; };
58
59     // OSDOVG-ROD-EXPERIMENT
60     virtual void doRender() { };
61
62     // Images
63     OsdImage createOsdImage();
64     virtual void garbageCollectOsdImages()=0;
65
66     void dumpImages();
67
68   protected:
69     static Osd* instance;
70     bool initted{};
71     Surface* screen{};
72     int fdOsd{};
73
74     // Images
75     void addOsdImage(OsdImage& oImage);
76     std::vector<OsdImage> images;
77     std::mutex imagesLock;
78 };
79
80 #endif