diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2022-06-12 13:15:26 +0200 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2022-06-13 22:42:55 +0200 |
commit | 7cae3d8b7685dda77b14aeab3a0fee22547e8f1d (patch) | |
tree | 0027a5507971076f74220fc9ce4bc37ba513427b /libavformat/aviobuf.c | |
parent | 4d45f5acbd9ab55cd8d29d01843f28315ee27fee (diff) | |
download | ffmpeg-7cae3d8b7685dda77b14aeab3a0fee22547e8f1d.tar.gz |
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>
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r-- | libavformat/aviobuf.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 33bc3c2e20..b20b1a611a 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -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++) |