History

lavu: add av_get_pix_fmt_name() convenience function

Also deprecate avcodec_get_pix_fmt_name() in its favor.

Stefano Sabatini committed 15 years ago

Commit e71f2601 parent 34e9c9b7 files · +32 −7Browse files

Unified · Split

7 files
  1. doc/APIchanges +4 −0
  2. libavcodec/avcodec.h +4 −0
  3. libavcodec/imgconvert.c +3 −4
  4. libavcodec/version.h +4 −1
  5. libavutil/avutil.h +2 −2
  6. libavutil/pixdesc.c +6 −0
  7. libavutil/pixdesc.h +9 −0
doc/APIchanges+4−0
@@ -13,6 +13,10 @@ libavutil: 2011-04-18 · 12 unmodified lines
1313
1414 API changes, most recent first:
1515
16+2011-05-28 - xxxxxx - lavu 51.3.0 - pixdesc.h
17+ Add av_get_pix_fmt_name() in libavutil/pixdesc.h, and deprecate
18+ avcodec_get_pix_fmt_name() in libavcodec/avcodec.h in its favor.
19+
1620 2011-05-22 - xxxxxx - lavf 53.2.0 - avformat.h
1721 Introduce avformat_alloc_output_context2() and deprecate
1822 avformat_alloc_output_context().
libavcodec/avcodec.h+4−0
@@ -3391,12 +3391,16 @@ int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, · 3390 unmodified lines
33913391 int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height);
33923392 void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift);
33933393
3394+#if FF_API_GET_PIX_FMT_NAME
33943395 /**
33953396 * Return the short name for a pixel format.
33963397 *
33973398 * \see av_get_pix_fmt(), av_get_pix_fmt_string().
3399+ * @deprecated Deprecated in favor of av_get_pix_fmt_name().
33983400 */
3401+attribute_deprecated
33993402 const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);
3403+#endif
34003404
34013405 void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
34023406
libavcodec/imgconvert.c+3−4
@@ -417,13 +417,12 @@ void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int * · 416 unmodified lines
417417 *v_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h;
418418 }
419419
420+#if FF_API_GET_PIX_FMT_NAME
420421 const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt)
421422 {
422− if ((unsigned)pix_fmt >= PIX_FMT_NB)
423− return NULL;
424− else
425− return av_pix_fmt_descriptors[pix_fmt].name;
423+ return av_get_pix_fmt_name(pix_fmt);
426424 }
425+#endif
427426
428427 int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt)
429428 {
libavcodec/version.h+4−1
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222
2323 #define LIBAVCODEC_VERSION_MAJOR 53
2424 #define LIBAVCODEC_VERSION_MINOR 6
25−#define LIBAVCODEC_VERSION_MICRO 0
25+#define LIBAVCODEC_VERSION_MICRO 1
2626
2727 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
2828 LIBAVCODEC_VERSION_MINOR, \
@@ -65,5 +65,8 @@ · 36 unmodified lines
6565 #ifndef FF_API_FLAC_GLOBAL_OPTS
6666 #define FF_API_FLAC_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
6767 #endif
68+#ifndef FF_API_GET_PIX_FMT_NAME
69+#define FF_API_GET_PIX_FMT_NAME (LIBAVCODEC_VERSION_MAJOR < 54)
70+#endif
6871
6972 #endif /* AVCODEC_VERSION_H */
libavutil/avutil.h+2−2
@@ -40,8 +40,8 @@ · 39 unmodified lines
4040 #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
4141
4242 #define LIBAVUTIL_VERSION_MAJOR 51
43−#define LIBAVUTIL_VERSION_MINOR 2
44−#define LIBAVUTIL_VERSION_MICRO 2
43+#define LIBAVUTIL_VERSION_MINOR 3
44+#define LIBAVUTIL_VERSION_MICRO 0
4545
4646 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
4747 LIBAVUTIL_VERSION_MINOR, \
libavutil/pixdesc.c+6−0
@@ -906,6 +906,12 @@ static enum PixelFormat get_pix_fmt_internal(const char *name) · 905 unmodified lines
906906 return PIX_FMT_NONE;
907907 }
908908
909+const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt)
910+{
911+ return (unsigned)pix_fmt < PIX_FMT_NB ?
912+ av_pix_fmt_descriptors[pix_fmt].name : NULL;
913+}
914+
909915 #if HAVE_BIGENDIAN
910916 # define X_NE(be, le) be
911917 #else
libavutil/pixdesc.h+9−0
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #ifndef AVUTIL_PIXDESC_H
2323 #define AVUTIL_PIXDESC_H
2424
25+#include "pixfmt.h"
2526 #include <inttypes.h>
2627
2728 typedef struct AVComponentDescriptor{
@@ -141,6 +142,14 @@ void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesi · 113 unmodified lines
141142 */
142143 enum PixelFormat av_get_pix_fmt(const char *name);
143144
145+/**
146+ * Return the short name for a pixel format, NULL in case pix_fmt is
147+ * unknown.
148+ *
149+ * @see av_get_pix_fmt(), av_get_pix_fmt_string()
150+ */
151+const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt);
152+
144153 /**
145154 * Print in buf the string corresponding to the pixel format with
146155 * number pix_fmt, or an header if pix_fmt is negative.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t