mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	EPG events that are no longer in the currently broadcasted data stream are now automatically deleted
This commit is contained in:
		
							
								
								
									
										4
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								HISTORY
									
									
									
									
									
								
							| @@ -3963,7 +3963,7 @@ Video Disk Recorder Revision History | ||||
|   commands may now be executed at any time, and the message will be displayed | ||||
|   (no more "pending message"). | ||||
|  | ||||
| 2005-12-25: Version 1.3.38 | ||||
| 2005-12-26: Version 1.3.38 | ||||
|  | ||||
| - Fixed handling second audio and Dolby Digital PIDs for encrypted channels | ||||
|   (was broken in version 1.3.37). | ||||
| @@ -3993,3 +3993,5 @@ Video Disk Recorder Revision History | ||||
|   recording or replay stops, etc. | ||||
| - The version number of EPG events is now also stored in the epg.data file | ||||
|   (thanks to Kendy Kutzner). | ||||
| - EPG events that are no longer in the currently broadcasted data stream are | ||||
|   now automatically deleted. | ||||
|   | ||||
							
								
								
									
										8
									
								
								eit.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								eit.c
									
									
									
									
									
								
							| @@ -8,7 +8,7 @@ | ||||
|  * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. | ||||
|  * Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg <marcel.wiesweg@gmx.de>. | ||||
|  * | ||||
|  * $Id: eit.c 1.112 2005/11/04 14:19:16 kls Exp $ | ||||
|  * $Id: eit.c 1.113 2005/12/26 11:50:09 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "eit.h" | ||||
| @@ -43,6 +43,8 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data) | ||||
|  | ||||
|   bool Empty = true; | ||||
|   bool Modified = false; | ||||
|   time_t SegmentStart = 0; | ||||
|   time_t SegmentEnd = 0; | ||||
|  | ||||
|   SI::EIT::Event SiEitEvent; | ||||
|   for (SI::Loop::Iterator it; eventLoop.getNext(SiEitEvent, it); ) { | ||||
| @@ -50,6 +52,9 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data) | ||||
|       if (SiEitEvent.getStartTime() == 0 || SiEitEvent.getStartTime() > 0 && SiEitEvent.getDuration() == 0) | ||||
|          continue; | ||||
|       Empty = false; | ||||
|       if (!SegmentStart) | ||||
|          SegmentStart = SiEitEvent.getStartTime(); | ||||
|       SegmentEnd = SiEitEvent.getStartTime() + SiEitEvent.getDuration(); | ||||
|       cEvent *newEvent = NULL; | ||||
|       cEvent *rEvent = NULL; | ||||
|       cEvent *pEvent = (cEvent *)pSchedule->GetEvent(SiEitEvent.getEventId(), SiEitEvent.getStartTime()); | ||||
| @@ -242,6 +247,7 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data) | ||||
|      pSchedule->SetPresentSeen(); | ||||
|   if (Modified) { | ||||
|      pSchedule->Sort(); | ||||
|      pSchedule->DropOutdated(SegmentStart, SegmentEnd, Tid, getVersionNumber()); | ||||
|      Schedules->SetModified(pSchedule); | ||||
|      } | ||||
| } | ||||
|   | ||||
							
								
								
									
										23
									
								
								epg.c
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								epg.c
									
									
									
									
									
								
							| @@ -7,7 +7,7 @@ | ||||
|  * Original version (as used in VDR before 1.3.0) written by | ||||
|  * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. | ||||
|  * | ||||
|  * $Id: epg.c 1.41 2005/12/25 11:11:17 kls Exp $ | ||||
|  * $Id: epg.c 1.42 2005/12/26 14:44:03 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "epg.h" | ||||
| @@ -739,6 +739,27 @@ void cSchedule::Sort(void) | ||||
|   events.Sort(); | ||||
| } | ||||
|  | ||||
| void cSchedule::DropOutdated(time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version) | ||||
| { | ||||
|   if (SegmentStart > 0 && SegmentEnd > 0) { | ||||
|      for (cEvent *p = events.First(); p; p = events.Next(p)) { | ||||
|          if (!(p->EndTime() <= SegmentStart || p->StartTime() >= SegmentEnd)) { | ||||
|             // The event overlaps with the given time segment. | ||||
|             if (p->TableID() > TableID || p->TableID() == TableID && p->Version() != Version) { | ||||
|                // The segment overwrites all events from tables with higher ids, and | ||||
|                // within the same table id all events must have the same version. | ||||
|                // We can't delete the event right here because a timer might have | ||||
|                // a pointer to it, so let's set its id and start time to 0 to have it | ||||
|                // "phased out": | ||||
|                UnhashEvent(p); | ||||
|                p->eventID = 0; | ||||
|                p->startTime = 0; | ||||
|                } | ||||
|             } | ||||
|          } | ||||
|      } | ||||
| } | ||||
|  | ||||
| void cSchedule::Cleanup(void) | ||||
| { | ||||
|   Cleanup(time(NULL)); | ||||
|   | ||||
							
								
								
									
										3
									
								
								epg.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								epg.h
									
									
									
									
									
								
							| @@ -7,7 +7,7 @@ | ||||
|  * Original version (as used in VDR before 1.3.0) written by | ||||
|  * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. | ||||
|  * | ||||
|  * $Id: epg.h 1.26 2005/09/11 12:54:30 kls Exp $ | ||||
|  * $Id: epg.h 1.27 2005/12/26 11:59:44 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #ifndef __EPG_H | ||||
| @@ -128,6 +128,7 @@ public: | ||||
|   void ClrRunningStatus(cChannel *Channel = NULL); | ||||
|   void ResetVersions(void); | ||||
|   void Sort(void); | ||||
|   void DropOutdated(time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version); | ||||
|   void Cleanup(time_t Time); | ||||
|   void Cleanup(void); | ||||
|   cEvent *AddEvent(cEvent *Event); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user