On Thu, 25 Apr 2019, Luca Barbato wrote:
---Sometimes you receive a seekable fd from the outside. libavformat/file.c | 32 ++++++++++++++++++++++++++++++++ libavformat/protocols.c | 1 + 2 files changed, 33 insertions(+) diff --git a/libavformat/file.c b/libavformat/file.c index 27ce4de6eb..6a74ebbf48 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -204,3 +204,35 @@ const URLProtocol ff_pipe_protocol = { }; #endif /* CONFIG_PIPE_PROTOCOL */ + +#if CONFIG_FD_PROTOCOL + +static int fd_open(URLContext *h, const char *filename, int flags) +{ + FileContext *c = h->priv_data; + int fd; + char *final; + av_strstart(filename, "fd:", &filename); + + fd = strtol(filename, &final, 10); + if ((filename == final) || *final ) { + return AVERROR(EINVAL); + } +#if HAVE_SETMODE + setmode(fd, O_BINARY); +#endif + c->fd = fd; + return 0; +} + +const URLProtocol ff_pipe_protocol = {
Did you test compilation of this? It doesn't look like it would work given this ^
Isn't this essentially exactly the same as the pipe protocol, except for not setting the is_streamed flag? Even though the name pipe doesn't feel quite right for that case, wouldn't it be possible to just add an option to the pipe protocol for controlling this?
// Martin _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
