From 2bf30066fa1fef65f0abe1330c398fca54b2e717 Mon Sep 17 00:00:00 2001 From: Thomas Reufer Date: Sat, 21 Mar 2015 23:19:07 +0100 Subject: added command line argument to disable OSD --- HISTORY | 1 + rpihddevice.c | 20 +++++++++++++++++--- setup.c | 27 +++++++++++++++++++++++++++ setup.h | 22 +++++++++++++++++++--- 4 files changed, 64 insertions(+), 6 deletions(-) diff --git a/HISTORY b/HISTORY index b7683dd..36d6d6d 100644 --- a/HISTORY +++ b/HISTORY @@ -2,6 +2,7 @@ VDR Plugin 'rpihddevice' Revision History ----------------------------------------- - new: + - added command line argument to disable OSD - combined digital audio format options to one single setup option - added font kerning - support for GPU accelerated pixmaps diff --git a/rpihddevice.c b/rpihddevice.c index 19a1f64..32b0b90 100644 --- a/rpihddevice.c +++ b/rpihddevice.c @@ -22,15 +22,19 @@ private: cOmxDevice *m_device; - static void OnPrimaryDevice(void) { new cRpiOsdProvider(); } + static void OnPrimaryDevice(void) + { + if (cRpiSetup::HasOsd()) + new cRpiOsdProvider(); + } public: cPluginRpiHdDevice(void); virtual ~cPluginRpiHdDevice(); virtual const char *Version(void) { return VERSION; } virtual const char *Description(void) { return tr(DESCRIPTION); } - virtual const char *CommandLineHelp(void) { return NULL; } - virtual bool ProcessArgs(int argc, char *argv[]) { return true; } + virtual const char *CommandLineHelp(void); + virtual bool ProcessArgs(int argc, char *argv[]); virtual bool Initialize(void); virtual bool Start(void); virtual void Stop(void); @@ -88,4 +92,14 @@ bool cPluginRpiHdDevice::SetupParse(const char *Name, const char *Value) return cRpiSetup::GetInstance()->Parse(Name, Value); } +bool cPluginRpiHdDevice::ProcessArgs(int argc, char *argv[]) +{ + return cRpiSetup::GetInstance()->ProcessArgs(argc, argv); +} + +const char *cPluginRpiHdDevice::CommandLineHelp(void) +{ + return cRpiSetup::GetInstance()->CommandLineHelp(); +} + VDRPLUGINCREATOR(cPluginRpiHdDevice); // Don't touch this! okay. diff --git a/setup.c b/setup.c index 0ea9fef..2301cbf 100644 --- a/setup.c +++ b/setup.c @@ -11,6 +11,8 @@ #include #include +#include + #include #include "interface/vchiq_arm/vchiq_if.h" #include "interface/vmcs_host/vc_tvservice.h" @@ -325,3 +327,28 @@ void cRpiSetup::Set(AudioParameters audio, VideoParameters video, cRpiOsdProvider::ResetOsd(false); } } + +bool cRpiSetup::ProcessArgs(int argc, char *argv[]) +{ + static struct option long_options[] = { + { "disable-osd", no_argument, NULL, 'd' }, + }; + int c; + while ((c = getopt_long(argc, argv, "d", long_options, NULL)) != -1) + { + switch (c) + { + case 'd': + m_plugin.hasOsd = false; + break; + default: + return false; + } + } + return true; +} + +const char *cRpiSetup::CommandLineHelp(void) +{ + return " -d, --disable-osd disable OSD\n"; +} diff --git a/setup.h b/setup.h index 0a12f87..72f8195 100644 --- a/setup.h +++ b/setup.h @@ -58,6 +58,14 @@ public: } }; + struct PluginParameters + { + PluginParameters() : + hasOsd(true) { } + + bool hasOsd; + }; + static bool HwInit(void); static cRpiAudioPort::ePort GetAudioPort(void) { @@ -109,6 +117,10 @@ public: return GetInstance()->m_osd.accelerated != 0; } + static bool HasOsd(void) { + return GetInstance()->m_plugin.hasOsd; + } + static void SetHDMIChannelMapping(bool passthrough, int channels); static cRpiSetup* GetInstance(void); @@ -122,6 +134,9 @@ public: static void SetAudioSetupChangedCallback(void (*callback)(void*), void* data = 0); static void SetVideoSetupChangedCallback(void (*callback)(void*), void* data = 0); + bool ProcessArgs(int argc, char *argv[]); + const char *CommandLineHelp(void); + private: cRpiSetup() : @@ -136,9 +151,10 @@ private: static cRpiSetup* s_instance; - AudioParameters m_audio; - VideoParameters m_video; - OsdParameters m_osd; + AudioParameters m_audio; + VideoParameters m_video; + OsdParameters m_osd; + PluginParameters m_plugin; bool m_mpeg2Enabled; -- cgit v1.2.3