I believe that vdr 1.3.34 fails to accept EPG data if the NID field of channels.conf is zero. For me, scan gets a lot of NID 0's, so this is a big problem (in fact, I am more interested in the EPG that the actual programs, for a project I am working on).
I believe the following patch allows vdr to match a channel even if it has NID 0. I am not sure if the corrected NID gets saved back to channels.conf with this patch, as for me it doesn't matter. It allows GetByChannelID to match without a NID, and tries this in eit.c if the channel match fails.
I am a bit new to vdr,so I hope posting this here is OK and it gets to the right person/people.
diff -x PLUGINS -X nopatch -NBbaur vdr-1.3.34/channels.c vdr-eitfix/ channels.c --- vdr-1.3.34/channels.c Sun Sep 11 10:22:24 2005 +++ vdr-eitfix/channels.c Sun Oct 23 12:28:21 2005 @@ -347,7 +349,7 @@ nid = Nid; tid = Tid; sid = Sid; - rid = Rid; + if (Rid!=0) rid = Rid; // if we knew the rid, don't lose track of it if (Number()) Channels.HashChannel(this); } @@ -950,7 +952,7 @@ return NULL; } -cChannel *cChannels::GetByChannelID(tChannelID ChannelID, bool TryWithoutRid, bool TryWithoutPolarization) +cChannel *cChannels::GetByChannelID(tChannelID ChannelID, bool TryWithoutRid, bool TryWithoutPolarization, bool TryWithoutNid) { int sid = ChannelID.Sid(); cList<cHashObject> *list = channelsHashSid.GetList(sid); @@ -965,6 +967,14 @@ for (cHashObject *hobj = list->First(); hobj; hobj = list-
Next(hobj)) {
cChannel *channel = (cChannel *)hobj->Object(); if (channel->Sid() == sid && channel->GetChannelID ().ClrRid() == ChannelID) + return channel; + } + } + if (TryWithoutNid) { + ChannelID.ClrNid(); + for (cHashObject *hobj = list->First(); hobj; hobj = list-
Next(hobj)) {
+ cChannel *channel = (cChannel *)hobj->Object(); + if (channel->Sid() == sid && channel->GetChannelID ().ClrNid() == ChannelID) return channel; } } diff -x PLUGINS -X nopatch -NBbaur vdr-1.3.34/channels.h vdr-eitfix/ channels.h --- vdr-1.3.34/channels.h Sat Sep 17 05:59:14 2005 +++ vdr-eitfix/channels.h Sun Oct 23 12:25:51 2005 @@ -68,9 +84,10 @@ 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 operator== (const tChannelID &arg) const { return source == arg.source && nid == arg.nid && tid == arg.tid && sid == arg.sid ;} // && rid == arg.rid; } 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 &ClrNid(void) { nid = 0; return *this; } tChannelID &ClrPolarization(void); int Source(void) { return source; } int Nid(void) { return nid; } @@ -223,7 +240,7 @@ void ReNumber(void); // Recalculate 'number' based on channel type cChannel *GetByNumber(int Number, int SkipGap = 0); cChannel *GetByServiceID(int Source, int Transponder, unsigned short ServiceID); - cChannel *GetByChannelID(tChannelID ChannelID, bool TryWithoutRid = false, bool TryWithoutPolarization = false); + cChannel *GetByChannelID(tChannelID ChannelID, bool TryWithoutRid = false, bool TryWithoutPolarization = false, bool TryWithoutNid = false); int BeingEdited(void) { return beingEdited; } void IncBeingEdited(void) { beingEdited++; } void DecBeingEdited(void) { beingEdited--; } diff -x PLUGINS -X nopatch -NBbaur vdr-1.3.34/eit.c vdr-eitfix/eit.c --- vdr-1.3.34/eit.c Fri Oct 14 20:57:38 2005 +++ vdr-eitfix/eit.c Sun Oct 23 12:28:03 2005 @@ -28,13 +29,28 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data) :SI::EIT(Data, false) { + int showing=0; + if (!CheckCRCAndParse()) return; tChannelID channelID(Source, getOriginalNetworkId(), getTransportStreamId(), getServiceId()); cChannel *channel = Channels.GetByChannelID(channelID, true); - if (!channel) - return; // only collect data for known channels + if (!channel) { + + // We have stumbled upon eit data for a channel we didn't know about. + channel = Channels.GetByChannelID(channelID, true, true, true); // dude5 NID fix + if (!channel) return; // only collect data for known channels + // found it, but we were using the unknwon NID of zero. Fix it. + channel->SetId(getOriginalNetworkId(), getTransportStreamId(), getServiceId(), 0); + } + // this is an ugly stupid way to do it.... clean it up, when tested. -- dude5 + tChannelID channelID2(Source, getOriginalNetworkId(), getTransportStreamId(), getServiceId()); + channelID = channelID2; + channel = Channels.GetByChannelID(channelID, true); + if (!channel) { + return; // even with unknown NID, we didn't have it + } cSchedule *pSchedule = (cSchedule *)Schedules->GetSchedule (channelID); if (!pSchedule) {
Gregory Dudek wrote:
I believe that vdr 1.3.34 fails to accept EPG data if the NID field of channels.conf is zero. For me, scan gets a lot of NID 0's, so this is a big problem (in fact, I am more interested in the EPG that the actual programs, for a project I am working on). ...
What channels are those, where 'scan' (I assume you are referring to the driver utility by that name) delivers a zero NID value?
Does VDR also detect them with NID=0?
Klaus