From c4cc5e613ccfbf573a7ed66d17702581ef00e376 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 2 Apr 2017 12:13:15 +0200 Subject: [PATCH] The cEvent class now has a new member 'aux' --- CONTRIBUTORS | 1 + HISTORY | 4 ++++ epg.c | 18 +++++++++++++++++- epg.h | 5 ++++- vdr.5 | 33 +++++++++++++++++++-------------- 5 files changed, 45 insertions(+), 16 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 564430e7..bbcc13ee 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2620,6 +2620,7 @@ J for adding Begin/EndSegmentTransfer() to the EPG handler interface for making cEpgHandlers::BeginSegmentTransfer() boolean for suggesting to change tEventID back to u_int32_t + for adding the 'aux' member to cEvent Peter Pinnau for reporting that 'uint32_t' requires including stdint.h in font.h on some systems diff --git a/HISTORY b/HISTORY index 0350a500..fc10b912 100644 --- a/HISTORY +++ b/HISTORY @@ -8940,3 +8940,7 @@ Video Disk Recorder Revision History - 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 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. diff --git a/epg.c b/epg.c index 7cf7cdbc..c67b6456 100644 --- a/epg.c +++ b/epg.c @@ -7,7 +7,7 @@ * Original version (as used in VDR before 1.3.0) written by * Robert Schneider and Rolf Hakenes . * - * $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" @@ -129,6 +129,7 @@ cEvent::cEvent(tEventID EventID) startTime = 0; duration = 0; vps = 0; + aux = NULL; SetSeen(); } @@ -137,6 +138,7 @@ cEvent::~cEvent() free(title); free(shortText); free(description); + free(aux); delete components; } @@ -237,6 +239,12 @@ void cEvent::SetSeen(void) seen = time(NULL); } +void cEvent::SetAux(const char *Aux) +{ + free(aux); + aux = Aux ? strdup(Aux) : NULL; +} + cString cEvent::ToDescr(void) const { char vpsbuf[64] = ""; @@ -469,6 +477,11 @@ void cEvent::Dump(FILE *f, const char *Prefix, bool InfoOnly) const } if (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) fprintf(f, "%se\n", Prefix); } @@ -507,6 +520,9 @@ bool cEvent::Parse(char *s) break; case 'V': SetVps(atoi(t)); break; + case '@': strreplace(t, '|', '\n'); + SetAux(t); + break; default: esyslog("ERROR: unexpected tag while reading EPG data: %s", s); return false; } diff --git a/epg.h b/epg.h index afadb82c..1341aa2e 100644 --- a/epg.h +++ b/epg.h @@ -7,7 +7,7 @@ * Original version (as used in VDR before 1.3.0) written by * Robert Schneider and Rolf Hakenes . * - * $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 @@ -89,6 +89,7 @@ private: uchar contents[MaxEventContents]; // Contents of this event 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 + char *aux; // Auxiliary data, for use with plugins public: cEvent(tEventID EventID); ~cEvent(); @@ -111,6 +112,7 @@ public: time_t Vps(void) const { return vps; } time_t Seen(void) const { return seen; } bool SeenWithin(int Seconds) const { return time(NULL) - seen < Seconds; } + const char *Aux(void) const { return aux; } void IncNumTimers(void) const; void DecNumTimers(void) const; bool HasTimer(void) const { return numTimers > 0; } @@ -135,6 +137,7 @@ public: void SetDuration(int Duration); void SetVps(time_t Vps); void SetSeen(void); + void SetAux(const char *Aux); cString ToDescr(void) const; void Dump(FILE *f, const char *Prefix = "", bool InfoOnly = false) const; bool Parse(char *s); diff --git a/vdr.5 b/vdr.5 index 947bdc72..8375aa4a 100644 --- a/vdr.5 +++ b/vdr.5 @@ -8,7 +8,7 @@ .\" License as specified in the file COPYING that comes with the .\" 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" .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: .TS -tab (@); +tab (|); l l. -\fBC\fR@ -\fBE\fR@ -\fBT\fR@ -\fBS\fR@<short text> -\fBD\fR@<description> -\fBG\fR@<genre> <genre>... -\fBR\fR@<parental rating> -\fBX\fR@<stream> <type> <language> <descr> -\fBV\fR@<vps time> -\fBe\fR@ -\fBc\fR@ +\fBC\fR|<channel id> <channel name> +\fBE\fR|<event id> <start time> <duration> <table id> <version> +\fBT\fR|<title> +\fBS\fR|<short text> +\fBD\fR|<description> +\fBG\fR|<genre> <genre>... +\fBR\fR|<parental rating> +\fBX\fR|<stream> <type> <language> <descr> +\fBV\fR|<vps time> +\fB@\fR|<auxiliary data> +\fBe\fR| +\fBc\fR| .TE 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.) the event provides. - .TS tab (@); l l. @@ -890,6 +890,7 @@ l l. <language> @is the three letter language code (optionally two codes, separated by '+') <descr> @is the description of this stream component <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 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 be used, so that external tools can generate EPG data that is guaranteed 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 The file \fIcam.data\fR contains information about which CAM in the system can decrypt a particular channel.