vdr-plugin-softhddevice-drm-gles 1.6.4-d0291bb
softhddevice-drm-gles.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: AGPL-3.0-or-later
2
17#include <vdr/player.h>
18#include <vdr/plugin.h>
19
20#include "logger.h"
21
23
24#include "config.h"
25#include "mediaplayer.h"
26#include "softhddevice.h"
27#include "softhdmenu.h"
28#include "softhdsetupmenu.h"
29
35/*****************************************************************************
36 * Static variables
37 ****************************************************************************/
38static const char *const VERSION = "1.6.4" GIT_DESCRIBE;
41
42static const char *const DESCRIPTION = trNOOP("A software and GPU emulated HD device");
44
45static const char *const MAINMENUENTRY = trNOOP("Softhddevice");
47
49
52/*****************************************************************************
53 * cPluginSoftHdDevice
54 ****************************************************************************/
55
69{
71 m_pDevice = new cSoftHdDevice(m_pConfig); // no need to delete m_pDevice, because VDR does it for us
72}
73
83
90{
91 return VERSION;
92}
93
100{
101 return tr(DESCRIPTION);
102}
103
110{
111 return m_pDevice->CommandLineHelp();
112}
113
118{
119// LOGDEBUG("plugin: %s:", __FUNCTION__);
120
121 return m_pDevice->ProcessArgs(argc, argv);
122}
123
130{
131// LOGDEBUG("plugin: %s:", __FUNCTION__);
132
133 return m_pDevice->Initialize();
134}
135
140{
141// LOGDEBUG("plugin: %s:", __FUNCTION__);
142
143 return m_pDevice->Start();
144}
145
152{
153 //LOGDEBUG("plugin: %s:", __FUNCTION__);
154
155 m_pDevice->Stop();
156}
157
162{
163 //LOGDEBUG("plugin: %s:", __FUNCTION__);
164
166}
167
172{
173 //LOGDEBUG("plugin: %s:", __FUNCTION__);
174
175 return new cSoftHdMenu("SoftHdDevice", m_pDevice);
176}
177
182{
183 //LOGDEBUG("plugin: %s:", __FUNCTION__);
184
185 return new cMenuSetupSoft(m_pDevice);
186}
187
188/*****************************************************************************
189 * cPluginSoftHdDevice - Setup parameters
190 ****************************************************************************/
191
201bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value)
202{
203 return m_pConfig->SetupParse(name, value);
204}
205
213bool cPluginSoftHdDevice::Service(const char *id, void *data)
214{
215 //LOGDEBUG("plugin: %s: id %s", __FUNCTION__, id);
216 (void)id;
217 (void)data;
218
219 return false;
220}
221
222/*****************************************************************************
223 * cPluginSoftHdDevice - SVDRP
224 ****************************************************************************/
225
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
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
Plugin Setup Menu.
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.
Plugin Configuration.
Definition config.h:29
bool SetupParse(const char *, const char *)
Parse setup parameters.
Definition config.cpp:33
bool ConfigHideMainMenuEntry
config hide main menu entry
Definition config.h:36
Media Player Control.
Output Device Implementation.
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.
bool Initialize(void)
Initialize the device.
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.
Plugin Main Menu.
Definition softhdmenu.h:43
Plugin Configuration Header File.
#define LOGDEBUG2
log to LOG_DEBUG and add a prefix
Definition logger.h:47
#define LOGDEBUG
log to LOG_DEBUG
Definition logger.h:45
@ L_MEDIA
mediaplayer logs
Definition logger.h:64
static cSoftHdMenu * pSoftHdMenu
Main Menu Instance.
Definition softhdmenu.h:47
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...
Logger Header File.
Mediaplayer Header File.
VDRPLUGINCREATOR(cPluginSoftHdDevice)
Main Plugin Interface Header File.
#define GIT_DESCRIBE
Output Device Header File.
Plugin Main Menu Header File.
Plugin Setup Menu Header File.