[PATCH] Section Filter Read Abstraction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

when using cDevice based classes that have no access to kernel based section filters it makes sense to have an abstract 'ReadFilter' function. The patch attached adds such a method to the cDevice class and changes cSectionHandler code to use the new method.

Please add this patch to current 1.6/1.7 development versions.

Deti
--- ../vdr-1.6.0/device.c	2009-01-26 20:26:49.000000000 +0100
+++ device.c	2009-01-26 23:12:59.000000000 +0100
@@ -674,6 +680,11 @@
   return -1;
 }
 
+int cDevice::ReadFilter(int Handle, void *Buffer, size_t Length)
+{
+  return safe_read(Handle, Buffer, Length);
+}
+
 void cDevice::CloseFilter(int Handle)
 {
   close(Handle);
--- ../vdr-1.6.0/device.h	2009-01-26 20:26:49.000000000 +0100
+++ device.h	2009-01-26 23:12:41.000000000 +0100
@@ -317,6 +317,10 @@
        ///< Opens a file handle for the given filter data.
        ///< A derived device that provides section data must
        ///< implement this function.
+  virtual int ReadFilter(int Handle, void *Buffer, size_t Length);
+       ///< Read from a handle for the given filter data.
+       ///< a derived class need not implement this function, because this
+       ///< is done by the default implementation.
   virtual void CloseFilter(int Handle);
        ///< Closes a file handle that has previously been opened
        ///< by OpenFilter(). If this is as simple as calling close(Handle),
--- ../vdr-1.6.0/sections.c	2007-10-14 14:52:07.000000000 +0200
+++ sections.c	2009-01-26 23:14:00.000000000 +0100
@@ -198,7 +198,7 @@
                   if (fh) {
                      // Read section data:
                      unsigned char buf[4096]; // max. allowed size for any EIT section
-                     int r = safe_read(fh->handle, buf, sizeof(buf));
+                     int r = device->ReadFilter(fh->handle, buf, sizeof(buf));
                      if (!DeviceHasLock)
                         continue; // we do the read anyway, to flush any data that might have come from a different transponder
                      if (r > 3) { // minimum number of bytes necessary to get section length
_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux