[FFmpeg-devel] [PATCH 4/9] avformat/aviobuf: Make ffio_set_buf_size() static
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Thu Aug 5 08:42:39 EEST 2021
Possible since 9c3adb7ce23522dcceb264bc0bffd3592dd3e1a5.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
It seems that despite the warning this function is called
after having performed I/O; and that this is intended.
Btw: Shall I move the functions around to avoid the forward
declarations?
libavformat/avio_internal.h | 3 ---
libavformat/aviobuf.c | 8 +++++---
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index 2c6d00b5ff..de95b43bdb 100644
--- a/libavformat/avio_internal.h
+++ b/libavformat/avio_internal.h
@@ -83,9 +83,6 @@ uint64_t ffio_read_varlen(AVIOContext *bc);
*/
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size);
-/** @warning must be called before any I/O */
-int ffio_set_buf_size(AVIOContext *s, int buf_size);
-
/**
* Reallocate a given buffer for AVIOContext.
*
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 9322ed38bc..1f0819b328 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -74,6 +74,8 @@ const AVClass ff_avio_class = {
static void fill_buffer(AVIOContext *s);
static int url_resetbuf(AVIOContext *s, int flags);
+/** @warning must be called before any I/O */
+static int set_buf_size(AVIOContext *s, int buf_size);
int ffio_init_context(AVIOContext *s,
unsigned char *buffer,
@@ -543,7 +545,7 @@ static void fill_buffer(AVIOContext *s)
/* make buffer smaller in case it ended up large after probing */
if (s->read_packet && s->orig_buffer_size && s->buffer_size > s->orig_buffer_size && len >= s->orig_buffer_size) {
if (dst == s->buffer && s->buf_ptr != dst) {
- int ret = ffio_set_buf_size(s, s->orig_buffer_size);
+ int ret = set_buf_size(s, s->orig_buffer_size);
if (ret < 0)
av_log(s, AV_LOG_WARNING, "Failed to decrease buffer size\n");
@@ -1040,7 +1042,7 @@ int ffio_limit(AVIOContext *s, int size)
return size;
}
-int ffio_set_buf_size(AVIOContext *s, int buf_size)
+static int set_buf_size(AVIOContext *s, int buf_size)
{
uint8_t *buffer;
buffer = av_malloc(buf_size);
@@ -1062,7 +1064,7 @@ int ffio_realloc_buf(AVIOContext *s, int buf_size)
int data_size;
if (!s->buffer_size)
- return ffio_set_buf_size(s, buf_size);
+ return set_buf_size(s, buf_size);
if (buf_size <= s->buffer_size)
return 0;
--
2.30.2
More information about the ffmpeg-devel
mailing list