Fixed the cChannel copy constructor

This commit is contained in:
Klaus Schmidinger 2005-08-06 12:13:55 +02:00
parent bc22ed879c
commit ff5df8f298
4 changed files with 31 additions and 22 deletions

View File

@ -731,6 +731,7 @@ Marcel Wiesweg <marcel.wiesweg@gmx.de>
for adding a few missing initializations
for adding play mode pmVideoOnly
for fixing a possible crash with inconsistent SI data
for pointing out a problem with the cChannel copy constructor
Torsten Herz <torsten.herz@web.de>
for fixing a possible deadlock when using the "Blue" button in the "Schedules" menu

View File

@ -3655,3 +3655,5 @@ Video Disk Recorder Revision History
problem with this).
- Files and directories are now created with rights according to the shell's
umask settings (thanks to Andreas Brachold).
- Fixed the cChannel copy constructor (thanks to Marcel Wiesweg for pointing out
a problem with it).

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.42 2005/05/29 10:32:38 kls Exp $
* $Id: channels.c 1.43 2005/08/06 12:06:37 kls Exp $
*/
#include "channels.h"
@ -179,27 +179,13 @@ cChannel::cChannel(void)
cChannel::cChannel(const cChannel &Channel)
{
name = strdup("");
shortName = strdup("");
provider = strdup("");
portalName = strdup("");
*this = Channel;
vpid = 0;
ppid = 0;
apids[0] = 0;
dpids[0] = 0;
spids[0] = 0;
tpid = 0;
caids[0] = 0;
nid = 0;
tid = 0;
sid = 0;
rid = 0;
number = 0;
groupSep = false;
modification = CHANNELMOD_NONE;
name = NULL;
shortName = NULL;
provider = NULL;
portalName = NULL;
linkChannels = NULL;
refChannel = NULL;
*this = Channel;
}
cChannel::~cChannel()
@ -265,6 +251,24 @@ int cChannel::Modification(int Mask)
return Result;
}
void cChannel::CopyTransponderData(const cChannel *Channel)
{
if (Channel) {
frequency = Channel->frequency;
source = Channel->source;
srate = Channel->srate;
polarization = Channel->polarization;
inversion = Channel->inversion;
bandwidth = Channel->bandwidth;
coderateH = Channel->coderateH;
coderateL = Channel->coderateL;
modulation = Channel->modulation;
transmission = Channel->transmission;
guard = Channel->guard;
hierarchy = Channel->hierarchy;
}
}
bool cChannel::SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH)
{
// Workarounds for broadcaster stupidity:
@ -977,7 +981,8 @@ cChannel *cChannels::NewChannel(const cChannel *Transponder, const char *Name, c
{
if (Transponder) {
dsyslog("creating new channel '%s,%s;%s' on %s transponder %d with id %d-%d-%d-%d", Name, ShortName, Provider, *cSource::ToString(Transponder->Source()), Transponder->Transponder(), Nid, Tid, Sid, Rid);
cChannel *NewChannel = new cChannel(*Transponder);
cChannel *NewChannel = new cChannel;
NewChannel->CopyTransponderData(Transponder);
NewChannel->SetId(Nid, Tid, Sid, Rid);
NewChannel->SetName(Name, ShortName, Provider);
Add(NewChannel);

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.32 2005/05/28 13:57:08 kls Exp $
* $Id: channels.h 1.33 2005/08/06 11:23:32 kls Exp $
*/
#ifndef __CHANNELS_H
@ -181,6 +181,7 @@ public:
bool IsTerr(void) const { return cSource::IsTerr(source); }
tChannelID GetChannelID(void) const { return tChannelID(source, nid, (nid || tid) ? tid : Transponder(), sid, rid); }
int Modification(int Mask = CHANNELMOD_ALL);
void CopyTransponderData(const cChannel *Channel);
bool SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH);
bool SetCableTransponderData(int Source, int Frequency, int Modulation, int Srate, int CoderateH);
bool SetTerrTransponderData(int Source, int Frequency, int Bandwidth, int Modulation, int Hierarchy, int CodeRateH, int CodeRateL, int Guard, int Transmission);