diff options
author | wm4 <wm4@nowhere> | 2014-06-14 09:58:48 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-06-14 09:58:48 +0200 |
commit | 6ab72f976035f094406584795f680d2de8761c2b (patch) | |
tree | a0a78435bd651c01542d510477c8f4d07d20e9b0 /video/img_format.h | |
parent | 6842d4bde5977a7bd76c4492e5a27e4b716fd5ec (diff) | |
download | mpv-6ab72f976035f094406584795f680d2de8761c2b.tar.bz2 mpv-6ab72f976035f094406584795f680d2de8761c2b.tar.xz |
video: automatically strip "le" and "be" suffix from pixle format names
These suffixes are annoying when they're redundant, so strip them
automatically. On little endian machines, always strip the "le" suffix,
and on big endian machines vice versa (although I don't think anyone
ever tried to run mpv on a big endian machine).
Since pixel format strings are returned by a certain function and we
can't just change static strings, use a trick to pass a stack buffer
transparently. But this also means the string can't be permanently
stored by the caller, so vf_dlopen.c has to be updated. There seems
to be no other case where this is done, though.
Diffstat (limited to 'video/img_format.h')
-rw-r--r-- | video/img_format.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/video/img_format.h b/video/img_format.h index 9277b0698c..64662aba08 100644 --- a/video/img_format.h +++ b/video/img_format.h @@ -71,7 +71,6 @@ struct mp_imgfmt_desc { int id; // IMGFMT_* int avformat; // AV_PIX_FMT_* (or AV_PIX_FMT_NONE) - const char *name; // e.g. "420p16" int flags; // MP_IMGFLAG_* bitfield int8_t num_planes; int8_t chroma_xs, chroma_ys; // chroma shift (i.e. log2 of chroma pixel size) @@ -335,7 +334,8 @@ static inline bool IMGFMT_IS_RGB(int fmt) (fmt) == IMGFMT_VAAPI || (fmt) == IMGFMT_VDA) int mp_imgfmt_from_name(bstr name, bool allow_hwaccel); -const char *mp_imgfmt_to_name(int fmt); +char *mp_imgfmt_to_name_buf(char *buf, size_t buf_size, int fmt); +#define mp_imgfmt_to_name(fmt) mp_imgfmt_to_name_buf((char[16]){0}, 16, (fmt)) char **mp_imgfmt_name_list(void); |