[FFmpeg-devel] [PATCH] lavu: add av_get_media_type_string() convenience function

Nicolas George nicolas.george at normalesup.org
Sat Aug 20 15:17:05 CEST 2011

Le tridi 3 fructidor, an CCXIX, Stefano Sabatini a écrit :
> This was also more consistent with the behavior of other similar
> function (av_get_pix_fmt_name(), sample_fmt_name(), etc.).
> But I see that this is sometimes clumsy, what about a macro like this:
> AV_X_IF_NULL(exp, x) ((exp) ? : (exp) : (x))

I almost suggested the same thing.

The macro has the drawback that the function is called twice.

It could be avoided using an inline function rather than a macro:

static inline const char *av_default_string(const char *str, const char *def)
    return str ? str : def;

You could also add av_pure to all these functions, but that will work for
gcc only. It would be a good thing anyway.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110820/5b57a3bb/attachment.asc>

More information about the ffmpeg-devel mailing list