valbok / QtAVPlayer

Free and open-source Qt Media Player library based on FFmpeg, for Linux, Windows, macOS, iOS and Android.
MIT License
282 stars 54 forks source link

Correção do drm/drm_fourcc.h não encontrado #471

Closed mxnt10 closed 3 months ago

mxnt10 commented 3 months ago

a correção foi o #include <drm/drm_fourcc.h> para #include <libdrm/drm_fourcc.h>

+++ b/qavhwdevice_vaapi_drm_egl.cpp     2024-05-19 20:34:09.990158427 -0300
@@ -16,7 +16,7 @@
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
 #include <va/va_drmcommon.h>
-#include <drm/drm_fourcc.h>
+#include <libdrm/drm_fourcc.h>

 extern "C" {
 #include <libavutil/hwcontext_vaapi.h>
valbok commented 3 months ago

What is the distro and version?

Ubuntu 22.04:

$ locate drm_fourcc.h
/usr/include/drm/drm_fourcc.h
mxnt10 commented 3 months ago

Slackware 15.0 Stable.

$ locate drm_fourcc.h
/usr/include/libdrm/drm_fourcc.h
/usr/src/linux-5.15.117/include/drm/drm_fourcc.h
/usr/src/linux-5.15.117/include/uapi/drm/drm_fourcc.h

Pacote: libdrm-2.4.109-x86_64-1

Tem que ver se o drm do Ubuntu não é o do próprio kernel. O Ubuntu também tem o libdrm que possui o local "/usr/include/libdrm/drm_fourcc.h".

EDIT:

dpkg-query -S /usr/include/drm/drm_fourcc.h
linux-libc-dev:amd64: /usr/include/drm/drm_fourcc.h

Descobri o problema: O pacote que tem o drm é o linux-libc-dev que não tem no slackware. Então, dá pra criar uma compatibilidade.

diff -u a/qavhwdevice_vaapi_drm_egl.cpp b/qavhwdevice_vaapi_drm_egl.cpp
--- a/qavhwdevice_vaapi_drm_egl.cpp     2024-05-19 19:58:54.133011919 -0300
+++ b/qavhwdevice_vaapi_drm_egl.cpp     2024-05-25 19:48:04.131841485 -0300
@@ -16,7 +16,12 @@
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
 #include <va/va_drmcommon.h>
-#include <drm/drm_fourcc.h>
+
+#ifdef USE_LIBDRM
+#include <libdrm/drm_fourcc.h> // libdrm
+#else
+#include <drm/drm_fourcc.h> // linux-libc-dev
+#endif

 extern "C" {
 #include <libavutil/hwcontext_vaapi.h>

No cmake:

include(CheckIncludeFile)

check_include_file("drm/drm_fourcc.h" HAVE_DRM_FOURCC_H)

if(HAVE_DRM_FOURCC_H)
    message(STATUS "Found drm/drm_fourcc.h")
else()
    message(STATUS "drm/drm_fourcc.h not found, using libdrm")
    add_definitions(-DUSE_LIBDRM)
endif()

Caso aceite, já mandei um pull request.

valbok commented 3 months ago

btw there is https://github.com/valbok/QtAVPlayer/pull/478 allows to use -DQT_AVPLAYER_VA_DRM=ON and fixes QT_CONFIG(egl) compile issue, for Qt5