Browse Source

Add --ecm-pid option to manually set ECM pid.

Georgi Chorbadzhiyski 12 years ago
parent
commit
8b98a9a164
4 changed files with 26 additions and 2 deletions
  1. 1
    0
      data.h
  2. 9
    1
      tables.c
  3. 7
    0
      tsdecrypt.1
  4. 9
    1
      tsdecrypt.c

+ 1
- 0
data.h View File

@@ -103,6 +103,7 @@ struct ts {
103 103
 	uint16_t			emm_caid, emm_pid;
104 104
 	uint16_t			ecm_caid, ecm_pid;
105 105
 	uint16_t			forced_emm_pid;
106
+	uint16_t			forced_ecm_pid;
106 107
 	uint16_t			ecm_counter;
107 108
 	pidmap_t			pidmap;
108 109
 	pidmap_t			cc; // Continuity counters

+ 9
- 1
tables.c View File

@@ -101,10 +101,18 @@ void process_pmt(struct ts *ts, uint16_t pid, uint8_t *ts_packet) {
101 101
 	}
102 102
 
103 103
 	ts_get_ecm_info(ts->pmt, ts->req_CA_sys, &ts->ecm_caid, &ts->ecm_pid);
104
+	if (!ts->ecm_caid && ts->forced_ecm_pid)
105
+		ts->ecm_caid = 0xffff;
104 106
 	if (ts->ecm_caid) {
105 107
 		char *CA_sys = ts_get_CA_sys_txt(ts_get_CA_sys(ts->ecm_caid));
106 108
 		ts_LOGf("--- | ECM CAID: 0x%04x (%s)\n", ts->ecm_caid, CA_sys);
107
-		ts_LOGf("--- | ECM pid : 0x%04x (%s)\n", ts->ecm_pid, CA_sys);
109
+		if (!ts->forced_ecm_pid) {
110
+			ts_LOGf("--- | ECM pid : 0x%04x (%s)\n", ts->ecm_pid, CA_sys);
111
+		} else {
112
+			ts_LOGf("--- | ECM pid : 0x%04x (%s) (forced: 0x%04x)\n",
113
+				ts->ecm_pid, CA_sys, ts->forced_ecm_pid);
114
+			ts->ecm_pid = ts->forced_ecm_pid;
115
+		}
108 116
 	} else {
109 117
 		ts_LOGf("*** | ERROR: Can't detect ECM pid.\n");
110 118
 	}

+ 7
- 0
tsdecrypt.1 View File

@@ -121,6 +121,13 @@ Set to \fB0\fR to disable EMM reporting.
121 121
 .SH ECM OPTIONS
122 122
 .PP
123 123
 .TP
124
+\fB\-X\fR, \fB\-\-ecm\-pid\fR <pid>
125
+Set ECM pid manually. This option is useful for services that have
126
+couple of ECM streams from one CA system. Without this option tsdecrypt
127
+always chooses the first stream from the chosen CA system. Run tsdecrypt
128
+with --debug 2 and look at CA descriptors in PMT to see what CA streams
129
+are available.
130
+.TP
124 131
 \fB\-G\fR, \fB\-\-ecm\-irdeto\-type\fR <type>
125 132
 Set ECM IRDETO type. IRDETO CA send ECMs with different id mixed
126 133
 into one stream. Only one of the IDs are valid in given time. This

+ 9
- 1
tsdecrypt.c View File

@@ -72,6 +72,7 @@ static const struct option long_options[] = {
72 72
 	{ "emm-only",			no_argument,       NULL, 'E' },
73 73
 	{ "emm-report-time",	required_argument, NULL, 'f' },
74 74
 
75
+	{ "ecm-pid",			required_argument, NULL, 'X' },
75 76
 	{ "ecm-irdeto-type",	required_argument, NULL, 'G' },
76 77
 
77 78
 	{ "debug",				required_argument, NULL, 'D' },
@@ -129,6 +130,7 @@ static void show_help(struct ts *ts) {
129 130
 	printf("                            | Set <sec> to 0 to disable reporting. Default: %d\n", ts->camd35.emm_count_report_interval);
130 131
 	printf("\n");
131 132
 	printf("ECM options:\n");
133
+	printf(" -X --ecm-pid <pid>         | Force ECM pid. Default: none\n");
132 134
 	printf(" -G --ecm-irdeto-type <int> | Process only IRDETO ECMs with selected type (0,1,2,3). Default: %d\n", ts->irdeto_ecm);
133 135
 	printf("\n");
134 136
 	printf("Misc options:\n");
@@ -164,7 +166,7 @@ static int parse_io_param(struct io *io, char *opt, int open_flags, mode_t open_
164 166
 
165 167
 static void parse_options(struct ts *ts, int argc, char **argv) {
166 168
 	int j, i, ca_err = 0, server_err = 1, input_addr_err = 0, output_addr_err = 0, output_intf_err = 0, ident_err = 0;
167
-	while ( (j = getopt_long(argc, argv, "i:d:l:L:I:RzO:o:t:pc:s:U:P:y:eZ:Ef:G:D:h", long_options, NULL)) != -1 ) {
169
+	while ( (j = getopt_long(argc, argv, "i:d:l:L:I:RzO:o:t:pc:s:U:P:y:eZ:Ef:X:G:D:h", long_options, NULL)) != -1 ) {
168 170
 		char *p = NULL;
169 171
 		switch (j) {
170 172
 			case 'i':
@@ -275,6 +277,9 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
275 277
 					ts->camd35.emm_count_report_interval = 86400;
276 278
 				break;
277 279
 
280
+			case 'X':
281
+				ts->forced_ecm_pid = strtoul(optarg, NULL, 0) & 0x1fff;
282
+				break;
278 283
 			case 'G':
279 284
 				ts->irdeto_ecm = atoi(optarg);
280 285
 				break;
@@ -332,6 +337,9 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
332 337
 	if (ts->forced_emm_pid)
333 338
 		ts_LOGf("EMM pid    : 0x%04x (%d)\n", ts->forced_emm_pid, ts->forced_emm_pid);
334 339
 
340
+	if (ts->forced_ecm_pid)
341
+		ts_LOGf("ECM pid    : 0x%04x (%d)\n", ts->forced_ecm_pid, ts->forced_ecm_pid);
342
+
335 343
 	if (!ts->emm_only)
336 344
 	{
337 345
 		if (ts->output.type == NET_IO) {

Loading…
Cancel
Save