From 4986f76b0a40e11997e572a75260034063023cb0 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 26 Aug 2012 13:09:01 +0200 Subject: Added cDevice::ReadFilter() --- CONTRIBUTORS | 2 ++ HISTORY | 2 ++ PLUGINS.html | 1 + device.c | 7 ++++++- device.h | 6 +++++- sections.c | 4 ++-- 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index e2b68597..49df88fe 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -87,6 +87,8 @@ Deti Fliegl for fixing setting the OSD size in the 'Confirm' interface call for fixing handling improper buffer lengths in the EIT parser for a patch that was used to implement StopSectionHandler() + for adding cDevice::ReadFilter() to allow devices to implement their own way of + retrieving section filter data Dave Chapman for implementing support for the teletext PID diff --git a/HISTORY b/HISTORY index 3a7802d0..fb21667b 100644 --- a/HISTORY +++ b/HISTORY @@ -7206,3 +7206,5 @@ Video Disk Recorder Revision History - Fixed detecting transfer mode on full featured DVB cards (thanks to Stefan Huelswitt for reporting a problem with updating CA descriptors in such cases). - Fixed a race condition when zapping in transfer mode (reported by Reinhard Nissl). +- The new function cDevice::ReadFilter() can be used by devices to implement their + own way of retrieving section filter data (thanks to Deti Fliegl). diff --git a/PLUGINS.html b/PLUGINS.html index a6b29f20..a7a0a9d2 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -1888,6 +1888,7 @@ the functions

 virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask);
+virtual int ReadFilter(int Handle, void *Buffer, size_t Length);
 virtual void CloseFilter(int Handle);
 

diff --git a/device.c b/device.c index e3ea677f..e2bcd915 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 2.63 2012/08/25 11:56:08 kls Exp $ + * $Id: device.c 2.64 2012/08/26 12:53:39 kls Exp $ */ #include "device.h" @@ -593,6 +593,11 @@ int cDevice::OpenFilter(u_short Pid, u_char Tid, u_char Mask) 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); diff --git a/device.h b/device.h index f279fda3..89a65694 100644 --- a/device.h +++ b/device.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.h 2.39 2012/04/04 09:48:21 kls Exp $ + * $Id: device.h 2.40 2012/08/26 12:56:14 kls Exp $ */ #ifndef __DEVICE_H @@ -393,6 +393,10 @@ public: ///< 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); + ///< Reads data from a handle for the given filter. + ///< 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), diff --git a/sections.c b/sections.c index afb4f0bd..c9ed0c14 100644 --- a/sections.c +++ b/sections.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: sections.c 1.15 2007/10/14 12:52:07 kls Exp $ + * $Id: sections.c 2.1 2012/08/26 12:53:39 kls Exp $ */ #include "sections.h" @@ -198,7 +198,7 @@ void cSectionHandler::Action(void) 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 -- cgit v1.2.3