[FFmpeg-devel] [PATCH 3/3] avformat/avio: remove 4k limit from avio_printf
Marton Balint
cus at passwd.hu
Wed Aug 7 07:37:54 EEST 2019
On Tue, 6 Aug 2019, Nicolas George wrote:
> Marton Balint (12019-08-05):
>> We do this by switching to AVBPrint.
>>
>> Signed-off-by: Marton Balint <cus at passwd.hu>
>> ---
>> doc/APIchanges | 3 +++
>> libavformat/avio.h | 5 ++++-
>> libavformat/aviobuf.c | 15 ++++++++++-----
>> libavformat/version.h | 2 +-
>> 4 files changed, 18 insertions(+), 7 deletions(-)
>>
>> diff --git a/doc/APIchanges b/doc/APIchanges
>> index 0b19fb067d..fe36c34b90 100644
>> --- a/doc/APIchanges
>> +++ b/doc/APIchanges
>> @@ -15,6 +15,9 @@ libavutil: 2017-10-21
>>
>> API changes, most recent first:
>>
>> +2019-08-xx - xxxxxxxxxx - lavf 58.31.101 - avio.h
>> + 4K limit removed from avio_printf.
>> +
>> 2019-08-xx - xxxxxxxxxx - lavf 58.31.100 - avio.h
>> Add avio_print_n_strings and avio_print.
>>
>> diff --git a/libavformat/avio.h b/libavformat/avio.h
>> index ca08907917..f2051da18d 100644
>> --- a/libavformat/avio.h
>> +++ b/libavformat/avio.h
>> @@ -571,7 +571,10 @@ int64_t avio_size(AVIOContext *s);
>> */
>> int avio_feof(AVIOContext *s);
>>
>> -/** @warning Writes up to 4 KiB per call */
>> +/**
>> + * Writes a formatted string to the context.
>> + * @return number of bytes written, < 0 on error.
>> + */
>> int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);
>>
>> /**
>> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
>> index c37b056b64..007fba6410 100644
>> --- a/libavformat/aviobuf.c
>> +++ b/libavformat/aviobuf.c
>> @@ -1215,14 +1215,19 @@ int avio_closep(AVIOContext **s)
>> int avio_printf(AVIOContext *s, const char *fmt, ...)
>> {
>> va_list ap;
>> - char buf[4096]; /* update doc entry in avio.h if changed */
>> - int ret;
>> + AVBPrint bp;
>>
>
>> + av_bprint_init(&bp, 0, INT_MAX);
>
> INT_MAX? Should be -1 or AV_BPRINT_SIZE_UNLIMITED.
The function returns an int so it can't signal writing longer strings that
that.
Regards,
Marton
More information about the ffmpeg-devel
mailing list