vdr-plugin-softhddevice-drm-gles 1.6.2
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
37/*****************************************************************************
38 * Static variables
39 ****************************************************************************/
40static const char *const VERSION = "1.6.2" GIT_DESCRIBE;
43
44static const char *const DESCRIPTION = trNOOP("A software and GPU emulated HD device");
46
47static const char *const MAINMENUENTRY = trNOOP("Softhddevice");
49
51
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
132{
133// LOGDEBUG("plugin: %s:", __FUNCTION__);
134
135 return true;
136}
137
142{
143// LOGDEBUG("plugin: %s:", __FUNCTION__);
144
145 return m_pDevice->Start();
146}
147
154{
155 //LOGDEBUG("plugin: %s:", __FUNCTION__);
156
157 m_pDevice->Stop();
158}
159
164{
165 //LOGDEBUG("plugin: %s:", __FUNCTION__);
166
168}
169
174{
175 //LOGDEBUG("plugin: %s:", __FUNCTION__);
176
177 return new cSoftHdMenu("SoftHdDevice", m_pDevice);
178}
179
184{
185 //LOGDEBUG("plugin: %s:", __FUNCTION__);
186
187 return new cMenuSetupSoft(m_pDevice);
188}
189
190/*****************************************************************************
191 * cPluginSoftHdDevice - Setup parameters
192 ****************************************************************************/
193
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
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.
cSoftHdConfig * m_pConfig
pointer to cSoftHdConfig object
cSoftHdDevice * m_pDevice
pointer to cSoftHdDevice object
Plugin Configuration.
Definition config.h:29
bool ConfigHideMainMenuEntry
config hide main menu entry
Definition config.h:58
Media Player Control.
Output Device Implementation.
bool UsePip(void)
Plugin Main Menu.
Definition softhdmenu.h:36
Plugin Configuration Header File.
#define GIT_DESCRIBE
Definition git-version.h:2
bool SetupParse(const char *, const char *)
Parse setup parameters.
Definition config.cpp:40
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.
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.
#define LOGDEBUG2
log to LOG_DEBUG and add a prefix
Definition logger.h:42
#define LOGDEBUG
log to LOG_DEBUG
Definition logger.h:40
@ L_MEDIA
mediaplayer logs
Definition logger.h:59
virtual void Stop(void)
Shutdown plugin.
static cSoftHdMenu * pSoftHdMenu
Definition softhdmenu.h:40
virtual const char * CommandLineHelp(void)
Return a string that describes all known command line options.
virtual cMenuSetupPage * SetupMenu(void)
Return our setup menu.
static const char *const DESCRIPTION
vdr-plugin description.
static const char * SVDRPHelpText[]
SVDRP commands help text.
virtual bool SetupParse(const char *, const char *)
Parse setup parameters.
virtual cOsdObject * MainMenuAction(void)
Perform the action when selected from the main VDR menu.
static const char *const MAINMENUENTRY
what is displayed in the main menu entry
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.
static const char *const VERSION
vdr-plugin version number Makefile extracts the version number for generating the file name for the d...
virtual ~cPluginSoftHdDevice(void)
cPluginSoftHdDevice destructor
virtual bool Initialize(void)
Initializes the DVB devices.
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.
Logger Header File.
Mediaplayer Header File.
VDRPLUGINCREATOR(cPluginSoftHdDevice)
Main Plugin Interface Header File.
Output Device Header File.
Plugin Main Menu Header File.
Plugin Setup Menu Header File.