From bd62ca6abc61827dd75962e952783acf83565949 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 31 Oct 2004 13:01:35 +0100 Subject: Added the 'portal name' to cChannels --- CONTRIBUTORS | 1 + HISTORY | 1 + channels.c | 18 +++++++++++++++++- channels.h | 5 ++++- eit.c | 8 +++++--- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 292b8eff..e5a75535 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1068,6 +1068,7 @@ Marco Schl errors don't occur any more for reporting a problem with initialization of the main program loop variables with older compiler versions + for adding the 'portal name' to cChannels Jürgen Schmitz for reporting a bug in displaying the current channel when switching via the SVDRP diff --git a/HISTORY b/HISTORY index 3a94fa43..090b1d9a 100644 --- a/HISTORY +++ b/HISTORY @@ -3103,3 +3103,4 @@ Video Disk Recorder Revision History true to make it return the name, if no short name is available. The sequence of 'name' and 'short name' in the channels.conf file has been swapped (see man vdr(5)). +- Added the 'portal name' to cChannels (thanks to Marco Schlüßler). diff --git a/channels.c b/channels.c index 5c1d82d1..57986e35 100644 --- a/channels.c +++ b/channels.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.c 1.29 2004/10/31 12:52:50 kls Exp $ + * $Id: channels.c 1.30 2004/10/31 12:54:06 kls Exp $ */ #include "channels.h" @@ -169,6 +169,7 @@ cChannel::cChannel(void) name = strdup(""); shortName = strdup(""); provider = strdup(""); + portalName = strdup(""); memset(&__BeginData__, 0, (char *)&__EndData__ - (char *)&__BeginData__); inversion = INVERSION_AUTO; bandwidth = BANDWIDTH_AUTO; @@ -188,6 +189,7 @@ cChannel::cChannel(const cChannel &Channel) name = strdup(""); shortName = strdup(""); provider = strdup(""); + portalName = strdup(""); *this = Channel; vpid = 0; ppid = 0; @@ -227,6 +229,7 @@ cChannel::~cChannel() free(name); free(shortName); free(provider); + free(portalName); } cChannel& cChannel::operator= (const cChannel &Channel) @@ -234,6 +237,7 @@ cChannel& cChannel::operator= (const cChannel &Channel) name = strcpyrealloc(name, Channel.name); shortName = strcpyrealloc(shortName, Channel.shortName); provider = strcpyrealloc(provider, Channel.provider); + portalName = strcpyrealloc(portalName, Channel.portalName); memcpy(&__BeginData__, &Channel.__BeginData__, (char *)&Channel.__EndData__ - (char *)&Channel.__BeginData__); return *this; } @@ -366,6 +370,18 @@ void cChannel::SetName(const char *Name, const char *ShortName, const char *Prov } } +void cChannel::SetPortalName(const char *PortalName) +{ + if (!isempty(PortalName) && strcmp(portalName, PortalName) != 0) { + if (Number()) { + dsyslog("changing portal name of channel %d from '%s' to '%s'", Number(), portalName, PortalName); + modification |= CHANNELMOD_NAME; + Channels.SetModified(); + } + portalName = strcpyrealloc(portalName, PortalName); + } +} + static bool IntArraysDiffer(const int *a, const int *b, const char na[][4] = NULL, const char nb[][4] = NULL) { int i = 0; diff --git a/channels.h b/channels.h index 5d119620..62b00c3c 100644 --- a/channels.h +++ b/channels.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.h 1.21 2004/10/31 12:41:38 kls Exp $ + * $Id: channels.h 1.22 2004/10/31 12:54:26 kls Exp $ */ #ifndef __CHANNELS_H @@ -92,6 +92,7 @@ private: char *name; char *shortName; char *provider; + char *portalName; int __BeginData__; int frequency; // MHz int source; @@ -136,6 +137,7 @@ public: const char *Name(void) const { return name; } const char *ShortName(bool OrName = false) const { return (OrName && isempty(shortName)) ? name : shortName; } const char *Provider(void) const { return provider; } + const char *PortalName(void) const { return portalName; } int Frequency(void) const { return frequency; } ///< Returns the actual frequency, as given in 'channels.conf' int Transponder(void) const; ///< Returns the transponder frequency in MHz, plus the polarization in case of sat static int Transponder(int Frequency, char Polarization); ///< builds the transponder from the given Frequency and Polarization @@ -175,6 +177,7 @@ public: bool SetTerrTransponderData(int Source, int Frequency, int Bandwidth, int Modulation, int Hierarchy, int CodeRateH, int CodeRateL, int Guard, int Transmission); void SetId(int Nid, int Tid, int Sid, int Rid = 0); void SetName(const char *Name, const char *ShortName, const char *Provider); + void SetPortalName(const char *PortalName); void SetPids(int Vpid, int Ppid, int *Apids, char ALangs[][4], int *Dpids, char DLangs[][4], int Tpid); void SetCaIds(const int *CaIds); // list must be zero-terminated void SetCaDescriptors(int Level); diff --git a/eit.c b/eit.c index af22f22e..ed02cf28 100644 --- a/eit.c +++ b/eit.c @@ -8,7 +8,7 @@ * Robert Schneider and Rolf Hakenes . * Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg . * - * $Id: eit.c 1.99 2004/10/31 12:41:04 kls Exp $ + * $Id: eit.c 1.100 2004/10/31 12:56:24 kls Exp $ */ #include "eit.h" @@ -161,10 +161,10 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data) time_t now = time(NULL); bool hit = SiEitEvent.getStartTime() <= now && now < SiEitEvent.getStartTime() + SiEitEvent.getDuration(); if (hit) { + char linkName[ld->privateData.getLength() + 1]; + strn0cpy(linkName, (const char *)ld->privateData.getData(), sizeof(linkName)); cChannel *link = Channels.GetByChannelID(linkID); if (link != channel) { // only link to other channels, not the same one - char linkName[ld->privateData.getLength() + 1]; - strn0cpy(linkName, (const char *)ld->privateData.getData(), sizeof(linkName)); //fprintf(stderr, "Linkage %s %4d %4d %5d %5d %5d %5d %02X '%s'\n", hit ? "*" : "", channel->Number(), link ? link->Number() : -1, SiEitEvent.getEventId(), ld->getOriginalNetworkId(), ld->getTransportStreamId(), ld->getServiceId(), ld->getLinkageType(), linkName);//XXX if (link) { if (Setup.UpdateChannels >= 1) @@ -180,6 +180,8 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data) LinkChannels->Add(new cLinkChannel(link)); } } + else + channel->SetPortalName(linkName); } } } -- cgit v1.2.3