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
This commit is contained in:
Vincent Fourmond 2007-08-17 15:14:29 +00:00 committed by Ramiro Polla
parent de79849eac
commit 9e33b10fd7
1 changed files with 6 additions and 0 deletions

View File

@ -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