player/command: fix video-params/[average-bpp, alpha] when hw decoding

Need to check hw_subfmt for real values.
This commit is contained in:
Kacper Michajłow 2023-08-31 18:56:02 +02:00 committed by Jan Ekström
parent d471f2902e
commit a6f661b5c7
1 changed files with 3 additions and 2 deletions

View File

@ -2329,8 +2329,9 @@ static int property_imgparams(const struct mp_image_params *p, int action, void
int bpp = 0;
enum pl_alpha_mode alpha = p->repr.alpha;
if (p->imgfmt) {
struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(p->imgfmt);
int fmt = p->hw_subfmt ? p->hw_subfmt : p->imgfmt;
if (fmt) {
struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(fmt);
for (int i = 0; i < desc.num_planes; i++)
bpp += desc.bpp[i] >> (desc.xs[i] + desc.ys[i]);