mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	Added a new plugin interface for implementing EPG handlers
This commit is contained in:
		
							
								
								
									
										154
									
								
								epg.c
									
									
									
									
									
								
							
							
						
						
									
										154
									
								
								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 2.11 2012/02/13 14:58:19 kls Exp $ | ||||
|  * $Id: epg.c 2.12 2012/03/10 13:14:27 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "epg.h" | ||||
| @@ -114,7 +114,7 @@ cEvent::cEvent(tEventID EventID) | ||||
| { | ||||
|   schedule = NULL; | ||||
|   eventID = EventID; | ||||
|   tableID = 0; | ||||
|   tableID = 0xFF; // actual table ids are 0x4E..0x60 | ||||
|   version = 0xFF; // actual version numbers are 0..31 | ||||
|   runningStatus = SI::RunningStatusUndefined; | ||||
|   title = NULL; | ||||
| @@ -1296,3 +1296,153 @@ void cEpgDataReader::Action(void) | ||||
| { | ||||
|   cSchedules::Read(); | ||||
| } | ||||
|  | ||||
| // --- cEpgHandler ----------------------------------------------------------- | ||||
|  | ||||
| cEpgHandler::cEpgHandler(void) | ||||
| { | ||||
|   EpgHandlers.Add(this); | ||||
| } | ||||
|  | ||||
| cEpgHandler::~cEpgHandler() | ||||
| { | ||||
|   EpgHandlers.Del(this, false); | ||||
| } | ||||
|  | ||||
| // --- cEpgHandlers ---------------------------------------------------------- | ||||
|  | ||||
| cEpgHandlers EpgHandlers; | ||||
|  | ||||
| bool cEpgHandlers::IgnoreChannel(const cChannel *Channel) | ||||
| { | ||||
|   for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { | ||||
|       if (eh->IgnoreChannel(Channel)) | ||||
|          return true; | ||||
|       } | ||||
|   return false; | ||||
| } | ||||
|  | ||||
| bool cEpgHandlers::HandleEitEvent(cSchedule *Schedule, const SI::EIT::Event *EitEvent, uchar TableID, uchar Version) | ||||
| { | ||||
|   for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { | ||||
|       if (eh->HandleEitEvent(Schedule, EitEvent, TableID, Version)) | ||||
|          return true; | ||||
|       } | ||||
|   return false; | ||||
| } | ||||
|  | ||||
| void cEpgHandlers::SetEventID(cEvent *Event, tEventID EventID) | ||||
| { | ||||
|   for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { | ||||
|       if (eh->SetEventID(Event, EventID)) | ||||
|          return; | ||||
|       } | ||||
|   Event->SetEventID(EventID); | ||||
| } | ||||
|  | ||||
| void cEpgHandlers::SetTitle(cEvent *Event, const char *Title) | ||||
| { | ||||
|   for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { | ||||
|       if (eh->SetTitle(Event, Title)) | ||||
|          return; | ||||
|       } | ||||
|   Event->SetTitle(Title); | ||||
| } | ||||
|  | ||||
| void cEpgHandlers::SetShortText(cEvent *Event, const char *ShortText) | ||||
| { | ||||
|   for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { | ||||
|       if (eh->SetShortText(Event, ShortText)) | ||||
|          return; | ||||
|       } | ||||
|   Event->SetShortText(ShortText); | ||||
| } | ||||
|  | ||||
| void cEpgHandlers::SetDescription(cEvent *Event, const char *Description) | ||||
| { | ||||
|   for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { | ||||
|       if (eh->SetDescription(Event, Description)) | ||||
|          return; | ||||
|       } | ||||
|   Event->SetDescription(Description); | ||||
| } | ||||
|  | ||||
| void cEpgHandlers::SetContents(cEvent *Event, uchar *Contents) | ||||
| { | ||||
|   for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { | ||||
|       if (eh->SetContents(Event, Contents)) | ||||
|          return; | ||||
|       } | ||||
|   Event->SetContents(Contents); | ||||
| } | ||||
|  | ||||
| void cEpgHandlers::SetParentalRating(cEvent *Event, int ParentalRating) | ||||
| { | ||||
|   for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { | ||||
|       if (eh->SetParentalRating(Event, ParentalRating)) | ||||
|          return; | ||||
|       } | ||||
|   Event->SetParentalRating(ParentalRating); | ||||
| } | ||||
|  | ||||
| void cEpgHandlers::SetStartTime(cEvent *Event, time_t StartTime) | ||||
| { | ||||
|   for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { | ||||
|       if (eh->SetStartTime(Event, StartTime)) | ||||
|          return; | ||||
|       } | ||||
|   Event->SetStartTime(StartTime); | ||||
| } | ||||
|  | ||||
| void cEpgHandlers::SetDuration(cEvent *Event, int Duration) | ||||
| { | ||||
|   for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { | ||||
|       if (eh->SetDuration(Event, Duration)) | ||||
|          return; | ||||
|       } | ||||
|   Event->SetDuration(Duration); | ||||
| } | ||||
|  | ||||
| void cEpgHandlers::SetVps(cEvent *Event, time_t Vps) | ||||
| { | ||||
|   for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { | ||||
|       if (eh->SetVps(Event, Vps)) | ||||
|          return; | ||||
|       } | ||||
|   Event->SetVps(Vps); | ||||
| } | ||||
|  | ||||
| void cEpgHandlers::FixEpgBugs(cEvent *Event) | ||||
| { | ||||
|   for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { | ||||
|       if (eh->FixEpgBugs(Event)) | ||||
|          return; | ||||
|       } | ||||
|   Event->FixEpgBugs(); | ||||
| } | ||||
|  | ||||
| void cEpgHandlers::HandleEvent(cEvent *Event) | ||||
| { | ||||
|   for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { | ||||
|       if (eh->HandleEvent(Event)) | ||||
|          break; | ||||
|       } | ||||
| } | ||||
|  | ||||
| void cEpgHandlers::SortSchedule(cSchedule *Schedule) | ||||
| { | ||||
|   for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { | ||||
|       if (eh->SortSchedule(Schedule)) | ||||
|          return; | ||||
|       } | ||||
|   Schedule->Sort(); | ||||
| } | ||||
|  | ||||
| void cEpgHandlers::DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version) | ||||
| { | ||||
|   for (cEpgHandler *eh = First(); eh; eh = Next(eh)) { | ||||
|       if (eh->DropOutdated(Schedule, SegmentStart, SegmentEnd, TableID, Version)) | ||||
|          return; | ||||
|       } | ||||
|   Schedule->DropOutdated(SegmentStart, SegmentEnd, TableID, Version); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user