From 67df515c06774a549078026816a32f8520c08d17 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 14 Oct 2007 13:11:23 +0200 Subject: [PATCH] Added cDevice::CloseFilter(); some fixes to PLUGINS.html --- CONTRIBUTORS | 2 ++ HISTORY | 3 +++ PLUGINS.html | 11 +++++++---- device.c | 7 ++++++- device.h | 7 ++++++- dvbdevice.c | 7 ++++++- dvbdevice.h | 3 ++- sections.c | 4 ++-- 8 files changed, 34 insertions(+), 10 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 05d9be35..34b4803e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1026,6 +1026,8 @@ Rolf Ahrenberg for adding internationalization to the "skincurses" plugin for helping with adding compatibility mode for playback of recordings made with the subtitles plugin + for implementing cDevice::CloseFilter() + for some fixes to PLUGINS.html Ralf Klueber for reporting a bug in cutting a recording if there is only a single editing mark diff --git a/HISTORY b/HISTORY index 41ac6f15..91d32fb3 100644 --- a/HISTORY +++ b/HISTORY @@ -5484,3 +5484,6 @@ Video Disk Recorder Revision History - Made the default copy ctor of cRecording private (thanks to Markus Hahn). Same for the assign operator. - Added cRecording::Undelete() (based on a patch from Markus Hahn). +- Added cDevice::CloseFilter() to allow a device to have complete control over + both opening and closing section filters (thanks to Rolf Ahrenberg). +- Some fixes to PLUGINS.html (thanks to Rolf Ahrenberg). diff --git a/PLUGINS.html b/PLUGINS.html index 134bd8f2..e34ab0ec 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -1786,7 +1786,7 @@ selecting which channel it shall tune to:

 virtual bool ProvidesSource(int Source) const;
 virtual bool ProvidesTransponder(const cChannel *Channel) const;
-virtual bool ProvidesChannel(const cChannel *Channel, int Priority = -1, bool *NeedsDetachReceivers = NULL);
+virtual bool ProvidesChannel(const cChannel *Channel, int Priority = -1, bool *NeedsDetachReceivers = NULL) const;
 virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
 

@@ -1849,7 +1849,7 @@ In addition, the following functions may be implemented to provide further functionality:

-virtual bool GrabImage(const char *FileName, bool Jpeg = true, int Quality = -1, int Si
+virtual bool GrabImage(const char *FileName, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
 virtual void SetVideoFormat(bool VideoFormat16_9);
 virtual void SetVolumeDevice(int Volume);
 

@@ -1858,13 +1858,16 @@ virtual void SetVolumeDevice(int Volume); Section Filtering

If your device provides section filtering capabilities it can implement -the function +the functions

 virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask);
+
  +virtual void CloseFilter(int Handle); +

-which must open a file handle that delivers section data for the given +which must open and close a file handle that delivers section data for the given filter parameters.

In order to actually start section handling, the diff --git a/device.c b/device.c index c4f99259..73decabb 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 1.144 2007/10/13 10:30:13 kls Exp $ + * $Id: device.c 1.145 2007/10/14 13:09:19 kls Exp $ */ #include "device.h" @@ -652,6 +652,11 @@ int cDevice::OpenFilter(u_short Pid, u_char Tid, u_char Mask) return -1; } +void cDevice::CloseFilter(int Handle) +{ + close(Handle); +} + void cDevice::AttachFilter(cFilter *Filter) { if (sectionHandler) diff --git a/device.h b/device.h index c306e004..825aadf5 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 1.84 2007/10/13 12:25:26 kls Exp $ + * $Id: device.h 1.85 2007/10/14 13:09:12 kls Exp $ */ #ifndef __DEVICE_H @@ -308,6 +308,11 @@ public: ///< Opens a file handle for the given filter data. ///< A derived device that provides section data must ///< implement this function. + 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), + ///< a derived class need not implement this function, because this + ///< is done by the default implementation. void AttachFilter(cFilter *Filter); ///< Attaches the given filter to this device. void Detach(cFilter *Filter); diff --git a/dvbdevice.c b/dvbdevice.c index 5864f49e..1a396064 100644 --- a/dvbdevice.c +++ b/dvbdevice.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.c 1.166 2007/10/13 11:15:50 kls Exp $ + * $Id: dvbdevice.c 1.167 2007/10/14 12:56:03 kls Exp $ */ #include "dvbdevice.h" @@ -711,6 +711,11 @@ int cDvbDevice::OpenFilter(u_short Pid, u_char Tid, u_char Mask) return -1; } +void cDvbDevice::CloseFilter(int Handle) +{ + close(Handle); +} + void cDvbDevice::TurnOffLiveMode(bool LiveView) { if (LiveView) { diff --git a/dvbdevice.h b/dvbdevice.h index 63c38d15..75572769 100644 --- a/dvbdevice.h +++ b/dvbdevice.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.h 1.44 2007/02/25 12:23:57 kls Exp $ + * $Id: dvbdevice.h 1.45 2007/10/14 13:01:25 kls Exp $ */ #ifndef __DVBDEVICE_H @@ -83,6 +83,7 @@ protected: protected: virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask); + virtual void CloseFilter(int Handle); // Common Interface facilities: diff --git a/sections.c b/sections.c index 041f5380..afb4f0bd 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.14 2005/09/18 09:33:40 kls Exp $ + * $Id: sections.c 1.15 2007/10/14 12:52:07 kls Exp $ */ #include "sections.h" @@ -105,7 +105,7 @@ void cSectionHandler::Del(const cFilterData *FilterData) for (fh = filterHandles.First(); fh; fh = filterHandles.Next(fh)) { if (fh->filterData.Is(FilterData->pid, FilterData->tid, FilterData->mask)) { if (--fh->used <= 0) { - close(fh->handle); + device->CloseFilter(fh->handle); filterHandles.Del(fh); break; }