cRecordingInfo stores channelID itself (preparation for change in cEvent)

This commit is contained in:
Klaus Schmidinger 2005-05-28 09:53:54 +02:00
parent 1855ab0ef3
commit 7114258ebd
6 changed files with 15 additions and 19 deletions

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.39 2005/05/26 11:10:06 kls Exp $
* $Id: channels.c 1.40 2005/05/28 09:44:41 kls Exp $
*/
#include "channels.h"
@ -141,7 +141,7 @@ tChannelID tChannelID::FromString(const char *s)
return tChannelID::InvalidID;
}
cString tChannelID::ToString(void)
cString tChannelID::ToString(void) const
{
char buffer[256];
snprintf(buffer, sizeof(buffer), rid ? "%s-%d-%d-%d-%d" : "%s-%d-%d-%d", *cSource::ToString(source), nid, tid, sid, rid);

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.30 2005/05/26 11:11:31 kls Exp $
* $Id: channels.h 1.31 2005/05/28 09:47:23 kls Exp $
*/
#ifndef __CHANNELS_H
@ -66,11 +66,11 @@ public:
tChannelID(void) { source = nid = tid = sid = rid = 0; }
tChannelID(int Source, int Nid, int Tid, int Sid, int Rid = 0) { source = Source; nid = Nid; tid = Tid; sid = Sid; rid = Rid; }
bool operator== (const tChannelID &arg) const { return source == arg.source && nid == arg.nid && tid == arg.tid && sid == arg.sid && rid == arg.rid; }
bool Valid(void) { return (nid || tid) && sid; } // rid is optional and source may be 0//XXX source may not be 0???
bool Valid(void) const { return (nid || tid) && sid; } // rid is optional and source may be 0//XXX source may not be 0???
tChannelID &ClrRid(void) { rid = 0; return *this; }
tChannelID &ClrPolarization(void);
static tChannelID FromString(const char *s);
cString ToString(void);
cString ToString(void) const;
static const tChannelID InvalidID;
};

7
epg.c
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
* $Id: epg.c 1.30 2005/05/16 14:12:00 kls Exp $
* $Id: epg.c 1.31 2005/05/28 09:49:04 kls Exp $
*/
#include "epg.h"
@ -112,11 +112,6 @@ int cEvent::Compare(const cListObject &ListObject) const
return startTime - e->startTime;
}
void cEvent::SetChannelID(tChannelID ChannelID)
{
channelID = ChannelID;
}
void cEvent::SetEventID(u_int16_t EventID)
{
eventID = EventID;

3
epg.h
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
* $Id: epg.h 1.22 2005/05/16 14:11:28 kls Exp $
* $Id: epg.h 1.23 2005/05/28 09:48:56 kls Exp $
*/
#ifndef __EPG_H
@ -86,7 +86,6 @@ public:
cString GetTimeString(void) const;
cString GetEndTimeString(void) const;
cString GetVpsString(void) const;
void SetChannelID(tChannelID ChannelID);
void SetEventID(u_int16_t EventID);
void SetTableID(uchar TableID);
void SetVersion(uchar Version);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.c 1.103 2005/05/22 11:27:28 kls Exp $
* $Id: recording.c 1.104 2005/05/28 09:53:54 kls Exp $
*/
#include "recording.h"
@ -224,6 +224,7 @@ cRecordingInfo::cRecordingInfo(const cEvent *Event)
{
if (Event) {
event = Event;
channelID = event->ChannelID();
ownEvent = NULL;
}
else
@ -258,7 +259,7 @@ bool cRecordingInfo::Read(FILE *f)
if (p)
*p = 0; // strips optional channel name
if (*t)
ownEvent->SetChannelID(tChannelID::FromString(t));
channelID = tChannelID::FromString(t);
}
break;
default: if (!ownEvent->Parse(s))
@ -273,9 +274,8 @@ bool cRecordingInfo::Read(FILE *f)
bool cRecordingInfo::Write(FILE *f, const char *Prefix) const
{
cChannel *channel = Channels.GetByChannelID(event->ChannelID(), true);
if (channel)
fprintf(f, "%sC %s %s\n", Prefix, *channel->GetChannelID().ToString(), channel->Name());
if (channelID.Valid())
fprintf(f, "%sC %s\n", Prefix, *channelID.ToString());
event->Dump(f, Prefix, true);
return true;
}

View File

@ -4,13 +4,14 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.h 1.37 2005/05/22 10:29:02 kls Exp $
* $Id: recording.h 1.38 2005/05/28 09:34:07 kls Exp $
*/
#ifndef __RECORDING_H
#define __RECORDING_H
#include <time.h>
#include "channels.h"
#include "config.h"
#include "epg.h"
#include "thread.h"
@ -36,6 +37,7 @@ public:
class cRecordingInfo {
friend class cRecording;
private:
tChannelID channelID;
const cEvent *event;
cEvent *ownEvent;
cRecordingInfo(const cEvent *Event = NULL);