mp_image: for hwaccel, use underlying fmt in mp_image_params_guess_csp()

If imgfmt is a hwaccel format, hw_subfmt will contain the CPU equivalent
of the data stored in the hw frames.

Strictly speaking, not doing this was a bug, but since hwaccel formats
were tagged with MP_IMGFLAG_YUV, it didn't have much of an impact.
This commit is contained in:
wm4 2017-02-21 10:34:26 +01:00
parent df30b217d9
commit b258327210
1 changed files with 2 additions and 1 deletions

View File

@ -614,7 +614,8 @@ void mp_image_set_attributes(struct mp_image *image,
// the colorspace as implied by the pixel format.
void mp_image_params_guess_csp(struct mp_image_params *params)
{
struct mp_imgfmt_desc fmt = mp_imgfmt_get_desc(params->imgfmt);
int imgfmt = params->hw_subfmt ? params->hw_subfmt : params->imgfmt;
struct mp_imgfmt_desc fmt = mp_imgfmt_get_desc(imgfmt);
if (!fmt.id)
return;
if (fmt.flags & MP_IMGFLAG_YUV) {