From patchwork Sat Oct 29 15:31:47 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Dudek X-Patchwork-Id: 12075 Received: from tomts20-srv.bellnexxia.net ([209.226.175.74]) by www.linuxtv.org with esmtp (Exim 4.50) id 1EVsh4-0001LI-JT for vdr@linuxtv.org; Sat, 29 Oct 2005 17:32:30 +0200 Received: from [192.168.0.77] ([64.229.127.70]) by tomts20-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20051029153153.VVXX26550.tomts20-srv.bellnexxia.net@[192.168.0.77]> for ; Sat, 29 Oct 2005 11:31:53 -0400 Mime-Version: 1.0 (Apple Message framework v734) In-Reply-To: <20051029100006.712F888CDE@avalanche.cim.mcgill.ca> References: <20051029100006.712F888CDE@avalanche.cim.mcgill.ca> Message-Id: <4F86EEBF-0C29-461F-A1E6-176C8E79AB9F@cim.mcgill.ca> From: Gregory Dudek Date: Sat, 29 Oct 2005 11:31:47 -0400 To: vdr@linuxtv.org X-Mailer: Apple Mail (2.734) Subject: [vdr] no epg data for unknown NID [patch] X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Oct 2005 15:32:31 -0000 Status: O X-Status: X-Keywords: X-UID: 5698 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. + if (!channel) { + return; // even with unknown NID, we didn't have it + } cSchedule *pSchedule = (cSchedule *)Schedules->GetSchedule (channelID); if (!pSchedule) { 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 *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);