[FFmpeg-devel] [PATCH] lavu: add av_get_media_type_string() convenience function
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the ffmpeg-devel