From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTPS id 00C314D243
	for <ffmpegdev@gitmailbox.com>; Wed, 16 Apr 2025 10:53:36 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 393DA687DCB;
	Wed, 16 Apr 2025 13:53:33 +0300 (EEST)
Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net
 [217.70.183.199])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5FF63687D3E
 for <ffmpeg-devel@ffmpeg.org>; Wed, 16 Apr 2025 13:53:27 +0300 (EEST)
Received: by mail.gandi.net (Postfix) with ESMTPSA id 9BE8A4396A
 for <ffmpeg-devel@ffmpeg.org>; Wed, 16 Apr 2025 10:53:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc;
 s=gm1; t=1744800806;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=nj2l+jpOeGGSHcDwVj8Ubl8KX4w+lfsofnFkAheg7HE=;
 b=PQ1FhHF9lD4a3dXi365A0B1V+CEj6ds9OjV6usFYtH6xtlkTQbLNbb5bTNoHA4UE/3wUdP
 uVWqwkJTy+XnuKZV3JcuEqx8qRSPW7paSOhjwOL1Gzz89xfm9sHobAPk0xopa7jUZsTpp9
 rFw7iprQsIiROW2MVfhyivSVCRNKXINGw3GBaSa42e7SCOkhBBxNXFZ/UPZADPYinbbbJp
 7FjxGTJ1P2HGPIjOqe+BKp08kniV+T5HHIQfNfQ/4YJIDDxJD9dAApQM1dyjbtpK/DvVgj
 kJiYRWUVPKUx+d5Rx1E5RrQ0YFUmvZ3r5CWvb6SZiPH+SeFUe2VeT8BwLfaItQ==
Date: Wed, 16 Apr 2025 12:53:25 +0200
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Message-ID: <20250416105325.GH4991@pb2>
References: <20250414231950.GN4991@pb2>
 <DM8P223MB0365928500AB53069869DC99BAB32@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM>
 <20250415185538.GR4991@pb2>
 <DM8P223MB0365E10D38EF9174A32557DFBAB22@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM>
 <20250415225001.GW4991@pb2>
 <DM8P223MB0365EFE83DE448577271D852BAB22@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM>
 <20250416012145.GE4991@pb2>
 <DM8P223MB0365836071D915E428907879BABD2@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM>
 <20250416013339.GF4991@pb2>
 <DM8P223MB03658C2F1D76A2E9901E6F77BABD2@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM>
MIME-Version: 1.0
In-Reply-To: <DM8P223MB03658C2F1D76A2E9901E6F77BABD2@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM>
X-GND-State: clean
X-GND-Score: -90
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvvdeiudekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculddutddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeffledtfeevfeffheeuuefhtdejieelueeftdeitdfgheetgefffeefteekffdthfenucffohhmrghinhepfhhfmhhpvghgrdhorhhgnecukfhppeeguddrieeirdeijedruddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeguddrieeirdeijedruddufedphhgvlhhopehlohgtrghlhhhoshhtpdhmrghilhhfrhhomhepmhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtpdhnsggprhgtphhtthhopedupdhrtghpthhtohepfhhfmhhpvghgqdguvghvvghlsehffhhmphgvghdrohhrgh
X-GND-Sasl: michael@niedermayer.cc
Subject: Re: [FFmpeg-devel] [PATCH 2/2] avformat/id3v2: Check that
 decode_str() did advance
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Type: multipart/mixed; boundary="===============0940657351229475614=="
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250416105325.GH4991@pb2/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>


--===============0940657351229475614==
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="/9GTJmp7pm48Gbid"
Content-Disposition: inline


--/9GTJmp7pm48Gbid
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi softworkz

On Wed, Apr 16, 2025 at 02:52:21AM +0000, softworkz . wrote:
>=20
>=20
> > -----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
> >=20
> > 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
>=20
> First of all, any patch MUST NOT introduce behavior that goes
> against our own specifications.
>=20
> From avformat.h:
>=20
> /**
>  * @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 'meta=
data'
>  * fields of the AVFormatContext, AVStream, AVChapter and AVProgram struc=
ts
>  * using the @ref lavu_dict "AVDictionary" API. Like all strings in FFmpe=
g,
>  * 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 produ=
ce
>  *    several keys that are literally different but semantically identica=
l.
>  *    E.g., key=3DAuthor5, key=3DAuthor6. In this example, all authors mu=
st 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 Ali=
ce
>  *    and actor Bob, that could have key=3Dalice_and_bobs_childs_email_ad=
dress.
>  * -  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-en=
g.
>  *    -  language -- a tag whose value is localized for a particular lang=
uage
>  *       is appended with the ISO 639-2/B 3-letter language code.
>  *       For example: Author-ger=3DMichael, Author-eng=3DMike
>  *       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=3D"The Beatles",
>  *       artist-sort=3D"Beatles, The".
>=20
>=20
> Especially:
>=20
> *    E.g., key=3DAuthor5, key=3DAuthor6. In this example, all authors mus=
t be
> *    placed in the same tag.
>=20
> 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 as=
sume
the internal ";" escaping rules (whatever they would be) match the target f=
ormat.

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/t=
runk

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 identica=
l,
+ *    like key=3DAuthor5, key=3DAuthor6.
+ *    All authors have to be placed in the same tag for the case of Author=
s.
+ * 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=3Dalice_and_bobs_childs_email_add=
ress.
+ * 3. A tag whichs value is translated has the ISO 639 3-letter language c=
ode
+ *    with a '-' between appended. So for example Author-ger=3DMichael, Au=
thor-eng=3DMike
+ *    the original/default language is in the unqualified "Author"
+ *    A demuxer should set a default if it sets any translated tag.
+ */

[...]

--=20
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

--/9GTJmp7pm48Gbid
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZ/+MIgAKCRBhHseHBAsP
q2lBAJwMbZLoIGOD49dol0qOYjKGfEZ1hACglFLJ0mH9K2UdvthNELfx8V2Gd10=
=qsbC
-----END PGP SIGNATURE-----

--/9GTJmp7pm48Gbid--

--===============0940657351229475614==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

--===============0940657351229475614==--