[FFmpeg-devel] [PATCH] avidec: export date as metadata
Aurelien Jacobs
aurel
Sun Nov 21 20:10:07 CET 2010
On Fri, Nov 19, 2010 at 02:30:15AM +0100, Michael Niedermayer wrote:
> 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
Applied.
Aurel
More information about the ffmpeg-devel
mailing list