[FFmpeg-devel] [PATCH 3/8] libavformat/flacdec: Export samples md5 as metadata

Michael Niedermayer michael at niedermayer.cc
Thu Feb 6 17:07:51 EET 2025


Hi Tomas

On Wed, Feb 05, 2025 at 03:20:09PM +0100, Tomas Härdin wrote:
> 

>  libavformat/flacdec.c                     |    6 ++++++
>  tests/ref/fate/cover-art-aiff-id3v2-remux |    5 +++--
>  tests/ref/fate/cover-art-flac-remux       |    1 +
>  tests/ref/fate/id3v2-utf16-bom            |    5 +++--
>  4 files changed, 13 insertions(+), 4 deletions(-)
> 685b0c4be452dc7138f993a3cbeb85320a045545  0003-libavformat-flacdec-Export-samples-md5-as-metadata.patch
> From e1c4dfa4cc7a574f6fac76c11591547d3cd90ad2 Mon Sep 17 00:00:00 2001
> From: Mattias Wadman <wader at spotify.com>
> Date: Mon, 11 Oct 2021 15:38:13 +0200
> Subject: [PATCH 3/8] libavformat/flacdec: Export samples md5 as metadata
> 
> Will be used by mal to compare metadat md5 with decoded samples md5.
> 
> Part of fixing https://jira.spotify.net/browse/GOL-681
> ---
>  libavformat/flacdec.c                     | 6 ++++++
>  tests/ref/fate/cover-art-aiff-id3v2-remux | 5 +++--
>  tests/ref/fate/cover-art-flac-remux       | 1 +
>  tests/ref/fate/id3v2-utf16-bom            | 5 +++--
>  4 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
> index 3c317acaee..9f65c25864 100644
> --- a/libavformat/flacdec.c
> +++ b/libavformat/flacdec.c
> @@ -33,6 +33,7 @@
>  #include "replaygain.h"
>  
>  #define SEEKPOINT_SIZE 18
> +#define MD5_BYTE_SIZE 16
>  
>  typedef struct FLACDecContext {
>      FFRawDemuxerContext rawctx;
> @@ -109,6 +110,7 @@ static int flac_read_header(AVFormatContext *s)
>          if (metadata_type == FLAC_METADATA_TYPE_STREAMINFO) {
>              uint32_t samplerate;
>              uint64_t samples;
> +            char md5hex[MD5_BYTE_SIZE*2+1]; // hex representation plus null terminator
>  
>              /* STREAMINFO can only occur once */
>              if (found_streaminfo) {
> @@ -133,6 +135,10 @@ static int flac_read_header(AVFormatContext *s)
>                  if (samples > 0)
>                      st->duration = samples;
>              }
> +
> +            ff_data_to_hex(md5hex, st->codecpar->extradata+18, MD5_BYTE_SIZE, 1 /* lowercase */);
> +            md5hex[sizeof(md5hex)-1] = '\0';
> +            av_dict_set(&s->metadata, "samples_md5", md5hex, 0);

I think "samples_md5" should be documented, so that other decoders can use
the same
i also see a verify_md5() in hevc
and crc seems frequently used in decoders

just mentioning so this all can be kept consistant

thx


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Give a rich man 100$ and he will turn it into 1000$.
Give a poor man 1000$ and he will spend it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250206/a8ce747a/attachment.sig>


More information about the ffmpeg-devel mailing list