Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Stefano Sabatini <stefasab@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavf/avio: add avio_vprintf()
Date: Sun, 12 Jun 2022 17:32:10 +0200
Message-ID: <20220612153210.GB11679@mariano> (raw)
In-Reply-To: <9ee5c7d1-fe54-f415-ba48-c0a095326d85@passwd.hu>

[-- Attachment #1: Type: text/plain, Size: 755 bytes --]

On date Thursday 2022-06-09 21:03:02 +0200, Marton Balint wrote:
> 
> 
> On Sun, 3 Apr 2022, Stefano Sabatini wrote:
> 
> > On date Wednesday 2021-04-21 23:53:35 +0200, Stefano Sabatini wrote:
> > > On date Sunday 2021-04-18 23:30:57 +0200, Stefano Sabatini wrote:
> > > > This new function makes it possible to use avio_printf() functionality from
> > > > a function taking a variable list of arguments.
> > > > ---
> > > >  doc/APIchanges        |  3 +++
> > > >  libavformat/avio.h    |  6 ++++++
> > > >  libavformat/aviobuf.c | 17 +++++++++++++----
> > > >  libavformat/version.h |  2 +-
> > > >  4 files changed, 23 insertions(+), 5 deletions(-)
> > > 
> > > Updated against master.
> > 
> > Updated.
> > 
> 
> Will rebase and apply soon.

Updated.

[-- Attachment #2: 0001-lavf-avio-add-avio_vprintf.patch --]
[-- Type: text/x-diff, Size: 2978 bytes --]

From fd1fd40b5f7bc66de6428a8b46be43aad30b6c2d Mon Sep 17 00:00:00 2001
From: Stefano Sabatini <stefasab@gmail.com>
Date: Sun, 12 Jun 2022 13:15:26 +0200
Subject: [PATCH 1/2] 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.
---
 doc/APIchanges        |  4 ++++
 libavformat/avio.h    |  6 ++++++
 libavformat/aviobuf.c | 17 +++++++++++++----
 libavformat/version.h |  2 +-
 4 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 337f1466d8..4f7a19d176 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -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.
 
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 3ed9175a9b..36c3d7b430 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -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.
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++)
diff --git a/libavformat/version.h b/libavformat/version.h
index 6c2776460b..966ebb7ed3 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -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, \
-- 
2.25.1


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2022-06-12 15:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210418213058.24475-1-stefasab@gmail.com>
     [not found] ` <20210421215335.GC12140@mariano>
2022-04-03 14:03   ` Stefano Sabatini
2022-06-09 19:03     ` Marton Balint
2022-06-12 15:32       ` Stefano Sabatini [this message]
2022-06-12 17:00         ` Nicolas George
2022-06-16 16:23           ` Soft Works
     [not found] ` <20210418213058.24475-2-stefasab@gmail.com>
     [not found]   ` <20210419092649.GJ4777@pb2>
     [not found]     ` <20210421215704.GD12140@mariano>
2022-04-03 14:06       ` [FFmpeg-devel] [PATCH 2/2] ffprobe: add -o option Stefano Sabatini
2022-06-09 19:09         ` Marton Balint
2022-06-12 15:33           ` Stefano Sabatini
2022-06-13 20:47             ` Marton Balint

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220612153210.GB11679@mariano \
    --to=stefasab@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git