shithub: opus-tools

Download patch

ref: 69f47e2d4f4f59af4203930e1b3f1dbd74968460
parent: 376d4d95f3267b0af15251ccfc9cdcccf72cb431
author: Martin Meszaros <meszaros@hft-leipzig.de>
date: Wed Nov 8 07:02:14 EST 2017

opusrtp: Make --extract argument mandatory

Make the --extract argument mandatory, as optional arguments don't
work as expected by most people anyway.
Also, now all other parameters are parsed before extraction begins, so
the order of the flags doesn't matter anymore.

Signed-off-by: Mark Harris <mark.hsj@gmail.com>

--- a/src/opusrtp.c
+++ b/src/opusrtp.c
@@ -963,7 +963,7 @@
   printf(" -s, --samplerate     Sets samplerate in pcap file (default 48000)\n");
   printf(" -t, --type           Set the used payload type for opus (default 120)\n");
   printf(" --sniff              Sniff and record Opus RTP streams\n");
-  printf(" -e, --extract        Extract from input pcap file (default input.pcap)\n");
+  printf(" -e, --extract        Extract from input pcap file\n");
   printf("\n");
   printf("By default, the given file(s) will be sent over RTP.\n");
 }
@@ -973,7 +973,7 @@
   int option, i;
   const char *dest = "127.0.0.1";
 #ifdef HAVE_PCAP
-  const char *input_pcap = "input.pcap";
+  const char *input_pcap = NULL;
 #endif
   int port = 1234;
   struct option long_options[] = {
@@ -1020,8 +1020,7 @@
 #ifdef HAVE_PCAP
         if (optarg)
             input_pcap = optarg;
-        extract(input_pcap);
-        return 0;
+        break;
 #else
         fprintf(stderr, "pcap support disabled, sorry.\n");
         return 1;
@@ -1051,7 +1050,12 @@
         return 1;
     }
   }
-
+#ifdef HAVE_PCAP
+  if(input_pcap) {
+    extract(input_pcap);
+    return 0;
+  }
+#endif
   for (i = optind; i < argc; i++) {
     rtp_send_file(argv[i], dest, port);
   }