[FFmpeg-devel] [PATCH] avidec: export date as metadata

Aurelien Jacobs aurel
Wed Nov 17 23:00:23 CET 2010


On Wed, Nov 17, 2010 at 01:00:28AM +0100, Michael Niedermayer wrote:
> On Wed, Nov 17, 2010 at 12:40:26AM +0100, Aurelien Jacobs wrote:
> > Hi,
> > 
> > Attached patch export the date stored in AVI files as a metadata.
> > 
> > Aurel
> >  avidec.c |   29 +++++++++++++++++++++++++++++
> >  1 file changed, 29 insertions(+)
> > 6bf2471b5811100ac2aeb54d957b20d662a784f6  avi_date.diff
> > diff --git a/libavformat/avidec.c b/libavformat/avidec.c
> > index 2d38191..3f2db9f 100644
> > --- a/libavformat/avidec.c
> > +++ b/libavformat/avidec.c
> > @@ -22,6 +22,7 @@
> >  //#define DEBUG
> >  //#define DEBUG_SEEK
> >  
> > +#include <strings.h>
> >  #include "libavutil/intreadwrite.h"
> >  #include "libavutil/bswap.h"
> >  #include "libavcodec/bytestream.h"
> > @@ -282,6 +283,26 @@ static void avi_read_info(AVFormatContext *s, uint64_t end)
> >      }
> >  }
> >  
> > +static const char months[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
> > +                                    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
> > +
> > +static void avi_metadata_date(AVMetadata **metadata, char *date)
> > +{
> 
> > +    if (HAVE_STRTOK_R) {
> 
> maybe strcspn() would make this unneeded ?

I thought about strcspn() at first, but it was unnecessarily ugly.

> or sscanf() could be used

and I don't know why I didn't thought about sscanf() by myself...

Here is a new version using sscanf().

Aurel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: avi_creation_time.diff
Type: text/x-diff
Size: 1907 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101117/77a379a5/attachment.diff>



More information about the ffmpeg-devel mailing list