lavu: add av_get_pix_fmt_name() convenience function

Also deprecate avcodec_get_pix_fmt_name() in its favor.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
This commit is contained in:
Stefano Sabatini
2011-05-28 02:39:20 +02:00
committed by Ronald S. Bultje
parent 26513856d6
commit 8f653e28f5
7 changed files with 34 additions and 5 deletions

View File

@@ -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 1
#define LIBAVUTIL_VERSION_MINOR 2
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

View File

@@ -906,6 +906,12 @@ 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)
{
return (unsigned)pix_fmt < PIX_FMT_NB ?
av_pix_fmt_descriptors[pix_fmt].name : NULL;
}
#if HAVE_BIGENDIAN
# define X_NE(be, le) be
#else

View File

@@ -23,6 +23,7 @@
#define AVUTIL_PIXDESC_H
#include <inttypes.h>
#include "pixfmt.h"
typedef struct AVComponentDescriptor{
uint16_t plane :2; ///< which of the 4 planes contains the component
@@ -141,6 +142,14 @@ 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 short name for a pixel format, NULL in case pix_fmt is
* unknown.
*
* @see av_get_pix_fmt(), av_get_pix_fmt_string()
*/
const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt);
/**
* Print in buf the string corresponding to the pixel format with
* number pix_fmt, or an header if pix_fmt is negative.