[ANNOUNCE] vdr-rotor support patches for VDR-1.5.14

Message ID 479D0E50.8010505@gmx.de
State New
Headers

Commit Message

Reinhard Nissl Jan. 27, 2008, 11:05 p.m. UTC
  Hi,

the attached patch is based on these files:

	vdr-rotor-0.1.4-vdr1.5.tgz
	rotor-0.1.4-vdr-15.12.diff

For simplicity a patched version is attached too.

NOTES:
- I couldn't test with a real rotor device
- I couldn't test with a FF card

Have fun!

Bye.
  

Patch

diff -Nurp ../rotor-0.1.4-vdr-1.5.12/filter.c ./filter.c
--- ../rotor-0.1.4-vdr-1.5.12/filter.c	2008-01-10 21:53:55.000000000 +0100
+++ ./filter.c	2008-01-27 23:47:22.000000000 +0100
@@ -385,6 +385,7 @@  void PatFilter::Process(u_short Pid, u_c
             switch (stream.getStreamType()) {
               case 1: // STREAMTYPE_11172_VIDEO
               case 2: // STREAMTYPE_13818_VIDEO
+              case 0x1b: //MPEG4
                       Vpid = stream.getPid();
                       break;
               case 3: // STREAMTYPE_11172_AUDIO
@@ -503,6 +504,7 @@  void SdtFilter::Process(u_short Pid, u_c
                    case 0x02: // digital radio sound service
                    case 0x04: // NVOD reference service
                    case 0x05: // NVOD time-shifted service
+                   case 0x19: // digital HD television service
                         {
                         char NameBuf[1024];
                         char ShortNameBuf[1024];
diff -Nurp ../rotor-0.1.4-vdr-1.5.12/menu.c ./menu.c
--- ../rotor-0.1.4-vdr-1.5.12/menu.c	2008-01-10 21:53:55.000000000 +0100
+++ ./menu.c	2008-01-27 23:47:22.000000000 +0100
@@ -35,10 +35,10 @@  void cMenuSetupRotor::Setup(void)
 
 void cMenuSetupRotor::Store(void)
 {
-  if (data.DvbCard!=newDvbCard-1)
+  if (data.DvbCard!=newDvbCard-1 && cDevice::GetDevice(newDvbCard-1))
   {
     static char buffer[PATH_MAX];
-    snprintf(buffer, sizeof(buffer), "%s%d/%s%d", "/dev/dvb/adapter",newDvbCard-1,"frontend",0);
+    snprintf(buffer, sizeof(buffer), "%s%d/%s%d", "/dev/dvb/adapter",cDevice::GetDevice(newDvbCard-1)->CardIndex(),"frontend",0);
     close(data.fd_frontend);
     data.fd_frontend = open(buffer,0);
   } 
@@ -144,6 +144,7 @@  cMainMenuRotor::cMainMenuRotor(void):cOs
   else
     Pol='H';
   Symbolrate=OldChannel->Srate();
+  System=OldChannel->System();
   m_Active = false;
 
 /*
@@ -180,7 +181,7 @@  cMainMenuRotor::~cMainMenuRotor()
   }
   Setup.UpdateChannels=oldupdate;
   if (HasSwitched)
-    cDevice::GetDevice(data.DvbCard)->SwitchChannel(OldChannel,true);
+    cDevice::PrimaryDevice()->SwitchChannel(OldChannel,true);
 /*
   cFont::SetFont(fontSml);
   cFont::SetFont(fontOsd);
@@ -212,6 +213,7 @@  void cMainMenuRotor::AddMenuItems()
   Add(n[5]);
   Add(new cMenuEditFreqItem(tr("Frequency"),&Frequenz,&Pol,osUser1));
   Add(new cMenuEditSymbItem(tr("Symbolrate"),&Symbolrate,0,50000,osUser1));
+  Add(new cMenuEditRotorMapItem(tr("System"),&System,SystemValues,osUser1));
   Add(new cOsdItem(CenterText(tr("Scan Transponder"),edw),osUser2));
   CursorDown();
 }
@@ -301,25 +303,25 @@  eOSState cMainMenuRotor::ProcessKey(eKey
   {
     cChannel *SChannel = new cChannel;
     *SChannel = *OldChannel;
-    SChannel->cChannel::SetSatTransponderData(RotorPos->R_Code(),Frequenz,Pol,Symbolrate,FEC_AUTO);
-    if (cDevice::GetDevice(data.DvbCard)==cDevice::ActualDevice())
-      HasSwitched=true;
+    SChannel->SetNumber(0);
+    SChannel->cChannel::SetSatTransponderData(RotorPos->R_Code(),Frequenz,Pol,Symbolrate,DVBFE_FEC_AUTO,DVBFE_MOD_AUTO,System,DVBFE_ROLLOFF_UNKNOWN);
     bool UseDiseqc=Setup.DiSEqC;
     Setup.DiSEqC=false;
-    cDevice::GetDevice(data.DvbCard)->SwitchChannel(SChannel,HasSwitched);
+    cDevice::PrimaryDevice()->SwitchChannel(SChannel,cDevice::GetDevice(data.DvbCard));
+    HasSwitched=true;
     Setup.DiSEqC=UseDiseqc;
   }
   if (state == osUser2)
   {
     cChannel *SChannel = new cChannel;
     *SChannel = *OldChannel;
-    SChannel->cChannel::SetSatTransponderData(RotorPos->R_Code(),Frequenz,Pol,Symbolrate,FEC_AUTO);
-    if (cDevice::GetDevice(data.DvbCard)==cDevice::ActualDevice())
-      HasSwitched=true;
+    SChannel->SetNumber(0);
+    SChannel->cChannel::SetSatTransponderData(RotorPos->R_Code(),Frequenz,Pol,Symbolrate,DVBFE_FEC_AUTO,DVBFE_MOD_AUTO,System,DVBFE_ROLLOFF_UNKNOWN);
     bool UseDiseqc=Setup.DiSEqC;
     Setup.DiSEqC=false;
     data.ActualSource=RotorPos->GetCode();
-    cDevice::GetDevice(data.DvbCard)->SwitchChannel(SChannel,HasSwitched);
+    cDevice::PrimaryDevice()->SwitchChannel(SChannel,cDevice::GetDevice(data.DvbCard));
+    HasSwitched=true;
     Setup.DiSEqC=UseDiseqc;
     AddSubMenu(new cMenuScan);
   }
@@ -388,7 +390,7 @@  eOSState cMenuScan::ProcessKey(eKeys Key
                   cDevice::GetDevice(data.DvbCard)->Detach(SFilter);
                   SFilter=NULL;
                 }     
-                cDevice::GetDevice(data.DvbCard)->SwitchChannel(&Channel[Current()],true);
+                cDevice::PrimaryDevice()->SwitchChannel(&Channel[Current()],cDevice::GetDevice(data.DvbCard));
                 break;
       default: return state;
       }
diff -Nurp ../rotor-0.1.4-vdr-1.5.12/menu.h ./menu.h
--- ../rotor-0.1.4-vdr-1.5.12/menu.h	2008-01-10 21:53:55.000000000 +0100
+++ ./menu.h	2008-01-27 23:47:22.000000000 +0100
@@ -83,6 +83,7 @@  public:
 class cMainMenuRotor : public cOsdMenu, public cThread {
 private:
   int oldupdate,Position,Frequenz,Symbolrate,edw;
+  int System;
   cRotorPos *RotorPos;
   char Pol;
   cChannel *OldChannel;
diff -Nurp ../rotor-0.1.4-vdr-1.5.12/menuitems.c ./menuitems.c
--- ../rotor-0.1.4-vdr-1.5.12/menuitems.c	2007-07-06 23:06:05.000000000 +0200
+++ ./menuitems.c	2008-01-27 23:47:22.000000000 +0100
@@ -463,3 +463,40 @@  eOSState cMenuEditRotorConfItem::Process
   return osContinue;
 }
 
+// --- cMenuEditRotorMapItem ------------------------------------------------------
+
+cMenuEditRotorMapItem::cMenuEditRotorMapItem(const char *Name, int *Value, const tChannelParameterMap *Map, eOSState State)
+:cMenuEditMapItem(Name, Value, Map)
+{
+  edw=cSkinDisplay::Current()->EditableWidth();
+  state = State;
+  MangleText();
+}
+
+void cMenuEditRotorMapItem::Set(void)
+{
+  cMenuEditMapItem::Set();
+  MangleText();
+}
+
+void cMenuEditRotorMapItem::MangleText(void)
+{
+  char text[700];
+  strcpy(text, Text());
+  char txt[50];
+  char *p = strchr(text, '\t');
+  strcpy(txt, p + 1);
+  *p = '\0';
+  int w=Width(text)+Width(txt);
+  for (int i=1; (i*Width(BLANK))<=(edw-w);i++) sprintf(text,"%s%c",text,edw>100 ? BLANK : ' ');
+  sprintf(text,"%s%s",text,txt);
+  SetText(text);
+}
+
+eOSState cMenuEditRotorMapItem::ProcessKey(eKeys Key)
+{
+  if (Key == kOk)
+     return state;
+
+  return cMenuEditMapItem::ProcessKey(Key);
+}
diff -Nurp ../rotor-0.1.4-vdr-1.5.12/menuitems.h ./menuitems.h
--- ../rotor-0.1.4-vdr-1.5.12/menuitems.h	2007-07-06 22:27:19.000000000 +0200
+++ ./menuitems.h	2008-01-27 23:47:22.000000000 +0100
@@ -88,4 +88,16 @@  public:
   eOSState ProcessKey(eKeys Key);
 };
 
+class cMenuEditRotorMapItem : public cMenuEditMapItem {
+private:
+  eOSState state;
+  int edw;
+  void MangleText(void);
+protected:
+  virtual void Set(void);
+public:
+  cMenuEditRotorMapItem(const char *Name, int *Value, const tChannelParameterMap *Map, eOSState State = osUnknown);
+  virtual eOSState ProcessKey(eKeys Key);
+};
+
 #endif
diff -Nurp ../rotor-0.1.4-vdr-1.5.12/patches/vdr-1.5.14-h264-other-rotor.diff ./patches/vdr-1.5.14-h264-other-rotor.diff
--- ../rotor-0.1.4-vdr-1.5.12/patches/vdr-1.5.14-h264-other-rotor.diff	1970-01-01 01:00:00.000000000 +0100
+++ ./patches/vdr-1.5.14-h264-other-rotor.diff	2008-01-27 23:47:22.000000000 +0100
@@ -0,0 +1,130 @@ 
+--- ../vdr-1.5.14-orig/device.h	2008-01-27 11:35:18.000000000 +0100
++++ device.h	2008-01-27 22:57:29.000000000 +0100
+@@ -23,6 +23,7 @@
+ #include "spu.h"
+ #include "thread.h"
+ #include "tools.h"
++#include <linux/dvb/frontend.h>
+ 
+ #define MAXDEVICES         16 // the maximum number of devices in the system
+ #define MAXPIDHANDLES      64 // the maximum number of different PIDs per device
+@@ -199,6 +200,7 @@ public:
+ 
+ protected:
+   static int currentChannel;
++  bool SwitchChannel(const cChannel *Channel, bool LiveView, cDevice *SpecificSourceDevice);
+ public:
+   virtual bool ProvidesSource(int Source) const;
+          ///< Returns true if this device can provide the given source.
+@@ -239,13 +241,17 @@ public:
+   bool SwitchChannel(const cChannel *Channel, bool LiveView);
+          ///< Switches the device to the given Channel, initiating transfer mode
+          ///< if necessary.
++  bool SwitchChannel(const cChannel *Channel, cDevice *SpecificSourceDevice);
++         ///< Switches the device to the given Channel for live view, initiating
++         ///< transfer mode if necessary. SpecificSourceDevice will be used to
++         ///< provide the channel.
+   static bool SwitchChannel(int Direction);
+          ///< Switches the primary device to the next available channel in the given
+          ///< Direction (only the sign of Direction is evaluated, positive values
+          ///< switch to higher channel numbers).
+ private:
+-  eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView);
+-         ///< Sets the device to the given channel (general setup).
++  eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView, cDevice *SpecificSourceDevice = NULL);
++         ///< Sets the device to the given channel (general setup).
+ protected:
+   virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
+          ///< Sets the device to the given channel (actual physical setup).
+@@ -267,6 +273,7 @@ public:
+   virtual bool HasProgramme(void);
+          ///< Returns true if the device is currently showing any programme to
+          ///< the user, either through replaying or live.
++  virtual bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd) {return false;}
+ 
+ // PID handle facilities
+ 
+--- ../vdr-1.5.14-orig/dvbdevice.h	2008-01-27 11:21:02.000000000 +0100
++++ dvbdevice.h	2008-01-27 22:57:29.000000000 +0100
+@@ -73,6 +73,7 @@ protected:
+   virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
+ public:
+   virtual bool HasLock(int TimeoutMs = 0);
++  virtual bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd);
+ 
+ // PID handle facilities
+ 
+--- ../vdr-1.5.14-orig/dvbdevice.c	2008-01-27 15:35:54.000000000 +0100
++++ dvbdevice.c	2008-01-27 22:57:29.000000000 +0100
+@@ -71,6 +71,7 @@ static int DvbOpen(const char *Name, int
+ class cDvbTuner : public cThread {
+ private:
+   enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked };
++  bool SendDiseqc;
+   int fd_frontend;
+   int cardIndex;
+   int tuneTimeout;
+@@ -83,6 +84,7 @@ private:
+   cMutex mutex;
+   cCondVar locked;
+   cCondVar newSet;
++  dvb_diseqc_master_cmd diseqc_cmd;
+   bool GetFrontendStatus(fe_status_t &Status, int TimeoutMs = 0);
+   bool SetFrontend(void);
+   virtual void Action(void);
+@@ -91,12 +93,14 @@ public:
+   virtual ~cDvbTuner();
+   bool IsTunedTo(const cChannel *Channel) const;
+   void Set(const cChannel *Channel, bool Tune);
++  bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd);
+   bool Locked(int TimeoutMs = 0);
+   };
+ 
+ cDvbTuner::cDvbTuner(int Fd_Frontend, int CardIndex, dvbfe_delsys FrontendType)
+ {
+   fd_frontend = Fd_Frontend;
++  SendDiseqc = false;
+   cardIndex = CardIndex;
+   frontendType = FrontendType;
+   tuneTimeout = 0;
+@@ -164,6 +168,17 @@ bool cDvbTuner::Locked(int TimeoutMs)
+   return tunerStatus >= tsLocked;
+ }
+ 
++bool cDvbTuner::SendDiseqcCmd(dvb_diseqc_master_cmd cmd)
++{
++  cMutexLock MutexLock(&mutex);
++  if (!(frontendType & (DVBFE_DELSYS_DVBS | DVBFE_DELSYS_DVBS2)) || SendDiseqc)
++    return false;
++  diseqc_cmd=cmd;
++  SendDiseqc=true;
++  newSet.Broadcast();
++  return true;
++}
++
+ bool cDvbTuner::GetFrontendStatus(fe_status_t &Status, int TimeoutMs)
+ {
+   if (TimeoutMs) {
+@@ -328,6 +343,10 @@ void cDvbTuner::Action(void)
+         if (GetFrontendStatus(NewStatus, 10))
+            Status = NewStatus;
+         cMutexLock MutexLock(&mutex);
++        if (SendDiseqc) {
++           CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_MASTER_CMD, &diseqc_cmd));
++           SendDiseqc=false;
++           }
+         switch (tunerStatus) {
+           case tsIdle:
+                break;
+@@ -937,6 +956,11 @@ bool cDvbDevice::HasLock(int TimeoutMs)
+   return dvbTuner ? dvbTuner->Locked(TimeoutMs) : false;
+ }
+ 
++bool cDvbDevice::SendDiseqcCmd(dvb_diseqc_master_cmd cmd)
++{
++  return dvbTuner->SendDiseqcCmd(cmd);
++}
++
+ int cDvbDevice::GetAudioChannelDevice(void)
+ {
+   if (HasDecoder()) {
diff -Nurp ../rotor-0.1.4-vdr-1.5.12/patches/vdr-1.5.5-rotor.diff ./patches/vdr-1.5.5-rotor.diff
--- ../rotor-0.1.4-vdr-1.5.12/patches/vdr-1.5.5-rotor.diff	2007-07-06 23:12:31.000000000 +0200
+++ ./patches/vdr-1.5.5-rotor.diff	1970-01-01 01:00:00.000000000 +0100
@@ -1,106 +0,0 @@ 
-diff -ubw vdr-1.5.5/device.h vdr-1.5.5-Rotor/device.h
---- vdr-1.5.5/device.h	2007-01-13 12:33:57.000000000 +0100
-+++ vdr-1.5.5-Rotor/device.h	2007-06-30 21:27:45.000000000 +0200
-@@ -22,6 +22,7 @@
- #include "spu.h"
- #include "thread.h"
- #include "tools.h"
-+#include <linux/dvb/frontend.h>
- 
- #define MAXDEVICES         16 // the maximum number of devices in the system
- #define MAXPIDHANDLES      64 // the maximum number of different PIDs per device
-@@ -256,6 +257,7 @@
-   virtual bool HasProgramme(void);
-          ///< Returns true if the device is currently showing any programme to
-          ///< the user, either through replaying or live.
-+  virtual bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd) {return false;}
- 
- // PID handle facilities
- 
-diff -ubw vdr-1.5.5/dvbdevice.c vdr-1.5.5-Rotor/dvbdevice.c
---- vdr-1.5.5/dvbdevice.c	2007-02-25 12:46:52.000000000 +0100
-+++ vdr-1.5.5-Rotor/dvbdevice.c	2007-06-30 21:28:47.000000000 +0200
-@@ -71,6 +71,7 @@
- class cDvbTuner : public cThread {
- private:
-   enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked };
-+ bool SendDiseqc;
-   int fd_frontend;
-   int cardIndex;
-   int tuneTimeout;
-@@ -83,6 +84,7 @@
-   cMutex mutex;
-   cCondVar locked;
-   cCondVar newSet;
-+  dvb_diseqc_master_cmd diseqc_cmd;
-   bool GetFrontendStatus(fe_status_t &Status, int TimeoutMs = 0);
-   bool SetFrontend(void);
-   virtual void Action(void);
-@@ -91,12 +93,14 @@
-   virtual ~cDvbTuner();
-   bool IsTunedTo(const cChannel *Channel) const;
-   void Set(const cChannel *Channel, bool Tune);
-+  bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd);
-   bool Locked(int TimeoutMs = 0);
-   };
- 
- cDvbTuner::cDvbTuner(int Fd_Frontend, int CardIndex, fe_type_t FrontendType)
- {
-   fd_frontend = Fd_Frontend;
-+  SendDiseqc=false;
-   cardIndex = CardIndex;
-   frontendType = FrontendType;
-   tuneTimeout = 0;
-@@ -145,6 +149,17 @@
-   return tunerStatus >= tsLocked;
- }
- 
-+bool cDvbTuner::SendDiseqcCmd(dvb_diseqc_master_cmd cmd)
-+{
-+  cMutexLock MutexLock(&mutex);
-+  if (frontendType!=FE_QPSK || SendDiseqc)
-+    return false;
-+  diseqc_cmd=cmd;
-+  SendDiseqc=true;
-+  newSet.Broadcast();
-+  return true;
-+}
-+
- bool cDvbTuner::GetFrontendStatus(fe_status_t &Status, int TimeoutMs)
- {
-   if (TimeoutMs) {
-@@ -297,6 +312,10 @@
-         if (GetFrontendStatus(NewStatus, 10))
-            Status = NewStatus;
-         cMutexLock MutexLock(&mutex);
-+        if (SendDiseqc) {
-+           CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_MASTER_CMD, &diseqc_cmd));
-+           SendDiseqc=false;
-+           }
-         switch (tunerStatus) {
-           case tsIdle:
-                break;
-@@ -858,6 +877,11 @@
-   return dvbTuner ? dvbTuner->Locked(TimeoutMs) : false;
- }
- 
-+bool cDvbDevice::SendDiseqcCmd(dvb_diseqc_master_cmd cmd)
-+{
-+  return dvbTuner->SendDiseqcCmd(cmd);
-+}
-+
- int cDvbDevice::GetAudioChannelDevice(void)
- {
-   if (HasDecoder()) {
-Nur in vdr-1.5.5-Rotor/: dvbdevice.c.rej.
-diff -ubw vdr-1.5.5/dvbdevice.h vdr-1.5.5-Rotor/dvbdevice.h
---- vdr-1.5.5/dvbdevice.h	2007-02-25 13:23:57.000000000 +0100
-+++ vdr-1.5.5-Rotor/dvbdevice.h	2007-06-30 21:27:45.000000000 +0200
-@@ -71,6 +71,7 @@
-   virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
- public:
-   virtual bool HasLock(int TimeoutMs = 0);
-+  virtual bool SendDiseqcCmd(dvb_diseqc_master_cmd cmd);
- 
- // PID handle facilities
- 
diff -Nurp ../rotor-0.1.4-vdr-1.5.12/rotor.c ./rotor.c
--- ../rotor-0.1.4-vdr-1.5.12/rotor.c	2007-07-06 23:11:55.000000000 +0200
+++ ./rotor.c	2008-01-27 23:47:22.000000000 +0100
@@ -97,7 +97,7 @@  bool cPluginRotor::Start(void)
     if ((diseqc=Diseqcs.Get(source->Code(),12000,'h')) || (diseqc=Diseqcs.Get(source->Code(),12000,'v')) || (diseqc=Diseqcs.Get(source->Code(),12000,'l')) || (diseqc=Diseqcs.Get(source->Code(),12000,'r'))) 
     {
       char *c=strdup(diseqc->Commands());
-      while (c = strchr(c, '['))
+      while ((c = strchr(c, '[')))
       {
         char *e = strchr(++c, ']');
         int n = 0;
@@ -142,8 +142,9 @@  bool cPluginRotor::Start(void)
       p->AddDescription(buf);
   }
   RotorPositions.Save();
-  char buffer[PATH_MAX];
-  snprintf(buffer, sizeof(buffer), "/dev/dvb/adapter%d/frontend0", data.DvbCard);
+  char buffer[PATH_MAX] = "";
+  if (cDevice::GetDevice(data.DvbCard))
+     snprintf(buffer, sizeof(buffer), "/dev/dvb/adapter%d/frontend0", cDevice::GetDevice(data.DvbCard)->CardIndex());
   data.fd_frontend = open(buffer,0);
   return true;
 }