aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Sliwka <martin.sliwka@gmail.com>2012-06-28 19:31:04 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-06-29 14:54:15 +0200
commitdf531b0e1004cdc76e656465d84ede7cfd9e370a (patch)
tree310cd663cf50ab7d090ab47aba84cda2c048f508
parent6851130fd61ff8af615f6270f3a3c8dec7a0cfbd (diff)
downloadffmpeg-df531b0e1004cdc76e656465d84ede7cfd9e370a.tar.gz
avformat: disable seeking on FIFOs/named pipes
Patch is addition to my previous patch (https://lists.ffmpeg.org/pipermail/ffmpeg-cvslog/2012-June/051590.html) and disables seeking on FIFOs/named pipes by setting URLContext::is_streamed (same as pipe: protocol does for stdin/stdout pipes) Fixes Ticket986 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/file.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/file.c b/libavformat/file.c
index 0c566c91a8..35c36a56b6 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -72,6 +72,7 @@ static int file_open(URLContext *h, const char *filename, int flags)
{
int access;
int fd;
+ struct stat st;
av_strstart(filename, "file:", &filename);
@@ -89,6 +90,9 @@ static int file_open(URLContext *h, const char *filename, int flags)
if (fd == -1)
return AVERROR(errno);
h->priv_data = (void *) (intptr_t) fd;
+
+ h->is_streamed = (0==fstat(fd, &st) && S_ISFIFO(st.st_mode)) ? 1 : 0;
+
return 0;
}