[FFmpeg-devel] [RFC] lavu PTS printing utils

Alexander Strasser eclipse7 at gmx.net
Tue Jan 17 22:44:21 CET 2012


Hi,

Stefano Sabatini wrote:
> +          tsutils.h                                                     \

  I don't know why we don't use _ in file names anymore, but at least it is
in line with a few other headers in lavu.

  Anyway I think concatenation of abbreviations can be quite unreadable and
the effect will be strengthened as more and more files with that naming style
are added.

  Please excuse the rant... I wanted to say this many times before.

[...]
> +
> +static inline char *av_get_ts_string(char *buf, size_t buf_size, int64_t ts)
> +{
> +    if (ts == AV_NOPTS_VALUE) snprintf(buf, buf_size, "NOPTS");
> +    else                      snprintf(buf, buf_size, "%"PRId64"", ts);
> +    return buf;
> +}
> +
> +#define av_ts2str(ts) av_get_ts_string((char[42]){ 0 }, 42, ts)
> +
> +static inline char* av_get_time_string(char *buf, size_t buf_size, int64_t ts, AVRational *tb)
> +{
> +    if (ts == AV_NOPTS_VALUE) snprintf(buf, buf_size, "NOPTS");
> +    else                      snprintf(buf, buf_size, "%f", av_q2d(*tb) * ts);
> +    return buf;
> +}
> +
> +#define av_time2str(ts, tb) av_get_time_string((char[42]){ 0 }, 42, ts, tb)

  The naming of the macros is a bit risky. Especially considering how often we
append numbers to names to introduce a successor. av_time2str2 would be rather
confusing.

  Nit: The verb "get" in the function names is IMHO a bit confusing, as you pass
a buffer in and don't really get any resource. Maybe "make" would be better fit.
What do you think?


  I still would like to hear a few more voices? Who wants to have these in lavu?
I am still not sure myself, though it seems small and useful enough.

  Alexander


More information about the ffmpeg-devel mailing list