Skip to content

Commit 2c2fd8a

Browse files
committed
feat(mpv): prioritize gpuinfo VO recommendation in AUTO decode mode
Use gpuinfo_get_vo() from libgpuinfo to get recommended video output for current GPU, overriding heuristic result in AUTO decode mode. 在自动解码模式下,优先使用gpuinfo提供的VO配置,覆盖硬件启发式判断。 Log: 自动解码模式优先使用gpuinfo的VO配置 PMS: BUG-356131 Influence: 当gpuinfo数据库中配置了GPU的推荐VO时,自动解码模式将优先使用该配置,提升特定GPU的兼容性。
1 parent 08a9d3c commit 2c2fd8a

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/backends/mpv/mpv_proxy.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,13 @@ void MpvProxy::initGpuInfoFuns()
209209
if(!SysUtils::libExist("libgpuinfo.so")) {
210210
qWarning() << "libgpuinfo.so not found - GPU info functions will be unavailable";
211211
m_gpuInfo = NULL;
212+
m_gpuInfoVo = NULL;
212213
qDebug() << "DEBUG: Exiting MpvProxy::initGpuInfoFuns due to missing libgpuinfo.so."; // Add exit log
213214
return;
214215
}
215216
QLibrary mpvLibrary(SysUtils::libPath("libgpuinfo.so"));
216217
m_gpuInfo = reinterpret_cast<void *>(mpvLibrary.resolve("vdp_Iter_decoderInfo"));
218+
m_gpuInfoVo = reinterpret_cast<const char* (*)(void)>(mpvLibrary.resolve("gpuinfo_get_vo"));
217219
qInfo() << "GPU info functions initialized successfully";
218220
}
219221

@@ -637,6 +639,16 @@ mpv_handle *MpvProxy::mpv_init()
637639
my_set_property(pHandle, "vo", "vaapi");
638640
m_sInitVo = "vaapi";
639641
}
642+
643+
// gpuinfo VO: if matched, use gpuinfo's recommendation (AUTO mode only)
644+
if (m_gpuInfoVo) {
645+
const char* vo = m_gpuInfoVo();
646+
if (vo && vo[0] != '\0') {
647+
qInfo() << "gpuinfo recommended vo:" << vo;
648+
my_set_property(pHandle, "vo", vo);
649+
m_sInitVo = vo;
650+
}
651+
}
640652
} else if (DecodeMode::HARDWARE == m_decodeMode) { //3.设置硬解
641653
qDebug() << "DEBUG: Decode mode set to HARDWARE. Checking specific hardware.";
642654
QFileInfo X100GPU("/dev/x100gpu");
@@ -1939,6 +1951,7 @@ void MpvProxy::initMember()
19391951
m_freeNodecontents = nullptr;
19401952
m_pConfig = nullptr;
19411953
m_gpuInfo = nullptr;
1954+
m_gpuInfoVo = nullptr;
19421955
}
19431956

19441957
void MpvProxy::play()

src/backends/mpv/mpv_proxy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ protected slots:
450450
mpvinitialize m_initialize;
451451
mpv_freeNode_contents m_freeNodecontents;
452452
void *m_gpuInfo; //解码探测函数指针
453+
const char* (*m_gpuInfoVo)(void); //gpuinfo_get_vo函数指针
453454

454455

455456
MpvHandle m_handle; //mpv句柄

0 commit comments

Comments
 (0)