[FFmpeg-devel] [PATCH 1/1] add option in file.c: pkt_size to set max_packet_size

Gyan Doshi ffmpeg at gyani.pro
Thu Jul 17 17:27:17 EEST 2025



On 2025-07-17 07:35 pm, yangsen5 via ffmpeg-devel wrote:
> From: yangsen5 <1441923451 at qq.com>
>
> Signed-off-by: yangsen5 <1441923451 at qq.com>
> ---
>   libavformat/file.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/file.c b/libavformat/file.c
> index 6a66040b65..8099a7e931 100644
> --- a/libavformat/file.c
> +++ b/libavformat/file.c
> @@ -94,6 +94,7 @@ typedef struct FileContext {
>       int fd;
>       int trunc;
>       int blocksize;
> +    int pkt_size;
>       int follow;
>       int seekable;
>   #if HAVE_DIRENT_H
> @@ -106,6 +107,7 @@ static const AVOption file_options[] = {
>       { "blocksize", "set I/O operation maximum block size", offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
>       { "follow", "Follow a file as it is being written", offsetof(FileContext, follow), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
>       { "seekable", "Sets if the file is seekable", offsetof(FileContext, seekable), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 0, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
> +    { "pkt_size", "Maximum file packet size", offsetof(FileContext, pkt_size), AV_OPT_TYPE_INT, { .i64 = 262144 }, -1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM },

I see naive assignment of the value in avio*.c
What happens if someone sets the value to -1?

Regards,
Gyan




More information about the ffmpeg-devel mailing list