[FFmpeg-cvslog] r26193 - in trunk/libavformat: avio.h aviobuf.c

cehoyos subversion
Sun Jan 2 11:45:07 CET 2011


Author: cehoyos
Date: Sun Jan  2 11:45:07 2011
New Revision: 26193

Log:
Add function put_nbyte() to speed up padding in SPDIF muxer.

Patch by Anssi Hannula, anssi d hannula a iki d fi

Modified:
   trunk/libavformat/avio.h
   trunk/libavformat/aviobuf.c

Modified: trunk/libavformat/avio.h
==============================================================================
--- trunk/libavformat/avio.h	Sun Jan  2 11:11:12 2011	(r26192)
+++ trunk/libavformat/avio.h	Sun Jan  2 11:45:07 2011	(r26193)
@@ -353,6 +353,7 @@ ByteIOContext *av_alloc_put_byte(
                   int64_t (*seek)(void *opaque, int64_t offset, int whence));
 
 void put_byte(ByteIOContext *s, int b);
+void put_nbyte(ByteIOContext *s, int b, int count);
 void put_buffer(ByteIOContext *s, const unsigned char *buf, int size);
 void put_le64(ByteIOContext *s, uint64_t val);
 void put_be64(ByteIOContext *s, uint64_t val);

Modified: trunk/libavformat/aviobuf.c
==============================================================================
--- trunk/libavformat/aviobuf.c	Sun Jan  2 11:11:12 2011	(r26192)
+++ trunk/libavformat/aviobuf.c	Sun Jan  2 11:45:07 2011	(r26193)
@@ -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) {



More information about the ffmpeg-cvslog mailing list