# HG changeset patch # User stefano # Date 1264877400 0 # Node ID e1bc538670928c29409dcebb8281a7fe4d59512f # Parent af4b724b99d5f55a582d2943aa1db322b9374c00 Implement av_get_pix_fmt(), and deprecate avcodec_get_pix_fmt(). diff -r af4b724b99d5 -r e1bc53867092 avcodec.h --- a/avcodec.h Sat Jan 30 14:33:25 2010 +0000 +++ b/avcodec.h Sat Jan 30 18:50:00 2010 +0000 @@ -2995,6 +2995,7 @@ 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 /** * Returns the pixel format corresponding to the name name. * @@ -3005,8 +3006,11 @@ * then for "gray16le". * * Finally if no pixel format has been found, returns PIX_FMT_NONE. + * + * @deprecated Deprecated in favor of av_get_pix_fmt(). */ -enum PixelFormat avcodec_get_pix_fmt(const char* name); +attribute_deprecated enum PixelFormat avcodec_get_pix_fmt(const char* name); +#endif /** * Returns a value representing the fourCC code associated to the diff -r af4b724b99d5 -r e1bc53867092 imgconvert.c --- a/imgconvert.c Sat Jan 30 14:33:25 2010 +0000 +++ b/imgconvert.c Sat Jan 30 18:50:00 2010 +0000 @@ -391,39 +391,12 @@ return av_pix_fmt_descriptors[pix_fmt].name; } -static enum PixelFormat avcodec_get_pix_fmt_internal(const char *name) -{ - int i; - - for (i=0; i < PIX_FMT_NB; i++) - if (av_pix_fmt_descriptors[i].name && !strcmp(av_pix_fmt_descriptors[i].name, name)) - return i; - return PIX_FMT_NONE; -} - -#if HAVE_BIGENDIAN -# define X_NE(be, le) be -#else -# define X_NE(be, le) le -#endif - +#if LIBAVCODEC_VERSION_MAJOR < 53 enum PixelFormat avcodec_get_pix_fmt(const char *name) { - enum PixelFormat pix_fmt; - - if (!strcmp(name, "rgb32")) - name = X_NE("argb", "bgra"); - else if (!strcmp(name, "bgr32")) - name = X_NE("abgr", "rgba"); - - pix_fmt = avcodec_get_pix_fmt_internal(name); - if (pix_fmt == PIX_FMT_NONE) { - char name2[32]; - snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le")); - pix_fmt = avcodec_get_pix_fmt_internal(name2); - } - return pix_fmt; + return av_get_pix_fmt(name); } +#endif void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt) {