summaryrefslogtreecommitdiff
path: root/libavformat/aviobuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r--libavformat/aviobuf.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 70084e9323..71406e0523 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -38,9 +38,7 @@
#define SHORT_SEEK_THRESHOLD 4096
static void fill_buffer(AVIOContext *s);
-#if !FF_API_URL_RESETBUF
static int url_resetbuf(AVIOContext *s, int flags);
-#endif
int ffio_init_context(AVIOContext *s,
unsigned char *buffer,
@@ -55,7 +53,7 @@ int ffio_init_context(AVIOContext *s,
s->buffer_size = buffer_size;
s->buf_ptr = buffer;
s->opaque = opaque;
- url_resetbuf(s, write_flag ? AVIO_WRONLY : AVIO_RDONLY);
+ url_resetbuf(s, write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ);
s->write_packet = write_packet;
s->read_packet = read_packet;
s->seek = seek;
@@ -854,7 +852,7 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
}
if (ffio_init_context(*s, buffer, buffer_size,
- (h->flags & AVIO_WRONLY || h->flags & AVIO_RDWR), h,
+ h->flags & AVIO_FLAG_WRITE, h,
ffurl_read, ffurl_write, ffurl_seek) < 0) {
av_free(buffer);
av_freep(s);
@@ -883,24 +881,15 @@ int ffio_set_buf_size(AVIOContext *s, int buf_size)
s->buffer = buffer;
s->buffer_size = buf_size;
s->buf_ptr = buffer;
- url_resetbuf(s, s->write_flag ? AVIO_WRONLY : AVIO_RDONLY);
+ url_resetbuf(s, s->write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ);
return 0;
}
-#if FF_API_URL_RESETBUF
-int url_resetbuf(AVIOContext *s, int flags)
-#else
static int url_resetbuf(AVIOContext *s, int flags)
-#endif
{
-#if FF_API_URL_RESETBUF
- if (flags & AVIO_RDWR)
- return AVERROR(EINVAL);
-#else
- assert(flags == AVIO_WRONLY || flags == AVIO_RDONLY);
-#endif
+ assert(flags == AVIO_FLAG_WRITE || flags == AVIO_FLAG_READ);
- if (flags & AVIO_WRONLY) {
+ if (flags & AVIO_FLAG_WRITE) {
s->buf_end = s->buffer + s->buffer_size;
s->write_flag = 1;
} else {
@@ -1058,7 +1047,7 @@ int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags)
if(!*s)
return AVERROR(ENOMEM);
ret = ffio_init_context(*s, buf, buf_size,
- (flags & AVIO_WRONLY || flags & AVIO_RDWR),
+ flags & AVIO_FLAG_WRITE,
NULL, NULL, NULL, NULL);
if(ret != 0)
av_freep(s);