Browse Source

Add emm only mode (-E option) to process only EMMs.

Georgi Chorbadzhiyski 12 years ago
parent
commit
cd218b023f
4 changed files with 33 additions and 11 deletions
  1. 1
    0
      data.h
  2. 3
    0
      process.c
  3. 4
    0
      tables.c
  4. 25
    11
      tsdecrypt.c

+ 1
- 0
data.h View File

@@ -104,6 +104,7 @@ struct ts {
104 104
 	enum CA_system		req_CA_sys;
105 105
 
106 106
 	int					emm_send;
107
+	int					emm_only;
107 108
 	int					pid_filter;
108 109
 
109 110
 	int					rtp_input;

+ 3
- 0
process.c View File

@@ -252,6 +252,9 @@ void process_packets(struct ts *ts, uint8_t *data, ssize_t data_len) {
252 252
 		if (!ts_pack_shown)
253 253
 			dump_ts_pack(ts, pid, ts_packet);
254 254
 
255
+		if (ts->emm_only)
256
+			continue;
257
+
255 258
 		if (ts->threaded) {
256 259
 			// Add to decode buffer. The decoder thread will handle it
257 260
 			if (cbuf_fill(ts->decode_buf, ts_packet, 188) != 0) {

+ 4
- 0
tables.c View File

@@ -113,6 +113,10 @@ void process_emm(struct ts *ts, uint16_t pid, uint8_t *ts_packet) {
113 113
 
114 114
 void process_ecm(struct ts *ts, uint16_t pid, uint8_t *ts_packet) {
115 115
 	char dump[dump_buf_sz];
116
+
117
+	if (ts->emm_only)
118
+		return;
119
+
116 120
 	if (!ts->ecm_pid || ts->ecm_pid != pid)
117 121
 		return;
118 122
 

+ 25
- 11
tsdecrypt.c View File

@@ -63,7 +63,10 @@ static void show_help(struct ts *ts) {
63 63
 	printf("    -s server_addr | default: disabled (format 1.2.3.4:2233)\n");
64 64
 	printf("    -U server_user | default: %s\n", ts->camd35.user);
65 65
 	printf("    -P server_pass | default: %s\n", ts->camd35.pass);
66
-	printf("    -y usec_delay  | Sleep X usec between sending ECM/EMM packets to OSCAM. default: %d\n", ts->packet_delay);
66
+	printf("    -y usec_delay  | Sleep X usec between sending ECM/EMM packets to OSCAM. Default: %d\n", ts->packet_delay);
67
+	printf("\n");
68
+	printf("  EMM options:\n");
69
+	printf("    -E             | Process only EMMs without decoding input stream. Default: %s\n", ts->emm_only ? "true" : "false");
67 70
 	printf("\n");
68 71
 	printf("  Filtering options:\n");
69 72
 	printf("    -e             | EMM send (default: %s).\n", ts->emm_send ? "enabled" : "disabled");
@@ -107,7 +110,7 @@ static int parse_io_param(struct io *io, char *opt, int open_flags, mode_t open_
107 110
 
108 111
 static void parse_options(struct ts *ts, int argc, char **argv) {
109 112
 	int j, i, ca_err = 0, server_err = 1, input_addr_err = 0, output_addr_err = 0, output_intf_err = 0, ident_err = 0;
110
-	while ((j = getopt(argc, argv, "i:d:l:L:c:s:I:O:o:t:U:P:y:ezpD:hR")) != -1) {
113
+	while ((j = getopt(argc, argv, "i:d:l:L:c:s:I:O:o:t:U:P:y:eEzpD:hR")) != -1) {
111 114
 		char *p = NULL;
112 115
 		switch (j) {
113 116
 			case 'i':
@@ -191,6 +194,10 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
191 194
 			case 'e':
192 195
 				ts->emm_send = !ts->emm_send;
193 196
 				break;
197
+			case 'E':
198
+				ts->emm_only = 1;
199
+				ts->emm_send = 1;
200
+				break;
194 201
 			case 'p':
195 202
 				ts->pid_filter = !ts->pid_filter;
196 203
 				break;
@@ -242,23 +249,30 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
242 249
 	} else if (ts->input.type == FILE_IO) {
243 250
 		ts_LOGf("Input file : %s\n", ts->input.fd == 0 ? "STDIN" : ts->input.fname);
244 251
 	}
245
-	if (ts->output.type == NET_IO) {
246
-		ts_LOGf("Output addr: udp://%s:%u/\n", inet_ntoa(ts->output.addr), ts->output.port);
247
-		ts_LOGf("Output intf: %s\n", inet_ntoa(ts->output.intf));
248
-		ts_LOGf("Output ttl : %d\n", ts->output.ttl);
249
-	} else if (ts->output.type == FILE_IO) {
250
-		ts_LOGf("Output file: %s\n", ts->output.fd == 1 ? "STDOUT" : ts->output.fname);
252
+	if (!ts->emm_only)
253
+	{
254
+		if (ts->output.type == NET_IO) {
255
+			ts_LOGf("Output addr: udp://%s:%u/\n", inet_ntoa(ts->output.addr), ts->output.port);
256
+			ts_LOGf("Output intf: %s\n", inet_ntoa(ts->output.intf));
257
+			ts_LOGf("Output ttl : %d\n", ts->output.ttl);
258
+		} else if (ts->output.type == FILE_IO) {
259
+			ts_LOGf("Output file: %s\n", ts->output.fd == 1 ? "STDOUT" : ts->output.fname);
260
+		}
251 261
 	}
252 262
 	ts_LOGf("Server addr: tcp://%s:%u/\n", inet_ntoa(ts->camd35.server_addr), ts->camd35.server_port);
253 263
 	ts_LOGf("Server user: %s\n", ts->camd35.user);
254 264
 	ts_LOGf("Server pass: %s\n", ts->camd35.pass);
255 265
 	if (ts->packet_delay)
256 266
 		ts_LOGf("Pkt sleep  : %d us (%d ms)\n", ts->packet_delay, ts->packet_delay / 1000);
257
-	ts_LOGf("EMM send   : %s\n", ts->emm_send   ? "enabled" : "disabled");
258
-	ts_LOGf("PID filter : %s\n", ts->pid_filter ? "enabled" : "disabled");
259 267
 	ts_LOGf("TS discont : %s\n", ts->ts_discont ? "report" : "ignore");
260 268
 	ts->threaded = !(ts->input.type == FILE_IO && ts->input.fd != 0);
261
-	ts_LOGf("Decoding   : %s\n", ts->threaded ? "threaded" : "single thread");
269
+	if (ts->emm_only) {
270
+		ts_LOGf("EMM only   : %s\n", ts->emm_only ? "yes" : "no");
271
+	} else {
272
+		ts_LOGf("EMM send   : %s\n", ts->emm_send   ? "enabled" : "disabled");
273
+		ts_LOGf("PID filter : %s\n", ts->pid_filter ? "enabled" : "disabled");
274
+		ts_LOGf("Decoding   : %s\n", ts->threaded ? "threaded" : "single thread");
275
+	}
262 276
 
263 277
 	for (i=0; i<(int)sizeof(ts->ident); i++) {
264 278
 		if (!ts->ident[i])

Loading…
Cancel
Save