Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Nicolas George <george@nsup.org>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [RFC] AVDictionary2
Date: Thu, 10 Apr 2025 10:40:23 +0200
Message-ID: <Z_eD90wqgyOXVXqQ@phare.normalesup.org> (raw)
In-Reply-To: <20250408101959.GP4991@pb2>

Michael Niedermayer (HE12025-04-08):
> As i have too many things to do already i did the most logic thing and
> started thinking about a new and unrelated idea.
> 
> This is a list of problems and ideas, that everyone is welcome to add to and
> comment on.
> 
> AVDictionary is just bad.

A few notes on the topic:

Steal a few ideas from BPrint, adapt them to a dictionary:

Include an initial buffer in the root structure.

Make the code tolerant to the size of the included buffer.

That ensures that the root structure can be allocated by the caller on
the stack.

Use a flat data structure with low overhead as long as the data fits in
the initial buffer and switch to a more efficient data structure when
dynamic allocation becomes needed.

A few points to decide:

Do we want only string → string, or do we want string → any or any →
any?

To handle any data structure, we can do:

	const struct {
	    int (*clone)(void *, const void *);
	    void (*free)(void *);
	    void (*ref)(void *);
	    void (*unref)(void *);
	    int (*compare)(const void *, const void *);
	    unsigned (*hash)(const void *);
	} *key_ops, *val_ops;

Supporting any kind of key or data can make it harder to use a flat data
structure, but we can manage.

The API should be designed to allow to avoid dynamic allocations, both
when adding and querying data. For query, consider all cases: if the
result is short lived, we can return the value inside the structure
itself; if the entry is removed from the structure immediately we can
return it (“my $v = delete $h{$k}” in perl).

Regards,

-- 
  Nicolas George
_______________________________________________
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".

  parent reply	other threads:[~2025-04-10  8:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-08 10:19 Michael Niedermayer
2025-04-08 16:10 ` Romain Beauxis
2025-04-08 20:29   ` Michael Niedermayer
2025-04-08 22:18     ` Gerion Entrup
2025-04-08 22:35       ` Michael Niedermayer
2025-04-08 22:37       ` softworkz .
2025-04-08 16:56 ` softworkz .
2025-04-08 18:16   ` Michael Niedermayer
2025-04-08 18:36     ` softworkz .
2025-04-08 19:45       ` Michael Niedermayer
2025-04-08 21:30         ` softworkz .
2025-04-11 19:06           ` Michael Niedermayer
2025-04-12  1:41             ` softworkz .
2025-04-12 11:02             ` softworkz .
2025-04-09  0:00 ` Leo Izen
2025-04-09 16:56   ` Michael Niedermayer
2025-04-10  8:40 ` Nicolas George [this message]
2025-04-10 18:31   ` softworkz .
2025-04-11 20:50 ` 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=Z_eD90wqgyOXVXqQ@phare.normalesup.org \
    --to=george@nsup.org \
    --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