[FFmpeg-devel] [PATCH 1/8] Deprecate avcodec_get_pix_fmt_name() in favor of the new av_get_pix_fmt_name().

Michael Niedermayer michaelni
Sat Nov 6 03:07:13 CET 2010


On Fri, Nov 05, 2010 at 12:00:32PM +0100, Stefano Sabatini wrote:
> Consistent with av_get_sample_fmt_name().
> ---
>  libavcodec/avcodec.h    |    7 ++++++-
>  libavcodec/imgconvert.c |    7 ++-----
>  libavutil/pixdesc.c     |    8 ++++++++
>  libavutil/pixdesc.h     |    6 ++++++
>  4 files changed, 22 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 6405455..91c0c98 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3161,11 +3161,16 @@ int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width,
>   */
>  int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height);
>  void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift);
> -const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);
>  void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
>  
>  #if LIBAVCODEC_VERSION_MAJOR < 53
>  /**
> + * @deprecated Use avcodec_get_pix_fmt_name() instead.
> + */
> +attribute_deprecated
> +const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);
> +
> +/**
>   * Return the pixel format corresponding to the name name.
>   *
>   * If there is no pixel format with name name, then look for a
> diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
> index 879335c..fa8469a 100644
> --- a/libavcodec/imgconvert.c
> +++ b/libavcodec/imgconvert.c
> @@ -417,15 +417,12 @@ void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *
>      *v_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h;
>  }
>  
> +#if LIBAVCODEC_VERSION_MAJOR < 53
>  const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt)
>  {
> -    if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB)
> -        return NULL;
> -    else
> -        return av_pix_fmt_descriptors[pix_fmt].name;
> +    return av_get_pix_fmt_name(pix_fmt);
>  }
>  
> -#if LIBAVCODEC_VERSION_MAJOR < 53
>  enum PixelFormat avcodec_get_pix_fmt(const char *name)
>  {
>      return av_get_pix_fmt(name);
> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> index 54f1d74..c099d03 100644
> --- a/libavutil/pixdesc.c
> +++ b/libavutil/pixdesc.c
> @@ -814,6 +814,14 @@ static enum PixelFormat get_pix_fmt_internal(const char *name)
>      return PIX_FMT_NONE;
>  }
>  
> +const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt)
> +{
> +    if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB)
> +        return NULL;
> +    else
> +        return av_pix_fmt_descriptors[pix_fmt].name;
> +}
> +

iam against adding a function per field of a public structure.


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101106/a5782d25/attachment.pgp>



More information about the ffmpeg-devel mailing list