mirror of
https://github.com/mpv-player/mpv
synced 2025-04-11 04:01:31 +00:00
build_image_converter - use full image format list to create hw_upload
currently we only try for the first format in the list
This commit is contained in:
parent
fbcd9c140f
commit
8314c907ab
@ -195,12 +195,13 @@ static bool build_image_converter(struct mp_autoconvert *c, struct mp_log *log,
|
|||||||
bool hw_to_sw = !imgfmt_is_sw && dst_have_sw;
|
bool hw_to_sw = !imgfmt_is_sw && dst_have_sw;
|
||||||
|
|
||||||
if (dst_all_hw && num_fmts > 0) {
|
if (dst_all_hw && num_fmts > 0) {
|
||||||
|
for (int i = 0; i < num_fmts; i++) {
|
||||||
// We can probably use this! Very lazy and very approximate.
|
// We can probably use this! Very lazy and very approximate.
|
||||||
struct mp_hwupload *upload = mp_hwupload_create(conv, fmts[0]);
|
struct mp_hwupload *upload = mp_hwupload_create(conv, fmts[i]);
|
||||||
if (upload) {
|
if (upload) {
|
||||||
int sw_fmt = imgfmt_is_sw ? img->imgfmt : img->params.hw_subfmt;
|
int sw_fmt = imgfmt_is_sw ? img->imgfmt : img->params.hw_subfmt;
|
||||||
|
|
||||||
mp_info(log, "HW-uploading to %s\n", mp_imgfmt_to_name(fmts[0]));
|
mp_info(log, "HW-uploading to %s\n", mp_imgfmt_to_name(fmts[i]));
|
||||||
filters[2] = upload->f;
|
filters[2] = upload->f;
|
||||||
hwupload_fmt = mp_hwupload_find_upload_format(upload, sw_fmt);
|
hwupload_fmt = mp_hwupload_find_upload_format(upload, sw_fmt);
|
||||||
fmts = &hwupload_fmt;
|
fmts = &hwupload_fmt;
|
||||||
@ -208,13 +209,13 @@ static bool build_image_converter(struct mp_autoconvert *c, struct mp_log *log,
|
|||||||
hw_to_sw = false;
|
hw_to_sw = false;
|
||||||
|
|
||||||
// We cannot do format conversions when transferring between
|
// We cannot do format conversions when transferring between
|
||||||
// two hardware devices, so fail immediately if that would be
|
// two hardware devices, so reject this format if that would be
|
||||||
// required.
|
// required.
|
||||||
if (!imgfmt_is_sw && hwupload_fmt != sw_fmt) {
|
if (!imgfmt_is_sw && hwupload_fmt != sw_fmt) {
|
||||||
mp_err(log, "Format %s is not supported by %s\n",
|
mp_err(log, "Format %s is not supported by %s\n",
|
||||||
mp_imgfmt_to_name(sw_fmt),
|
mp_imgfmt_to_name(sw_fmt),
|
||||||
mp_imgfmt_to_name(p->imgfmts[0]));
|
mp_imgfmt_to_name(p->imgfmts[i]));
|
||||||
goto fail;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user