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

octoscan: Fixed NIT timeout

This commit is contained in:
mvoelkel 2016-02-01 18:48:56 +01:00
parent b6b99c380e
commit 2170eee2d3

View File

@ -1009,63 +1009,64 @@ static int nit_cb(struct sfilter *sf)
//fprintf(stderr, "NIT(%02x): len %u nid %u snr %02x lsnr %02x", buf[0], slen, nid, buf[6], buf[7]); //fprintf(stderr, "NIT(%02x): len %u nid %u snr %02x lsnr %02x", buf[0], slen, nid, buf[6], buf[7]);
//fprintf(stderr, " ndl %02x tsll %02x\n", ndl, tsll); //fprintf(stderr, " ndl %02x tsll %02x\n", ndl, tsll);
for (c = tsp + 2; c < slen; c += tdl) { if (p->tsi->stp->tpi->use_nit) {
//dump(buf + c + 6, tdl); for (c = tsp + 2; c < slen; c += tdl) {
memset(&t, 0, sizeof(struct tp_info)); //dump(buf + c + 6, tdl);
t.tsid = get16(buf + c); memset(&t, 0, sizeof(struct tp_info));
t.onid = get16(buf + c + 2); t.tsid = get16(buf + c);
t.nid = nid; t.onid = get16(buf + c + 2);
t.use_nit = p->tsi->stp->tpi->use_nit; t.nid = nid;
t.scan_eit = p->tsi->stp->tpi->scan_eit; t.use_nit = p->tsi->stp->tpi->use_nit;
//t.use_nit = p->tsi->stp->tpi->use_nit; t.scan_eit = p->tsi->stp->tpi->scan_eit;
tdl = get12(buf + c + 4); //t.use_nit = p->tsi->stp->tpi->use_nit;
//fprintf(stderr, " tsid %02x onid %02x tdl %02x\n", tsid, onid, tdl); tdl = get12(buf + c + 4);
c += 6; //fprintf(stderr, " tsid %02x onid %02x tdl %02x\n", tsid, onid, tdl);
switch (buf[c]) { c += 6;
case 0x43: switch (buf[c]) {
t.freq = getbcd(buf + c + 2, 8) / 100; case 0x43:
t.freq_frac = 0; t.freq = getbcd(buf + c + 2, 8) / 100;
t.pos = getbcd(buf + c + 6, 4); t.freq_frac = 0;
t.sr = getbcd(buf + c + 9, 7) / 10; t.pos = getbcd(buf + c + 6, 4);
t.east = (buf[c + 8] & 0x80) >> 7; t.sr = getbcd(buf + c + 9, 7) / 10;
t.pol = 1 ^ ((buf[c + 8] & 0x60) >> 5); // H V L R t.east = (buf[c + 8] & 0x80) >> 7;
t.ro = (buf[c + 8] & 0x18) >> 3; // 35 25 20 t.pol = 1 ^ ((buf[c + 8] & 0x60) >> 5); // H V L R
t.type = t.msys = ((buf[c + 8] & 0x04) >> 2) ? 6 : 5; t.ro = (buf[c + 8] & 0x18) >> 3; // 35 25 20
t.mod = buf[c + 8] & 0x03; // auto qpsk 8psk 16-qam t.type = t.msys = ((buf[c + 8] & 0x04) >> 2) ? 6 : 5;
t.fec = buf[c + 12] & 0x0f; // undef 1/2 2/3 3/4 5/6 7/8 8/9 3/5 4/5 9/10 t.mod = buf[c + 8] & 0x03; // auto qpsk 8psk 16-qam
//fprintf(stderr, " freq = %u pos = %u sr = %u fec = %u \n", freq, pos, sr, fec); t.fec = buf[c + 12] & 0x0f; // undef 1/2 2/3 3/4 5/6 7/8 8/9 3/5 4/5 9/10
//fprintf(stderr, "freq=%u&pol=%s&msys=%s&sr=%u\n", //fprintf(stderr, " freq = %u pos = %u sr = %u fec = %u \n", freq, pos, sr, fec);
//t.freq, pol2str[t.pol&3], t.type == 6 ? "dvbs2" : "dvbs", t.sr); //fprintf(stderr, "freq=%u&pol=%s&msys=%s&sr=%u\n",
t.src = p->tsi->stp->tpi->src; //t.freq, pol2str[t.pol&3], t.type == 6 ? "dvbs2" : "dvbs", t.sr);
add_tp(sip, &t); t.src = p->tsi->stp->tpi->src;
break;
case 0x44:
{
uint32_t freq = getbcd(buf + c + 2, 8);
t.freq = freq / 10000;
t.freq_frac = freq % 10000;
}
t.sr = getbcd(buf + c + 9, 7) / 10;
t.mod = buf[c + 8]; // undef 16 32 64 128 256
t.msys = 1;
t.type = 1;
//fprintf(stderr, " freq = %u pos = %u sr = %u fec = %u \n", freq, pos, sr, fec);
//fprintf(stderr, "freq=%u&msys=dvbc&mtype=%s\n", t.freq, mtype2str[t.mod]);
if( t.freq >= 50 && t.freq <= 1000 && t.sr >= 1000 && t.sr <= 7100 && t.mod >= 1 && t.mod <= 5 )
add_tp(sip, &t); add_tp(sip, &t);
else { break;
fprintf(stderr, " ************************* freq = %u sr = %u mod = %u \n", t.freq, t.sr, t.mod); case 0x44:
fprintf(stderr, " ************************* buffer start:\n" ); {
dump(buf, 32); uint32_t freq = getbcd(buf + c + 2, 8);
fprintf(stderr, " ************************* buffer position (c-32,c+16) c = %d, slen = %d\n", c, slen); t.freq = freq / 10000;
dump(buf + c - 32, 48); t.freq_frac = freq % 10000;
} }
t.sr = getbcd(buf + c + 9, 7) / 10;
t.mod = buf[c + 8]; // undef 16 32 64 128 256
t.msys = 1;
t.type = 1;
//fprintf(stderr, " freq = %u pos = %u sr = %u fec = %u \n", freq, pos, sr, fec);
//fprintf(stderr, "freq=%u&msys=dvbc&mtype=%s\n", t.freq, mtype2str[t.mod]);
if( t.freq >= 50 && t.freq <= 1000 && t.sr >= 1000 && t.sr <= 7100 && t.mod >= 1 && t.mod <= 5 )
add_tp(sip, &t);
else {
fprintf(stderr, " ************************* freq = %u sr = %u mod = %u \n", t.freq, t.sr, t.mod);
fprintf(stderr, " ************************* buffer start:\n" );
dump(buf, 32);
fprintf(stderr, " ************************* buffer position (c-32,c+16) c = %d, slen = %d\n", c, slen);
dump(buf + c - 32, 48);
}
break; break;
}
} }
} }
return 0; return 0;
} }
@ -1470,17 +1471,17 @@ static int proc_sec(struct pid_info *p)
break; break;
case 0x40: case 0x40:
case 0x41: case 0x41:
if( p->tsi->stp->tpi->use_nit ) res = nit_cb(sf);
res = nit_cb(sf);
break; break;
case 0x42: case 0x42:
case 0x46: case 0x46:
res = sdt_cb(sf); res = sdt_cb(sf);
break; break;
default: default:
if (tid >= 0x4E && tid <= 0x6F) { if (tid >= 0x4E && tid <= 0x6F)
res = eit_cb(sf, refresh); res = eit_cb(sf, refresh);
} else
res = -1;
break; break;
} }
if (res == 0) { if (res == 0) {
@ -1930,7 +1931,7 @@ static int scanip(struct scanip *sip)
tpi = list_first_entry(&sip->tps, struct tp_info, link); tpi = list_first_entry(&sip->tps, struct tp_info, link);
tpstring(tpi, &stp->scon.tune[0], sizeof(stp->scon.tune)); tpstring(tpi, &stp->scon.tune[0], sizeof(stp->scon.tune));
printf("\nTUNE:%s\n", stp->scon.tune); printf("\nTUNE:%s\n", stp->scon.tune);
fflush(stdout); fflush(stdout);
stp->tpi = tpi; stp->tpi = tpi;
scan_tp(stp); scan_tp(stp);
ts_info_release(tsi); ts_info_release(tsi);