Hi,

the attached patch replaces the previously released but
incomplete patch for VDR-1.5.14, which was part of my recent
rotor support patches.

You have to apply this patch after patching VDR-1.5.16 with
DVB-S2+H.264 support.

Bye.
-- 
Dipl.-Inform. (FH) Reinhard Nissl
mailto:[EMAIL PROTECTED]
diff -Nurp ../vdr-1.5.16-dvbs2-other/device.c ./device.c
--- ../vdr-1.5.16-dvbs2-other/device.c	2008-02-24 19:14:45.000000000 +0100
+++ ./device.c	2008-02-24 20:53:36.000000000 +0100
@@ -745,12 +745,22 @@ bool cDevice::MaySwitchTransponder(void)
 
 bool cDevice::SwitchChannel(const cChannel *Channel, bool LiveView)
 {
+  return SwitchChannel(Channel, LiveView, NULL);
+}
+
+bool cDevice::SwitchChannel(const cChannel *Channel, cDevice *SpecificSourceDevice)
+{
+  return SwitchChannel(Channel, true, SpecificSourceDevice);
+}
+
+bool cDevice::SwitchChannel(const cChannel *Channel, bool LiveView, cDevice *SpecificSourceDevice)
+{
   if (LiveView) {
      isyslog("switching to channel %d", Channel->Number());
      cControl::Shutdown(); // prevents old channel from being shown too long if GetDevice() takes longer
      }
   for (int i = 3; i--;) {
-      switch (SetChannel(Channel, LiveView)) {
+      switch (SetChannel(Channel, LiveView, SpecificSourceDevice)) {
         case scrOk:           return true;
         case scrNotAvailable: Skins.Message(mtInfo, tr("Channel not available!"));
                               return false;
@@ -793,7 +803,7 @@ bool cDevice::SwitchChannel(int Directio
   return result;
 }
 
-eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
+eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView, cDevice *SpecificSourceDevice)
 {
   if (LiveView) {
      StopReplay();
@@ -801,7 +811,7 @@ eSetChannelResult cDevice::SetChannel(co
      DELETENULL(dvbSubtitleConverter);
      }
 
-  cDevice *Device = (LiveView && IsPrimaryDevice()) ? GetDevice(Channel, 0, LiveView) : this;
+  cDevice *Device = (LiveView && IsPrimaryDevice()) ? (SpecificSourceDevice ? SpecificSourceDevice : GetDevice(Channel, 0, LiveView)) : this;
 
   bool NeedsTransferMode = Device != this;
 
diff -Nurp ../vdr-1.5.16-dvbs2-other/device.h ./device.h
--- ../vdr-1.5.16-dvbs2-other/device.h	2008-02-24 19:14:45.000000000 +0100
+++ ./device.h	2008-02-24 20:53:36.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
@@ -203,6 +204,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.
@@ -243,12 +245,16 @@ 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);
+  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);
@@ -271,6 +277,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
 
diff -Nurp ../vdr-1.5.16-dvbs2-other/dvbdevice.c ./dvbdevice.c
--- ../vdr-1.5.16-dvbs2-other/dvbdevice.c	2008-02-24 19:14:45.000000000 +0100
+++ ./dvbdevice.c	2008-02-24 20:52:50.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;
@@ -938,6 +957,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 ../vdr-1.5.16-dvbs2-other/dvbdevice.h ./dvbdevice.h
--- ../vdr-1.5.16-dvbs2-other/dvbdevice.h	2008-02-24 19:14:45.000000000 +0100
+++ ./dvbdevice.h	2008-02-24 20:52:50.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 mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

Reply via email to