diff -upr dvbhddevice/dvbhddevice.c dvbhddevice_dag/dvbhddevice.c --- dvbhddevice/dvbhddevice.c 2013-03-31 11:30:18.000000000 +0200 +++ dvbhddevice_dag/dvbhddevice.c 2013-04-05 13:06:56.037186662 +0200 @@ -10,13 +10,11 @@ #include "menu.h" #include "setup.h" -static const char *VERSION = "2.1.3"; +static const char *VERSION = "2.1.3dag"; 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; AdapterCmdRemoteSetProtocol((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); @@ -929,46 +946,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-03-02 18:58:21.000000000 +0100 +++ dvbhddevice_dag/dvbhdffdevice.h 2013-04-05 13:06:56.037186662 +0200 @@ -8,16 +8,18 @@ #define __DVBHDFFDEVICE_H #include "hdffcmd.h" -#include +#include #include /// 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