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

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 * 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.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" #include "channels.h"
@ -141,7 +141,7 @@ tChannelID tChannelID::FromString(const char *s)
return tChannelID::InvalidID; return tChannelID::InvalidID;
} }
cString tChannelID::ToString(void) cString tChannelID::ToString(void) const
{ {
char buffer[256]; char buffer[256];
snprintf(buffer, sizeof(buffer), rid ? "%s-%d-%d-%d-%d" : "%s-%d-%d-%d", *cSource::ToString(source), nid, tid, sid, rid); 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 * 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.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 #ifndef __CHANNELS_H
@ -66,11 +66,11 @@ public:
tChannelID(void) { source = nid = tid = sid = rid = 0; } 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; } 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 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 &ClrRid(void) { rid = 0; return *this; }
tChannelID &ClrPolarization(void); tChannelID &ClrPolarization(void);
static tChannelID FromString(const char *s); static tChannelID FromString(const char *s);
cString ToString(void); cString ToString(void) const;
static const tChannelID InvalidID; 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 * Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * 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" #include "epg.h"
@ -112,11 +112,6 @@ int cEvent::Compare(const cListObject &ListObject) const
return startTime - e->startTime; return startTime - e->startTime;
} }
void cEvent::SetChannelID(tChannelID ChannelID)
{
channelID = ChannelID;
}
void cEvent::SetEventID(u_int16_t EventID) void cEvent::SetEventID(u_int16_t EventID)
{ {
eventID = EventID; eventID = EventID;

3
epg.h
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by * Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * 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 #ifndef __EPG_H
@ -86,7 +86,6 @@ public:
cString GetTimeString(void) const; cString GetTimeString(void) const;
cString GetEndTimeString(void) const; cString GetEndTimeString(void) const;
cString GetVpsString(void) const; cString GetVpsString(void) const;
void SetChannelID(tChannelID ChannelID);
void SetEventID(u_int16_t EventID); void SetEventID(u_int16_t EventID);
void SetTableID(uchar TableID); void SetTableID(uchar TableID);
void SetVersion(uchar Version); void SetVersion(uchar Version);

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: 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" #include "recording.h"
@ -224,6 +224,7 @@ cRecordingInfo::cRecordingInfo(const cEvent *Event)
{ {
if (Event) { if (Event) {
event = Event; event = Event;
channelID = event->ChannelID();
ownEvent = NULL; ownEvent = NULL;
} }
else else
@ -258,7 +259,7 @@ bool cRecordingInfo::Read(FILE *f)
if (p) if (p)
*p = 0; // strips optional channel name *p = 0; // strips optional channel name
if (*t) if (*t)
ownEvent->SetChannelID(tChannelID::FromString(t)); channelID = tChannelID::FromString(t);
} }
break; break;
default: if (!ownEvent->Parse(s)) default: if (!ownEvent->Parse(s))
@ -273,9 +274,8 @@ bool cRecordingInfo::Read(FILE *f)
bool cRecordingInfo::Write(FILE *f, const char *Prefix) const bool cRecordingInfo::Write(FILE *f, const char *Prefix) const
{ {
cChannel *channel = Channels.GetByChannelID(event->ChannelID(), true); if (channelID.Valid())
if (channel) fprintf(f, "%sC %s\n", Prefix, *channelID.ToString());
fprintf(f, "%sC %s %s\n", Prefix, *channel->GetChannelID().ToString(), channel->Name());
event->Dump(f, Prefix, true); event->Dump(f, Prefix, true);
return true; return true;
} }

View File

@ -4,13 +4,14 @@
* 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: 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 #ifndef __RECORDING_H
#define __RECORDING_H #define __RECORDING_H
#include <time.h> #include <time.h>
#include "channels.h"
#include "config.h" #include "config.h"
#include "epg.h" #include "epg.h"
#include "thread.h" #include "thread.h"
@ -36,6 +37,7 @@ public:
class cRecordingInfo { class cRecordingInfo {
friend class cRecording; friend class cRecording;
private: private:
tChannelID channelID;
const cEvent *event; const cEvent *event;
cEvent *ownEvent; cEvent *ownEvent;
cRecordingInfo(const cEvent *Event = NULL); cRecordingInfo(const cEvent *Event = NULL);