vdr-plugin-softhddevice-drm-gles 1.5.9-20e15de
softhddevice-drm-gles.cpp
Go to the documentation of this file.
1
25#include <vdr/player.h>
26#include <vdr/plugin.h>
27
28#include "logger.h"
29
31
32#include "config.h"
33#include "mediaplayer.h"
34#include "softhddevice.h"
35#include "softhdmenu.h"
36#include "softhdsetupmenu.h"
37
38/*****************************************************************************
39 * Static variables
40 ****************************************************************************/
41static const char *const VERSION = "1.5.9" GIT_DESCRIBE;
44
45static const char *const DESCRIPTION = trNOOP("A software and GPU emulated HD device");
47
48static const char *const MAINMENUENTRY = trNOOP("Softhddevice");
50
52
53/*****************************************************************************
54 * cPluginSoftHdDevice
55 ****************************************************************************/
56
70{
72 m_pDevice = new cSoftHdDevice(m_pConfig); // no need to delete m_pDevice, because VDR does it for us
73}
74
84
91{
92 return VERSION;
93}
94
101{
102 return tr(DESCRIPTION);
103}
104
111{
112 return m_pDevice->CommandLineHelp();
113}
114
118bool cPluginSoftHdDevice::ProcessArgs(int argc, char *argv[])
119{
120// LOGDEBUG("plugin: %s:", __FUNCTION__);
121
122 return m_pDevice->ProcessArgs(argc, argv);
123}
124
133{
134// LOGDEBUG("plugin: %s:", __FUNCTION__);
135
136 return true;
137}
138
143{
144// LOGDEBUG("plugin: %s:", __FUNCTION__);
145
146 return m_pDevice->Start();
147}
148
155{
156 //LOGDEBUG("plugin: %s:", __FUNCTION__);
157
158 m_pDevice->Stop();
159}
160
165{
166 //LOGDEBUG("plugin: %s:", __FUNCTION__);
167
169}
170
175{
176 //LOGDEBUG("plugin: %s:", __FUNCTION__);
177
178 return new cSoftHdMenu("SoftHdDevice", m_pDevice);
179}
180
185{
186 //LOGDEBUG("plugin: %s:", __FUNCTION__);
187
188 return new cMenuSetupSoft(m_pDevice);
189}
190
191/*****************************************************************************
192 * cPluginSoftHdDevice - Setup parameters
193 ****************************************************************************/
194
203bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value)
204{
205 return m_pConfig->SetupParse(name, value);
206}
207
215bool cPluginSoftHdDevice::Service(const char *id, void *data)
216{
217 //LOGDEBUG("plugin: %s: id %s", __FUNCTION__, id);
218 (void)id;
219 (void)data;
220
221 return false;
222}
223
224/*****************************************************************************
225 * cPluginSoftHdDevice - SVDRP
226 ****************************************************************************/
227
231static const char *SVDRPHelpText[] = {
232 "PLAY Url\n" " Play the media from the given url.\n",
233 "DETA\n" " Detach the plugin.\n",
234 "ATTA\n" " Attach the plugin.\n",
235 "STAT\n" " Get attached/detached status.\n"
236 " ATTACHED -> 910\n"
237 " DETACHED -> 911\n",
238 "PION\n" " Enable picture-in-picture.\n",
239 "PIOF\n" " Disable picture-in-picture.\n",
240 "PITO\n" " Toggle picture-in-picture.\n",
241 "PIPU\n" " Pip channel up.\n",
242 "PIPD\n" " Pip channel down.\n",
243 "PIPC\n" " Pip swap channels.\n",
244 "PIPS\n" " Pip switch main stream to pip channel and close pip.\n",
245 "PIIP\n" " Pip swap positions.\n",
246 NULL
247};
248
256{
257 return SVDRPHelpText;
258}
259
267cString cPluginSoftHdDevice::SVDRPCommand(const char *command, const char *option, int &reply_code)
268{
269 // mediaplayer
270 if (!strcasecmp(command, "PLAY")) {
271 LOGDEBUG2(L_MEDIA, "plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
272 cControl::Launch(new cSoftHdControl(option, m_pDevice));
273 return "PLAY url";
274 }
275
276 // attach/detach
277 if (!strcasecmp(command, "DETA")) {
278 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
279 if (m_pDevice->IsDetached())
280 return "SoftHdDevice is already detached";
281
282 m_pDevice->Detach();
283 return "Detached SoftHdDevice";
284 }
285 if (!strcasecmp(command, "ATTA")) {
286 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
287 if (!m_pDevice->IsDetached())
288 return "SoftHdDevice is not detached";
289
290 m_pDevice->Attach();
291 return "Attached SoftHdDevice";
292 }
293 if (!strcasecmp(command, "STAT")) {
294 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
295 if (!m_pDevice->IsDetached()) {
296 reply_code = 910;
297 return "SoftHdDevice is attached";
298 } else {
299 reply_code = 911;
300 return "SoftHdDevice is detached";
301 }
302 }
303
304 // pip
305 if (m_pDevice->UsePip()) {
306 if (!strcasecmp(command, "PION")) {
307 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
308 if (m_pDevice->PipIsEnabled())
309 return "Pip is already enabled";
310
312 return "Pip was enabled";
313 }
314 if (!strcasecmp(command, "PIOF")) {
315 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
316 if (!m_pDevice->PipIsEnabled())
317 return "Pip isn't enabled";
318
320 return "Pip was disabled";
321 }
322 if (!strcasecmp(command, "PITO")) {
323 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
324 if (!m_pDevice->PipIsEnabled()) {
326 return "Pip was enabled";
327 } else {
329 return "Pip was disabled";
330 }
331 }
332 if (!strcasecmp(command, "PIPU")) {
333 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
334 if (!m_pDevice->PipIsEnabled())
335 return "Pip isn't enabled";
336
338 return "Pip channel up";
339 }
340 if (!strcasecmp(command, "PIPD")) {
341 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
342 if (!m_pDevice->PipIsEnabled())
343 return "Pip isn't enabled";
344
346 return "Pip channel down";
347 }
348 if (!strcasecmp(command, "PIPC")) {
349 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
350 if (!m_pDevice->PipIsEnabled())
351 return "Pip isn't enabled";
352
354 return "Pip swap channels";
355 }
356 if (!strcasecmp(command, "PIPS")) {
357 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
358 if (!m_pDevice->PipIsEnabled())
359 return "Pip isn't enabled";
360
362 return "Pip switch main stream to pip channel and close pip";
363 }
364 if (!strcasecmp(command, "PIPP")) {
365 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
366 if (!m_pDevice->PipIsEnabled())
367 return "Pip isn't enabled";
368
370 return "Pip swap position";
371 }
372 }
373
374 return NULL;
375}
376
cMenuSetupSoft - SoftHdDevice plugin menu setup page class
cPluginSoftHdDevice - SoftHdDevice plugin class
virtual void Stop(void)
Shutdown plugin.
virtual const char * CommandLineHelp(void)
Return a string that describes all known command line options.
virtual cMenuSetupPage * SetupMenu(void)
Return our setup menu.
virtual bool SetupParse(const char *, const char *)
Parse setup parameters.
virtual cOsdObject * MainMenuAction(void)
Perform the action when selected from the main VDR menu.
virtual const char * Description(void)
Return plugin short description.
cPluginSoftHdDevice(void)
cPluginSoftHdDevice constructor
virtual bool Start(void)
Start any background activities the plugin shall perform.
virtual const char ** SVDRPHelpPages(void)
Return SVDRP commands help pages.
cSoftHdConfig * m_pConfig
pointer to cSoftHdConfig object
virtual ~cPluginSoftHdDevice(void)
cPluginSoftHdDevice destructor
virtual bool Initialize(void)
Initializes the DVB devices.
cSoftHdDevice * m_pDevice
pointer to cSoftHdDevice object
virtual bool ProcessArgs(int, char *[])
Process the command line arguments.
virtual const char * Version(void)
Return plugin version number.
virtual const char * MainMenuEntry(void)
Create main menu entry.
virtual cString SVDRPCommand(const char *, const char *, int &)
Handle SVDRP commands.
virtual bool Service(const char *, void *=nullptr)
Receive requests or messages.
bool SetupParse(const char *, const char *)
Parse setup parameters.
Definition config.cpp:45
bool ConfigHideMainMenuEntry
config hide main menu entry
Definition config.h:57
void Stop(void)
Called by VDR when the plugin is stopped.
void PipChannelSwap(bool)
void PipSwapPosition(void)
int Start(void)
Called by VDR when the plugin is started.
bool UsePip(void)
void Detach(void)
Detach the device.
const char * CommandLineHelp(void)
Return command line help string.
bool IsDetached(void) const
Returns true, if the device is detached.
bool PipIsEnabled(void)
Returns true, if pip is currently enabled.
void PipDisable(void)
void PipEnable(void)
int ProcessArgs(int, char *[])
Process the command line arguments.
void PipChannelChange(int)
void Attach(void)
Attach the device again.
static cSoftHdMenu * pSoftHdMenu
Definition softhdmenu.h:45
SoftHdDevice config header file.
Logger class header file.
#define LOGDEBUG2
Definition logger.h:45
#define LOGDEBUG
Definition logger.h:44
#define L_MEDIA
Definition logger.h:61
Mediaplayer class header file.
static const char *const DESCRIPTION
vdr-plugin description.
static const char * SVDRPHelpText[]
SVDRP commands help text.
static const char *const MAINMENUENTRY
what is displayed in the main menu entry
static const char *const VERSION
vdr-plugin version number Makefile extracts the version number for generating the file name for the d...
VDRPLUGINCREATOR(cPluginSoftHdDevice)
Main plugin class header file.
#define GIT_DESCRIBE
Device class header file.
Softhddevice menu class header file.
Setup menu class header file.