Mercurial > libavformat.hg
changeset 2853:7ad207078047 libavformat
Add a av_alloc_put_byte function.
The name is in analogy to init_put_byte, but I would not mind it
being changed to something better.
author | reimar |
---|---|
date | Sat, 22 Dec 2007 16:18:07 +0000 |
parents | 5f2ec0e202b0 |
children | c56f975e7661 |
files | avio.h aviobuf.c |
diffstat | 2 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/avio.h Fri Dec 21 11:51:39 2007 +0000 +++ b/avio.h Sat Dec 22 16:18:07 2007 +0000 @@ -181,6 +181,14 @@ int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), offset_t (*seek)(void *opaque, offset_t offset, int whence)); +ByteIOContext *av_alloc_put_byte( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + offset_t (*seek)(void *opaque, offset_t offset, int whence)); void put_byte(ByteIOContext *s, int b); void put_buffer(ByteIOContext *s, const unsigned char *buf, int size);
--- a/aviobuf.c Fri Dec 21 11:51:39 2007 +0000 +++ b/aviobuf.c Sat Dec 22 16:18:07 2007 +0000 @@ -60,6 +60,20 @@ return 0; } +ByteIOContext *av_alloc_put_byte( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + offset_t (*seek)(void *opaque, offset_t offset, int whence)) { + ByteIOContext *s = av_mallocz(sizeof(ByteIOContext)); + init_put_byte(s, buffer, buffer_size, write_flag, opaque, + read_packet, write_packet, seek); + return s; +} + static void flush_buffer(ByteIOContext *s) { if (s->buf_ptr > s->buffer) {