summaryrefslogtreecommitdiff
path: root/libavformat/file.c
diff options
context:
space:
mode:
authorVincent Fourmond <vincent.fourmond@9online.fr>2007-08-17 15:14:29 +0000
committerRamiro Polla <ramiro.polla@gmail.com>2007-08-17 15:14:29 +0000
commit9e33b10fd784aaefae92253779c4e8a6c5efa547 (patch)
tree65816e0032970115404c32d63620aeb84569401d /libavformat/file.c
parentde79849eace7b16a6e92c6820d3146ff06997017 (diff)
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
Diffstat (limited to 'libavformat/file.c')
-rw-r--r--libavformat/file.c6
1 files changed, 6 insertions, 0 deletions
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 <fcntl.h>
#include <unistd.h>
#include <sys/time.h>
+#include <stdlib.h>
/* 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