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

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 a few missing initializations
for adding play mode pmVideoOnly for adding play mode pmVideoOnly
for fixing a possible crash with inconsistent SI data 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> Torsten Herz <torsten.herz@web.de>
for fixing a possible deadlock when using the "Blue" button in the "Schedules" menu 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). problem with this).
- Files and directories are now created with rights according to the shell's - Files and directories are now created with rights according to the shell's
umask settings (thanks to Andreas Brachold). 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 * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "channels.h"
@ -179,27 +179,13 @@ cChannel::cChannel(void)
cChannel::cChannel(const cChannel &Channel) cChannel::cChannel(const cChannel &Channel)
{ {
name = strdup(""); name = NULL;
shortName = strdup(""); shortName = NULL;
provider = strdup(""); provider = NULL;
portalName = strdup(""); portalName = NULL;
*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;
linkChannels = NULL; linkChannels = NULL;
refChannel = NULL; refChannel = NULL;
*this = Channel;
} }
cChannel::~cChannel() cChannel::~cChannel()
@ -265,6 +251,24 @@ int cChannel::Modification(int Mask)
return Result; 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) bool cChannel::SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH)
{ {
// Workarounds for broadcaster stupidity: // Workarounds for broadcaster stupidity:
@ -977,7 +981,8 @@ cChannel *cChannels::NewChannel(const cChannel *Transponder, const char *Name, c
{ {
if (Transponder) { 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); 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->SetId(Nid, Tid, Sid, Rid);
NewChannel->SetName(Name, ShortName, Provider); NewChannel->SetName(Name, ShortName, Provider);
Add(NewChannel); Add(NewChannel);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __CHANNELS_H
@ -181,6 +181,7 @@ public:
bool IsTerr(void) const { return cSource::IsTerr(source); } bool IsTerr(void) const { return cSource::IsTerr(source); }
tChannelID GetChannelID(void) const { return tChannelID(source, nid, (nid || tid) ? tid : Transponder(), sid, rid); } tChannelID GetChannelID(void) const { return tChannelID(source, nid, (nid || tid) ? tid : Transponder(), sid, rid); }
int Modification(int Mask = CHANNELMOD_ALL); int Modification(int Mask = CHANNELMOD_ALL);
void CopyTransponderData(const cChannel *Channel);
bool SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH); 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 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); bool SetTerrTransponderData(int Source, int Frequency, int Bandwidth, int Modulation, int Hierarchy, int CodeRateH, int CodeRateL, int Guard, int Transmission);