[FFmpeg-devel] [PATCH 3/8] libavformat/flacdec: Export samples md5 as metadata
Michael Niedermayer
michael at niedermayer.cc
Wed Feb 12 23:55:00 EET 2025
Hi
On Wed, Feb 12, 2025 at 11:56:16AM +0100, Tomas Härdin wrote:
> tor 2025-02-06 klockan 16:07 +0100 skrev Michael Niedermayer:
> > Hi Tomas
> >
> > On Wed, Feb 05, 2025 at 03:20:09PM +0100, Tomas Härdin wrote:
[...]
> > > 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
>
> Documented where? doc/metadata.texi doesn't seem like the place for it.
> doc/demuxers.texi maybe?
honestly, i didnt think about "where", just that it should be documented
somewhere
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Those who are best at talking, realize last or never when they are wrong.
-------------- 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/20250212/dc318fe8/attachment.sig>
More information about the ffmpeg-devel
mailing list