diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-03-17 16:53:58 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-03-17 17:22:52 +0100 |
commit | 0fecf2642b9d909820683647c70031a954f5e58d (patch) | |
tree | 36ca02de9fa27a049829fb589517223d2d0ce5f5 /libavformat/aviobuf.c | |
parent | e309fdc7018a1027d187ec27fb1d69a41a4ee167 (diff) | |
parent | f1f60f5252b0b448adcce0c1c52f3161ee69b9bf (diff) | |
download | ffmpeg-0fecf2642b9d909820683647c70031a954f5e58d.tar.gz |
Merge remote-tracking branch 'newdev/master'
Conflicts:
Changelog
doc/APIchanges
doc/optimization.txt
libavformat/avio.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r-- | libavformat/aviobuf.c | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index a4f95210bf..b8cfb9286a 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -170,7 +170,7 @@ void avio_write(AVIOContext *s, const unsigned char *buf, int size) } } -void put_flush_packet(AVIOContext *s) +void avio_flush(AVIOContext *s) { flush_buffer(s); s->must_flush = 0; @@ -386,6 +386,26 @@ int64_t url_fsize(AVIOContext *s) { return avio_size(s); } +int url_setbufsize(AVIOContext *s, int buf_size) +{ + return ffio_set_buf_size(s, buf_size); +} +int url_fprintf(AVIOContext *s, const char *fmt, ...) +{ + va_list ap; + char buf[4096]; + int ret; + + va_start(ap, fmt); + ret = vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + avio_write(s, buf, strlen(buf)); + return ret; +} +void put_flush_packet(AVIOContext *s) +{ + avio_flush(s); +} #endif int avio_put_str(AVIOContext *s, const char *str) @@ -499,7 +519,7 @@ static void fill_buffer(AVIOContext *s) /* make buffer smaller in case it ended up large after probing */ if (s->buffer_size > max_buffer_size) { - url_setbufsize(s, max_buffer_size); + ffio_set_buf_size(s, max_buffer_size); s->checksum_ptr = dst = s->buffer; len = s->buffer_size; @@ -762,7 +782,7 @@ uint64_t avio_rb64(AVIOContext *s) return val; } -uint64_t ff_get_v(AVIOContext *bc){ +uint64_t ffio_read_varlen(AVIOContext *bc){ uint64_t val = 0; int tmp; @@ -810,7 +830,7 @@ int url_fdopen(AVIOContext **s, URLContext *h) return 0; } -int url_setbufsize(AVIOContext *s, int buf_size) +int ffio_set_buf_size(AVIOContext *s, int buf_size) { uint8_t *buffer; buffer = av_malloc(buf_size); @@ -917,8 +937,7 @@ URLContext *url_fileno(AVIOContext *s) return s->opaque; } -#if CONFIG_MUXERS -int url_fprintf(AVIOContext *s, const char *fmt, ...) +int avio_printf(AVIOContext *s, const char *fmt, ...) { va_list ap; char buf[4096]; @@ -930,7 +949,6 @@ int url_fprintf(AVIOContext *s, const char *fmt, ...) avio_write(s, buf, strlen(buf)); return ret; } -#endif //CONFIG_MUXERS #if FF_API_OLD_AVIO char *url_fgets(AVIOContext *s, char *buf, int buf_size) @@ -991,6 +1009,7 @@ int64_t av_url_read_fseek(AVIOContext *s, int stream_index, * back to the server even if CONFIG_MUXERS is false. */ #if CONFIG_MUXERS || CONFIG_NETWORK /* buffer handling */ +#if FF_API_OLD_AVIO int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags) { int ret; @@ -1007,9 +1026,10 @@ int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags) int url_close_buf(AVIOContext *s) { - put_flush_packet(s); + avio_flush(s); return s->buf_ptr - s->buffer; } +#endif /* output in a dynamic buffer */ @@ -1134,7 +1154,7 @@ int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) padding = FF_INPUT_BUFFER_PADDING_SIZE; } - put_flush_packet(s); + avio_flush(s); *pbuffer = d->buffer; size = d->size; |