summaryrefslogtreecommitdiff
path: root/libavformat/aviobuf.c
diff options
context:
space:
mode:
authorAnssi Hannula <anssi.hannula@iki.fi>2011-01-02 10:45:07 +0000
committerCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>2011-01-02 10:45:07 +0000
commit17ee8f669f2285aea8aa73bb4d3aa1f2262cb07b (patch)
tree4cf398426fd3f38be5b5a4accf34954178cb36b3 /libavformat/aviobuf.c
parentd2995eb910151cb83259223c2af6c665949ae6d0 (diff)
Add function put_nbyte() to speed up padding in SPDIF muxer.
Patch by Anssi Hannula, anssi d hannula a iki d fi Originally committed as revision 26193 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r--libavformat/aviobuf.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index faae089195..df76507866 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -113,6 +113,20 @@ void put_byte(ByteIOContext *s, int b)
flush_buffer(s);
}
+void put_nbyte(ByteIOContext *s, int b, int count)
+{
+ while (count > 0) {
+ int len = FFMIN(s->buf_end - s->buf_ptr, count);
+ memset(s->buf_ptr, b, len);
+ s->buf_ptr += len;
+
+ if (s->buf_ptr >= s->buf_end)
+ flush_buffer(s);
+
+ count -= len;
+ }
+}
+
void put_buffer(ByteIOContext *s, const unsigned char *buf, int size)
{
while (size > 0) {