From d2342ae2ef163ca35727dcc1f72df4b253a06154 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 27 Aug 2011 11:40:21 +0200 Subject: The dvbsddevice plugin now supports the new option --outputonly --- PLUGINS/src/dvbsddevice/HISTORY | 4 ++++ PLUGINS/src/dvbsddevice/dvbsddevice.c | 30 ++++++++++++++++++++++++++++-- PLUGINS/src/dvbsddevice/dvbsdffdevice.c | 20 +++++++++++++++++--- PLUGINS/src/dvbsddevice/dvbsdffdevice.h | 11 +++++++++-- 4 files changed, 58 insertions(+), 7 deletions(-) (limited to 'PLUGINS/src') diff --git a/PLUGINS/src/dvbsddevice/HISTORY b/PLUGINS/src/dvbsddevice/HISTORY index 9672f6fc..229e35b0 100644 --- a/PLUGINS/src/dvbsddevice/HISTORY +++ b/PLUGINS/src/dvbsddevice/HISTORY @@ -19,3 +19,7 @@ VDR Plugin 'dvbsddevice' Revision History 2011-04-17: Version 0.0.4 - Removed an obsolete local variable in dvbsdffosd.c (thanks to Paul Menzel). + +2011-08-27: Version 0.0.5 + +- Added option --outputonly to use the device only for output (thanks to Udo Richter). diff --git a/PLUGINS/src/dvbsddevice/dvbsddevice.c b/PLUGINS/src/dvbsddevice/dvbsddevice.c index 6f042d8b..2aa8c77d 100644 --- a/PLUGINS/src/dvbsddevice/dvbsddevice.c +++ b/PLUGINS/src/dvbsddevice/dvbsddevice.c @@ -3,13 +3,14 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: dvbsddevice.c 1.4 2011/04/17 12:55:43 kls Exp $ + * $Id: dvbsddevice.c 1.5 2011/08/27 11:34:58 kls Exp $ */ +#include #include #include "dvbsdffdevice.h" -static const char *VERSION = "0.0.4"; +static const char *VERSION = "0.0.5"; static const char *DESCRIPTION = "SD Full Featured DVB device"; class cPluginDvbsddevice : public cPlugin { @@ -20,6 +21,8 @@ public: virtual ~cPluginDvbsddevice(); virtual const char *Version(void) { return VERSION; } virtual const char *Description(void) { return DESCRIPTION; } + virtual const char *CommandLineHelp(void); + virtual bool ProcessArgs(int argc, char *argv[]); }; cPluginDvbsddevice::cPluginDvbsddevice(void) @@ -32,4 +35,27 @@ cPluginDvbsddevice::~cPluginDvbsddevice() delete probe; } +const char *cPluginDvbsddevice::CommandLineHelp(void) +{ + return " -o --outputonly do not receive, just use as output device\n"; +} + +bool cPluginDvbsddevice::ProcessArgs(int argc, char *argv[]) +{ + static struct option long_options[] = { + { "outputonly", no_argument, NULL, 'o' }, + { NULL, no_argument, NULL, 0 } + }; + + int c; + while ((c = getopt_long(argc, argv, "", long_options, NULL)) != -1) { + switch (c) { + case 'o': probe->SetOutputOnly(true); + break; + default: return false; + } + } + return true; +} + VDRPLUGINCREATOR(cPluginDvbsddevice); // Don't touch this! diff --git a/PLUGINS/src/dvbsddevice/dvbsdffdevice.c b/PLUGINS/src/dvbsddevice/dvbsdffdevice.c index 73e55bac..17f842b6 100644 --- a/PLUGINS/src/dvbsddevice/dvbsdffdevice.c +++ b/PLUGINS/src/dvbsddevice/dvbsdffdevice.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: dvbsdffdevice.c 2.29 2011/05/22 15:22:14 kls Exp $ + * $Id: dvbsdffdevice.c 2.30 2011/08/27 11:33:57 kls Exp $ */ #include "dvbsdffdevice.h" @@ -23,12 +23,13 @@ int cDvbSdFfDevice::devVideoOffset = -1; -cDvbSdFfDevice::cDvbSdFfDevice(int Adapter, int Frontend) +cDvbSdFfDevice::cDvbSdFfDevice(int Adapter, int Frontend, bool OutputOnly) :cDvbDevice(Adapter, Frontend) { spuDecoder = NULL; digitalAudio = false; playMode = pmNone; + outputOnly = OutputOnly; // Devices that are only present on cards with decoders: @@ -357,6 +358,14 @@ bool cDvbSdFfDevice::SetPid(cPidHandle *Handle, int Type, bool On) return true; } +bool cDvbSdFfDevice::ProvidesSource(int Source) const +{ + if (outputOnly) + return false; + else + return cDvbDevice::ProvidesSource(Source); +} + void cDvbSdFfDevice::TurnOffLiveMode(bool LiveView) { if (LiveView) { @@ -761,6 +770,11 @@ int cDvbSdFfDevice::PlayTsAudio(const uchar *Data, int Length) // --- cDvbSdFfDeviceProbe --------------------------------------------------- +cDvbSdFfDeviceProbe::cDvbSdFfDeviceProbe(void) +{ + outputOnly = false; +} + bool cDvbSdFfDeviceProbe::Probe(int Adapter, int Frontend) { static uint32_t SubsystemIds[] = { @@ -781,7 +795,7 @@ bool cDvbSdFfDeviceProbe::Probe(int Adapter, int Frontend) for (uint32_t *sid = SubsystemIds; *sid; sid++) { if (*sid == SubsystemId) { dsyslog("creating cDvbSdFfDevice"); - new cDvbSdFfDevice(Adapter, Frontend); + new cDvbSdFfDevice(Adapter, Frontend, outputOnly); return true; } } diff --git a/PLUGINS/src/dvbsddevice/dvbsdffdevice.h b/PLUGINS/src/dvbsddevice/dvbsdffdevice.h index afe4727e..bd74cde6 100644 --- a/PLUGINS/src/dvbsddevice/dvbsdffdevice.h +++ b/PLUGINS/src/dvbsddevice/dvbsdffdevice.h @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: dvbsdffdevice.h 2.12 2011/05/21 12:56:49 kls Exp $ + * $Id: dvbsdffdevice.h 2.13 2011/08/27 11:32:42 kls Exp $ */ #ifndef __DVBSDFFDEVICE_H @@ -17,10 +17,11 @@ class cDvbSdFfDevice : public cDvbDevice { private: int fd_osd, fd_audio, fd_video, fd_stc; + bool outputOnly; protected: virtual void MakePrimaryDevice(bool On); public: - cDvbSdFfDevice(int Adapter, int Frontend); + cDvbSdFfDevice(int Adapter, int Frontend, bool OutputOnly); virtual ~cDvbSdFfDevice(); virtual bool HasDecoder(void) const; virtual bool AvoidRecording(void) const; @@ -34,6 +35,8 @@ public: // Channel facilities +public: + virtual bool ProvidesSource(int Source) const; private: void TurnOffLiveMode(bool LiveView); protected: @@ -101,7 +104,11 @@ public: }; class cDvbSdFfDeviceProbe : public cDvbDeviceProbe { +private: + bool outputOnly; public: + cDvbSdFfDeviceProbe(void); + void SetOutputOnly(bool On) { outputOnly = On; } virtual bool Probe(int Adapter, int Frontend); }; -- cgit v1.2.3