Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] The case for a good string API
Date: Mon, 15 Aug 2022 21:15:26 +0200
Message-ID: <20220815191526.GS2088045@pb2> (raw)
In-Reply-To: <YqyWcxSSeeWUrRW+@phare.normalesup.org>


[-- Attachment #1.1: Type: text/plain, Size: 2745 bytes --]

On Fri, Jun 17, 2022 at 04:57:55PM +0200, Nicolas George wrote:
> Stefano Sabatini (12022-06-17):
> > 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.
> 
> You have touched the main difference between AVWriter and BPrint.
> 
> BPrint is a specific implementation, it works the way it works and
> return the string as a pointer and a length field. If you are not happy
> with it, you must take it anyway.
> 
> AVWriter is a layer of abstraction. A very thin, very lightweight layer.
> Very ffmpeg.
> 
> You can make an AVWriter out of anything, as long as it is something
> where writing to it text makes sense. You just need to write a few
> low-level callbacks to write bits of string, and benefit from the
> high-level features of AVWriter.
> 
> There is already an AVWriter that will let you have a static-or-dynamic
> buffer allocated with av_realloc(). In fact it is a BPrint inside of it,
> because no need to duplicate the code.
> 
> There is already an AVWriter that will use a buffer you already have.
> There is already an AVWriter that will write the text to the logs
> without storing it.
> 
> If you are writing an application that is partially in Rust, you can
> make an AVWriter that will store the text in a Rust String object. Same
> goes with Perl, Java, whatever language.
> 
> If you are writing a GUI application, you can make an AVWriter that will
> store the text directly in a text widget.
> 
> You can make an AVWriter that will change the character encoding of the
> text, or compress it, or encrypt it, and write the result to another
> AVWriter.
> 
> Your imagination is the limit. But if you only want good old C strings,
> you do not need to know any of that, just use one of the built-in
> AVWriter as shown in the documentation and you are good to go.
> 
> I have to confess, I am rather proud of the ideas I have had to make an
> abstraction layer that is lightweight, nimble and future-proof at the
> same time. Eventually, I would like to go further in that direction, for
> example with side data types describing themselves how they can be
> serialized / duplicated / referenced. But later.

Sorry for my late reply.
I do like the AVWriter idea, i think replacing BPrint by it is a good
idea
I only now looked at your examples you posted in april last year. I may
have looked before, i dont remember but from these examples it looks
nice

Thanks


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: 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-08-15 19:15 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
2022-06-17 14:57       ` Nicolas George
2022-08-15 19:15         ` Michael Niedermayer [this message]

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=20220815191526.GS2088045@pb2 \
    --to=michael@niedermayer.cc \
    --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