40 return read(fd, buf, size);
46 return write(fd, buf, size);
67 #if CONFIG_FILE_PROTOCOL
77 access = O_CREAT | O_TRUNC | O_RDWR;
79 access = O_CREAT | O_TRUNC | O_WRONLY;
86 fd = open(filename, access, 0666);
94 static int64_t file_seek(
URLContext *h, int64_t pos,
int whence)
99 int ret = fstat(fd, &st);
100 return ret < 0 ?
AVERROR(errno) : st.st_size;
102 return lseek(fd, pos, whence);
113 .url_open = file_open,
116 .url_seek = file_seek,
117 .url_close = file_close,
124 #if CONFIG_PIPE_PROTOCOL
126 static int pipe_open(
URLContext *h,
const char *filename,
int flags)
132 fd = strtol(filename, &
final, 10);
133 if((filename ==
final) || *
final ) {
134 if (flags & AVIO_FLAG_WRITE) {
141 setmode(fd, O_BINARY);
150 .url_open = pipe_open,