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 8f653e21 parent 26513857 files · +34 −5Browse files

Unified · Split

7 files
  1. doc/APIchanges +4 −0
  2. libavcodec/avcodec.h +8 −0
  3. libavcodec/imgconvert.c +3 −4
  4. libavcodec/version.h +3 −0
  5. libavutil/avutil.h +1 −1
  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
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162011-05-XX - xxxxxx - lavu 51.X.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
162011-05-25 - 30315a8 - lavf 53.1.0 - avformat.h202011-05-25 - 30315a8 - lavf 53.1.0 - avformat.h
17 Add fps_probe_size to AVFormatContext.21 Add fps_probe_size to AVFormatContext.
18 22
libavcodec/avcodec.h+8−0
@@ -3306,7 +3306,15 @@ int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, · 3305 unmodified lines
3306 */3306 */
3307int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height);3307int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height);
3308void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift);3308void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift);
3309
3310#if FF_API_GET_PIX_FMT_NAME
3311/**
3312 * @deprecated Deprecated in favor of av_get_pix_fmt_name().
3313 */
3314attribute_deprecated
3309const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);3315const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);
3316#endif
3317
3310void avcodec_set_dimensions(AVCodecContext *s, int width, int height);3318void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
3311 3319
3312/**3320/**
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
417 *v_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h;417 *v_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h;
418}418}
419 419
420#if FF_API_GET_PIX_FMT_NAME
420const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt)421const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt)
421{422{
422 if ((unsigned)pix_fmt >= PIX_FMT_NB)423 return av_get_pix_fmt_name(pix_fmt);
423 return NULL;
424 else
425 return av_pix_fmt_descriptors[pix_fmt].name;
426}424}
425#endif
427 426
428int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt)427int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt)
429{428{
libavcodec/version.h+3−0
@@ -65,5 +65,8 @@ · 64 unmodified lines
65#ifndef FF_API_FLAC_GLOBAL_OPTS65#ifndef FF_API_FLAC_GLOBAL_OPTS
66#define FF_API_FLAC_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)66#define FF_API_FLAC_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
67#endif67#endif
68#ifndef FF_API_GET_PIX_FMT_NAME
69#define FF_API_GET_PIX_FMT_NAME (LIBAVCODEC_VERSION_MAJOR < 54)
70#endif
68 71
69#endif /* AVCODEC_VERSION_H */72#endif /* AVCODEC_VERSION_H */
libavutil/avutil.h+1−1
@@ -40,7 +40,7 @@ · 39 unmodified lines
40#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)40#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
41 41
42#define LIBAVUTIL_VERSION_MAJOR 5142#define LIBAVUTIL_VERSION_MAJOR 51
43#define LIBAVUTIL_VERSION_MINOR 143#define LIBAVUTIL_VERSION_MINOR 2
44#define LIBAVUTIL_VERSION_MICRO 044#define LIBAVUTIL_VERSION_MICRO 0
45 45
46#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \46#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
libavutil/pixdesc.c+6−0
@@ -906,6 +906,12 @@ static enum PixelFormat get_pix_fmt_internal(const char *name) · 905 unmodified lines
906 return PIX_FMT_NONE;906 return PIX_FMT_NONE;
907}907}
908 908
909const 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
909#if HAVE_BIGENDIAN915#if HAVE_BIGENDIAN
910# define X_NE(be, le) be916# define X_NE(be, le) be
911#else917#else
libavutil/pixdesc.h+9−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
23#define AVUTIL_PIXDESC_H23#define AVUTIL_PIXDESC_H
24 24
25#include <inttypes.h>25#include <inttypes.h>
26#include "pixfmt.h"
26 27
27typedef struct AVComponentDescriptor{28typedef struct AVComponentDescriptor{
28 uint16_t plane :2; ///< which of the 4 planes contains the component29 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 · 112 unmodified lines
141 */142 */
142enum PixelFormat av_get_pix_fmt(const char *name);143enum PixelFormat av_get_pix_fmt(const char *name);
143 144
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 */
151const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt);
152
144/**153/**
145 * Print in buf the string corresponding to the pixel format with154 * Print in buf the string corresponding to the pixel format with
146 * number pix_fmt, or an header if pix_fmt is negative.155 * 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