[FFmpeg-devel] [PATCH] Move av_parse_frame_size() and av_parse_frame_rate() from libavcodec to libavcore
Stefano Sabatini
stefano.sabatini-lala
Tue Jul 27 01:13:58 CEST 2010
On date Monday 2010-07-26 23:21:59 +0200, Michael Niedermayer encoded:
> oOn Mon, Jul 26, 2010 at 11:38:17AM +0200, Stefano Sabatini wrote:
> [...]
> > +int av_parse_video_rate(AVRational *frame_rate, const char *arg)
> > +{
> > + int i;
> > + int n = FF_ARRAY_ELEMS(video_frame_rate_abbrs);
> > + char *cp;
> > +
> > + /* First, we check our abbreviation table */
> > + for (i = 0; i < n; ++i)
> > + if (!strcmp(video_frame_rate_abbrs[i].abbr, arg)) {
>
> > + frame_rate->num = video_frame_rate_abbrs[i].rate_num;
> > + frame_rate->den = video_frame_rate_abbrs[i].rate_den;
>
> > + return 0;
> > + }
> > +
> > + /* Then, we try to parse it as fraction */
> > + cp = strchr(arg, '/');
> > + if (!cp)
> > + cp = strchr(arg, ':');
> > + if (cp) {
> > + char *cpp;
> > + frame_rate->num = strtol(arg, &cpp, 10);
> > + if (cpp != arg || cpp == cp)
> > + frame_rate->den = strtol(cp+1, &cpp, 10);
> > + else
> > + frame_rate->num = 0;
> > + } else {
> > + /* Finally we give up and parse it as double */
> > + AVRational time_base = av_d2q(strtod(arg, 0), 1001000);
> > + frame_rate->den = time_base.den;
> > + frame_rate->num = time_base.num;
> > + }
> > + if (!frame_rate->num || !frame_rate->den)
> > + return -1;
> > + else
>
> {}
> and it needs a <0 check
>
> looks ok otherwise as far as i maintain the files
Applied.
--
FFmpeg = Fast and Freak Mega Power Excellent Game
More information about the ffmpeg-devel
mailing list