|
@@ -27,6 +27,7 @@
|
27
|
27
|
#include <syslog.h>
|
28
|
28
|
|
29
|
29
|
#include <dvbcsa/dvbcsa.h>
|
|
30
|
+#include <openssl/rand.h>
|
30
|
31
|
|
31
|
32
|
#include "libfuncs/libfuncs.h"
|
32
|
33
|
|
|
@@ -103,9 +104,9 @@ void run_benchmark(void) {
|
103
|
104
|
puts("* Done *");
|
104
|
105
|
}
|
105
|
106
|
|
106
|
|
-static const char short_options[] = "i:d:N:Sl:L:I:RzM:W:O:o:t:g:pwxyc:C:A:s:U:P:B:eZ:Ef:X:H:G:KJ:D:jbhV";
|
|
107
|
+static const char short_options[] = "i:d:N:Sl:L:I:RzM:W:O:o:t:rk:g:pwxyc:C:A:s:U:P:B:eZ:Ef:X:H:G:KJ:D:jbhV";
|
107
|
108
|
|
108
|
|
-// Unused short options: FQTYakmnqruv0123456789
|
|
109
|
+// Unused short options: FQTYamnquv0123456789
|
109
|
110
|
static const struct option long_options[] = {
|
110
|
111
|
{ "ident", required_argument, NULL, 'i' },
|
111
|
112
|
{ "daemon", required_argument, NULL, 'd' },
|
|
@@ -123,6 +124,8 @@ static const struct option long_options[] = {
|
123
|
124
|
{ "output", required_argument, NULL, 'O' },
|
124
|
125
|
{ "output-intf", required_argument, NULL, 'o' },
|
125
|
126
|
{ "output-ttl", required_argument, NULL, 't' },
|
|
127
|
+ { "output-rtp", no_argument, NULL, 'r' },
|
|
128
|
+ { "output-rtp-ssrc", required_argument, NULL, 'k' },
|
126
|
129
|
{ "output-tos", required_argument, NULL, 'g' },
|
127
|
130
|
{ "output-filter", no_argument, NULL, 'p' },
|
128
|
131
|
{ "no-output-filter", no_argument, NULL, 'p' },
|
|
@@ -191,6 +194,8 @@ static void show_help(struct ts *ts) {
|
191
|
194
|
printf(" . -O - (write to stdout) (default)\n");
|
192
|
195
|
printf(" -o --output-intf <addr> | Set multicast output interface. Default: %s\n", inet_ntoa(ts->output.intf));
|
193
|
196
|
printf(" -t --output-ttl <ttl> | Set multicast ttl. Default: %d\n", ts->output.ttl);
|
|
197
|
+ printf(" -r --output-rtp | Enable RTP output.\n");
|
|
198
|
+ printf(" -k --output-rtp-ssrc <id> | Set RTP SSRC. Default: %u\n", ts->rtp_ssrc);
|
194
|
199
|
printf(" -g --output-tos <tos> | Set TOS value of output packets. Default: none\n");
|
195
|
200
|
printf(" -p --no-output-filter | Disable output filtering. Default: %s\n", ts->pid_filter ? "enabled" : "disabled");
|
196
|
201
|
printf(" -y --output-nit-pass | Pass through NIT.\n");
|
|
@@ -331,6 +336,12 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
|
331
|
336
|
case 't':
|
332
|
337
|
ts->output.ttl = atoi(optarg);
|
333
|
338
|
break;
|
|
339
|
+ case 'r':
|
|
340
|
+ ts->rtp_output = 1;
|
|
341
|
+ break;
|
|
342
|
+ case 'k':
|
|
343
|
+ ts->rtp_ssrc = strtoul(optarg, NULL, 0);
|
|
344
|
+ break;
|
334
|
345
|
case 'g':
|
335
|
346
|
ts->output.tos = (uint8_t)strtol(optarg, NULL, 0);
|
336
|
347
|
break;
|
|
@@ -539,11 +550,19 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
|
539
|
550
|
if (!ts->emm_only)
|
540
|
551
|
{
|
541
|
552
|
if (ts->output.type == NET_IO) {
|
542
|
|
- ts_LOGf("Output addr: udp://%s:%u/\n", inet_ntoa(ts->output.addr), ts->output.port);
|
|
553
|
+ ts_LOGf("Output addr: %s://%s:%u/\n",
|
|
554
|
+ ts->rtp_output ? "rtp" : "udp",
|
|
555
|
+ inet_ntoa(ts->output.addr), ts->output.port);
|
543
|
556
|
ts_LOGf("Output intf: %s\n", inet_ntoa(ts->output.intf));
|
544
|
557
|
ts_LOGf("Output ttl : %d\n", ts->output.ttl);
|
545
|
558
|
if (ts->output.tos > -1)
|
546
|
559
|
ts_LOGf("Output TOS : %u (0x%02x)\n", ts->output.tos, ts->output.tos);
|
|
560
|
+ if (ts->rtp_output) {
|
|
561
|
+ ts_LOGf("RTP SSRC : %u (0x%04x)\n",
|
|
562
|
+ ts->rtp_ssrc, ts->rtp_ssrc);
|
|
563
|
+ // It is recommended that RTP seqnum starts with random number
|
|
564
|
+ RAND_bytes((unsigned char *)&(ts->rtp_seqnum), 2);
|
|
565
|
+ }
|
547
|
566
|
} else if (ts->output.type == FILE_IO) {
|
548
|
567
|
ts_LOGf("Output file: %s\n", ts->output.fd == 1 ? "STDOUT" : ts->output.fname);
|
549
|
568
|
}
|