]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/aviobuf.c
In av_close_input_stream(), flush the packet queue before to actually
[ffmpeg] / libavformat / aviobuf.c
index 2a96f5aaa3c4f13c1ad0dc0c23f74065f2a85355..df765078662c130ef1cfedb5820e748f676c4e19 100644 (file)
@@ -36,7 +36,7 @@
 #define SHORT_SEEK_THRESHOLD 4096
 
 static void fill_buffer(ByteIOContext *s);
-#if LIBAVFORMAT_VERSION_MAJOR >= 53
+#if !FF_API_URL_RESETBUF
 static int url_resetbuf(ByteIOContext *s, int flags);
 #endif
 
@@ -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) {
@@ -632,13 +646,13 @@ int url_setbufsize(ByteIOContext *s, int buf_size)
     return 0;
 }
 
-#if LIBAVFORMAT_VERSION_MAJOR < 53
+#if FF_API_URL_RESETBUF
 int url_resetbuf(ByteIOContext *s, int flags)
 #else
 static int url_resetbuf(ByteIOContext *s, int flags)
 #endif
 {
-#if LIBAVFORMAT_VERSION_MAJOR < 53
+#if FF_API_URL_RESETBUF
     if (flags & URL_RDWR)
         return AVERROR(EINVAL);
 #else