Commit 881fc336 authored by ramiro's avatar ramiro

Allow pipe: URL to take fd number as input

Patch by Vincent Fourmond [vincent dot fourmond at 9online dot fr]

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@10134 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent a0f68281
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <sys/time.h> #include <sys/time.h>
#include <stdlib.h>
/* standard file protocol */ /* standard file protocol */
...@@ -90,12 +91,17 @@ URLProtocol file_protocol = { ...@@ -90,12 +91,17 @@ URLProtocol file_protocol = {
static int pipe_open(URLContext *h, const char *filename, int flags) static int pipe_open(URLContext *h, const char *filename, int flags)
{ {
int fd; 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) { if (flags & URL_WRONLY) {
fd = 1; fd = 1;
} else { } else {
fd = 0; fd = 0;
} }
}
#ifdef O_BINARY #ifdef O_BINARY
setmode(fd, O_BINARY); setmode(fd, O_BINARY);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment