Browse Source

Add --emm-pid option to manually set EMM pid.

Georgi Chorbadzhiyski 12 years ago
parent
commit
32e40e0c67
4 changed files with 24 additions and 2 deletions
  1. 1
    0
      data.h
  2. 9
    1
      tables.c
  3. 5
    0
      tsdecrypt.1
  4. 9
    1
      tsdecrypt.c

+ 1
- 0
data.h View File

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

+ 9
- 1
tables.c View File

@@ -66,10 +66,18 @@ void process_cat(struct ts *ts, uint16_t pid, uint8_t *ts_packet) {
66 66
 	handle_table_changes(cat);
67 67
 
68 68
 	ts_get_emm_info(ts->cat, ts->req_CA_sys, &ts->emm_caid, &ts->emm_pid);
69
+	if (!ts->emm_caid && ts->forced_emm_pid)
70
+		ts->emm_caid = 0xffff;
69 71
 	if (ts->emm_caid) {
70 72
 		char *CA_sys = ts_get_CA_sys_txt(ts_get_CA_sys(ts->emm_caid));
71 73
 		ts_LOGf("--- | EMM CAID: 0x%04x (%s)\n", ts->emm_caid, CA_sys);
72
-		ts_LOGf("--- | EMM pid : 0x%04x (%s)\n", ts->emm_pid, CA_sys);
74
+		if (!ts->forced_emm_pid) {
75
+			ts_LOGf("--- | EMM pid : 0x%04x (%s)\n", ts->emm_pid, CA_sys);
76
+		} else {
77
+			ts_LOGf("--- | EMM pid : 0x%04x (%s) (forced: 0x%04x)\n",
78
+				ts->emm_pid, CA_sys, ts->forced_emm_pid);
79
+			ts->emm_pid = ts->forced_emm_pid;
80
+		}
73 81
 	} else {
74 82
 		ts_LOGf("*** | ERROR: Can't detect EMM pid.\n");
75 83
 	}

+ 5
- 0
tsdecrypt.1 View File

@@ -104,6 +104,11 @@ is workaround for camd35 OSCAM protocol processing. The default sleep time is
104 104
 Enable sending EMM's to CAMD for processing. By default EMM processing
105 105
 is \fBdisabled\fR and only ECM are processed.
106 106
 .TP
107
+\fB\-Z\fR, \fB\-\-emm\-pid\fR <pid>
108
+Set EMM pid manually. This option is useful for services that have
109
+couple of EMM streams from one CA system. Without this option tsdecrypt
110
+always chooses the first stream from the chosen CA system.
111
+.TP
107 112
 \fB\-E\fR, \fB\-\-emm\-only\fR <hierarchy>
108 113
 Disable ECM processing and stream output. This option is useful if the EMM
109 114
 stream has very high rate and is interfering with ECM processing. Using

+ 9
- 1
tsdecrypt.c View File

@@ -68,6 +68,7 @@ static const struct option long_options[] = {
68 68
 	{ "camd-pkt-delay",		required_argument, NULL, 'y' },
69 69
 
70 70
 	{ "emm",				no_argument,       NULL, 'e' },
71
+	{ "emm-pid",			required_argument, NULL, 'Z' },
71 72
 	{ "emm-only",			no_argument,       NULL, 'E' },
72 73
 	{ "emm-report-time",	required_argument, NULL, 'f' },
73 74
 
@@ -123,6 +124,7 @@ static void show_help(struct ts *ts) {
123 124
 	printf("EMM options:\n");
124 125
 	printf(" -e --emm                   | Enable sending EMM's to CAMD for processing. Default: %s\n", ts->emm_send ? "enabled" : "disabled");
125 126
 	printf(" -E --emm-only              | Send only EMMs to CAMD, without decoding input stream. Default: %s\n", ts->emm_only ? "enabled" : "disabled");
127
+	printf(" -Z --emm-pid <pid>         | Force EMM pid. Default: none\n");
126 128
 	printf(" -f --emm-report-time <sec> | Report how much EMMs has been send for processing each <sec> seconds.\n");
127 129
 	printf("                            | Set <sec> to 0 to disable reporting. Default: %d\n", ts->camd35.emm_count_report_interval);
128 130
 	printf("\n");
@@ -162,7 +164,7 @@ static int parse_io_param(struct io *io, char *opt, int open_flags, mode_t open_
162 164
 
163 165
 static void parse_options(struct ts *ts, int argc, char **argv) {
164 166
 	int j, i, ca_err = 0, server_err = 1, input_addr_err = 0, output_addr_err = 0, output_intf_err = 0, ident_err = 0;
165
-	while ( (j = getopt_long(argc, argv, "i:d:l:L:I:RzO:o:t:pc:s:U:P:y:eEf:G:D:h", long_options, NULL)) != -1 ) {
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 ) {
166 168
 		char *p = NULL;
167 169
 		switch (j) {
168 170
 			case 'i':
@@ -258,6 +260,9 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
258 260
 			case 'e':
259 261
 				ts->emm_send = !ts->emm_send;
260 262
 				break;
263
+			case 'Z':
264
+				ts->forced_emm_pid = strtoul(optarg, NULL, 0) & 0x1fff;
265
+				break;
261 266
 			case 'E':
262 267
 				ts->emm_only = 1;
263 268
 				ts->emm_send = 1;
@@ -324,6 +329,9 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
324 329
 	if (ts->req_CA_sys == CA_IRDETO)
325 330
 		ts_LOGf("Irdeto ECM : %d\n", ts->irdeto_ecm);
326 331
 
332
+	if (ts->forced_emm_pid)
333
+		ts_LOGf("EMM pid    : 0x%04x (%d)\n", ts->forced_emm_pid, ts->forced_emm_pid);
334
+
327 335
 	if (!ts->emm_only)
328 336
 	{
329 337
 		if (ts->output.type == NET_IO) {

Loading…
Cancel
Save