Added the 'portal name' to cChannels

This commit is contained in:
Klaus Schmidinger 2004-10-31 13:01:35 +01:00
parent fd9c2d298c
commit bd62ca6abc
5 changed files with 28 additions and 5 deletions

View File

@ -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 <j.schmitz@web.de>
for reporting a bug in displaying the current channel when switching via the SVDRP

View File

@ -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).

View File

@ -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;

View File

@ -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);

8
eit.c
View File

@ -8,7 +8,7 @@
* 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>.
*
* $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);
}
}
}