41 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
43 # define S_ISFIFO(m) 0
86 r = read(c->
fd, buf, size);
95 r = write(c->
fd, buf, size);
112 #if HAVE_ACCESS && defined(R_OK)
113 if (access(filename, F_OK) < 0)
116 if (access(filename, R_OK) >= 0)
119 if (access(filename, W_OK) >= 0)
123 ret = stat(filename, &st);
127 ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0;
128 ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0;
134 #if CONFIG_FILE_PROTOCOL
146 access = O_CREAT | O_RDWR;
150 access = O_CREAT | O_WRONLY;
170 static int64_t file_seek(
URLContext *h, int64_t pos,
int whence)
177 ret = fstat(c->
fd, &st);
178 return ret < 0 ?
AVERROR(errno) : (
S_ISFIFO(st.st_mode) ? 0 : st.st_size);
181 ret = lseek(c->
fd, pos, whence);
183 return ret < 0 ?
AVERROR(errno) : ret;
194 .url_open = file_open,
197 .url_seek = file_seek,
198 .url_close = file_close,
202 .priv_data_class = &file_class,
207 #if CONFIG_PIPE_PROTOCOL
209 static int pipe_open(
URLContext *h,
const char *filename,
int flags)
216 fd = strtol(filename, &
final, 10);
217 if((filename ==
final) || *
final ) {
218 if (flags & AVIO_FLAG_WRITE) {
234 .url_open = pipe_open,
240 .priv_data_class = &pipe_class,
#define LIBAVUTIL_VERSION_INT
int is_streamed
true if streamed (no seek possible), default = false
#define AVIO_FLAG_READ
read-only
#define AVIO_FLAG_WRITE
write-only
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
miscellaneous OS support macros and functions.
int avpriv_open(const char *filename, int flags,...)
A wrapper for open() setting O_CLOEXEC.
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
static const uint16_t mask[17]
common internal API header
static av_always_inline av_const double trunc(double x)
Describe the class of an AVClass context structure.
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
char * filename
specified URL
#define AVSEEK_SIZE
Passing this as the "whence" parameter to a seek function causes it to return the filesize without se...
unbuffered private I/O API