1
0
mirror of https://github.com/DigitalDevices/dddvb.git synced 2023-10-10 13:37:43 +02:00

- correct style

- bug in header check
This commit is contained in:
none 2020-08-29 14:34:53 +02:00
parent ed8bb5af82
commit bb5e9e7f39

View File

@ -25,49 +25,43 @@ uint8_t cc[8192] = { 0 };
void proc_ts(int i, uint8_t *buf) void proc_ts(int i, uint8_t *buf)
{ {
uint16_t pid=0x1fff&((buf[1]<<8)|buf[2]); uint16_t pid= 0x1fff& ((buf[1] << 8) | buf[2]);
uint8_t ccin = buf[3] & 0x1F; uint8_t ccin = buf[3] & 0x1f;
if( buf[0] == 0x47 && (buf[1] & 0x80) == 0) if( buf[0] == 0x47 && (buf[1] & 0x80) == 0) {
{ if( pid != 8191 ) {
if( pid != 8191 ) if (ccin & 0x10) {
{ if( cc[pid] != 0 ) {
if( ccin != 0 ) // TODO: 1 repetition allowed
{ if ((((cc[pid] + 1) & 0x0F) != (ccin & 0x0F)) )
if( cc[pid] != 0 ) cc_errors += 1;
{ }
// TODO: 1 repetition allowed cc[pid] = ccin;
if( ( ccin & 0x10 ) != 0 && (((cc[pid] + 1) & 0x0F) != (ccin & 0x0F)) ) }
cc_errors += 1; payload_packets += 1;
} }
cc[pid] = ccin; } else
} packet_errors += 1;
payload_packets += 1;
} if( (packets & 0x3FFF ) == 0) {
} printf("%s Packets: %12u non null %12u, errors: %12u, CC errors: %12u%s",
else line_start, packets, payload_packets, packet_errors, cc_errors, line_end);
packet_errors += 1; fflush(stdout);
}
if( (packets & 0x3FFF ) == 0) packets += 1;
{
printf("%s Packets: %12u non null %12u, errors: %12u, CC errors: %12u%s", line_start, packets, payload_packets, packet_errors, cc_errors, line_end);
fflush(stdout);
}
packets += 1;
} }
#define TSBUFSIZE (100*188) #define TSBUFSIZE (100*188)
void citest(char* n) void citest(char* n)
{ {
uint8_t *buf; uint8_t *buf;
uint8_t id; uint8_t id;
int i, nts; int i, nts;
int len; int len;
int ts=open(n, O_RDONLY); int ts=open(n, O_RDONLY);
buf=(uint8_t *)malloc(TSBUFSIZE); buf=(uint8_t *)malloc(TSBUFSIZE);
while(1) { while(1) {
len=read(ts, buf, TSBUFSIZE); len=read(ts, buf, TSBUFSIZE);
@ -90,20 +84,20 @@ void citest(char* n)
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
if( argc < 2 ) if( argc < 2 )
{ {
printf("tscheck <file>|<device> [<display line>]\n"); printf("tscheck <file>|<device> [<display line>]\n");
exit(0); exit(0);
} }
if( argc > 2 ) if( argc > 2 )
{ {
int line = atoi(argv[2]); int line = atoi(argv[2]);
if( line >= 0 && line < 64 ) if( line >= 0 && line < 64 )
{ {
snprintf(line_start,sizeof(line_start)-1,"\0337\033[%d;0H",line); snprintf(line_start,sizeof(line_start)-1,"\0337\033[%d;0H",line);
strncpy(line_end,"\0338",sizeof(line_end)-1); strncpy(line_end,"\0338",sizeof(line_end)-1);
} }
} }
citest(argv[1]); citest(argv[1]);
} }