[FFmpeg-devel] [PATCH 1/4] lavu: add av_x_if_null().

Stefano Sabatini stefasab at gmail.com
Fri Sep 16 13:38:50 CEST 2011


On date Friday 2011-09-16 12:57:48 +0200, Clément Bœsch encoded:
> ---
>  doc/APIchanges     |    3 +++
>  libavutil/avutil.h |   10 +++++++++-
>  2 files changed, 12 insertions(+), 1 deletions(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index b97df1f..96d5453 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,9 @@ libavutil:   2011-04-18
>  
>  API changes, most recent first:
>  
> +2011-09-xx - xxxxxxx - lavu 51.17.0
> +  Add av_x_if_null().
> +
>  2011-09-16 - xxxxxxx - lavfi 2.42.0
>    Add avfilter_all_channel_layouts.
>  
> diff --git a/libavutil/avutil.h b/libavutil/avutil.h
> index ef7a145..3d46365 100644
> --- a/libavutil/avutil.h
> +++ b/libavutil/avutil.h
> @@ -40,7 +40,7 @@
>  #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
>  
>  #define LIBAVUTIL_VERSION_MAJOR 51
> -#define LIBAVUTIL_VERSION_MINOR 16
> +#define LIBAVUTIL_VERSION_MINOR 17
>  #define LIBAVUTIL_VERSION_MICRO  0
>  
>  #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
> @@ -135,6 +135,14 @@ enum AVPictureType {
>   */
>  char av_get_picture_type_char(enum AVPictureType pict_type);
>  
> +/**
> + * Return x default pointer in case p is NULL.
> + */
> +static inline const void *av_x_if_null(const void *p, const void *x)
> +{
> +    return p ? p : x;
> +}
> +

Should be fine, maybe av_get_x_if_null() for keeping a verb in the
function name, or a better/shorter name if you can find one,
suggestions are welcome.

In each case, leave two/three days to the other developers for
commenting before the commit.
-- 
FFmpeg = Fiendish and Fanciful Mere Practical Eccentric Gorilla


More information about the ffmpeg-devel mailing list