Mercurial > libavformat.hg
comparison aviobuf.c @ 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 | f51675f78402 |
children | c31c50af40c5 |
comparison
equal
deleted
inserted
replaced
2852:5f2ec0e202b0 | 2853:7ad207078047 |
---|---|
56 s->buf_end = s->buffer + buffer_size; | 56 s->buf_end = s->buffer + buffer_size; |
57 } | 57 } |
58 s->read_pause = NULL; | 58 s->read_pause = NULL; |
59 s->read_seek = NULL; | 59 s->read_seek = NULL; |
60 return 0; | 60 return 0; |
61 } | |
62 | |
63 ByteIOContext *av_alloc_put_byte( | |
64 unsigned char *buffer, | |
65 int buffer_size, | |
66 int write_flag, | |
67 void *opaque, | |
68 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), | |
69 int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), | |
70 offset_t (*seek)(void *opaque, offset_t offset, int whence)) { | |
71 ByteIOContext *s = av_mallocz(sizeof(ByteIOContext)); | |
72 init_put_byte(s, buffer, buffer_size, write_flag, opaque, | |
73 read_packet, write_packet, seek); | |
74 return s; | |
61 } | 75 } |
62 | 76 |
63 static void flush_buffer(ByteIOContext *s) | 77 static void flush_buffer(ByteIOContext *s) |
64 { | 78 { |
65 if (s->buf_ptr > s->buffer) { | 79 if (s->buf_ptr > s->buffer) { |