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

Michael Niedermayer michaelni
Fri Nov 19 02:30:15 CET 2010


On Wed, Nov 17, 2010 at 11:00:23PM +0100, Aurelien Jacobs wrote:
> 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...

2 brains have more ideas than one ...


> 
> Here is a new version using sscanf().
> 
> Aurel
>  avidec.c |   27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> d7637839bdce38b01dbd8edf1bd7aa939295c61d  avi_creation_time.diff
> diff --git a/libavformat/avidec.c b/libavformat/avidec.c

lgtm


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- 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/20101119/cfa2e4ea/attachment.pgp>



More information about the ffmpeg-devel mailing list