62 return read(c->
fd, buf, size);
68 return write(c->
fd, buf, size);
90 #if CONFIG_FILE_PROTOCOL
101 access = O_CREAT | O_RDWR;
105 access = O_CREAT | O_WRONLY;
122 static int64_t file_seek(
URLContext *h, int64_t pos,
int whence)
130 ret = fstat(c->
fd, &st);
131 return ret < 0 ?
AVERROR(errno) : st.st_size;
134 ret = lseek(c->
fd, pos, whence);
136 return ret < 0 ?
AVERROR(errno) : ret;
147 .url_open = file_open,
150 .url_seek = file_seek,
151 .url_close = file_close,
155 .priv_data_class = &file_class,
160 #if CONFIG_PIPE_PROTOCOL
162 static int pipe_open(
URLContext *h,
const char *filename,
int flags)
169 fd = strtol(filename, &
final, 10);
170 if((filename ==
final) || *
final ) {
171 if (flags & AVIO_FLAG_WRITE) {
178 setmode(fd, O_BINARY);
187 .url_open = pipe_open,