From f7e1373ac807a9b007e7598b292416751ac6c879 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sun, 28 Apr 2013 12:19:31 +0200 Subject: HACK avio: add a flag to skip the fstat on file opening for performance reasons --- libavformat/avio.h | 2 ++ libavformat/file.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index f14b003ba5..33a94508aa 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -669,6 +669,8 @@ int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); */ #define AVIO_FLAG_DIRECT 0x8000 +#define AVIO_FLAG_AVOID_FSTAT 0x80000000 + /** * Create and initialize a AVIOContext for accessing the * resource indicated by url. diff --git a/libavformat/file.c b/libavformat/file.c index 1d321c4205..563918f34d 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -227,7 +227,7 @@ static int file_open(URLContext *h, const char *filename, int flags) return AVERROR(errno); c->fd = fd; - h->is_streamed = !fstat(fd, &st) && S_ISFIFO(st.st_mode); + h->is_streamed = !(flags & AVIO_FLAG_AVOID_FSTAT) && !fstat(fd, &st) && S_ISFIFO(st.st_mode); /* Buffer writes more than the default 32k to improve throughput especially * with networked file systems */ -- cgit v1.2.3