|
@@ -92,16 +92,19 @@ void LOG_func(const char *msg) {
|
92
|
92
|
|
93
|
93
|
unsigned long ts_pack = 0;
|
94
|
94
|
int ts_pack_shown = 0;
|
|
95
|
+int debug_level = 0;
|
95
|
96
|
|
96
|
97
|
static void show_ts_pack(uint16_t pid, char *wtf, char *extra, uint8_t *ts_packet) {
|
97
|
98
|
char cw1_dump[8 * 6];
|
98
|
99
|
char cw2_dump[8 * 6];
|
|
100
|
+ if (debug_level < 4)
|
|
101
|
+ return;
|
99
|
102
|
if (ts_pack_shown)
|
100
|
103
|
return;
|
101
|
104
|
int stype = ts_packet_get_scrambled(ts_packet);
|
102
|
105
|
ts_hex_dump_buf(cw1_dump, 8 * 6, cur_cw , 8, 0);
|
103
|
106
|
ts_hex_dump_buf(cw2_dump, 8 * 6, cur_cw + 8, 8, 0);
|
104
|
|
- fprintf(stdout, "%s %s %03x %5ld %7ld | %s %s | %s\n",
|
|
107
|
+ fprintf(stderr, "@ %s %s %03x %5ld %7ld | %s %s | %s\n",
|
105
|
108
|
stype == 0 ? "------" :
|
106
|
109
|
stype == 2 ? "even 0" :
|
107
|
110
|
stype == 3 ? "odd 1" : "??????",
|
|
@@ -198,7 +201,7 @@ static int camd35_recv(uint8_t *data, int *data_len) {
|
198
|
201
|
return *data_len;
|
199
|
202
|
}
|
200
|
203
|
|
201
|
|
-#define ERR(x) do { fprintf(stderr, "%s", x); return NULL; } while (0)
|
|
204
|
+#define ERR(x) do { ts_LOGf("%s", x); return NULL; } while (0)
|
202
|
205
|
|
203
|
206
|
static uint8_t *camd35_recv_cw() {
|
204
|
207
|
uint8_t data[BUF_SIZE];
|
|
@@ -404,7 +407,7 @@ void process_ecm(struct ts *ts, uint16_t pid, uint8_t *ts_packet) {
|
404
|
407
|
ts->ecm_counter,
|
405
|
408
|
dump);
|
406
|
409
|
camd35_send_ecm(ts->service_id, ts->ecm_caid, ts->ecm_counter++, sec->section_data, sec->section_data_len);
|
407
|
|
- } else {
|
|
410
|
+ } else if (debug_level > 2) {
|
408
|
411
|
ts_LOGf("ECM | CAID: 0x%04x PID 0x%04x Table: 0x%02x Length: %3d IDX: 0x%04x Data: -dup-\n",
|
409
|
412
|
ts->ecm_caid,
|
410
|
413
|
th->pid,
|
|
@@ -460,7 +463,7 @@ void show_help() {
|
460
|
463
|
void parse_options(int argc, char **argv) {
|
461
|
464
|
int j, ca_err = 0, server_err = 0;
|
462
|
465
|
inet_aton(camd35_server, &camd35_server_ip);
|
463
|
|
- while ((j = getopt(argc, argv, "C:S:P:u:p:h")) != -1) {
|
|
466
|
+ while ((j = getopt(argc, argv, "C:S:P:u:p:hd:")) != -1) {
|
464
|
467
|
switch (j) {
|
465
|
468
|
case 'C':
|
466
|
469
|
if (strcasecmp("IRDETO", optarg) == 0)
|
|
@@ -486,6 +489,9 @@ void parse_options(int argc, char **argv) {
|
486
|
489
|
case 'p':
|
487
|
490
|
camd35_pass = optarg;
|
488
|
491
|
break;
|
|
492
|
+ case 'd':
|
|
493
|
+ debug_level = atoi(optarg);
|
|
494
|
+ break;
|
489
|
495
|
case 'h':
|
490
|
496
|
show_help();
|
491
|
497
|
exit(0);
|
|
@@ -500,10 +506,11 @@ void parse_options(int argc, char **argv) {
|
500
|
506
|
show_help();
|
501
|
507
|
exit(1);
|
502
|
508
|
}
|
503
|
|
- fprintf(stderr, "CA System : %s\n", ts_get_CA_sys_txt(req_CA_sys));
|
504
|
|
- fprintf(stderr, "Server\n");
|
505
|
|
- fprintf(stderr, " Addr : %s:%d\n", inet_ntoa(camd35_server_ip), camd35_port);
|
506
|
|
- fprintf(stderr, " Auth : %s / %s\n", camd35_user, camd35_pass);
|
|
509
|
+ ts_LOGf("CA System : %s\n", ts_get_CA_sys_txt(req_CA_sys));
|
|
510
|
+ ts_LOGf("Server\n");
|
|
511
|
+ ts_LOGf(" Addr : %s:%d\n", inet_ntoa(camd35_server_ip), camd35_port);
|
|
512
|
+ ts_LOGf(" Auth : %s / %s\n", camd35_user, camd35_pass);
|
|
513
|
+
|
507
|
514
|
camd35_connect();
|
508
|
515
|
}
|
509
|
516
|
|