1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-14 11:01:35 +00:00

video: get hwaccel flag from pixdesc

This commit is contained in:
wm4 2014-11-04 22:26:31 +01:00
parent 5e9dfe932f
commit ffe9c03502
2 changed files with 8 additions and 5 deletions

View File

@ -121,7 +121,8 @@ static struct mp_imgfmt_desc mp_only_imgfmt_desc(int mpfmt)
return (struct mp_imgfmt_desc) { return (struct mp_imgfmt_desc) {
.id = mpfmt, .id = mpfmt,
.avformat = AV_PIX_FMT_NONE, .avformat = AV_PIX_FMT_NONE,
.flags = MP_IMGFLAG_BE | MP_IMGFLAG_LE | MP_IMGFLAG_RGB, .flags = MP_IMGFLAG_BE | MP_IMGFLAG_LE | MP_IMGFLAG_RGB |
MP_IMGFLAG_HWACCEL,
}; };
} }
return (struct mp_imgfmt_desc) {0}; return (struct mp_imgfmt_desc) {0};
@ -224,6 +225,9 @@ struct mp_imgfmt_desc mp_imgfmt_get_desc(int mpfmt)
if ((desc.bpp[0] % 8) != 0) if ((desc.bpp[0] % 8) != 0)
desc.align_x = 8 / desc.bpp[0]; // expect power of 2 desc.align_x = 8 / desc.bpp[0]; // expect power of 2
if (pd->flags & AV_PIX_FMT_FLAG_HWACCEL)
desc.flags |= MP_IMGFLAG_HWACCEL;
return desc; return desc;
} }

View File

@ -64,6 +64,8 @@
// The only real paletted format we support is IMGFMT_PAL8, so check for that // The only real paletted format we support is IMGFMT_PAL8, so check for that
// format directly if you want an actual paletted format. // format directly if you want an actual paletted format.
#define MP_IMGFLAG_PAL 0x8000 #define MP_IMGFLAG_PAL 0x8000
// planes don't contain real data; planes[3] contains an API-specific pointer
#define MP_IMGFLAG_HWACCEL 0x10000
// Exactly one of these bits is set in mp_imgfmt_desc.flags // Exactly one of these bits is set in mp_imgfmt_desc.flags
#define MP_IMGFLAG_COLOR_CLASS_MASK \ #define MP_IMGFLAG_COLOR_CLASS_MASK \
@ -330,10 +332,7 @@ static inline bool IMGFMT_IS_RGB(int fmt)
} }
#define IMGFMT_RGB_DEPTH(fmt) (mp_imgfmt_get_desc(fmt).plane_bits) #define IMGFMT_RGB_DEPTH(fmt) (mp_imgfmt_get_desc(fmt).plane_bits)
#define IMGFMT_IS_HWACCEL(fmt) (mp_imgfmt_get_desc(fmt).flags & MP_IMGFLAG_HWACCEL)
#define IMGFMT_IS_HWACCEL(fmt) \
((fmt) == IMGFMT_VDPAU || (fmt) == IMGFMT_VDPAU_OUTPUT || \
(fmt) == IMGFMT_VAAPI || (fmt) == IMGFMT_VDA || (fmt) == IMGFMT_DXVA2)
int mp_imgfmt_from_name(bstr name, bool allow_hwaccel); int mp_imgfmt_from_name(bstr name, bool allow_hwaccel);
char *mp_imgfmt_to_name_buf(char *buf, size_t buf_size, int fmt); char *mp_imgfmt_to_name_buf(char *buf, size_t buf_size, int fmt);