google / sagetv

SageTV is a cross-platform networked DVR and media management system
http://forums.sagetv.com/
Apache License 2.0
267 stars 174 forks source link

Need to get Logical Channel Numbers from DVB descriptors. #234

Open CraziFuzzy opened 7 years ago

CraziFuzzy commented 7 years ago

from request here: https://forums.sagetv.com/forums/showthread.php?p=597380&postcount=130

DVB has an optional descriptor (tag 0x83) that contains a Logical channel number, as well as a 'visible' bit, for the various services (channels) in a stream. Parsing and using these would greatly improve the ability of a DVB scan to match up with the EPG data, since it appears that the LCN's in the broadcast (at least in the requester's London market) do match the numbers that Schedules Direct provides.

As far as I can tell, a DVB scan currently is returning onid-tsid-sid-idx(name)broadcastType;9018-12294-14576-1(ADULT Studio 66)DVB-T; where: onid = Original Network ID (9018) tsid = Transport Stream ID (12294) sid = Service ID (14576) idx = index number (1) name = Channel Name (ADULT Studio 66) broadcastType = Broadcast Type (DVB-T)

the issue is that idx is just a relatively arbitrary number, simply incrementing from 1 for each channel the scan finds and adds to it's list (the above example was the first channel found in his scan). Instead of the index, we need to lookup the logical channel number, in the 0x83 descriptor if available, and pass THAT as the 4th parameter in the scanresult. The same LCN descriptor contains a bit that sets whether a service should be visible or not. I think we should throw out channels that are explicitly marked as non-visible.

Unfortunately, this is handled in the native tuner code, and I am VERY weak on .c. I'm pretty sure on some of the steps, but the code jumps around a lot between different files. I'm think we need to do at least the following: In native/ax/Channel-2/Channel.h:

In native/ax/Channel-2/Channel.c:

In native/ax/Native2.0/NativeCore/DVBPSIParser.c

Currently, the scanresult is being generated prior to the NIT being looked up, so that would also have to change, sicne the NIT parsing would need to be done prior.

I would really like to get this done. DVB regions have always had to do so much manual manipulation to get their channels setup anyway, due to the EPG situations over there, but with good EPG data now, they really SHOULDN'T have to do that. I think this could help quite a bit.

e10kstarfire commented 7 years ago

Would love to see this implemented, would greatly enhance ease of setup here in the UK at least