diff options
author | Diego Biurrun <diego@biurrun.de> | 2011-05-04 21:20:03 +0400 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2011-05-04 23:12:42 +0400 |
commit | 8799541a0a7bd84c04a2fac73bf819aaf53fc302 (patch) | |
tree | e034c21bb3e9c244630765989df4aa92c54cbd07 /libavformat | |
parent | 3d2690592577ad4b4318cc7a6dcab63481a5acae (diff) |
Fix standalone compilation of pipe protocol.
file_check() is not only used by the file protocol, adjust #ifdef accordingly.
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/file.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/libavformat/file.c b/libavformat/file.c index 6a3ed5acb0..649640a927 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -51,6 +51,19 @@ static int file_get_handle(URLContext *h) return (intptr_t) h->priv_data; } +static int file_check(URLContext *h, int mask) +{ + struct stat st; + int ret = stat(h->filename, &st); + if (ret < 0) + return AVERROR(errno); + + ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0; + ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0; + + return ret; +} + #if CONFIG_FILE_PROTOCOL static int file_open(URLContext *h, const char *filename, int flags) @@ -95,19 +108,6 @@ static int file_close(URLContext *h) return close(fd); } -static int file_check(URLContext *h, int mask) -{ - struct stat st; - int ret = stat(h->filename, &st); - if (ret < 0) - return AVERROR(errno); - - ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0; - ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0; - - return ret; -} - URLProtocol ff_file_protocol = { .name = "file", .url_open = file_open, |