changeset 2395:1e827f59ddae libavformat

Allow pipe: URL to take fd number as input Patch by Vincent Fourmond [vincent dot fourmond at 9online dot fr]
author ramiro
date Fri, 17 Aug 2007 15:14:29 +0000
parents be66ba5bc96d
children 28f19eb568a2
files file.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/file.c	Fri Aug 17 15:12:30 2007 +0000
+++ b/file.c	Fri Aug 17 15:14:29 2007 +0000
@@ -23,6 +23,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/time.h>
+#include <stdlib.h>
 
 
 /* standard file protocol */
@@ -90,12 +91,17 @@
 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