mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-26 17:32:06 +00:00
avformat/file: add fd option for pipe
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
parent
0d7c452d84
commit
49b8f043ca
@ -687,7 +687,7 @@ The accepted syntax is:
|
||||
pipe:[@var{number}]
|
||||
@end example
|
||||
|
||||
@var{number} is the number corresponding to the file descriptor of the
|
||||
If @option{fd} isn't specified, @var{number} is the number corresponding to the file descriptor of the
|
||||
pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If @var{number}
|
||||
is not specified, by default the stdout file descriptor will be used
|
||||
for writing, stdin for reading.
|
||||
@ -714,6 +714,8 @@ Set I/O operation maximum block size, in bytes. Default value is
|
||||
@code{INT_MAX}, which results in not limiting the requested block size.
|
||||
Setting this value reasonably low improves user termination request reaction
|
||||
time, which is valuable if data transmission is slow.
|
||||
@item fd
|
||||
Set file descriptor.
|
||||
@end table
|
||||
|
||||
Note that some formats (typically MOV), require the output protocol to
|
||||
|
@ -92,6 +92,7 @@ static const AVOption file_options[] = {
|
||||
|
||||
static const AVOption pipe_options[] = {
|
||||
{ "blocksize", "set I/O operation maximum block size", offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
|
||||
{ "fd", "set file descriptor", offsetof(FileContext, fd), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@ -381,6 +382,8 @@ static int pipe_open(URLContext *h, const char *filename, int flags)
|
||||
FileContext *c = h->priv_data;
|
||||
int fd;
|
||||
char *final;
|
||||
|
||||
if (c->fd < 0) {
|
||||
av_strstart(filename, "pipe:", &filename);
|
||||
|
||||
fd = strtol(filename, &final, 10);
|
||||
@ -391,10 +394,12 @@ static int pipe_open(URLContext *h, const char *filename, int flags)
|
||||
fd = 0;
|
||||
}
|
||||
}
|
||||
#if HAVE_SETMODE
|
||||
setmode(fd, O_BINARY);
|
||||
#endif
|
||||
c->fd = fd;
|
||||
}
|
||||
|
||||
#if HAVE_SETMODE
|
||||
setmode(c->fd, O_BINARY);
|
||||
#endif
|
||||
h->is_streamed = 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "version_major.h"
|
||||
|
||||
#define LIBAVFORMAT_VERSION_MINOR 34
|
||||
#define LIBAVFORMAT_VERSION_MICRO 102
|
||||
#define LIBAVFORMAT_VERSION_MICRO 103
|
||||
|
||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||
LIBAVFORMAT_VERSION_MINOR, \
|
||||
|
Loading…
Reference in New Issue
Block a user