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] The case for a good string API
Date: Fri, 17 Jun 2022 01:01:27 +0200
Message-ID: <20220616230127.GA173404@mariano> (raw)
In-Reply-To: <YqtQnPLeGpiUCe9Q@phare.normalesup.org>

Hi Nicolas!

On date Thursday 2022-06-16 17:47:40 +0200, Nicolas George wrote:
> Stefano Sabatini (12022-06-15):
> > Hi, and sorry for the long delay (I'll comment soon about the AVWriter
> > API).
> 
> Thanks. I was starting to despair that somebody else gives a damn about
> it.
> 
> > Before jumping to the discussion, probably it's good to think a bit
> > about the bprint.h API and its limitations (the ones which come to mind
> > are: no errors in case of truncation, and possible inefficiency due to
> > the realloc). So while it covers the case for small strings (and it's
> > not that bad IMO from the API point of view), probably it's underkill
> > for data serialization.
> > 
> > Do you have more in mind about its limitations?
> 
> The limitations of BPrint were one of the motivations to start working
> on this. But I am not sure what you are referring to exactly.
> 

> BPrint already has a means to test for truncation in case of memory
> allocation failure. I tried to make it a little harder to forget with
> dynamic AVWriter,  but it is a fine line between harder to forget and
> annoying to use.

Right, I completely forgot about it.

> Regarding realloc(), I am even more confused: we cannot avoid a dynamic
> allocation if the string is larger than the initial buffer. But AVWriter
> goes a step further in that direction: if you want to write to a file or
> to the network, it can do so on the fly, without using a dynamic buffer.

I was thinking about mempool (and no, I don't think it's really
neeeded for this use case).

I still had to read the implementation, now I think I got what this is
about.

> > Also, is the new API supposed to be a replacement for AVBprint or is
> > it supposed to live in parallel with it (to serve different purposes)?
> 
> Eventually, I would like to have all useful features of BPrint in the
> dynamic buffer AVWriter and deprecate BPrint, since that was written in
> part to learn and do BPrint better.

OK, sounds good.
_______________________________________________
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-16 23:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22 16:12 Nicolas George
2022-06-15 20:56 ` Stefano Sabatini
2022-06-16 15:47   ` Nicolas George
2022-06-16 23:01     ` Stefano Sabatini [this message]
2022-06-17 14:57       ` Nicolas George
2022-08-15 19:15         ` Michael Niedermayer

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=20220616230127.GA173404@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