From 4743fc349ce4719585857ca58efcdb73c786ec53 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 3 Jan 2010 15:45:23 +0100 Subject: After a CLRE command, no further EPG processing is now done for 10 seconds --- CONTRIBUTORS | 1 + HISTORY | 3 +++ eit.c | 15 ++++++++++++++- eit.h | 5 ++++- svdrp.c | 11 +++++++++-- 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index ca992d0e..93afd89f 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -602,6 +602,7 @@ Helmut Auer for making the SVDRP command PUTE support reading the EPG data from a given file for a patch that was used to implement the command line options --edit and --genindex + for suggesting to disable EPG processing for a while after a CLRE command Jeremy Hall for fixing an incomplete initialization of the filter parameters in eit.c diff --git a/HISTORY b/HISTORY index 89043668..8353b9ab 100644 --- a/HISTORY +++ b/HISTORY @@ -6267,3 +6267,6 @@ Video Disk Recorder Revision History IMPORTANT NOTE: if VDR doesn't display a parental rating, this does not necessarily mean that the given programme is suitable for all audiences! - Rearranged cEvent members to minimize memory waste. +- After a CLRE command, no further EPG processing is now done for 10 seconds, + so that data sent with subsequent PUTE commands doesn't interfere with data + from the broadcasters (suggested by Helmut Auer). diff --git a/eit.c b/eit.c index 15a2ac62..72d05cb6 100644 --- a/eit.c +++ b/eit.c @@ -8,7 +8,7 @@ * Robert Schneider and Rolf Hakenes . * Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg . * - * $Id: eit.c 2.9 2010/01/03 13:39:48 kls Exp $ + * $Id: eit.c 2.10 2010/01/03 15:35:21 kls Exp $ */ #include "eit.h" @@ -351,6 +351,8 @@ cTDT::cTDT(const u_char *Data) // --- cEitFilter ------------------------------------------------------------ +time_t cEitFilter::disableUntil = 0; + cEitFilter::cEitFilter(void) { Set(0x12, 0x40, 0xC0); // event info now&next actual/other TS (0x4E/0x4F), future actual/other TS (0x5X/0x6X) @@ -358,8 +360,19 @@ cEitFilter::cEitFilter(void) Set(0x14, 0x70); // TDT } +void cEitFilter::SetDisableUntil(time_t Time) +{ + disableUntil = Time; +} + void cEitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length) { + if (disableUntil) { + if (time(NULL) > disableUntil) + disableUntil = 0; + else + return; + } switch (Pid) { case 0x12: { if (Tid >= 0x4E && Tid <= 0x6F) { diff --git a/eit.h b/eit.h index c57dd519..b5523728 100644 --- a/eit.h +++ b/eit.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: eit.h 1.30 2003/12/21 14:51:50 kls Exp $ + * $Id: eit.h 2.1 2010/01/03 15:28:34 kls Exp $ */ #ifndef __EIT_H @@ -13,10 +13,13 @@ #include "filter.h" class cEitFilter : public cFilter { +private: + static time_t disableUntil; protected: virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length); public: cEitFilter(void); + static void SetDisableUntil(time_t Time); }; #endif //__EIT_H diff --git a/svdrp.c b/svdrp.c index 5729052a..b181fcd5 100644 --- a/svdrp.c +++ b/svdrp.c @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * graphical interface that sits on top of an SVDRP connection. * - * $Id: svdrp.c 2.6 2009/10/18 14:08:58 kls Exp $ + * $Id: svdrp.c 2.7 2010/01/03 15:41:26 kls Exp $ */ #include "svdrp.h" @@ -179,6 +179,8 @@ bool cPUTEhandler::Process(const char *s) // --- cSVDRP ---------------------------------------------------------------- #define MAXHELPTOPIC 10 +#define EITDISABLETIME 10 // seconds until EIT processing is enabled again after a CLRE command + // adjust the help for CLRE accordingly if changing this! const char *HelpPages[] = { "CHAN [ + | - | | | ]\n" @@ -187,7 +189,10 @@ const char *HelpPages[] = { " it returns the current channel number and name.", "CLRE [ | | ]\n" " Clear the EPG list of the given channel number, name or id.\n" - " Without option it clears the entire EPG list.", + " Without option it clears the entire EPG list.\n" + " After a CLRE command, no further EPG processing is done for 10\n" + " seconds, so that data sent with subsequent PUTE commands doesn't\n" + " interfere with data from the broadcasters.", "DELC \n" " Delete channel.", "DELR \n" @@ -574,6 +579,7 @@ void cSVDRP::CmdCLRE(const char *Option) } if (Schedule) { Schedule->Cleanup(INT_MAX); + cEitFilter::SetDisableUntil(time(NULL) + EITDISABLETIME); Reply(250, "EPG data of channel \"%s\" cleared", Option); } else { @@ -589,6 +595,7 @@ void cSVDRP::CmdCLRE(const char *Option) } else { cSchedules::ClearAll(); + cEitFilter::SetDisableUntil(time(NULL) + EITDISABLETIME); Reply(250, "EPG data cleared"); } } -- cgit v1.2.3