Patch by Anssi Hannula, anssi d hannula a iki d fi
Originally committed as revision 26193 to svn://svn.ffmpeg.org/ffmpeg/trunk
... | ... |
@@ -353,6 +353,7 @@ ByteIOContext *av_alloc_put_byte( |
353 | 353 |
int64_t (*seek)(void *opaque, int64_t offset, int whence)); |
354 | 354 |
|
355 | 355 |
void put_byte(ByteIOContext *s, int b); |
356 |
+void put_nbyte(ByteIOContext *s, int b, int count); |
|
356 | 357 |
void put_buffer(ByteIOContext *s, const unsigned char *buf, int size); |
357 | 358 |
void put_le64(ByteIOContext *s, uint64_t val); |
358 | 359 |
void put_be64(ByteIOContext *s, uint64_t val); |
... | ... |
@@ -113,6 +113,20 @@ void put_byte(ByteIOContext *s, int b) |
113 | 113 |
flush_buffer(s); |
114 | 114 |
} |
115 | 115 |
|
116 |
+void put_nbyte(ByteIOContext *s, int b, int count) |
|
117 |
+{ |
|
118 |
+ while (count > 0) { |
|
119 |
+ int len = FFMIN(s->buf_end - s->buf_ptr, count); |
|
120 |
+ memset(s->buf_ptr, b, len); |
|
121 |
+ s->buf_ptr += len; |
|
122 |
+ |
|
123 |
+ if (s->buf_ptr >= s->buf_end) |
|
124 |
+ flush_buffer(s); |
|
125 |
+ |
|
126 |
+ count -= len; |
|
127 |
+ } |
|
128 |
+} |
|
129 |
+ |
|
116 | 130 |
void put_buffer(ByteIOContext *s, const unsigned char *buf, int size) |
117 | 131 |
{ |
118 | 132 |
while (size > 0) { |