diff -upr dvbhddevice/dvbhddevice.c dvbhddevice.dag/dvbhddevice.c
--- dvbhddevice/dvbhddevice.c 2013-05-09 00:16:16.000000000 +0200
+++ dvbhddevice.dag/dvbhddevice.c 2013-05-09 00:16:16.000000000 +0200
@@ -10,13 +10,11 @@
#include "menu.h"
#include "setup.h"
-static const char *VERSION = "2.0.1";
+static const char *VERSION = "2.0.1dag";
static const char *DESCRIPTION = trNOOP("HD Full Featured DVB device");
static const char *MAINMENUENTRY = "dvbhddevice";
class cPluginDvbhddevice : public cPlugin {
-private:
- cDvbHdFfDeviceProbe *probe;
bool mIsUserInactive;
public:
cPluginDvbhddevice(void);
@@ -29,23 +27,62 @@ public:
virtual cOsdObject *MainMenuAction(void);
virtual cMenuSetupPage *SetupMenu(void);
virtual bool SetupParse(const char *Name, const char *Value);
+ virtual bool Initialize();
};
-cPluginDvbhddevice::cPluginDvbhddevice(void)
-: mIsUserInactive(true)
-{
- probe = new cDvbHdFfDeviceProbe;
-}
+cPluginDvbhddevice::cPluginDvbhddevice(void){}
-cPluginDvbhddevice::~cPluginDvbhddevice()
+cPluginDvbhddevice::~cPluginDvbhddevice(){}
+
+bool cPluginDvbhddevice::Initialize()
{
- delete probe;
+ mIsUserInactive = true;
+ dsyslog("cPluginDvbhddevice::Initialize");
+ static uint32_t SubsystemIds[] = {
+ 0x13C23009, // Technotrend S2-6400 HDFF development samples
+ 0x13C2300A, // Technotrend S2-6400 HDFF production version
+ 0x00000000
+ };
+
+ for (int Adapter = 0; Adapter<MAXDVBDEVICES; Adapter++)
+ {
+ cString FileName;
+ cReadLine ReadLine;
+ FILE *f = NULL;
+ uint32_t SubsystemId = 0;
+ FileName = cString::sprintf("/sys/class/dvb/dvb%d.frontend0/device/subsystem_vendor", Adapter);
+ if ((f = fopen(FileName, "r")) != NULL) {
+ if (char *s = ReadLine.Read(f))
+ SubsystemId = strtoul(s, NULL, 0) << 16;
+ fclose(f);
+ }
+ FileName = cString::sprintf("/sys/class/dvb/dvb%d.frontend0/device/subsystem_device", Adapter);
+ if ((f = fopen(FileName, "r")) != NULL) {
+ if (char *s = ReadLine.Read(f))
+ SubsystemId |= strtoul(s, NULL, 0);
+ fclose(f);
+ }
+ for (uint32_t *sid = SubsystemIds; *sid; sid++) {
+ if (*sid == SubsystemId) {
+ FileName = cString::sprintf("/dev/dvb/adapter%d/osd0", Adapter);
+ int fd = open(FileName, O_RDWR);
+ if (fd != -1) { //TODO treat the second path of the S2-6400 as a budget device
+ close(fd);
+ dsyslog("creating cDvbHdFfDevice");
+ new cDvbHdFfDevice(Adapter, 0);
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
}
void cPluginDvbhddevice::MainThreadHook(void)
{
bool isUserInactive = ShutdownHandler.IsUserInactive();
- if (isUserInactive != mIsUserInactive)
+ if (isUserInactive != mIsUserInactive)
{
mIsUserInactive = isUserInactive;
if (gHdffSetup.CecEnabled && gHdffSetup.CecTvOn)
diff -upr dvbhddevice/dvbhdffdevice.c dvbhddevice.dag/dvbhdffdevice.c
--- dvbhddevice/dvbhdffdevice.c 2013-05-09 00:16:16.000000000 +0200
+++ dvbhddevice.dag/dvbhdffdevice.c 2013-05-09 00:16:16.000000000 +0200
@@ -30,12 +30,13 @@ static uchar *YuvToJpeg(uchar *Mem, int
int cDvbHdFfDevice::devHdffOffset = -1;
cDvbHdFfDevice::cDvbHdFfDevice(int Adapter, int Frontend)
-:cDvbDevice(Adapter, Frontend)
{
spuDecoder = NULL;
audioChannel = 0;
playMode = pmNone;
mHdffCmdIf = NULL;
+ adapter = Adapter;
+ frontend = Frontend;
// Devices that are only present on cards with decoders:
@@ -47,7 +48,7 @@ cDvbHdFfDevice::cDvbHdFfDevice(int Adapt
isHdffPrimary = false;
if (devHdffOffset < 0) {
- devHdffOffset = adapter;
+ devHdffOffset = DeviceNumber();
isHdffPrimary = true;
mHdffCmdIf = new HDFF::cHdffCmdIf(fd_osd);
@@ -87,6 +88,7 @@ cDvbHdFfDevice::cDvbHdFfDevice(int Adapt
mHdffCmdIf->CmdRemoteSetProtocol((HdffRemoteProtocol_t) gHdffSetup.RemoteProtocol);
mHdffCmdIf->CmdRemoteSetAddressFilter(gHdffSetup.RemoteAddress >= 0, gHdffSetup.RemoteAddress);
}
+ SetPlayMode(pmNone);
}
cDvbHdFfDevice::~cDvbHdFfDevice()
@@ -100,11 +102,29 @@ cDvbHdFfDevice::~cDvbHdFfDevice()
// caused segfaults. Besides, the program is about to terminate anyway...
}
+cString cDvbHdFfDevice::DvbName(const char *Name, int Adapter, int Frontend)
+{
+#if VDRVERSNUM < 10724
+ return cString::sprintf("%s%d/%s%d", DEV_DVB_ADAPTER, Adapter, Name, Frontend);
+#else
+ return cString::sprintf("%s/%s%d/%s%d", DEV_DVB_BASE, DEV_DVB_ADAPTER, Adapter, Name, Frontend);
+#endif
+}
+
+int cDvbHdFfDevice::DvbOpen(const char *Name, int Adapter, int Frontend, int Mode, bool ReportError)
+{
+ cString FileName = DvbName(Name, Adapter, Frontend);
+ int fd = open(FileName, Mode);
+ if (fd < 0 && ReportError)
+ LOG_ERROR_STR(*FileName);
+ return fd;
+}
+
void cDvbHdFfDevice::MakePrimaryDevice(bool On)
{
if (On)
new cHdffOsdProvider(mHdffCmdIf);
- cDvbDevice::MakePrimaryDevice(On);
+ cDevice::MakePrimaryDevice(On);
}
bool cDvbHdFfDevice::HasDecoder(void) const
@@ -354,7 +374,7 @@ bool cDvbHdFfDevice::SetPid(cPidHandle *
return true;
}
-void cDvbHdFfDevice::TurnOffLiveMode(bool LiveView)
+/* void cDvbHdFfDevice::TurnOffLiveMode(bool LiveView)
{
// Turn off live PIDs:
@@ -419,7 +439,7 @@ bool cDvbHdFfDevice::SetChannelDevice(co
cControl::Launch(new cTransferControl(this, Channel));
return true;
-}
+}*/
int cDvbHdFfDevice::GetAudioChannelDevice(void)
{
@@ -499,9 +519,6 @@ bool cDvbHdFfDevice::SetPlayMode(ePlayMo
mHdffCmdIf->CmdAvMuteAudio(0, false);
}
else {
- if (playMode == pmNone)
- TurnOffLiveMode(true);
-
if (PlayMode == pmExtern_THIS_SHOULD_BE_AVOIDED)
{
close(fd_video);
@@ -950,46 +967,6 @@ HDFF::cHdffCmdIf *cDvbHdFfDevice::GetHdf
return NULL;
}
-// --- cDvbHdFfDeviceProbe ---------------------------------------------------
-
-bool cDvbHdFfDeviceProbe::Probe(int Adapter, int Frontend)
-{
- static uint32_t SubsystemIds[] = {
- 0x13C23009, // Technotrend S2-6400 HDFF development samples
- 0x13C2300A, // Technotrend S2-6400 HDFF production version
- 0x00000000
- };
- cString FileName;
- cReadLine ReadLine;
- FILE *f = NULL;
- uint32_t SubsystemId = 0;
- FileName = cString::sprintf("/sys/class/dvb/dvb%d.frontend%d/device/subsystem_vendor", Adapter, Frontend);
- if ((f = fopen(FileName, "r")) != NULL) {
- if (char *s = ReadLine.Read(f))
- SubsystemId = strtoul(s, NULL, 0) << 16;
- fclose(f);
- }
- FileName = cString::sprintf("/sys/class/dvb/dvb%d.frontend%d/device/subsystem_device", Adapter, Frontend);
- if ((f = fopen(FileName, "r")) != NULL) {
- if (char *s = ReadLine.Read(f))
- SubsystemId |= strtoul(s, NULL, 0);
- fclose(f);
- }
- for (uint32_t *sid = SubsystemIds; *sid; sid++) {
- if (*sid == SubsystemId) {
- FileName = cString::sprintf("/dev/dvb/adapter%d/osd0", Adapter);
- int fd = open(FileName, O_RDWR);
- if (fd != -1) { //TODO treat the second path of the S2-6400 as a budget device
- close(fd);
- dsyslog("creating cDvbHdFfDevice");
- new cDvbHdFfDevice(Adapter, Frontend);
- return true;
- }
- }
- }
- return false;
-}
-
// --- YuvToJpeg -------------------------------------------------------------
diff -upr dvbhddevice/dvbhdffdevice.h dvbhddevice.dag/dvbhdffdevice.h
--- dvbhddevice/dvbhdffdevice.h 2013-05-09 00:16:16.000000000 +0200
+++ dvbhddevice.dag/dvbhdffdevice.h 2013-05-09 00:16:16.000000000 +0200
@@ -8,16 +8,18 @@
#define __DVBHDFFDEVICE_H
#include "hdffcmd.h"
-#include <vdr/dvbdevice.h>
+#include <vdr/device.h>
#include <vdr/dvbspu.h>
/// The cDvbHdFfDevice implements a DVB device which can be accessed through the Linux DVB driver API.
-class cDvbHdFfDevice : public cDvbDevice {
+class cDvbHdFfDevice : public cDevice {
private:
- int fd_osd, fd_audio, fd_video;
+ int adapter, frontend, fd_osd, fd_audio, fd_video;
protected:
virtual void MakePrimaryDevice(bool On);
+ static cString DvbName(const char *Name, int Adapter, int Frontend);
+ static int DvbOpen(const char *Name, int Adapter, int Frontend, int Mode, bool ReportError = false);
public:
static bool Probe(int Adapter, int Frontend);
cDvbHdFfDevice(int Adapter, int Frontend);
@@ -31,13 +33,6 @@ private:
public:
virtual cSpuDecoder *GetSpuDecoder(void);
-// Channel facilities
-
-private:
- void TurnOffLiveMode(bool LiveView);
-protected:
- virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
-
// PID handle facilities
protected:
@@ -118,9 +113,4 @@ private:
HDFF::cHdffCmdIf *mHdffCmdIf;
};
-class cDvbHdFfDeviceProbe : public cDvbDeviceProbe {
-public:
- virtual bool Probe(int Adapter, int Frontend);
- };
-
#endif //__DVBHDFFDEVICE_H