[FFmpeg-devel] [PATCH v6] avfilter/avf_aphasemeter: Add out-of-phase and mono detection
Romane Lafon
romane at nomalab.com
Fri Aug 16 14:58:55 EEST 2019
> > + { "duration", "set minimum mono or out-of-phase duration in
> seconds", OFFSET(duration), AV_OPT_TYPE_DOUBLE, {.dbl=2.}, 0, 24*60*60,
> FLAGS },
>
> ffmpeg also provides a AV_OPT_TYPE_DURATION. (This may have been
> discussed before - sorry if so.)
AV_OPT_TYPE_DURATION is used as an integer (for duration expressed in milli
or microseconds I think). But I prefer to use double and seconds. It's
easier to do the comparison with mono_duration for example, which is
calculated in seconds with floating point.
> > +static inline float get_index(AVFilterLink *inlink, AVFrame *in)
> > +{
> > + char *index_str = av_ts2timestr(in->pts, &inlink->time_base);
> > + return atof(index_str);
> > +}
>
> Just wondering: Are you sure this works? The av_ts2timestr() macro is
> specifically documented as such:
>
> [...] the return value should be used only directly in
> function arguments but never stand-alone
>
> Likely because it defines a buffer locally which goes out of scope.
>
You're right, it works but it's not correct as it should be used in
arguments. I will use : return atof(av_ts2timestr(in->pts,
&inlink->time_base));
Cheers,
Romane
More information about the ffmpeg-devel
mailing list