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] [PATCH 2/2] avformat/id3v2: Check that decode_str() did advance
Date: Wed, 16 Apr 2025 12:53:25 +0200
Message-ID: <20250416105325.GH4991@pb2> (raw)
In-Reply-To: <DM8P223MB03658C2F1D76A2E9901E6F77BABD2@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM>


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

Hi softworkz

On Wed, Apr 16, 2025 at 02:52:21AM +0000, softworkz . wrote:
> 
> 
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > Michael Niedermayer
> > Sent: Mittwoch, 16. April 2025 03:34
> > To: FFmpeg development discussions and patches <ffmpeg-
> > devel@ffmpeg.org>
> > Subject: Re: [FFmpeg-devel] [PATCH 2/2] avformat/id3v2: Check that
> > decode_str() did advance
> > 
> > On Wed, Apr 16, 2025 at 01:29:02AM +0000, softworkz . wrote:
> > [...]
> > > > > This will cause deserialization errors for many people in the
> > world
> > > > > who are processing FFprobe data.
> > > >
> > > > As said, ffprobe should not produce troublesome output
> 
> First of all, any patch MUST NOT introduce behavior that goes
> against our own specifications.
> 
> From avformat.h:
> 
> /**
>  * @defgroup metadata_api Public Metadata API
>  * @{
>  * @ingroup libavf
>  * The metadata API allows libavformat to export metadata tags to a client
>  * application when demuxing. Conversely it allows a client application to
>  * set metadata when muxing.
>  *
>  * Metadata is exported or set as pairs of key/value strings in the 'metadata'
>  * fields of the AVFormatContext, AVStream, AVChapter and AVProgram structs
>  * using the @ref lavu_dict "AVDictionary" API. Like all strings in FFmpeg,
>  * metadata is assumed to be UTF-8 encoded Unicode. Note that metadata
>  * exported by demuxers isn't checked to be valid UTF-8 in most cases.
>  *
>  * Important concepts to keep in mind:
>  * -  Keys are unique; there can never be 2 tags with the same key. This is
>  *    also meant semantically, i.e., a demuxer should not knowingly produce
>  *    several keys that are literally different but semantically identical.
>  *    E.g., key=Author5, key=Author6. In this example, all authors must be
>  *    placed in the same tag.
>  * -  Metadata is flat, not hierarchical; there are no subtags. If you
>  *    want to store, e.g., the email address of the child of producer Alice
>  *    and actor Bob, that could have key=alice_and_bobs_childs_email_address.
>  * -  Several modifiers can be applied to the tag name. This is done by
>  *    appending a dash character ('-') and the modifier name in the order
>  *    they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng.
>  *    -  language -- a tag whose value is localized for a particular language
>  *       is appended with the ISO 639-2/B 3-letter language code.
>  *       For example: Author-ger=Michael, Author-eng=Mike
>  *       The original/default language is in the unqualified "Author" tag.
>  *       A demuxer should set a default if it sets any translated tag.
>  *    -  sorting  -- a modified version of a tag that should be used for
>  *       sorting will have '-sort' appended. E.g. artist="The Beatles",
>  *       artist-sort="Beatles, The".
> 
> 
> Especially:
> 
> *    E.g., key=Author5, key=Author6. In this example, all authors must be
> *    placed in the same tag.
> 
> I think, this tells very clearly how it's gotta be and how not.

This is written by me 16 years ago
and it made sense at the time. Our APIs did not support multiple values per
key.
The API supports multiple values per key since 9 years. Using said API is
more convenient than having to parse and escape ";" around.
Thats for our code, its simpler for a muxer to iterate over a AVDictionary key
than parse a ";" seperated string (with undefined escaping rules).
and easier to build a ";" string from a multi-value AVDictionary than to assume
the internal ";" escaping rules (whatever they would be) match the target format.

commit 47146dfbf6bca94dd0706b4313cc5e26edaf18d4
Author: Michael Niedermayer <michaelni@gmx.at>
Date:   Sun Jan 4 18:48:37 2009 +0000

    Generic metadata API.
    avi is updated as example.
    No version bump, the API still might change slightly ...
    No update to ffmpeg.c as requested by aurel.

    Originally committed as revision 16424 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index e45f7d6dfb3..7038d2d2c41 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -400,6 +400,51 @@ enum SampleFormat {
  */
 #define FF_MIN_BUFFER_SIZE 16384

+
+/*
+ * public Metadata API.
+ * Important concepts, to keep in mind
+ * 1. keys are unique, there are never 2 tags with equal keys, this is also
+ *    meant semantically that is a demuxer should not knowingly produce
+ *    several keys that are litterally different but semantically identical,
+ *    like key=Author5, key=Author6.
+ *    All authors have to be placed in the same tag for the case of Authors.
+ * 2. Metadata is flat, there are no subtags, if you for whatever obscene
+ *    reason want to store the email address of the child of producer alice
+ *    and actor bob, that could have key=alice_and_bobs_childs_email_address.
+ * 3. A tag whichs value is translated has the ISO 639 3-letter language code
+ *    with a '-' between appended. So for example Author-ger=Michael, Author-eng=Mike
+ *    the original/default language is in the unqualified "Author"
+ *    A demuxer should set a default if it sets any translated tag.
+ */

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin

[-- 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:[~2025-04-16 10:53 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11 22:27 [FFmpeg-devel] [PATCH 1/2] avformat/id3v2: Print the unknown encoding Michael Niedermayer
2025-04-11 22:27 ` [FFmpeg-devel] [PATCH 2/2] avformat/id3v2: Check that decode_str() did advance Michael Niedermayer
2025-04-12  1:49   ` softworkz .
2025-04-14 23:19     ` Michael Niedermayer
2025-04-14 23:59       ` softworkz .
2025-04-15  0:02         ` Ridley Combs via ffmpeg-devel
2025-04-15  0:17           ` softworkz .
2025-04-15 18:32             ` Michael Niedermayer
2025-04-15 19:03               ` Nicolas George
2025-04-15 20:12                 ` softworkz .
2025-04-15 20:47                   ` Nicolas George
2025-04-15 22:20                     ` softworkz .
2025-04-16  5:15                       ` Nicolas George
2025-04-16  5:59                         ` softworkz .
2025-04-16  7:02                           ` Nicolas George
2025-04-15 19:15               ` softworkz .
2025-04-15 19:02           ` Nicolas George
2025-04-16  8:02           ` Andreas Rheinhardt
2025-04-15 18:55         ` Michael Niedermayer
2025-04-15 19:59           ` softworkz .
2025-04-15 22:50             ` Michael Niedermayer
2025-04-15 22:59               ` softworkz .
2025-04-15 23:01                 ` softworkz .
2025-04-16  0:53                   ` Michael Niedermayer
2025-04-16  1:01                     ` softworkz .
2025-04-16  2:39                     ` softworkz .
2025-04-16  7:04                       ` Nicolas George
2025-04-16 11:07                       ` Michael Niedermayer
2025-04-16 11:15                         ` softworkz .
2025-04-16  1:21                 ` Michael Niedermayer
2025-04-16  1:29                   ` softworkz .
2025-04-16  1:33                     ` Michael Niedermayer
2025-04-16  2:18                       ` softworkz .
2025-04-16  2:31                       ` softworkz .
2025-04-16 10:41                         ` Michael Niedermayer
2025-04-16 10:59                           ` softworkz .
2025-04-16  2:52                       ` softworkz .
2025-04-16 10:53                         ` Michael Niedermayer [this message]
2025-04-16 10:57                           ` Andreas Rheinhardt
2025-04-16 11:02                             ` Michael Niedermayer
2025-04-16 10:58                           ` softworkz .
2025-04-15  1:37       ` softworkz .
2025-04-15 18:25         ` Michael Niedermayer
2025-04-15 19:07           ` softworkz .

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=20250416105325.GH4991@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