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

The cEvent class now has a new member 'aux'

This commit is contained in:
Klaus Schmidinger 2017-04-02 12:13:15 +02:00
parent 0a5a7893a5
commit c4cc5e613c
5 changed files with 45 additions and 16 deletions

View File

@ -2620,6 +2620,7 @@ J
for adding Begin/EndSegmentTransfer() to the EPG handler interface for adding Begin/EndSegmentTransfer() to the EPG handler interface
for making cEpgHandlers::BeginSegmentTransfer() boolean for making cEpgHandlers::BeginSegmentTransfer() boolean
for suggesting to change tEventID back to u_int32_t for suggesting to change tEventID back to u_int32_t
for adding the 'aux' member to cEvent
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

@ -8940,3 +8940,7 @@ Video Disk Recorder Revision History
- The file 'cam.data' is no longer written if it is read-only. - The file 'cam.data' is no longer written if it is read-only.
- Detecting whether a particular CAM actually decrypts a given channel is now - Detecting whether a particular CAM actually decrypts a given channel is now
done separately for each receiver. done separately for each receiver.
- The cEvent class now has a new member 'aux', in which external applications can
store auxiliary information with an event (thanks to Jörg Wendel). This string
has no meaning whatsoever to VDR itself, and it will not be written into the
info file of a recording that is made for such an event.

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 4.3 2017/03/31 15:16:46 kls Exp $ * $Id: epg.c 4.4 2017/04/02 11:34:15 kls Exp $
*/ */
#include "epg.h" #include "epg.h"
@ -129,6 +129,7 @@ cEvent::cEvent(tEventID EventID)
startTime = 0; startTime = 0;
duration = 0; duration = 0;
vps = 0; vps = 0;
aux = NULL;
SetSeen(); SetSeen();
} }
@ -137,6 +138,7 @@ cEvent::~cEvent()
free(title); free(title);
free(shortText); free(shortText);
free(description); free(description);
free(aux);
delete components; delete components;
} }
@ -237,6 +239,12 @@ void cEvent::SetSeen(void)
seen = time(NULL); seen = time(NULL);
} }
void cEvent::SetAux(const char *Aux)
{
free(aux);
aux = Aux ? strdup(Aux) : NULL;
}
cString cEvent::ToDescr(void) const cString cEvent::ToDescr(void) const
{ {
char vpsbuf[64] = ""; char vpsbuf[64] = "";
@ -469,6 +477,11 @@ void cEvent::Dump(FILE *f, const char *Prefix, bool InfoOnly) const
} }
if (vps) if (vps)
fprintf(f, "%sV %ld\n", Prefix, vps); fprintf(f, "%sV %ld\n", Prefix, vps);
if (!InfoOnly && !isempty(aux)) {
strreplace(aux, '\n', '|');
fprintf(f, "%s@ %s\n", Prefix, aux);
strreplace(aux, '|', '\n');
}
if (!InfoOnly) if (!InfoOnly)
fprintf(f, "%se\n", Prefix); fprintf(f, "%se\n", Prefix);
} }
@ -507,6 +520,9 @@ bool cEvent::Parse(char *s)
break; break;
case 'V': SetVps(atoi(t)); case 'V': SetVps(atoi(t));
break; break;
case '@': strreplace(t, '|', '\n');
SetAux(t);
break;
default: esyslog("ERROR: unexpected tag while reading EPG data: %s", s); default: esyslog("ERROR: unexpected tag while reading EPG data: %s", s);
return false; return false;
} }

5
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 4.3 2017/04/01 12:27:28 kls Exp $ * $Id: epg.h 4.4 2017/04/02 11:22:21 kls Exp $
*/ */
#ifndef __EPG_H #ifndef __EPG_H
@ -89,6 +89,7 @@ private:
uchar contents[MaxEventContents]; // Contents of this event uchar contents[MaxEventContents]; // Contents of this event
time_t vps; // Video Programming Service timestamp (VPS, aka "Programme Identification Label", PIL) time_t vps; // Video Programming Service timestamp (VPS, aka "Programme Identification Label", PIL)
time_t seen; // When this event was last seen in the data stream time_t seen; // When this event was last seen in the data stream
char *aux; // Auxiliary data, for use with plugins
public: public:
cEvent(tEventID EventID); cEvent(tEventID EventID);
~cEvent(); ~cEvent();
@ -111,6 +112,7 @@ public:
time_t Vps(void) const { return vps; } time_t Vps(void) const { return vps; }
time_t Seen(void) const { return seen; } time_t Seen(void) const { return seen; }
bool SeenWithin(int Seconds) const { return time(NULL) - seen < Seconds; } bool SeenWithin(int Seconds) const { return time(NULL) - seen < Seconds; }
const char *Aux(void) const { return aux; }
void IncNumTimers(void) const; void IncNumTimers(void) const;
void DecNumTimers(void) const; void DecNumTimers(void) const;
bool HasTimer(void) const { return numTimers > 0; } bool HasTimer(void) const { return numTimers > 0; }
@ -135,6 +137,7 @@ public:
void SetDuration(int Duration); void SetDuration(int Duration);
void SetVps(time_t Vps); void SetVps(time_t Vps);
void SetSeen(void); void SetSeen(void);
void SetAux(const char *Aux);
cString ToDescr(void) const; cString ToDescr(void) const;
void Dump(FILE *f, const char *Prefix = "", bool InfoOnly = false) const; void Dump(FILE *f, const char *Prefix = "", bool InfoOnly = false) const;
bool Parse(char *s); bool Parse(char *s);

33
vdr.5
View File

@ -8,7 +8,7 @@
.\" License as specified in the file COPYING that comes with the .\" License as specified in the file COPYING that comes with the
.\" vdr distribution. .\" vdr distribution.
.\" .\"
.\" $Id: vdr.5 4.1 2017/01/09 13:35:08 kls Exp $ .\" $Id: vdr.5 4.2 2017/04/02 11:41:51 kls Exp $
.\" .\"
.TH vdr 5 "19 Feb 2015" "2.2" "Video Disk Recorder Files" .TH vdr 5 "19 Feb 2015" "2.2" "Video Disk Recorder Files"
.SH NAME .SH NAME
@ -845,19 +845,20 @@ The first character of each line defines what kind of data this line contains.
The following tag characters are defined: The following tag characters are defined:
.TS .TS
tab (@); tab (|);
l l. l l.
\fBC\fR@<channel id> <channel name> \fBC\fR|<channel id> <channel name>
\fBE\fR@<event id> <start time> <duration> <table id> <version> \fBE\fR|<event id> <start time> <duration> <table id> <version>
\fBT\fR@<title> \fBT\fR|<title>
\fBS\fR@<short text> \fBS\fR|<short text>
\fBD\fR@<description> \fBD\fR|<description>
\fBG\fR@<genre> <genre>... \fBG\fR|<genre> <genre>...
\fBR\fR@<parental rating> \fBR\fR|<parental rating>
\fBX\fR@<stream> <type> <language> <descr> \fBX\fR|<stream> <type> <language> <descr>
\fBV\fR@<vps time> \fBV\fR|<vps time>
\fBe\fR@ \fB@\fR|<auxiliary data>
\fBc\fR@ \fBe\fR|
\fBc\fR|
.TE .TE
Lowercase characters mark the end of a sequence that was started by the Lowercase characters mark the end of a sequence that was started by the
@ -869,7 +870,6 @@ should at least have a \fBT\fR entry).
There may be several \fBX\fR tags, depending on the number of tracks (video, audio etc.) There may be several \fBX\fR tags, depending on the number of tracks (video, audio etc.)
the event provides. the event provides.
.TS .TS
tab (@); tab (@);
l l. l l.
@ -890,6 +890,7 @@ l l.
<language> @is the three letter language code (optionally two codes, separated by '+') <language> @is the three letter language code (optionally two codes, separated by '+')
<descr> @is the description of this stream component <descr> @is the description of this stream component
<vps time> @is the Video Programming Service time of this event <vps time> @is the Video Programming Service time of this event
<auxiliary data>@is an arbitrary string that can be used by external applications to store data; newline characters will be replaced with '|' when writing the \fIepg.data\fR file.
.TE .TE
This file will be read at program startup in order to restore the results of This file will be read at program startup in order to restore the results of
@ -899,6 +900,10 @@ Note that the \fBevent id\fR that comes from the DVB data stream is actually
just 16 bit wide. The internal representation in VDR allows for 32 bit to just 16 bit wide. The internal representation in VDR allows for 32 bit to
be used, so that external tools can generate EPG data that is guaranteed be used, so that external tools can generate EPG data that is guaranteed
not to collide with the ids of existing data. not to collide with the ids of existing data.
The \fBauxiliary data\fR can be used for plugin specific purposes and has no meaning
whatsoever to VDR itself. It will \fBnot\fR be written into the \fIinfo\fR file of
a recording that is made for such an event.
.SS CAM DATA .SS CAM DATA
The file \fIcam.data\fR contains information about which CAM in the system can The file \fIcam.data\fR contains information about which CAM in the system can
decrypt a particular channel. decrypt a particular channel.