-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxstreamplugin.h
More file actions
77 lines (53 loc) · 1.45 KB
/
xstreamplugin.h
File metadata and controls
77 lines (53 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//
// Created by Ian Parker on 19/11/2024.
//
#ifndef UFCPLUGIN_H
#define UFCPLUGIN_H
#define XPLM200 1
#define XPLM210 1
#define XPLM400 1
#include <XPLMMenus.h>
#include <XPLMUtilities.h>
#include <gst/gst.h>
#include "logger.h"
#include <thread>
class VideoStream;
class DisplayManager;
class XPPluginDataSource;
class XPLogPrinter : public LogPrinter
{
public:
virtual ~XPLogPrinter() = default;
void printf(const char* message, ...) override
{
va_list va;
va_start(va, message);
char buf[4096];
vsnprintf(buf, 4094, message, va);
XPLMDebugString(buf);
va_end(va);
}
};
class XStreamPlugin : private Logger
{
private:
XPLogPrinter m_logPrinter;
int m_menuContainer = -1;
XPLMMenuID m_menuId = nullptr;
int m_streamMenuIndex = -1;
std::shared_ptr<VideoStream> m_videoStream;
std::shared_ptr<DisplayManager> m_displayManager;
static void menuCallback(void* menuRef, void* itemRef);
void menu(void* itemRef);
public:
XStreamPlugin() : Logger("XScreenPlugin") {}
int start(char* outName, char* outSig, char* outDesc);
void stop();
int enable();
void disable();
void startStream();
void receiveMessage(XPLMPluginID inFrom, int inMsg, void * inParam);
std::shared_ptr<VideoStream> getVideoStream() { return m_videoStream; }
std::shared_ptr<DisplayManager> getDisplayManager() { return m_displayManager; }
};
#endif //UFCPLUGIN_H