> > + { "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 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".