44 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
46 # define S_ISFIFO(m) 0
53 # define S_ISLNK(m) (((m) & S_IFLNK) == S_IFLNK)
62 # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
64 # define S_ISSOCK(m) 0
114 ret = read(
c->fd, buf,
size);
115 if (ret == 0 &&
c->follow)
119 return (ret == -1) ?
AVERROR(errno) : ret;
127 ret = write(
c->fd, buf,
size);
128 return (ret == -1) ?
AVERROR(errno) : ret;
140 const char *filename =
h->filename;
144 #if HAVE_ACCESS && defined(R_OK)
145 if (access(filename, F_OK) < 0)
148 if (access(filename, R_OK) >= 0)
151 if (access(filename, W_OK) >= 0)
156 ret = stat(filename, &st);
158 ret = win32_stat(filename, &st);
174 const char *filename =
h->filename;
177 ret = rmdir(filename);
178 if (ret < 0 && (errno == ENOTDIR
183 ret = unlink(filename);
195 const char *filename_src = h_src->
filename;
196 const char *filename_dst = h_dst->
filename;
200 if (rename(filename_src, filename_dst) < 0)
206 #if CONFIG_FILE_PROTOCOL
218 access = O_CREAT | O_RDWR;
222 access = O_CREAT | O_WRONLY;
236 h->is_streamed = !fstat(fd, &st) &&
S_ISFIFO(st.st_mode);
241 h->min_packet_size =
h->max_packet_size = 262144;
243 if (
c->seekable >= 0)
244 h->is_streamed = !
c->seekable;
257 ret = fstat(
c->fd, &st);
258 return ret < 0 ?
AVERROR(errno) : (
S_ISFIFO(st.st_mode) ? 0 : st.st_size);
261 ret = lseek(
c->fd,
pos, whence);
263 return ret < 0 ?
AVERROR(errno) : ret;
277 c->dir = opendir(
h->filename);
292 char *fullpath =
NULL;
299 dir = readdir(
c->dir);
304 }
while (!strcmp(dir->d_name,
".") || !strcmp(dir->d_name,
".."));
309 if (!lstat(fullpath, &st)) {
310 if (S_ISDIR(st.st_mode))
314 else if (S_ISCHR(st.st_mode))
316 else if (S_ISBLK(st.st_mode))
322 else if (S_ISREG(st.st_mode))
327 (*next)->group_id = st.st_gid;
328 (*next)->user_id = st.st_uid;
329 (*next)->size = st.st_size;
330 (*next)->filemode = st.st_mode & 0777;
331 (*next)->modification_timestamp = INT64_C(1000000) * st.st_mtime;
332 (*next)->access_timestamp = INT64_C(1000000) * st.st_atime;
333 (*next)->status_change_timestamp = INT64_C(1000000) * st.st_ctime;
358 .url_open = file_open,
361 .url_seek = file_seek,
362 .url_close = file_close,
369 .url_open_dir = file_open_dir,
370 .url_read_dir = file_read_dir,
371 .url_close_dir = file_close_dir,
372 .default_whitelist =
"file,crypto,data"
377 #if CONFIG_PIPE_PROTOCOL
386 fd = strtol(filename, &
final, 10);
387 if((filename ==
final) || *
final ) {
395 setmode(fd, O_BINARY);
404 .url_open = pipe_open,
411 .default_whitelist =
"crypto,data"
#define AVIO_FLAG_READ
read-only
#define AVSEEK_SIZE
ORing this as the "whence" parameter to a seek function causes it to return the filesize without seek...
#define AVIO_FLAG_WRITE
write-only
@ AVIO_ENTRY_BLOCK_DEVICE
@ AVIO_ENTRY_SYMBOLIC_LINK
@ AVIO_ENTRY_CHARACTER_DEVICE
#define flags(name, subs,...)
static __device__ float trunc(float a)
#define AVERROR_EOF
End of file.
const char * av_default_item_name(void *ptr)
Return the context name.
char * av_strdup(const char *s)
Duplicate a string.
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
char * av_append_path_component(const char *path, const char *component)
Append path component to the existing path.
#define LIBAVUTIL_VERSION_INT
int avpriv_open(const char *filename, int flags,...)
A wrapper for open() setting O_CLOEXEC.
common internal API header
static const uint16_t mask[17]
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
miscellaneous OS support macros and functions.
const URLProtocol ff_file_protocol
const URLProtocol ff_pipe_protocol
Describe the class of an AVClass context structure.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Describes single entry of the directory.
char * filename
specified URL
AVIODirEntry * ff_alloc_dir_entry(void)
Allocate directory entry with default values.
unbuffered private I/O API