[FFmpeg-devel] [PATCH 2/5] metadata: add new conversion API

Anton Khirnov anton
Mon Oct 4 08:37:23 CEST 2010


On Mon, Oct 04, 2010 at 02:07:04AM +0200, Michael Niedermayer wrote:
> On Sun, Oct 03, 2010 at 03:52:54PM -0700, Baptiste Coudurier wrote:
> > On 10/3/10 12:51 PM, Michael Niedermayer wrote:
> > > On Sun, Oct 03, 2010 at 09:14:23PM +0200, Anton Khirnov wrote:
> > >> From: Anton Khirnov <wyskas at gmail.com>
> > >>
> > >> Track current metadata format in AVMetadata and add av_metadata_clone()
> > >> function for copying/replacing metadata.
> > > [...]
> > >> index 362a056..a9fb39f 100644
> > >> --- a/libavformat/avformat.h
> > >> +++ b/libavformat/avformat.h
> > >> @@ -198,6 +198,22 @@ void av_metadata_conv(struct AVFormatContext *ctx, const AVMetadataConv *d_conv,
> > >>                                                     const AVMetadataConv *s_conv);
> > >>  
> > >>  /**
> > >> + * Copy metadata from src to dst, converting between their respective formats.
> > >> + * dst may be equal to src -- for in-place conversion -- or empty (i.e. a
> > >> + * pointer to NULL), in both cases it is initialized to dst_fmt format.
> > >> + * Otherwise dst_fmt is ignored. src may be a pointer to NULL, in which case
> > >> + * dst is initialized, but nothing is copied.
> > >> + *
> > >> + * @param pattern Used to copy only some keys. If non-NULL, it is passed
> > >> + *                directly to av_metadata_get().
> > >> + * @param flags   Passed directly to av_metadata_get/set. If pattern is NULL,
> > >> + *                defaults to AV_METADATA_IGNORE_SUFFIX|AV_METADATA_DONT_OVERWRITE.
> > >> + * @return >= 0 on success otherwise an error code <0
> > >> + */
> > >> +int av_metadata_clone(AVMetadata **src, AVMetadata **dst, const AVMetadataConv *dst_fmt,
> > >> +                      const char *pattern, int flags);
> > > 
> > > in all calls src==dst
> > > 
> > > where would that not be so?
> > 
> > You want to print "intelligible" metadata in dump_format, this is not
> > done currently, but should.
> > 
> > The easiest way is to create a new AVMetadata and translate.
> 
> I imagined that the new metadata api would either
> export 2 AVMetadata sets (one unchanged and one converted to generic tags)
> OR
> that there would be a flag that specifies which of the 2 variants should be
> exported by a demuxer.
iirc the original reason why the demuxers export metadata in native
format is so it can be losslessly muxed to the same format --
av_metadata_conv() with identical conv tables is a noop. if what you're
proposing is done then it stops making sense to export the native format
at all, so we might as well export only generic.

which OTOH might be exactly what we should do. or is anybody aware of
anyother reason to export native format?

> 
> This is a consequence of the Convertion tables to have been found insufficient
> by anton and i prefer not to have ugly callbacks if it can be avoided ...
> 
> Within that imaginagtion metadata translation would happen inside the
> (de)muxers. And alot of complexity would become unneeded i think, this
> function in that form too possibly
this wouldn't magically remove the need for a conversion system, it'd
just make it non-public, but most of it would remain the same i think.
a demuxer would still read the metadata in the native format, then
convert it to generic in pretty much the same way it's done now.

--
Anton Khirnov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101004/051ff8a2/attachment.pgp>



More information about the ffmpeg-devel mailing list