]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/file.c
align and remove useless braces
[ffmpeg] / libavformat / file.c
index 48e7803ba135a13e54ebeed98235165ef88ab3af..6285c1bba2b322b3d15b4a73633b28e3bf47f59b 100644 (file)
@@ -23,6 +23,8 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/time.h>
+#include <stdlib.h>
+#include "os_support.h"
 
 
 /* standard file protocol */
@@ -90,12 +92,17 @@ URLProtocol file_protocol = {
 static int pipe_open(URLContext *h, const char *filename, int flags)
 {
     int fd;
+    const char * final;
+    av_strstart(filename, "pipe:", &filename);
 
+    fd = strtol(filename, &final, 10);
+    if((filename == final) || *final ) {/* No digits found, or something like 10ab */
         if (flags & URL_WRONLY) {
             fd = 1;
         } else {
             fd = 0;
         }
+    }
 #ifdef O_BINARY
     setmode(fd, O_BINARY);
 #endif
@@ -104,16 +111,9 @@ static int pipe_open(URLContext *h, const char *filename, int flags)
     return 0;
 }
 
-static int pipe_close(URLContext *h)
-{
-    return 0;
-}
-
 URLProtocol pipe_protocol = {
     "pipe",
     pipe_open,
     file_read,
     file_write,
-    NULL,
-    pipe_close,
 };