From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mailr.qinetiq-tim.net ([128.98.1.9]) by www.linuxtv.org with esmtp (Exim 4.63) (envelope-from ) id 1K66Pf-0006qg-Gx for linux-dvb@linuxtv.org; Tue, 10 Jun 2008 18:09:36 +0200 Received: from mailhost.eris.qinetiq.com (mail-relay.eris.qinetiq.com [128.98.2.2]) by mailr.qinetiq-tim.net (Postfix) with SMTP id C729C8CCA6 for ; Tue, 10 Jun 2008 17:09:00 +0100 (BST) Message-ID: <484EA718.20807@eris.qinetiq.com> Date: Tue, 10 Jun 2008 17:08:56 +0100 From: Simon Kilvington MIME-Version: 1.0 To: linux-dvb References: <48480A2D.9010507@eris.qinetiq.com> <48480C33.3060705@onelan.co.uk> In-Reply-To: <48480C33.3060705@onelan.co.uk> Content-Type: multipart/mixed; boundary="------------090502090906040705090806" Subject: Re: [linux-dvb] UK FreeView logical channel numbers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-dvb-bounces@linuxtv.org Errors-To: linux-dvb-bounces+mchehab=infradead.org@linuxtv.org List-ID: This is a multi-part message in MIME format. --------------090502090906040705090806 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Simon Farnsworth wrote: > Simon Kilvington wrote: >> Hi, >> >> does anyone know where the logical channel numbers are >> transmitted in FreeView? - ie BBC1 is 1, BBC News is 80, etc - I've been >> looking at the PAT and PMTs with dvbsnoop but can't see anything >> obvious. >> > > It's in the NIT, using a private descriptor - scan from dvb-apps > (http://linuxtv.org/hg/dvb-apps/file/9311c900f746/util/scan/scan.c) > knows about them, and they're fully specced in the DTG 'D-Book' (see > http://dtg.org.uk/publications/books.html). thanks for the info the reason I wanted to know was because when I did a scan with mythtv I had to give it each frequency by hand, then it only managed to find the channel numbers for the channels on one mux - though this may be because the nit on my transmitter seems to be split into two bits - one nit has the info for 5 muxs, the other nit has the info for the other mux anyway, I wrote a small program that will get the channel numbers out of the nit(s) and dump some sql statements that you can use to update the channel numbers in an existing mythtv database - I've attached it here, compile it like this: gcc -o get-lcns get-lcns.c and run it like this (you'll probably need different dvbtune params): dvbtune -f 722166667 -qam 16 -cr 3_4 && ./get-lcns > lcns it will print a load of sql commands to stdout, so the > will put them in the "lcns" file. You can just pipe the output into mysql, like this: cat lcns | mysql -umythtv -pmythtv mythconverg to update your channel table - -- Simon Kilvington -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.4 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFITqcYmt9ZifioJSwRAiFvAJsF3JkuO7XbPw9/FVyCLSU76cYDTwCfV1sx kr74Bd1GCOJRxltIedK11aY= =kfY/ -----END PGP SIGNATURE----- --------------090502090906040705090806 Content-Type: text/x-csrc; name="get-lcns.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="get-lcns.c" /* * dvbtune -f 722166667 -qam 16 -cr 3_4 && dvbsnoop 0x10 * * NIT: * PID=0x10 * TID=0x40 * tag=0x83 */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define TIMEOUT 30 #define MAX_TABLE_LEN 4096 /* Network Information Table PID and TID */ #define PID_NIT 0x0010 #define TID_NIT 0x40 #define TAG_LCN 0x83 bool read_nit(char *, unsigned int, unsigned char *); bool read_table(char *, uint16_t, uint8_t, unsigned int, unsigned char *); void fatal(char *, ...); int main(void) { unsigned char nit[MAX_TABLE_LEN]; unsigned char *data; unsigned int section_len; unsigned int nit_len; unsigned int descriptors_loop_len; unsigned int transport_stream_id; unsigned int ntransport_ids; unsigned int transport_ids[6]; unsigned int i; /* * Malvern transmitter (repeater for Sutton Coldfield) broadcasts 2 NITs * one has the LCNs for 5 MUXs * the other has the LCNs for the other MUX */ ntransport_ids = 0; while(ntransport_ids < 6) { bzero(nit, MAX_TABLE_LEN); if(!read_nit("/dev/dvb/adapter0/demux0", TIMEOUT, nit)) fatal("Unable to read NIT"); /* generic header */ data = nit; section_len = ((data[1] & 0x0f) << 8) | data[2]; data += 8; /* header + CRC */ nit_len = section_len - (5 + 4); /* skip the first descriptors loop */ descriptors_loop_len = ((data[0] & 0x0f) << 8) | data[1]; data += descriptors_loop_len + 4; nit_len -= descriptors_loop_len + 4; while(nit_len > 6) { transport_stream_id = (data[0] << 8) | data[1]; /* have we already seen it */ for(i=0; i 0) { unsigned char desc_tag = data[0]; unsigned char desc_len = data[1] + 2; data += 2; if(desc_tag == TAG_LCN) { for(i=0; i