vdr-plugin-softhddevice-drm-gles 1.4.0
softhddevice-drm-gles.cpp
Go to the documentation of this file.
1
25#define __STDC_CONSTANT_MACROS
26
27#include <string>
28using std::string;
29#include <fstream>
30using std::ifstream;
31
32#include <vdr/player.h>
33#include <vdr/plugin.h>
34
35#include "logger.h"
36
38#include "softhddevice.h"
39#include "softhdmenu.h"
40#include "mediaplayer.h"
41
42#ifdef USE_GLES
43#include "openglosd.h"
44#endif
45
46extern "C"
47{
48#include <libavcodec/avcodec.h>
49}
50
51#include "videostream.h"
52#include "videorender.h"
53#include "audio.h"
54#include "codec_audio.h"
55#include "softhdosd.h"
56#include "softhdsetupmenu.h"
57
58/*****************************************************************************
59 * Static variables
60 ****************************************************************************/
61static const char *const VERSION = "1.4.0";
64
65static const char *const DESCRIPTION = trNOOP("A software and GPU emulated HD device");
67
68static const char *const MAINMENUENTRY = trNOOP("Softhddevice");
70
72
73/*****************************************************************************
74 * cPluginSoftHdDevice
75 ****************************************************************************/
76
90{
92 m_pDevice = new cSoftHdDevice(m_pConfig); // no need to delete m_pDevice, because VDR does it for us
93}
94
101{
102 delete m_pConfig;
103}
104
111{
112 return VERSION;
113}
114
121{
122 return tr(DESCRIPTION);
123}
124
131{
132 return m_pDevice->CommandLineHelp();
133}
134
138bool cPluginSoftHdDevice::ProcessArgs(int argc, char *argv[])
139{
140// LOGDEBUG("plugin: %s:", __FUNCTION__);
141
142 return m_pDevice->ProcessArgs(argc, argv);
143}
144
153{
154// LOGDEBUG("plugin: %s:", __FUNCTION__);
155
156 return true;
157}
158
163{
164// LOGDEBUG("plugin: %s:", __FUNCTION__);
165
166 return m_pDevice->Start();
167}
168
175{
176 //LOGDEBUG("plugin: %s:", __FUNCTION__);
177
178 m_pDevice->Stop();
179}
180
185{
186 //LOGDEBUG("plugin: %s:", __FUNCTION__);
187
189}
190
195{
196 //LOGDEBUG("plugin: %s:", __FUNCTION__);
197
198 return new cSoftHdMenu("SoftHdDevice", m_pDevice);
199}
200
205{
206 //LOGDEBUG("plugin: %s:", __FUNCTION__);
207
208 return new cMenuSetupSoft(m_pDevice);
209}
210
211/*****************************************************************************
212 * cPluginSoftHdDevice - Setup parameters
213 ****************************************************************************/
214
223bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value)
224{
225 return m_pConfig->SetupParse(name, value);
226}
227
235bool cPluginSoftHdDevice::Service(const char *id, void *data)
236{
237 //LOGDEBUG("plugin: %s: id %s", __FUNCTION__, id);
238 (void)id;
239 (void)data;
240
241 return false;
242}
243
244/*****************************************************************************
245 * cPluginSoftHdDevice - SVDRP
246 ****************************************************************************/
247
251static const char *SVDRPHelpText[] = {
252 "PLAY Url\n" " Play the media from the given url.\n",
253 "DETA\n" " Detach the plugin.\n",
254 "ATTA\n" " Attach the plugin.\n",
255 "STAT\n" " Get attached/detached status.\n"
256 " ATTACHED -> 910\n"
257 " DETACHED -> 911\n",
258 "PION\n" " Enable picture-in-picture.\n",
259 "PIOF\n" " Disable picture-in-picture.\n",
260 "PITO\n" " Toggle picture-in-picture.\n",
261 "PIPU\n" " Pip channel up.\n",
262 "PIPD\n" " Pip channel down.\n",
263 "PIPC\n" " Pip swap channels.\n",
264 "PIIP\n" " Pip swap positions.\n",
265 NULL
266};
267
275{
276 return SVDRPHelpText;
277}
278
286cString cPluginSoftHdDevice::SVDRPCommand(const char *command, const char *option, int &reply_code)
287{
288 // mediaplayer
289 if (!strcasecmp(command, "PLAY")) {
290 LOGDEBUG2(L_MEDIA, "plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
291 cControl::Launch(new cSoftHdControl(option, m_pDevice));
292 return "PLAY url";
293 }
294
295 // attach/detach
296 if (!strcasecmp(command, "DETA")) {
297 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
298 if (m_pDevice->IsDetached())
299 return "SoftHdDevice is already detached";
300
301 m_pDevice->Detach();
302 return "Detached SoftHdDevice";
303 }
304 if (!strcasecmp(command, "ATTA")) {
305 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
306 if (!m_pDevice->IsDetached())
307 return "SoftHdDevice is not detached";
308
309 m_pDevice->Attach();
310 return "Attached SoftHdDevice";
311 }
312 if (!strcasecmp(command, "STAT")) {
313 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
314 if (!m_pDevice->IsDetached()) {
315 reply_code = 910;
316 return "SoftHdDevice is attached";
317 } else {
318 reply_code = 911;
319 return "SoftHdDevice is detached";
320 }
321 }
322
323 // pip
324 if (!strcasecmp(command, "PION")) {
325 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
326 if (m_pDevice->PipIsEnabled())
327 return "Pip is already enabled";
328
330 return "Pip was enabled";
331 }
332 if (!strcasecmp(command, "PIOF")) {
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 was disabled";
339 }
340 if (!strcasecmp(command, "PITO")) {
341 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
342 if (!m_pDevice->PipIsEnabled()) {
344 return "Pip was enabled";
345 } else {
347 return "Pip was disabled";
348 }
349 }
350 if (!strcasecmp(command, "PIPU")) {
351 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
352 if (!m_pDevice->PipIsEnabled())
353 return "Pip isn't enabled";
354
356 return "Pip channel up";
357 }
358 if (!strcasecmp(command, "PIPD")) {
359 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
360 if (!m_pDevice->PipIsEnabled())
361 return "Pip isn't enabled";
362
364 return "Pip channel down";
365 }
366 if (!strcasecmp(command, "PIPC")) {
367 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
368 if (!m_pDevice->PipIsEnabled())
369 return "Pip isn't enabled";
370
372 return "Pip swap channels";
373 }
374 if (!strcasecmp(command, "PIPP")) {
375 LOGDEBUG("plugin: %s: SVDRPCommand: %s %s", __FUNCTION__, command, option);
376 if (!m_pDevice->PipIsEnabled())
377 return "Pip isn't enabled";
378
380 return "Pip swap position";
381 }
382
383 return NULL;
384}
385
Audio and alsa module header file.
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 bool Service(const char *, void *=NULL)
Receive requests or messages.
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.
bool SetupParse(const char *, const char *)
Parse setup parameters.
Definition: config.cpp:50
bool ConfigHideMainMenuEntry
config hide main menu entry
Definition: config.h:58
void Stop(void)
Called by VDR when the plugin is stopped.
void PipSwapPosition(void)
Swap pip between normal and alternative position.
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 picture-in-picture is running.
void PipDisable(void)
Stop picture-in-picture.
void PipEnable(void)
Start picture-in-picture.
void PipChannelSwap(void)
Swap the pip channel with main live channel.
int ProcessArgs(int, char *[])
Process the command line arguments.
void PipChannelChange(int)
Change the pip channel.
void Attach(void)
Attach the device again.
static cSoftHdMenu * pSoftHdMenu
Definition: softhdmenu.h:40
Audio decoder header file.
Logger class header file.
#define LOGDEBUG2
Definition: logger.h:50
#define LOGDEBUG
Definition: logger.h:49
#define L_MEDIA
Definition: logger.h:66
Mediaplayer class header file.
Osd class - hardware accelerated (OpenGL/ES) - 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.
Device class header file.
Softhddevice menu class header file.
Softhddevice osd header file.
Setup menu class header file.
Rendering class header file.
Videostream class header file.