From 106bbc7e8f7015d0820ea84fe7cc80307b2e6516 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 30 Jan 2024 10:05:23 +0100 Subject: [PATCH] fixed lavd always selected Fixes the commit b62566ca72 (2th Oct 2023), which caused that lavd was always selected as the decoder, even though not designated. Eg.: ``` $ uv -t testcard:codec=I420 -d gl Decompressor "libavcodec" initialized successfully. [lavd] Unsupported codec!!! ``` The problem was that on probe ugc==VC_NONE and HW acceleration is not set, thus hw_accel_to_ug_pixfmt(0) return also VC_NONE, in which case the decoder is unconditionally selected for all formats. --- src/video_decompress/libavcodec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video_decompress/libavcodec.c b/src/video_decompress/libavcodec.c index 1385dec4b..bc7ea1758 100644 --- a/src/video_decompress/libavcodec.c +++ b/src/video_decompress/libavcodec.c @@ -1156,7 +1156,8 @@ static int libavcodec_decompress_get_priority(codec_t compression, struct pixfmt PRIO_LOWER = 800, PRIO_LO = 900, }; - if (hw_accel_to_ug_pixfmt(internal.accel_type) == ugc) { + if (internal.accel_type != HWACCEL_NONE && + hw_accel_to_ug_pixfmt(internal.accel_type) == ugc) { return PRIO_HI; }