7
#include "xineCommon.h"
9
#include <vdr/remote.h>
11
#if APIVERSNUM < 10307
13
#include <vdr/osdbase.h>
18
#define MAXNUMWINDOWS MAXOSDAREAS
22
#include <vdr/plugin.h>
24
#include "xineExternal.h"
25
#include "xineSettings.h"
35
virtual ~cXineLibEvents() {}
37
virtual void OnClientConnect() = 0;
38
virtual void OnClientDisconnect() = 0;
39
virtual void ReshowCurrentOSD(const int frameLeft, const int frameTop, const int frameWidth, const int frameHeight, const int frameZoomX, const int frameZoomY) = 0;
40
virtual bool DeviceReplayingOrTransferring() = 0;
47
// This class performs the adaption from Xine events
48
// to VDR's remote control events.
56
cCondVar m_activeCondVar;
57
const bool m_remoteOn;
60
virtual void Action (void);
61
bool Ready(void) { return false; };
65
cXineRemote(const bool remoteOn);
66
virtual ~cXineRemote();
68
void setXineLib(cXineLib *const xineLib);
75
class cXineLib : public cThread
86
string m_fifoNameControl;
87
string m_fifoNameResult;
88
string m_fifoNameRemote;
89
string m_fifoNameStream;
90
string m_fifoNameExtControl;
91
string m_fifoNameExtResult;
96
cPlugin *const m_plugin;
97
cXineExternal m_external;
99
void internalPaused(const bool paused);
100
cMutex m_pausedMutex;
101
cCondVar m_pausedCondVar;
102
cMutex m_shutdownMutex;
103
cCondVar m_shutdownCondVar;
105
const cXineSettings &m_settings;
107
bool m_osdWindowVisible[ MAXNUMWINDOWS ];
109
#if APIVERSNUM >= 10307
110
int m_osdWindowVideoLeft[ MAXNUMWINDOWS ];
111
int m_osdWindowVideoTop[ MAXNUMWINDOWS ];
112
int m_osdWindowVideoWidth[ MAXNUMWINDOWS ];
113
int m_osdWindowVideoHeight[ MAXNUMWINDOWS ];
114
int m_osdWindowVideoZoomX[ MAXNUMWINDOWS ];
115
int m_osdWindowVideoZoomY[ MAXNUMWINDOWS ];
116
int m_osdWindowLeft[ MAXNUMWINDOWS ];
117
int m_osdWindowTop[ MAXNUMWINDOWS ];
118
int m_osdWindowWidth[ MAXNUMWINDOWS ];
119
int m_osdWindowHeight[ MAXNUMWINDOWS ];
121
int m_osdWindowColorsNum[ MAXNUMWINDOWS ];
122
tColor m_osdWindowColors[ MAXNUMWINDOWS ][ MAXNUMCOLORS ];
124
int m_scaledWindowColorsNum[ MAXNUMWINDOWS ];
125
tColor m_scaledWindowColors[ MAXNUMWINDOWS ][ MAXNUMCOLORS ];
127
cXineSettings::eOsdMode m_osdWindowMode[ MAXNUMWINDOWS ];
128
int m_osdWindowGamma[ MAXNUMWINDOWS ];
129
bool m_osdWindowSupportTransparency[ MAXNUMWINDOWS ];
131
int m_osdWindowBufferSize[ MAXNUMWINDOWS ];
132
tIndex *m_osdWindowBuffer[ MAXNUMWINDOWS ];
137
void cloneBitmap(const int windowNum, cBitmap *bitmap, int x1, int y1, int x2, int y2);
138
bool bitmapDiffers(const int windowNum, cXineOsd *xineOsd, cBitmap *bitmap, int &x1, int &y1, int &x2, int &y2);
139
bool clipBitmap(cXineOsd *xineOsd, cBitmap *bitmap, int &x1, int &y1, const int x2, const int y2);
141
bool m_osdFlushRequired;
144
int getRemoteFD() const
150
int CreateServerSocket(unsigned short port);
151
int SocketAcceptHelper(int fd);
153
int fd_fifo0_serv, fd_result_serv, fd_control_serv, fd_remote_serv;
154
int fd_fifo0, fd_result, fd_control, fd_remote;
156
cMutex m_ioMutex, m_dataMutex, m_disconnectMutex;
167
bool m_trickSpeedMode;
173
int xwrite(int f, const void *b, int n);
174
int xread(int f, void *b, int n);
177
char m_noSignalStreamData[ 6 + 0xffff ];
178
long m_noSignalStreamSize;
180
cXineLibEvents *m_eventSink;
182
eNeedsScaling NeedsScaling(const int maxOsdWidth, const int maxOsdHeight, const int videoWidth, const int videoHeight);
184
bool pushOut(const uchar id = 0xff);
187
bool hasNoSignalStream() const
189
return m_noSignalStreamSize > 0;
192
virtual void Action(void);
194
bool checkXineVersion();
197
void enableExternal(const bool enable = true);
198
void ExternalStreamFinished();
201
cXineLib(cPlugin *const plugin, const cXineSettings &settings, cMutex &osdMutex, cXineRemote *const remote);
204
void SetEventSink(cXineLibEvents *const eventSink);
209
bool Poll(cPoller &Poller, int TimeoutMs = 0, const bool special = false);
211
#if APIVERSNUM < 10307
213
bool OpenWindow(cXineOsd *const xineOsd, cWindow *Window);
214
void CommitWindow(cXineOsd *const xineOsd, cWindow *Window, const bool optimize = true);
215
void ShowWindow(cXineOsd *const xineOsd, cWindow *Window);
216
void HideWindow(cXineOsd *const xineOsd, cWindow *Window, bool Hide);
217
void MoveWindow(cXineOsd *const xineOsd, cWindow *Window, int x, int y);
218
void CloseWindow(cXineOsd *const xineOsd, cWindow *Window);
219
void CloseWindow(cXineOsd *const xineOsd, int Window);
223
void sendWindow(const int maxOsdWidth, const int maxOsdHeight, cXineOsd *const xineOsd, const int windowNum, cBitmap *bitmap = 0, const int videoLeft = -1, const int videoTop = -1, const int videoWidth = -1, const int videoHeight = -1, const int videoZoomX = -1, const int videoZoomY = -1, const bool dontOptimize = false);
224
void SendWindow(const int maxOsdWidth, const int maxOsdHeight, cXineOsd *const xineOsd, const int windowNum, cBitmap *bitmap = 0, const int videoLeft = -1, const int videoTop = -1, const int videoWidth = -1, const int videoHeight = -1, const int videoZoomX = -1, const int videoZoomY = -1, const bool dontOptimize = false);
226
bool execFuncOsdNew(const int maxOsdWidth, const int maxOsdHeight, const eNeedsScaling needsScaling, const int videoLeft, const int videoTop, const int videoWidth, const int videoHeight, int window, int x, int y, int width, int height);
227
bool execFuncOsdDrawBitmap(const int maxOsdWidth, const int maxOsdHeight, const eNeedsScaling needsScaling, const int videoWidth, const int videoHeight, cXineOsd *const xineOsd, int window, cBitmap *const bitmap, int x, int y, int width, int height, int stride);
229
void SetVideoWindow(const int maxOsdWidth, const int maxOsdHeight, tArea vidWin, const bool dontOptimize = false);
233
int execFuncStream1(const uchar *Data, int Length);
234
int execFuncStream(const uchar *Data, int Length);
235
bool execFuncStream0(const uchar *Data, int Length);
236
bool execFuncStart();
239
bool execFuncSetup();
240
bool execFuncDiscontinuity();
242
bool execFuncOsdFlush();
243
bool execFuncOsdNew(int window, int x, int y, int width, int height);
244
bool execFuncOsdFree(int window);
245
bool execFuncOsdShow(int window);
246
bool execFuncOsdHide(int window);
247
bool execFuncOsdSetPosition(int window, int x, int y);
248
bool execFuncOsdDrawBitmap(int window, uint8_t *bitmap, int x, int y, int width, int height, int stride);
250
#if APIVERSNUM < 10307
251
bool execFuncSetColor(int window, int index, eDvbColor color);
252
bool execFuncSetColor(int window, int index, eDvbColor *const colors, int numColors);
253
eDvbColor filterAlpha(eDvbColor color);
255
bool execFuncSetColor(int window, int index, tColor color);
256
bool execFuncSetColor(int window, int index, tColor *const colors, int numColors);
257
tColor filterAlpha(tColor color);
260
bool execFuncSetColor(int window, int index, int numColors, uint32_t *const colors);
262
bool execFuncMute(bool mute = true);
263
bool execFuncClear(int n);
264
bool execFuncResetAudio();
265
bool execFuncSelectAudio(int channel);
266
bool execFuncFirstFrame();
267
bool execFuncStillFrame();
268
bool execFuncFlush(int TimeoutMs = -1, const bool justWait = false);
269
bool execFuncSetVolume(int volume);
270
bool execFuncSetSpeed(double speed);
271
bool execFuncTrickSpeedMode(bool on);
272
bool execFuncDelay(int usDelay);
273
bool execFuncMetronom(int64_t pts, uint32_t flags = 0);
275
bool execFuncSetPrebuffer(int frames);
276
bool execFuncGetPTS(int64_t &pts);
277
bool execFuncVideoSize(int &videoLeft, int &videoTop, int &videoWidth, int &videoHeight, int &videoZoomX, int &videoZoomY);
279
bool execFuncGetVersion(int32_t &version);
281
uchar *execFuncGrabImage(const char *FileName, int &Size, bool Jpeg, int Quality, int SizeX, int SizeY);
283
bool execFuncSetVideoWindow(int x, int y, int w, int h, int wRef, int hRef);
285
bool execFuncPlayExternal(const char *const fileName = 0);
289
void pause(bool doPause = true);
290
void freeze(bool doFreeze = true);
291
void ignore(bool doIgnore = true);
295
void ReshowCurrentOSD(const int frameLeft, const int frameTop, const int frameWidth, const int frameHeight, const int frameZoomX, const int frameZoomY);
297
void ReshowCurrentOSD()
299
ReshowCurrentOSD(-1, -1, -1, -1, -1, -1);