[FFmpeg-devel] [PATCH] avformat/avio: Add max_pkt_size option

Zhao Zhili quinkblack at foxmail.com
Thu Mar 13 14:48:40 EET 2025


From: Zhao Zhili <zhilizhao at tencent.com>

Optimizing memory footprint in memory-constrained systems.

Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>
---
 libavformat/avio.c    | 2 ++
 libavformat/version.h | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index d109f3adff..e1b959ed73 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -61,6 +61,8 @@ static const AVOption options[] = {
     {"protocol_whitelist", "List of protocols that are allowed to be used", OFFSET(protocol_whitelist), AV_OPT_TYPE_STRING, { .str = NULL },  0, 0, D },
     {"protocol_blacklist", "List of protocols that are not allowed to be used", OFFSET(protocol_blacklist), AV_OPT_TYPE_STRING, { .str = NULL },  0, 0, D },
     {"rw_timeout", "Timeout for IO operations (in microseconds)", offsetof(URLContext, rw_timeout), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_DECODING_PARAM },
+    {"max_pkt_size", "Default maximum packet size in bytes, could be overwritten by particular protocol",
+            offsetof(URLContext, max_packet_size), AV_OPT_TYPE_INT, { .i64 = IO_BUFFER_SIZE }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_DECODING_PARAM },
     { NULL }
 };
 
diff --git a/libavformat/version.h b/libavformat/version.h
index 6ffdf61b43..e1ab967f5b 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 #include "version_major.h"
 
 #define LIBAVFORMAT_VERSION_MINOR   9
-#define LIBAVFORMAT_VERSION_MICRO 107
+#define LIBAVFORMAT_VERSION_MICRO 108
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \
-- 
2.46.0



More information about the ffmpeg-devel mailing list