summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-01-12 01:33:02 +0100
committerwm4 <wm4@nowhere>2020-01-12 01:33:02 +0100
commita3f220ba4444a09dc23f810087630163ed5b0dc8 (patch)
tree0147c529911b2f0b09498fc438235c5c200808e3
parent4b168bcda3a403fdaeb3696d822f180dd339b929 (diff)
downloadmpv-a3f220ba4444a09dc23f810087630163ed5b0dc8.tar.bz2
mpv-a3f220ba4444a09dc23f810087630163ed5b0dc8.tar.xz
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.
-rw-r--r--filters/f_autoconvert.c6
1 files changed, 4 insertions, 2 deletions
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) {