|
@@ -218,7 +218,7 @@ static void show_help(struct ts *ts) {
|
218
|
218
|
printf(" -6 --ipv6 | Use only IPv6 addresses of the camd server.\n");
|
219
|
219
|
printf("\n");
|
220
|
220
|
printf("EMM options:\n");
|
221
|
|
- printf(" -e --emm | Enable sending EMM's to CAMD. Default: %s\n", ts->emm_send ? "enabled" : "disabled");
|
|
221
|
+ printf(" -e --emm | Enable sending EMM's to CAMD. Default: %s\n", ts->process_emm ? "enabled" : "disabled");
|
222
|
222
|
printf(" -E --emm-only | Send only EMMs to CAMD, skipping ECMs and without\n");
|
223
|
223
|
printf(" . decoding the input stream.\n");
|
224
|
224
|
printf(" -Z --emm-pid <pid> | Force EMM pid. Default: none\n");
|
|
@@ -493,14 +493,15 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
|
493
|
493
|
break;
|
494
|
494
|
|
495
|
495
|
case 'e': // --emm
|
496
|
|
- ts->emm_send = !ts->emm_send;
|
|
496
|
+ ts->process_emm = !ts->process_emm;
|
497
|
497
|
break;
|
498
|
498
|
case 'Z': // --emm-pid
|
499
|
499
|
ts->forced_emm_pid = strtoul(optarg, NULL, 0) & 0x1fff;
|
500
|
500
|
break;
|
501
|
501
|
case 'E': // --emm-only
|
502
|
|
- ts->emm_only = 1;
|
503
|
|
- ts->emm_send = 1;
|
|
502
|
+ ts->process_emm = 1;
|
|
503
|
+ ts->process_ecm = 0;
|
|
504
|
+ ts->output_stream = 0;
|
504
|
505
|
break;
|
505
|
506
|
case 'f': // --emm-report-time
|
506
|
507
|
ts->emm_report_interval = strtoul(optarg, NULL, 10);
|
|
@@ -600,10 +601,9 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
|
600
|
601
|
ts->output.type = FILE_IO;
|
601
|
602
|
ts->output.fd = 1;
|
602
|
603
|
ts->pid_filter = 0;
|
603
|
|
- ts->emm_send = 1;
|
604
|
|
- ts->emm_report_interval = 0;
|
605
|
|
- ts->ecm_report_interval = 0;
|
606
|
|
- ts->cw_warn_sec = 0;
|
|
604
|
+ ts->process_ecm = 0;
|
|
605
|
+ ts->process_emm = 0;
|
|
606
|
+ ts->output_stream = 0;
|
607
|
607
|
ts->camd.no_reconnect = 1;
|
608
|
608
|
ts->camd.check_emm_errors = 1;
|
609
|
609
|
ts->emm_filters_num = 0;
|
|
@@ -612,13 +612,9 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
|
612
|
612
|
// Constant codeword is special. Disable conflicting options
|
613
|
613
|
if (ts->camd.constant_codeword) {
|
614
|
614
|
server_err = 0; // No server settings are required
|
615
|
|
- ts->forced_caid = 0;
|
616
|
|
- ts->forced_ecm_pid = 0;
|
617
|
|
- ts->forced_emm_pid = 0;
|
618
|
|
- ts->emm_send = 0;
|
619
|
|
- ts->emm_report_interval = 0;
|
620
|
|
- ts->ecm_report_interval = 0;
|
621
|
|
- ts->cw_warn_sec = 0;
|
|
615
|
+ ts->process_ecm = 0;
|
|
616
|
+ ts->process_emm = 0;
|
|
617
|
+ ts->output_stream = 1;
|
622
|
618
|
}
|
623
|
619
|
|
624
|
620
|
if (ident_err || ca_err || server_err || input_addr_err || output_addr_err || ts->input.type == WTF_IO || ts->output.type == WTF_IO) {
|
|
@@ -709,8 +705,7 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
|
709
|
705
|
if (ts->req_CA_sys == CA_IRDETO)
|
710
|
706
|
ts_LOGf("Irdeto ECM : %d\n", ts->irdeto_ecm);
|
711
|
707
|
|
712
|
|
- if (!ts->emm_only)
|
713
|
|
- {
|
|
708
|
+ if (ts->output_stream) {
|
714
|
709
|
if (ts->output.type == NET_IO) {
|
715
|
710
|
ts_LOGf("Output addr: %s://%s:%s/\n",
|
716
|
711
|
ts->rtp_output ? "rtp" : "udp",
|
|
@@ -727,16 +722,13 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
|
727
|
722
|
RAND_bytes((unsigned char *)&(ts->rtp_seqnum), 2);
|
728
|
723
|
}
|
729
|
724
|
} else if (ts->output.type == FILE_IO) {
|
730
|
|
- if (!packet_from_file)
|
731
|
|
- ts_LOGf("Output file: %s\n", ts->output.fd == 1 ? "STDOUT" : ts->output.fname);
|
732
|
|
- }
|
733
|
|
- if (!packet_from_file) {
|
734
|
|
- ts_LOGf("Out filter : %s (%s)%s\n",
|
735
|
|
- ts->pid_filter ? "enabled" : "disabled",
|
736
|
|
- ts->pid_filter ? "output only service related PIDs" : "output everything",
|
737
|
|
- ts->no_output_on_error ? " (No output on CW error)" : ""
|
738
|
|
- );
|
|
725
|
+ ts_LOGf("Output file: %s\n", ts->output.fd == 1 ? "STDOUT" : ts->output.fname);
|
739
|
726
|
}
|
|
727
|
+ ts_LOGf("Out filter : %s (%s)%s\n",
|
|
728
|
+ ts->pid_filter ? "enabled" : "disabled",
|
|
729
|
+ ts->pid_filter ? "output only service related PIDs" : "output everything",
|
|
730
|
+ ts->no_output_on_error ? " (No output on CW error)" : ""
|
|
731
|
+ );
|
740
|
732
|
if (ts->pid_filter) {
|
741
|
733
|
if (ts->nit_passthrough)
|
742
|
734
|
ts_LOGf("Out filter : Pass through NIT.\n");
|
|
@@ -745,7 +737,13 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
|
745
|
737
|
if (ts->tdt_passthrough)
|
746
|
738
|
ts_LOGf("Out filter : Pass through TDT/TOT.\n");
|
747
|
739
|
}
|
|
740
|
+ ts_LOGf("TS discont : %s\n", ts->ts_discont ? "report" : "ignore");
|
|
741
|
+ ts->threaded = !(ts->input.type == FILE_IO && ts->input.fd != 0);
|
|
742
|
+ ts_LOGf("Decoding : %s\n", ts->threaded ? "threaded" : "single thread");
|
|
743
|
+ } else {
|
|
744
|
+ ts_LOGf("Decoding : disabled\n");
|
748
|
745
|
}
|
|
746
|
+
|
749
|
747
|
if (!ts->camd.constant_codeword) {
|
750
|
748
|
ts_LOGf("CAMD proto : %s\n", ts->camd.ops.ident);
|
751
|
749
|
ts_LOGf("CAMD addr : %s:%s%s\n", ts->camd.hostname, ts->camd.service,
|
|
@@ -759,34 +757,18 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
|
759
|
757
|
ts_LOGf("CAMD deskey: %s\n", ts->camd.newcamd.hex_des_key);
|
760
|
758
|
}
|
761
|
759
|
|
762
|
|
- if (!packet_from_file) {
|
763
|
|
- ts_LOGf("TS discont : %s\n", ts->ts_discont ? "report" : "ignore");
|
764
|
|
- ts->threaded = !(ts->input.type == FILE_IO && ts->input.fd != 0);
|
765
|
|
- }
|
|
760
|
+ if (!packet_from_file)
|
|
761
|
+ ts_LOGf("EMM process: %s\n", ts->process_emm ? "Yes" : "No");
|
766
|
762
|
|
767
|
|
- if (!packet_from_file && !ts->emm_only) {
|
768
|
|
- ts_LOGf("Decoding : %s\n", ts->threaded ? "threaded" : "single thread");
|
769
|
|
- }
|
770
|
|
-
|
771
|
|
- if (!packet_from_file) {
|
772
|
|
- if (ts->emm_send && ts->emm_report_interval)
|
773
|
|
- ts_LOGf("EMM report : %d sec\n", ts->emm_report_interval);
|
774
|
|
- if (ts->emm_send && ts->emm_report_interval == 0)
|
775
|
|
- ts_LOGf("EMM report : disabled\n");
|
|
763
|
+ if (ts->process_emm) {
|
776
|
764
|
if (ts->forced_emm_pid)
|
777
|
765
|
ts_LOGf("EMM pid : 0x%04x (%d)\n", ts->forced_emm_pid, ts->forced_emm_pid);
|
778
|
|
- }
|
779
|
|
- if (ts->emm_only) {
|
780
|
|
- ts_LOGf("EMM only : %s\n", ts->emm_only ? "yes" : "no");
|
781
|
|
- } else {
|
782
|
|
- if (!packet_from_file) {
|
783
|
|
- if (!ts->camd.constant_codeword)
|
784
|
|
- ts_LOGf("EMM send : %s\n", ts->emm_send ? "enabled" : "disabled");
|
785
|
|
- ts_LOGf("Decoding : %s\n", ts->threaded ? "threaded" : "single thread");
|
786
|
|
- }
|
787
|
|
- }
|
788
|
766
|
|
789
|
|
- if (ts->emm_send) {
|
|
767
|
+ if (ts->emm_report_interval)
|
|
768
|
+ ts_LOGf("EMM report : %d sec\n", ts->emm_report_interval);
|
|
769
|
+ else
|
|
770
|
+ ts_LOGf("EMM report : disabled\n");
|
|
771
|
+
|
790
|
772
|
for (i = 0; i < ts->emm_filters_num; i++) {
|
791
|
773
|
char tmp[512];
|
792
|
774
|
filter_dump(&ts->emm_filters[i], tmp, sizeof(tmp));
|
|
@@ -794,20 +776,24 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
|
794
|
776
|
}
|
795
|
777
|
}
|
796
|
778
|
|
797
|
|
- if (!packet_from_file) {
|
798
|
|
- if (!ts->emm_only && ts->ecm_report_interval)
|
799
|
|
- ts_LOGf("ECM report : %d sec\n", ts->emm_report_interval);
|
800
|
|
- if (!ts->emm_only && ts->ecm_report_interval == 0 && !ts->camd.constant_codeword)
|
801
|
|
- ts_LOGf("ECM report : disabled\n");
|
|
779
|
+ if (!packet_from_file)
|
|
780
|
+ ts_LOGf("ECM process: %s\n", ts->process_ecm ? "Yes" : "No");
|
|
781
|
+
|
|
782
|
+ if (ts->process_ecm) {
|
802
|
783
|
if (ts->forced_ecm_pid)
|
803
|
784
|
ts_LOGf("ECM pid : 0x%04x (%d)\n", ts->forced_ecm_pid, ts->forced_ecm_pid);
|
804
|
785
|
|
805
|
|
- if (!ts->emm_only && ts->cw_warn_sec)
|
|
786
|
+ if (ts->ecm_report_interval)
|
|
787
|
+ ts_LOGf("ECM report : %d sec\n", ts->emm_report_interval);
|
|
788
|
+ else
|
|
789
|
+ ts_LOGf("ECM report : disabled\n");
|
|
790
|
+
|
|
791
|
+ if (ts->cw_warn_sec)
|
806
|
792
|
ts_LOGf("CW warning : %d sec\n", ts->cw_warn_sec);
|
807
|
|
- if (!ts->emm_only && ts->cw_warn_sec && !ts->camd.constant_codeword)
|
|
793
|
+ else
|
808
|
794
|
ts_LOGf("CW warning : disabled\n");
|
809
|
795
|
|
810
|
|
- if (!ts->ecm_cw_log && !ts->camd.constant_codeword)
|
|
796
|
+ if (!ts->ecm_cw_log)
|
811
|
797
|
ts_LOGf("ECM/CW log : disabled\n");
|
812
|
798
|
}
|
813
|
799
|
|
|
@@ -865,7 +851,7 @@ static void do_reports(struct ts *ts) {
|
865
|
851
|
static int first_emm_report = 1;
|
866
|
852
|
static int first_ecm_report = 1;
|
867
|
853
|
time_t now = time(NULL);
|
868
|
|
- if (ts->emm_send && ts->emm_report_interval) {
|
|
854
|
+ if (ts->process_emm && ts->emm_report_interval) {
|
869
|
855
|
if (first_emm_report && now >= ts->emm_last_report) {
|
870
|
856
|
first_emm_report = 0;
|
871
|
857
|
ts->emm_last_report -= FIRST_REPORT_SEC;
|
|
@@ -874,7 +860,7 @@ static void do_reports(struct ts *ts) {
|
874
|
860
|
report_emms(ts, now);
|
875
|
861
|
}
|
876
|
862
|
}
|
877
|
|
- if (!ts->emm_only && ts->ecm_report_interval) {
|
|
863
|
+ if (ts->process_ecm && ts->ecm_report_interval) {
|
878
|
864
|
if (first_ecm_report && now >= ts->ecm_last_report) {
|
879
|
865
|
first_ecm_report = 0;
|
880
|
866
|
ts->ecm_last_report -= FIRST_REPORT_SEC;
|
|
@@ -884,7 +870,7 @@ static void do_reports(struct ts *ts) {
|
884
|
870
|
}
|
885
|
871
|
}
|
886
|
872
|
|
887
|
|
- if (!ts->emm_only && !ts->key.is_valid_cw) {
|
|
873
|
+ if (ts->process_ecm && !ts->key.is_valid_cw) {
|
888
|
874
|
if (ts->cw_warn_sec && now >= ts->cw_next_warn) {
|
889
|
875
|
report_cw_warn(ts, now);
|
890
|
876
|
}
|