[FFmpeg-devel] [PATCH 2/5] lavf: add av_ prefix to parse_date

Stefano Sabatini stefano.sabatini-lala
Sun Feb 6 20:10:07 CET 2011


On date Sunday 2011-02-06 17:28:57 +0100, Michael Niedermayer encoded:
> On Sun, Feb 06, 2011 at 04:22:14PM +0100, Stefano Sabatini wrote:
> > On date Sunday 2011-02-06 10:08:55 -0500, Ronald S. Bultje encoded:
> > > Hi,
> > > 
> > > On Sun, Feb 6, 2011 at 9:50 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > > > On Sun, Feb 06, 2011 at 03:46:47PM +0100, Anton Khirnov wrote:
> > > > [...]
> > > >> index f354539..4027990 100644
> > > >> --- a/libavformat/avformat.h
> > > >> +++ b/libavformat/avformat.h
> > > >> @@ -1474,6 +1474,10 @@ attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base,
> > > >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const char *arg);
> > > >> ?#endif
> > > >>
> > > >> +#if FF_API_PARSE_DATE
> > > >> +attribute_deprecated int64_t parse_date(const char *datestr, int duration);
> > > >> +#endif
> > > >> +
> > > >> ?/**
> > > >> ? * Parse datestr and return a corresponding number of microseconds.
> > > >> ? * @param datestr String representing a date or a duration.
> > > >> @@ -1501,7 +1505,7 @@ attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base,
> > > >> ? * not zero datestr is interpreted as a duration, otherwise as a
> > > >> ? * date.
> > > >> ? */
> > > >> -int64_t parse_date(const char *datestr, int duration);
> > > >> +int64_t av_parse_date(const char *datestr, int duration);
> > > >
> > > > This also doesnt belong in libavformat, which is why it doesnt have a av
> > > > prefix id guess
> > > 
> > > In addition to htat, the API is schizophrenic. Why not one function
> > > for parsing a duration and one for parsing a date?
> > 
> > Also check:
> > http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/111811
> > 
> > I suppose it is safe to keep the current semantics if the objective is
> > removing non av-prefixed functions, *then* implement av_parse_time (or
> > av_parse_date/duration as separate functions).
> 
> 
> > Also it would make
> > sense to have this such functions somewhere in libavutil/libavcore.
> 
> Thats what ive meant with that it doesntz belong in libavformat

Updated version as requested by elenril, av_parse_time() moved to
libavcore/parseutils.h, I remember I wanted to implement some more
features (maybe it was support for negative times or something like
that, like -44-03-15 for B.C. dates but then the time system is
completely f*@#ed up so I don't know if it is a good idea).

Not tested.
-- 
FFmpeg = Fiendish and Formidable MultiPurpose Elected God



More information about the ffmpeg-devel mailing list