From: Stefano Sabatini <[email protected]>
---
libavformat/file.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/libavformat/file.c b/libavformat/file.c
index 31067ed..6eabdae 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -95,6 +95,16 @@ static int file_close(URLContext *h)
return close(fd);
}
+static int file_check(URLContext *h, int flags)
+{
+ struct stat st;
+ int ret = stat(h->filename, &st);
+ if (ret < 0)
+ return AVERROR(errno);
+
+ return !!(st.st_mode & flags);
+}
+
URLProtocol ff_file_protocol = {
.name = "file",
.url_open = file_open,
@@ -103,6 +113,7 @@ URLProtocol ff_file_protocol = {
.url_seek = file_seek,
.url_close = file_close,
.url_get_file_handle = file_get_handle,
+ .url_check = file_check,
};
#endif /* CONFIG_FILE_PROTOCOL */
@@ -137,6 +148,7 @@ URLProtocol ff_pipe_protocol = {
.url_read = file_read,
.url_write = file_write,
.url_get_file_handle = file_get_handle,
+ .url_check = file_check,
};
#endif /* CONFIG_PIPE_PROTOCOL */
--
1.7.4.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel