From d2fcb356caf38c12b0fc9d8c5bac592a28b0f0f1 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 6 Oct 2012 12:36:38 +0200 Subject: pixdesc: add functions for accessing pixel format descriptors. Make av_pix_fmt_descriptors table static on next major bump. Making the table public is dangerous, since the caller has no way to know how large it actually is. It also prevents adding new fields to AVPixFmtDescriptor without a major bump. --- libavutil/pixdesc.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'libavutil/pixdesc.h') diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h index 31ddd2e378..7da17bcf12 100644 --- a/libavutil/pixdesc.h +++ b/libavutil/pixdesc.h @@ -96,10 +96,12 @@ typedef struct AVPixFmtDescriptor{ */ #define PIX_FMT_PSEUDOPAL 64 +#if FF_API_PIX_FMT_DESC /** * The array of all the pixel format descriptors. */ extern const AVPixFmtDescriptor av_pix_fmt_descriptors[]; +#endif /** * Read a line from an image, and write the values of the @@ -180,4 +182,25 @@ char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt */ int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc); +/** + * @return a pixel format descriptor for provided pixel format or NULL if + * this pixel format is unknown. + */ +const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt); + +/** + * Iterate over all pixel format descriptors known to libavutil. + * + * @param prev previous descriptor. NULL to get the first descriptor. + * + * @return next descriptor or NULL after the last descriptor + */ +const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev); + +/** + * @return an AVPixelFormat id described by desc, or AV_PIX_FMT_NONE if desc + * is not a valid pointer to a pixel format descriptor. + */ +enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc); + #endif /* AVUTIL_PIXDESC_H */ -- cgit v1.2.3