From a3f220ba4444a09dc23f810087630163ed5b0dc8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 12 Jan 2020 01:33:02 +0100 Subject: f_autoconvert: usw f_hwtransfer properly With the recent change how f_hwtransfer could select formats, it's possible that the upload_fmts list contains formats that are never selected, and the filter would have failed. The way it works now is that f_hwtransfer gets to select the format (which honestly doesn't make sense, but whatever), and f_autoconvert gets only a single format. It would be more ideal if f_hwtransfer provided a list of possible input formats, but that's absurdly too complex for now. Maybe I'll change it back at some later point, but I expect this shit to be in a perpetual state of complexity and brokenness. --- filters/f_autoconvert.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'filters/f_autoconvert.c') diff --git a/filters/f_autoconvert.c b/filters/f_autoconvert.c index d563b1fcd3..37a16c9851 100644 --- a/filters/f_autoconvert.c +++ b/filters/f_autoconvert.c @@ -230,6 +230,7 @@ static bool build_image_converter(struct mp_autoconvert *c, struct mp_log *log, int *fmts = p->imgfmts; int num_fmts = p->num_imgfmts; + int hwupload_fmt = 0; bool imgfmt_is_sw = !IMGFMT_IS_HWACCEL(img->imgfmt); @@ -256,8 +257,9 @@ static bool build_image_converter(struct mp_autoconvert *c, struct mp_log *log, if (upload) { mp_info(log, "HW-uploading to %s\n", mp_imgfmt_to_name(fmts[0])); filters[2] = upload->f; - fmts = upload->upload_fmts; - num_fmts = upload->num_upload_fmts; + hwupload_fmt = mp_hwupload_find_upload_format(upload, img->imgfmt); + fmts = &hwupload_fmt; + num_fmts = hwupload_fmt ? 1 : 0; hw_to_sw = false; } } else if (p->vo_convert && different_subfmt && info && info->hwdec_devs) { -- cgit v1.2.3