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

Stefano Sabatini stefano.sabatini-lala
Fri Nov 5 12:00:32 CET 2010


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;
+}
+
 #if HAVE_BIGENDIAN
 #   define X_NE(be, le) be
 #else
diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
index 8d131be..e0e3f4d 100644
--- a/libavutil/pixdesc.h
+++ b/libavutil/pixdesc.h
@@ -142,6 +142,12 @@ void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesi
 enum PixelFormat av_get_pix_fmt(const char *name);
 
 /**
+ * Return the name of pix_fmt, or NULL if sample_fmt is not
+ * recognized.
+ */
+const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt);
+
+/**
  * Return the number of bits per pixel used by the pixel format
  * described by pixdesc.
  *
-- 
1.7.1




More information about the ffmpeg-devel mailing list