Browse Source

Add --no-output-on-error (-u) option.

By using this option output can be disabled if there is no currently
received code word.
Georgi Chorbadzhiyski 12 years ago
parent
commit
78ea5cf936
6 changed files with 20 additions and 6 deletions
  1. 4
    0
      ChangeLog
  2. 1
    0
      README
  3. 1
    0
      data.h
  4. 1
    1
      process.c
  5. 3
    1
      tsdecrypt.1
  6. 10
    4
      tsdecrypt.c

+ 4
- 0
ChangeLog View File

@@ -1,3 +1,7 @@
1
+2012-06-20 : Version next
2
+ * Add --no-output-on-error (-u) option. By using this option output can be
3
+   disabled if there is no currently received code word.
4
+
1 5
 2012-04-19 : Version 8.1
2 6
  * Add support for Bulcrypt CAS.
3 7
 

+ 1
- 0
README View File

@@ -122,6 +122,7 @@ Output options:
122 122
  -r --output-rtp            | Enable RTP output.
123 123
  -k --output-rtp-ssrc <id>  | Set RTP SSRC. Default: 0
124 124
  -g --output-tos <tos>      | Set TOS value of output packets. Default: none
125
+ -u --no-output-on-error    | Do not output data when the code word is missing.
125 126
  -p --no-output-filter      | Disable output filtering. Default: enabled
126 127
  -y --output-nit-pass       | Pass through NIT.
127 128
  -w --output-eit-pass       | Pass through EIT (EPG).

+ 1
- 0
data.h View File

@@ -273,6 +273,7 @@ struct ts {
273 273
 
274 274
 	int					camd_stop;
275 275
 	int					is_cw_error;
276
+	int					no_output_on_error;
276 277
 
277 278
 	int					threaded;
278 279
 

+ 1
- 1
process.c View File

@@ -244,7 +244,7 @@ void *decode_thread(void *_ts) {
244 244
 static inline void output_write(struct ts *ts, uint8_t *data, unsigned int data_size) {
245 245
 	if (!data)
246 246
 		return;
247
-	if (!ts->camd.key->is_valid_cw)
247
+	if (ts->no_output_on_error && !ts->camd.key->is_valid_cw)
248 248
 		return;
249 249
 	if (!ts->rtp_output) {
250 250
 		write(ts->output.fd, data, data_size);

+ 3
- 1
tsdecrypt.1 View File

@@ -122,7 +122,9 @@ Enable RTP output. The default output is standard MPEG TS over UDP, this
122 122
 option enables tsdecrypt to output RTP packets.
123 123
 .TP
124 124
 \fB\-k\fR, \fB\-\-output\-rtp\-ssrc\fR <ssrc>
125
-Set RTP SSRC field to <ssrc>. By default is is set to \fB0\fR.
125
+.TP
126
+\fB\-u\fR, \fB\-\-no\-output\-on\-error\fR
127
+Filter all output when there is no valid code word.
126 128
 .TP
127 129
 \fB\-p\fR, \fB\-\-no\-output\-filter\fR
128 130
 Disable output filtering. By default the output filter is enabled and only

+ 10
- 4
tsdecrypt.c View File

@@ -69,9 +69,9 @@ static void LOG_func(const char *msg) {
69 69
 		LOG(msg);
70 70
 }
71 71
 
72
-static const char short_options[] = "i:d:N:Sl:L:F:I:RzM:T:W:O:o:t:rk:g:pwxyc:C:Y:Q:A:s:U:P:B:eZ:Ef:X:H:G:KJ:D:jbhV";
72
+static const char short_options[] = "i:d:N:Sl:L:F:I:RzM:T:W:O:o:t:rk:g:upwxyc:C:Y:Q:A:s:U:P:B:eZ:Ef:X:H:G:KJ:D:jbhV";
73 73
 
74
-// Unused short options: amnquv0123456789
74
+// Unused short options: amnqv0123456789
75 75
 static const struct option long_options[] = {
76 76
 	{ "ident",				required_argument, NULL, 'i' },
77 77
 	{ "daemon",				required_argument, NULL, 'd' },
@@ -95,6 +95,7 @@ static const struct option long_options[] = {
95 95
 	{ "output-rtp-ssrc",	required_argument, NULL, 'k' },
96 96
 	{ "output-tos",			required_argument, NULL, 'g' },
97 97
 	{ "output-filter",		no_argument,       NULL, 'p' },
98
+	{ "no-output-on-error",	no_argument,       NULL, 'u' },
98 99
 	{ "no-output-filter",	no_argument,       NULL, 'p' },
99 100
 	{ "output-nit-pass",	no_argument,       NULL, 'y' },
100 101
 	{ "output-eit-pass",	no_argument,       NULL, 'w' },
@@ -163,6 +164,7 @@ static void show_help(struct ts *ts) {
163 164
 	printf(" -r --output-rtp            | Enable RTP output.\n");
164 165
 	printf(" -k --output-rtp-ssrc <id>  | Set RTP SSRC. Default: %u\n", ts->rtp_ssrc);
165 166
 	printf(" -g --output-tos <tos>      | Set TOS value of output packets. Default: none\n");
167
+	printf(" -u --no-output-on-error    | Do not output data when the code word is missing.\n");
166 168
 	printf(" -p --no-output-filter      | Disable output filtering. Default: %s\n", ts->pid_filter ? "enabled" : "disabled");
167 169
 	printf(" -y --output-nit-pass       | Pass through NIT.\n");
168 170
 	printf(" -w --output-eit-pass       | Pass through EIT (EPG).\n");
@@ -322,6 +324,9 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
322 324
 			case 'g': // --output-tos
323 325
 				ts->output.tos = (uint8_t)strtol(optarg, NULL, 0);
324 326
 				break;
327
+			case 'u': // --no-output-on-error
328
+				ts->no_output_on_error = !ts->no_output_on_error;
329
+				break;
325 330
 			case 'p': // --no-output-filter
326 331
 				ts->pid_filter = 0;
327 332
 				break;
@@ -628,9 +633,10 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
628 633
 		} else if (ts->output.type == FILE_IO) {
629 634
 			ts_LOGf("Output file: %s\n", ts->output.fd == 1 ? "STDOUT" : ts->output.fname);
630 635
 		}
631
-		ts_LOGf("Out filter : %s (%s)\n",
636
+		ts_LOGf("Out filter : %s (%s)%s\n",
632 637
 			ts->pid_filter ? "enabled" : "disabled",
633
-			ts->pid_filter ? "output only service related PIDs" : "output everything"
638
+			ts->pid_filter ? "output only service related PIDs" : "output everything",
639
+			ts->no_output_on_error ? " (No output on CW error)" : ""
634 640
 		);
635 641
 		if (ts->pid_filter) {
636 642
 			if (ts->nit_passthrough)

Loading…
Cancel
Save