1
0
mirror of https://github.com/DigitalDevices/octonet.git synced 2023-10-10 13:36:52 +02:00
validate tuning parameter from nit (dvbc only)
tab cleanup
This commit is contained in:
mvoelkel 2016-01-10 01:20:15 +01:00
parent 420d38a6a9
commit 6976c3713b

View File

@ -220,14 +220,14 @@ void dump(const uint8_t *b, int l)
for (j = 0; j < l; j += 16, b += 16) {
for (i = 0; i < 16; i++)
if (i + j < l)
printf("%02x ", b[i]);
fprintf(stderr, "%02x ", b[i]);
else
printf(" ");
printf(" | ");
fprintf(stderr, " ");
fprintf(stderr, " | ");
for (i = 0; i < 16; i++)
if (i + j < l)
putchar((b[i] > 31 && b[i] < 127) ? b[i] : '.');
printf("\n");
fputc((b[i] > 31 && b[i] < 127) ? b[i] : '.', stderr);
fprintf(stderr, "\n");
}
}
@ -979,7 +979,16 @@ static int nit_cb(struct sfilter *sf)
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, 16);
fprintf(stderr, " ************************* buffer position c = %d\n", c);
dump(buf + c, 16);
}
break;
}
@ -1039,6 +1048,7 @@ void en300468_parse_string_to_utf8(char *dest, uint8_t *src,
{
int utf8 = (src[0] == 0x15) ? 1 : 0;
int skip = (src[0] < 0x20) ? 1 : 0;
if( src[0] == 0x10 ) skip += 2;
uint16_t utf8_cc;
int dest_pos = 0;
int emphasis = 0;
@ -1127,8 +1137,14 @@ static int sdt_cb(struct sfilter *sf)
if (tag == 0x48) {
spnl = buf[doff + 3];
snl = buf[doff + 4 + spnl];
s->pname[79] = 0x00;
s->name[79] = 0x00;
en300468_parse_string_to_utf8(s->pname, buf + doff + 4, spnl);
if( s->pname[79] != 0 )
printf("********************************************* PNAME OVERFLOW %d spnl = %d",spnl);
en300468_parse_string_to_utf8(s->name, buf + doff + 5 + spnl, snl);
if( s->name[79] != 0 )
printf("********************************************* SNAME OVERFLOW %d snl = %d",snl);
s->got_sdt = 1;
}
}
@ -1440,6 +1456,7 @@ static void dump_tp(struct tp_info *tpi)
if ( s->is_enc )
printf(" ENC:1\n");
printf("END\n");
fflush(stdout);
}
//~ if (!s->got_pmt)
//~ printf("NO PMT: ");
@ -1571,6 +1588,7 @@ static int scanip(struct scanip *sip)
tpi = list_first_entry(&sip->tps, struct tp_info, link);
tpstring(tpi, &stp->scon.tune[0], sizeof(stp->scon.tune));
printf("\nTUNE:%s\n", stp->scon.tune);
fflush(stdout);
stp->tpi = tpi;
scan_tp(stp);
ts_info_release(tsi);
@ -1661,7 +1679,7 @@ void usage() {
printf(" which is usable only on the same hardware configuration.\n");
printf("\n");
printf(" Example: NIT based scan which should work on Unitymedia in Germany\n");
printf(" octoscan --use_nit --freq=138 --msys=dvbs --sr=6900 --mtype=256qam 10.0.4.24\n");
printf(" octoscan --use_nit --freq=138 --msys=dvbc --sr=6900 --mtype=256qam 10.0.4.24\n");
}
int main(int argc, char **argv)
@ -1784,8 +1802,8 @@ int main(int argc, char **argv)
}
}
if( optind > argc - 1 ) {
printf("To many arguments\n\n");
if( optind != argc - 1 ) {
printf("wrong number of arguments\n\n");
usage();
exit(-1);
}