From 9e33b10fd784aaefae92253779c4e8a6c5efa547 Mon Sep 17 00:00:00 2001 From: Vincent Fourmond Date: Fri, 17 Aug 2007 15:14:29 +0000 Subject: [PATCH] Allow pipe: URL to take fd number as input Patch by Vincent Fourmond [vincent dot fourmond at 9online dot fr] Originally committed as revision 10134 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/file.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavformat/file.c b/libavformat/file.c index 48e7803ba1..c0134d15df 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -23,6 +23,7 @@ #include #include #include +#include /* standard file protocol */ @@ -90,12 +91,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