[FFmpeg-devel] [PATCH 2/9] tools/aviocat: add options to enable EXCL.

Nicolas George george at nsup.org
Wed Apr 16 18:58:25 CEST 2014


The -X variant is strict, the -x variant is loose.

Signed-off-by: Nicolas George <george at nsup.org>
---
 tools/aviocat.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/aviocat.c b/tools/aviocat.c
index 56b918e..c07c70f 100644
--- a/tools/aviocat.c
+++ b/tools/aviocat.c
@@ -26,13 +26,13 @@
 
 static int usage(const char *argv0, int ret)
 {
-    fprintf(stderr, "%s [-b bytespersec] [-d duration] input_url output_url\n", argv0);
+    fprintf(stderr, "%s [-b bytespersec] [-d duration] [-X] [-x] input_url output_url\n", argv0);
     return ret;
 }
 
 int main(int argc, char **argv)
 {
-    int bps = 0, duration = 0, ret, i;
+    int bps = 0, duration = 0, ret, i, write_flags = 0;
     const char *input_url = NULL, *output_url = NULL;
     int64_t stream_pos = 0;
     int64_t start_time;
@@ -49,6 +49,10 @@ int main(int argc, char **argv)
         } else if (!strcmp(argv[i], "-d") && i + 1 < argc) {
             duration = atoi(argv[i + 1]);
             i++;
+        } else if (!strcmp(argv[i], "-x")) {
+            write_flags = AVIO_FLAG_EXCL_LOOSE;
+        } else if (!strcmp(argv[i], "-X")) {
+            write_flags = AVIO_FLAG_EXCL;
         } else if (!input_url) {
             input_url = argv[i];
         } else if (!output_url) {
@@ -75,7 +79,7 @@ int main(int argc, char **argv)
         }
         bps = size / duration;
     }
-    ret = avio_open2(&output, output_url, AVIO_FLAG_WRITE, NULL, NULL);
+    ret = avio_open2(&output, output_url, AVIO_FLAG_WRITE | write_flags, NULL, NULL);
     if (ret) {
         av_strerror(ret, errbuf, sizeof(errbuf));
         fprintf(stderr, "Unable to open %s: %s\n", output_url, errbuf);
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list