mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-13 02:41:37 +00:00
lavf/avio: add avio_vprintf()
This new function makes it possible to use avio_printf() functionality from a function taking a variable list of arguments. Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
parent
4d45f5acbd
commit
7cae3d8b76
@ -14,6 +14,10 @@ libavutil: 2021-04-27
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
2022-06-12 - xxxxxxxxxx - lavf 59.25.100 - avio.h
|
||||
Add avio_vprintf(), similar to avio_printf() but allow to use it
|
||||
from within a function taking a variable argument list as input.
|
||||
|
||||
2022-05-23 - xxxxxxxxx - lavu 57.25.100 - avutil.h
|
||||
Deprecate av_fopen_utf8() without replacement.
|
||||
|
||||
|
@ -519,6 +519,12 @@ int64_t avio_size(AVIOContext *s);
|
||||
*/
|
||||
int avio_feof(AVIOContext *s);
|
||||
|
||||
/**
|
||||
* Writes a formatted string to the context taking a va_list.
|
||||
* @return number of bytes written, < 0 on error.
|
||||
*/
|
||||
int avio_vprintf(AVIOContext *s, const char *fmt, va_list ap);
|
||||
|
||||
/**
|
||||
* Writes a formatted string to the context.
|
||||
* @return number of bytes written, < 0 on error.
|
||||
|
@ -1292,15 +1292,12 @@ int avio_closep(AVIOContext **s)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int avio_printf(AVIOContext *s, const char *fmt, ...)
|
||||
int avio_vprintf(AVIOContext *s, const char *fmt, va_list ap)
|
||||
{
|
||||
va_list ap;
|
||||
AVBPrint bp;
|
||||
|
||||
av_bprint_init(&bp, 0, INT_MAX);
|
||||
va_start(ap, fmt);
|
||||
av_vbprintf(&bp, fmt, ap);
|
||||
va_end(ap);
|
||||
if (!av_bprint_is_complete(&bp)) {
|
||||
av_bprint_finalize(&bp, NULL);
|
||||
s->error = AVERROR(ENOMEM);
|
||||
@ -1311,6 +1308,18 @@ int avio_printf(AVIOContext *s, const char *fmt, ...)
|
||||
return bp.len;
|
||||
}
|
||||
|
||||
int avio_printf(AVIOContext *s, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
|
||||
va_start(ap, fmt);
|
||||
ret = avio_vprintf(s, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void avio_print_string_array(AVIOContext *s, const char *strings[])
|
||||
{
|
||||
for(; *strings; strings++)
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#include "version_major.h"
|
||||
|
||||
#define LIBAVFORMAT_VERSION_MINOR 24
|
||||
#define LIBAVFORMAT_VERSION_MINOR 25
|
||||
#define LIBAVFORMAT_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||
|
Loading…
Reference in New Issue
Block a user