The dvbsddevice plugin now supports the new option --outputonly

This commit is contained in:
Klaus Schmidinger
2011-08-27 11:40:21 +02:00
parent 6700e772e5
commit d2342ae2ef
6 changed files with 62 additions and 7 deletions

View File

@@ -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).

View File

@@ -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 <getopt.h>
#include <vdr/plugin.h>
#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!

View File

@@ -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;
}
}

View File

@@ -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);
};