vd_lavc: sort hwdecs without hwdevices last for autoprobing

For hwdecs without devices we can't get instant feedback during probing
whether the hwdec can possibly work or not, so we definitely want to try them last.
Independently this would also have solved the issue addressed by the previous commit.
This commit is contained in:
sfan5 2023-02-24 23:12:22 +01:00
parent 1dda09b817
commit 5a83745316
1 changed files with 3 additions and 0 deletions

View File

@ -267,6 +267,9 @@ static int hwdec_compare(const void *p1, const void *p2)
// Order by autoprobe preference order.
if (h1->auto_pos != h2->auto_pos)
return h1->auto_pos > h2->auto_pos ? 1 : -1;
// Put hwdecs without hw_device_ctx last
if ((!!h1->lavc_device) != (!!h2->lavc_device))
return h1->lavc_device ? -1 : 1;
// Fallback sort order to make sorting stable.
return h1->rank > h2->rank ? 1 :-1;
}