[FFmpeg-devel] [PATCH 1/6] ffmpeg.c: copy global metadata by default

Anton Khirnov anton
Thu Nov 11 13:17:36 CET 2010


On Tue, Nov 09, 2010 at 10:17:39PM +0100, Michael Niedermayer wrote:
> On Thu, Nov 04, 2010 at 05:27:04PM +0100, Anton Khirnov wrote:
> > On Thu, Nov 04, 2010 at 01:41:52AM +0100, Michael Niedermayer wrote:
> > > On Tue, Nov 02, 2010 at 10:04:00PM +0100, Anton Khirnov wrote:
> > > > ---
> > > >  ffmpeg.c |   12 ++++++++++++
> > > >  1 files changed, 12 insertions(+), 0 deletions(-)
> > > > 
> > > > diff --git a/ffmpeg.c b/ffmpeg.c
> > > > index fd3b404..26237a2 100644
> > > > --- a/ffmpeg.c
> > > > +++ b/ffmpeg.c
> > > > @@ -129,6 +129,7 @@ static int nb_stream_maps;
> > > >  /* first item specifies output metadata, second is input */
> > > >  static AVMetaDataMap (*meta_data_maps)[2] = NULL;
> > > >  static int nb_meta_data_maps;
> > > > +static int metadata_global_autocopy   = 1;
> > > >  static int metadata_streams_autocopy  = 1;
> > > >  static int metadata_chapters_autocopy = 1;
> > > >  
> > > > @@ -2380,6 +2381,15 @@ static int transcode(AVFormatContext **output_files,
> > > >              av_metadata_set2(meta[0], mtag->key, mtag->value, AV_METADATA_DONT_OVERWRITE);
> > > >      }
> > > >  
> > > > +    /* copy global metadata by default */
> > > > +    if (metadata_global_autocopy) {
> > > > +        AVMetadataTag *t = NULL;
> > > > +
> > > > +        while ((t = av_metadata_get(input_files[0]->metadata, "", t, AV_METADATA_IGNORE_SUFFIX)))
> > > > +            for (i = 0; i < nb_output_files; i++)
> > > > +                av_metadata_set2(&output_files[i]->metadata, t->key, t->value, AV_METADATA_DONT_OVERWRITE);
> > > > +    }
> > > 
> > > is that copying code seperate from the one used to copy what the user specifies?
> > > that seems a bit messy
> > How do you want to merge them, the first one is
> > 'for map in maps: figure out the metadata; copy metadata;'
> > the second one is
> > 'if no maps: copy metadata;'
> > The copying code itself is two lines, not really worth factorizing.
> 
> maps could be set to defaults that lead to default copying (of course if this
> means more or messier code then its not a good idea)
yes, creating the default maps makes the patch about 2x longer.
pick whatever you prefer.


-- 
Anton Khirnov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ffmpeg.c-copy-global-metadata-by-default.patch
Type: text/x-diff
Size: 1946 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101111/17a14688/attachment.patch>
-------------- 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/20101111/17a14688/attachment.pgp>



More information about the ffmpeg-devel mailing list