Re: [vdr] [patch] optimize device selection

2009-08-10 Thread Janusz Krzysztofik

Timothy D. Lenz wrote:

I don't yet know if this patch is the cause, but I have a setup I am working on 
which has a FusionHDTV7 dual express and after it
has been running for a few days, vdr seems to loose contact with the second 
tunner. When selecting other channels using vdradmin and
then going back to the channel it had been left on for awhile, I get the xine 
no signal screen. Switching to any other channel
works. Using femon I switch tunners while on the channel that no longer works 
and it starts working. I can go to any channel and
swith between the tunners and only get video on the first tunner. The problem 
may be triggered by recording but sure. The amount of
time to pass for it to show changes.

Using vdr-1.7.8

First I thought it was the driver crashing. So I tried restarting vdr, but not 
the drivers and that got the second tunner back.


Hi,
Sounds similiar to my problem description posted here some time ago:

http://www.linuxtv.org/pipermail/vdr/2008-December/018991.html

Nobody answered :(, so I am still using that getstream/iptv workaround.

Hoped this patch could help me, but had no opportunity to check for this 
yet.


Thanks,
Janusz

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] [patch] optimize device selection

2009-08-10 Thread jlacvdr
The patch in the previous message is not complete, please use this one.

Thanks Timothy D. Lenz

Regards,

--

Hi,

I have a update to this patch (attached file), try it and keep me
inform about your problem.

this patch is for vdr-1.7.8

Regards,



2009/8/8 Timothy D. Lenz tl...@vorgon.com:
 I don't yet know if this patch is the cause, but I have a setup I am working 
 on which has a FusionHDTV7 dual express and after it
 has been running for a few days, vdr seems to loose contact with the second 
 tunner. When selecting other channels using vdradmin and
 then going back to the channel it had been left on for awhile, I get the xine 
 no signal screen. Switching to any other channel
 works. Using femon I switch tunners while on the channel that no longer works 
 and it starts working. I can go to any channel and
 swith between the tunners and only get video on the first tunner. The problem 
 may be triggered by recording but sure. The amount of
 time to pass for it to show changes.

 Using vdr-1.7.8

 First I thought it was the driver crashing. So I tried restarting vdr, but 
 not the drivers and that got the second tunner back.

 - Original Message -
 From: jlacvdr jlac...@gmail.com
 To: VDR Mailing List vdr@linuxtv.org
 Sent: Sunday, May 10, 2009 10:35 AM
 Subject: [vdr] [patch] optimize device selection


 Hi,

 This patch is for vdr users's which have several cards.

 He changes the device selection, by adding two factors in the 'impact' 
 choice :
 - prefering a already tuned device
 - the last usage time of device

 So, all devices are used and zapping time is reduce.

 Works better when eitscanner is disable.

 Regards,

 JLac



 


 ___
 vdr mailing list
 vdr@linuxtv.org
 http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr



 ___
 vdr mailing list
 vdr@linuxtv.org
 http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

diff -bBurN vdr-1.7.8-orig/device.c vdr-1.7.8/device.c
--- vdr-1.7.8-orig/device.c	2009-06-06 15:25:58.0 +0200
+++ vdr-1.7.8/device.c	2009-08-09 20:20:12.0 +0200
@@ -80,6 +80,7 @@
 
   camSlot = NULL;
   startScrambleDetection = 0;
+  startReceiving = 0;
 
   player = NULL;
   isPlayingVideo = false;
@@ -238,6 +239,43 @@
   cDevice *d = NULL;
   cCamSlot *s = NULL;
 
+  int deviceTuneOld[MAXDEVICES];
+  time_t deviceTuneAge[MAXDEVICES];
+  time_t now = time(NULL);
+  for (int i = 0; i  numDevices; i++)
+  {
+if( device[i]-IsTunedToTransponder(Channel) )
+{
+	  now = 0;
+}
+  }
+  
+  if( now != 0 )
+  {
+	for (int i = 0; i  numDevices; i++)
+	{
+		deviceTuneAge[i] = 1+(now-device[i]-startReceiving);
+	}
+	for (int i = 0; i  numDevices; i++)
+	{
+		int max = 0;
+		int idx = -1;
+		for (int j = 0; j  numDevices; j++)
+		{
+			if( deviceTuneAge[j]  max ) 
+			{
+max = deviceTuneAge[j];
+idx = j;
+			}
+		}
+		if( idx != -1 )
+		{
+			deviceTuneOld[idx] = i;
+			deviceTuneAge[idx] = 0;
+		}
+	}
+  }  
+  
   uint32_t Impact = 0x; // we're looking for a device with the least impact
   for (int j = 0; j  NumCamSlots || !NumUsableSlots; j++) {
   if (NumUsableSlots  SlotPriority[j]  MAXPRIORITY)
@@ -260,6 +298,9 @@
  // to their individual severity, where the one listed first will make the most
  // difference, because it results in the most significant bit of the result.
  uint32_t imp = 0;
+
+ imp = 1; imp |= device[i]-IsTunedToTransponder(Channel) ? 0 : 1; // prefer device already tune
+ imp = 3; imp |= deviceTuneOld[i]  0x07; // sort devices by last time usage 
  imp = 1; imp |= LiveView ? !device[i]-IsPrimaryDevice() || ndr : 0;  // prefer the primary device for live viewing if we don't need to detach existing receivers
  imp = 1; imp |= !device[i]-Receiving()  (device[i] != cTransferControl::ReceiverDevice() || device[i]-IsPrimaryDevice()) || ndr; // use receiving devices if we don't need to detach existing receivers, but avoid primary device in local transfer mode
  imp = 1; imp |= device[i]-Receiving();   // avoid devices that are receiving
@@ -286,6 +327,7 @@
  break; // no CAM necessary, so just one loop over the devices
   }
   if (d) {
+ d-startReceiving = time(NULL);
  if (NeedsDetachReceivers)
 d-DetachAllReceivers();
  if (s) {
diff -bBurN vdr-1.7.8-orig/device.h vdr-1.7.8/device.h
--- vdr-1.7.8-orig/device.h	2009-06-06 13:15:49.0 +0200
+++ vdr-1.7.8/device.h	2009-08-09 20:20:12.0 +0200
@@ -333,6 +333,7 @@
 
 private:
   time_t startScrambleDetection;
+  time_t startReceiving;
   cCamSlot *camSlot;
 public:
   virtual bool HasCi(void);
___
vdr mailing list
vdr

Re: [vdr] [patch] optimize device selection

2009-08-09 Thread jlacvdr
Hi,

I have a update to this patch (attached file), try it and keep me
inform about your problem.

this patch is for vdr-1.7.8

Regards,



2009/8/8 Timothy D. Lenz tl...@vorgon.com:
 I don't yet know if this patch is the cause, but I have a setup I am working 
 on which has a FusionHDTV7 dual express and after it
 has been running for a few days, vdr seems to loose contact with the second 
 tunner. When selecting other channels using vdradmin and
 then going back to the channel it had been left on for awhile, I get the xine 
 no signal screen. Switching to any other channel
 works. Using femon I switch tunners while on the channel that no longer works 
 and it starts working. I can go to any channel and
 swith between the tunners and only get video on the first tunner. The problem 
 may be triggered by recording but sure. The amount of
 time to pass for it to show changes.

 Using vdr-1.7.8

 First I thought it was the driver crashing. So I tried restarting vdr, but 
 not the drivers and that got the second tunner back.

 - Original Message -
 From: jlacvdr jlac...@gmail.com
 To: VDR Mailing List vdr@linuxtv.org
 Sent: Sunday, May 10, 2009 10:35 AM
 Subject: [vdr] [patch] optimize device selection


 Hi,

 This patch is for vdr users's which have several cards.

 He changes the device selection, by adding two factors in the 'impact' 
 choice :
 - prefering a already tuned device
 - the last usage time of device

 So, all devices are used and zapping time is reduce.

 Works better when eitscanner is disable.

 Regards,

 JLac



 


 ___
 vdr mailing list
 vdr@linuxtv.org
 http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr



 ___
 vdr mailing list
 vdr@linuxtv.org
 http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

diff -bBurN vdr-1.7.8-orig/device.c vdr-1.7.8/device.c
--- vdr-1.7.8-orig/device.c	2009-06-06 15:25:58.0 +0200
+++ vdr-1.7.8/device.c	2009-08-09 20:20:12.0 +0200
@@ -80,6 +80,7 @@
 
   camSlot = NULL;
   startScrambleDetection = 0;
+  startReceiving = 0;
 
   player = NULL;
   isPlayingVideo = false;
@@ -238,6 +239,43 @@
   cDevice *d = NULL;
   cCamSlot *s = NULL;
 
+  int deviceTuneOld[MAXDEVICES];
+  time_t deviceTuneAge[MAXDEVICES];
+  time_t now = time(NULL);
+  for (int i = 0; i  numDevices; i++)
+  {
+if( device[i]-IsTunedToTransponder(Channel) )
+{
+	  now = 0;
+}
+  }
+  
+  if( now != 0 )
+  {
+	for (int i = 0; i  numDevices; i++)
+	{
+		deviceTuneAge[i] = 1+(now-device[i]-startReceiving);
+	}
+	for (int i = 0; i  numDevices; i++)
+	{
+		int max = 0;
+		int idx = -1;
+		for (int j = 0; j  numDevices; j++)
+		{
+			if( deviceTuneAge[j]  max ) 
+			{
+max = deviceTuneAge[j];
+idx = j;
+			}
+		}
+		if( idx != -1 )
+		{
+			deviceTuneOld[idx] = i;
+			deviceTuneAge[idx] = 0;
+		}
+	}
+  }  
+  
   uint32_t Impact = 0x; // we're looking for a device with the least impact
   for (int j = 0; j  NumCamSlots || !NumUsableSlots; j++) {
   if (NumUsableSlots  SlotPriority[j]  MAXPRIORITY)
@@ -260,6 +298,9 @@
  // to their individual severity, where the one listed first will make the most
  // difference, because it results in the most significant bit of the result.
  uint32_t imp = 0;
+
+ imp = 1; imp |= device[i]-IsTunedToTransponder(Channel) ? 0 : 1; // prefer device already tune
+ imp = 3; imp |= deviceTuneOld[i]  0x07; // sort devices by last time usage 
  imp = 1; imp |= LiveView ? !device[i]-IsPrimaryDevice() || ndr : 0;  // prefer the primary device for live viewing if we don't need to detach existing receivers
  imp = 1; imp |= !device[i]-Receiving()  (device[i] != cTransferControl::ReceiverDevice() || device[i]-IsPrimaryDevice()) || ndr; // use receiving devices if we don't need to detach existing receivers, but avoid primary device in local transfer mode
  imp = 1; imp |= device[i]-Receiving();   // avoid devices that are receiving
@@ -286,6 +327,7 @@
  break; // no CAM necessary, so just one loop over the devices
   }
   if (d) {
+ d-startReceiving = time(NULL);
  if (NeedsDetachReceivers)
 d-DetachAllReceivers();
  if (s) {
___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] [patch] optimize device selection

2009-08-08 Thread Timothy D. Lenz
I don't yet know if this patch is the cause, but I have a setup I am working on 
which has a FusionHDTV7 dual express and after it
has been running for a few days, vdr seems to loose contact with the second 
tunner. When selecting other channels using vdradmin and
then going back to the channel it had been left on for awhile, I get the xine 
no signal screen. Switching to any other channel
works. Using femon I switch tunners while on the channel that no longer works 
and it starts working. I can go to any channel and
swith between the tunners and only get video on the first tunner. The problem 
may be triggered by recording but sure. The amount of
time to pass for it to show changes.

Using vdr-1.7.8

First I thought it was the driver crashing. So I tried restarting vdr, but not 
the drivers and that got the second tunner back.

- Original Message - 
From: jlacvdr jlac...@gmail.com
To: VDR Mailing List vdr@linuxtv.org
Sent: Sunday, May 10, 2009 10:35 AM
Subject: [vdr] [patch] optimize device selection


 Hi,

 This patch is for vdr users's which have several cards.

 He changes the device selection, by adding two factors in the 'impact' choice 
 :
 - prefering a already tuned device
 - the last usage time of device

 So, all devices are used and zapping time is reduce.

 Works better when eitscanner is disable.

 Regards,

 JLac






 ___
 vdr mailing list
 vdr@linuxtv.org
 http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr



___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


[vdr] [patch] optimize device selection

2009-05-10 Thread jlacvdr
Hi,

This patch is for vdr users's which have several cards.

He changes the device selection, by adding two factors in the 'impact' choice :
- prefering a already tuned device
- the last usage time of device

So, all devices are used and zapping time is reduce.

Works better when eitscanner is disable.

Regards,

JLac
diff -bBurN vdr-1.7.7-orig/device.c vdr-1.7.7/device.c
--- vdr-1.7.7-orig/device.c	2009-05-02 14:17:39.0 +0200
+++ vdr-1.7.7/device.c	2009-05-10 18:52:27.0 +0200
@@ -84,6 +84,7 @@
 
   camSlot = NULL;
   startScrambleDetection = 0;
+  startReceiving = 0;
 
   player = NULL;
   isPlayingVideo = false;
@@ -264,6 +265,11 @@
  // to their individual severity, where the one listed first will make the most
  // difference, because it results in the most significant bit of the result.
  uint32_t imp = 0;
+
+ imp = 1; imp |= device[i]-IsTunedToTransponder(Channel) ? 0 : 1; // prefer device already tune
+ int t=((time(NULL)-device[i]-startReceiving)/16);
+ imp = 4;  imp |= t  0x0f ? 0 : 0x0f-t;			 // sort devices by last time usage 
+
  imp = 1; imp |= LiveView ? !device[i]-IsPrimaryDevice() || ndr : 0;  // prefer the primary device for live viewing if we don't need to detach existing receivers
  imp = 1; imp |= !device[i]-Receiving()  (device[i] != cTransferControl::ReceiverDevice() || device[i]-IsPrimaryDevice()) || ndr; // use receiving devices if we don't need to detach existing receivers, but avoid primary device in local transfer mode
  imp = 1; imp |= device[i]-Receiving();   // avoid devices that are receiving
@@ -290,6 +296,7 @@
  break; // no CAM necessary, so just one loop over the devices
   }
   if (d) {
+ d-startReceiving = time(NULL);
  if (NeedsDetachReceivers)
 d-DetachAllReceivers();
  if (s) {
diff -bBurN vdr-1.7.7-orig/device.h vdr-1.7.7/device.h
--- vdr-1.7.7-orig/device.h	2009-05-02 14:16:20.0 +0200
+++ vdr-1.7.7/device.h	2009-05-10 18:49:00.0 +0200
@@ -340,6 +340,7 @@
 
 private:
   time_t startScrambleDetection;
+  time_t startReceiving;
   cCamSlot *camSlot;
 public:
   virtual bool HasCi(void);
___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr