1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Added Begin/EndSegmentTransfer() to the EPG handler interface

This commit is contained in:
Klaus Schmidinger 2013-08-23 10:54:49 +02:00
parent 9492231058
commit f0537ea0f1
5 changed files with 31 additions and 3 deletions

View File

@ -2550,6 +2550,7 @@ J
for reporting that cPlugin::Active() was called too often for reporting that cPlugin::Active() was called too often
for adding HandledExternally() to the EPG handler interface for adding HandledExternally() to the EPG handler interface
for adding IsUpdate() to the EPG handler interface for adding IsUpdate() to the EPG handler interface
for adding Begin/EndSegmentTransfer() to the EPG handler interface
Peter Pinnau <vdr@unterbrecher.de> Peter Pinnau <vdr@unterbrecher.de>
for reporting that 'uint32_t' requires including stdint.h in font.h on some systems for reporting that 'uint32_t' requires including stdint.h in font.h on some systems

View File

@ -7884,3 +7884,4 @@ Video Disk Recorder Revision History
Manfred Völkel and Oliver Endriss). Manfred Völkel and Oliver Endriss).
- Reverted the change from version 1.5.7 that made all logging go to LOG_ERR (thanks - Reverted the change from version 1.5.7 that made all logging go to LOG_ERR (thanks
to Christopher Reimer). to Christopher Reimer).
- Added Begin/EndSegmentTransfer() to the EPG handler interface (thanks to Jörg Wendel).

4
eit.c
View File

@ -8,7 +8,7 @@
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * 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>. * Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg <marcel.wiesweg@gmx.de>.
* *
* $Id: eit.c 2.23 2012/12/04 11:10:10 kls Exp $ * $Id: eit.c 3.1 2013/08/23 10:52:27 kls Exp $
*/ */
#include "eit.h" #include "eit.h"
@ -46,6 +46,7 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bo
return; return;
} }
EpgHandlers.BeginSegmentTransfer(channel, OnlyRunningStatus);
bool handledExternally = EpgHandlers.HandledExternally(channel); bool handledExternally = EpgHandlers.HandledExternally(channel);
cSchedule *pSchedule = (cSchedule *)Schedules->GetSchedule(channel, true); cSchedule *pSchedule = (cSchedule *)Schedules->GetSchedule(channel, true);
@ -310,6 +311,7 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bo
Schedules->SetModified(pSchedule); Schedules->SetModified(pSchedule);
} }
Channels.Unlock(); Channels.Unlock();
EpgHandlers.EndSegmentTransfer(Modified, OnlyRunningStatus);
} }
// --- cTDT ------------------------------------------------------------------ // --- cTDT ------------------------------------------------------------------

18
epg.c
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by * Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
* *
* $Id: epg.c 2.23 2013/02/17 14:12:07 kls Exp $ * $Id: epg.c 3.1 2013/08/23 10:46:33 kls Exp $
*/ */
#include "epg.h" #include "epg.h"
@ -1537,3 +1537,19 @@ void cEpgHandlers::DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t
} }
Schedule->DropOutdated(SegmentStart, SegmentEnd, TableID, Version); Schedule->DropOutdated(SegmentStart, SegmentEnd, TableID, Version);
} }
void cEpgHandlers::BeginSegmentTransfer(const cChannel *Channel, bool OnlyRunningStatus)
{
for (cEpgHandler *eh = First(); eh; eh = Next(eh)) {
if (eh->BeginSegmentTransfer(Channel, OnlyRunningStatus))
return;
}
}
void cEpgHandlers::EndSegmentTransfer(bool Modified, bool OnlyRunningStatus)
{
for (cEpgHandler *eh = First(); eh; eh = Next(eh)) {
if (eh->EndSegmentTransfer(Modified, OnlyRunningStatus))
return;
}
}

10
epg.h
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by * Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
* *
* $Id: epg.h 2.15 2012/09/24 12:53:53 kls Exp $ * $Id: epg.h 3.1 2013/08/23 10:50:05 kls Exp $
*/ */
#ifndef __EPG_H #ifndef __EPG_H
@ -273,6 +273,12 @@ public:
virtual bool DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version) { return false; } virtual bool DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version) { return false; }
///< Takes a look at all EPG events between SegmentStart and SegmentEnd and ///< Takes a look at all EPG events between SegmentStart and SegmentEnd and
///< drops outdated events. ///< drops outdated events.
virtual bool BeginSegmentTransfer(const cChannel *Channel, bool OnlyRunningStatus) { return false; }
///< Called directly after IgnoreChannel() before any other handler method is called.
///< Designed to give handlers the possibility to prepare a database transaction.
virtual bool EndSegmentTransfer(bool Modified, bool OnlyRunningStatus) { return false; }
///< Called after the segment data has been processed.
///< At this point handlers should close/commit/rollback any pending database transactions.
}; };
class cEpgHandlers : public cList<cEpgHandler> { class cEpgHandlers : public cList<cEpgHandler> {
@ -295,6 +301,8 @@ public:
void HandleEvent(cEvent *Event); void HandleEvent(cEvent *Event);
void SortSchedule(cSchedule *Schedule); void SortSchedule(cSchedule *Schedule);
void DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version); void DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version);
void BeginSegmentTransfer(const cChannel *Channel, bool OnlyRunningStatus);
void EndSegmentTransfer(bool Modified, bool OnlyRunningStatus);
}; };
extern cEpgHandlers EpgHandlers; extern cEpgHandlers EpgHandlers;