Warning, /graphics/digikam/core/cmake/rules/RulesMediaPlayer.cmake is written in an unsupported language. File is not indexed.

0001 #
0002 # SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier, <caulier dot gilles at gmail dot com>
0003 #
0004 # SPDX-License-Identifier: BSD-3-Clause
0005 #
0006 
0007 if(ENABLE_MEDIAPLAYER)
0008 
0009     # NOTE: For Qt5, QtMultimedia is used to render video on widget.
0010     # NOTE: For Qt6, QtMultimedia based on FFMpeg is only supported with version > 6.5.
0011 
0012     find_package(Qt${QT_VERSION_MAJOR}
0013                  OPTIONAL_COMPONENTS
0014                  Multimedia
0015                  MultimediaWidgets
0016     )
0017 
0018     include_directories($<TARGET_PROPERTY:Qt${QT_VERSION_MAJOR}::Multimedia,INTERFACE_INCLUDE_DIRECTORIES>
0019                         $<TARGET_PROPERTY:Qt${QT_VERSION_MAJOR}::MultimediaWidgets,INTERFACE_INCLUDE_DIRECTORIES>)
0020 
0021     if(Qt6_FOUND)
0022 
0023         include_directories(${CMAKE_SOURCE_DIR}/core/libs/video/player/qtmm)
0024 
0025 
0026         set(ENABLE_QTMULTIMEDIA ON)
0027         message(STATUS "MediaPlayer type:     Qt6::Multimedia")
0028 
0029     else()
0030 
0031         set(ENABLE_QTMULTIMEDIA OFF)
0032 
0033         if(NOT ${FFMPEG_FOUND})
0034 
0035             set(ENABLE_MEDIAPLAYER OFF)
0036             message(STATUS "MediaPlayer type:     None")
0037 
0038         else()
0039 
0040             message(STATUS "--------------------------------------------------")
0041             message(STATUS "QtAVPlayer dependencies checks:")
0042             message(STATUS "")
0043 
0044             find_package(VAAPI QUIET)
0045             find_package(VDPAU QUIET)
0046 
0047             MACRO_BOOL_TO_01(VAAPI_FOUND           HAVE_LIBVAAPI)
0048             MACRO_BOOL_TO_01(VDPAU_FOUND           HAVE_LIBVDPAU)
0049 
0050             # --- Reports and Libraries -----------------------------------------------------------
0051 
0052             if(VAAPI_FOUND)
0053 
0054                 set(MEDIAPLAYER_LIBRARIES ${MEDIAPLAYER_LIBRARIES} ${VAAPI_LIBRARIES})
0055 
0056                 if(VAAPI_X11_FOUND AND OpenGL_GLX_FOUND)
0057 
0058                     set(MEDIAPLAYER_LIBRARIES ${MEDIAPLAYER_LIBRARIES} ${OPENGL_LIBRARIES})
0059 
0060                     message(STATUS "MediaPlayer will be compiled with VaAPI X11 support  : yes")
0061 
0062                 else()
0063 
0064                     set(VAAPI_X11_FOUND FALSE)
0065                     message(STATUS "MediaPlayer will be compiled with VaAPI X11 support  : no")
0066 
0067                 endif()
0068 
0069                 if(VAAPI_DRM_FOUND AND OPENSLES_FOUND)
0070 
0071                     set(MEDIAPLAYER_LIBRARIES ${MEDIAPLAYER_LIBRARIES} ${OPENSLES_LIBRARIES})
0072 
0073                     message(STATUS "MediaPlayer will be compiled with VaAPI DRM support  : yes")
0074 
0075                 else()
0076 
0077                     set(VAAPI_DRM_FOUND FALSE)
0078                     message(STATUS "MediaPlayer will be compiled with VaAPI DRM support  : no")
0079 
0080                 endif()
0081 
0082             endif()
0083 
0084             if(VDPAU_FOUND AND OpenGL_FOUND)
0085 
0086                 set(MEDIAPLAYER_LIBRARIES ${MEDIAPLAYER_LIBRARIES} ${VDPAU_LIBRARIES} ${OPENGL_LIBRARIES})
0087 
0088                 message(STATUS "MediaPlayer will be compiled with VDPAU support      : yes")
0089 
0090             else()
0091 
0092                 message(STATUS "MediaPlayer will be compiled with VDPAU support      : no")
0093 
0094             endif()
0095 
0096             # --- MacOS config ---
0097 
0098             if(APPLE)
0099 
0100                 set(MEDIAPLAYER_LIBRARIES ${MEDIAPLAYER_LIBRARIES} "-framework CoreMedia"
0101                                                                    "-framework CoreVideo"
0102                                                                    "-framework VideoToolbox"
0103                                                                    "-framework AudioToolbox"
0104                                                                    "-framework CoreFoundation"
0105                                                                    "-framework Metal"
0106                                                                    "-framework IOSurface"
0107                                                                    "-framework VideoDecodeAcceleration"
0108                 )
0109 
0110                 if(AVDEVICE_FOUND)
0111 
0112                     set(MEDIAPLAYER_LIBRARIES ${MEDIAPLAYER_LIBRARIES} "-framework Foundation"
0113                                                                        "-framework QuartzCore"
0114                                                                        "-framework CoreGraphics"
0115                                                                        "-framework AVFoundation"
0116                     )
0117 
0118                 endif()
0119 
0120                 if(AVFILTER_FOUND)
0121 
0122                     set(MEDIAPLAYER_LIBRARIES ${MEDIAPLAYER_LIBRARIES} "-framework AppKit")
0123 
0124                 endif()
0125 
0126             endif()
0127 
0128             # --- Resume ---------------------------------------------------------------------------------------
0129 
0130             set(MEDIAPLAYER_DEFINITIONS ${MEDIAPLAYER_DEFINITIONS} -DQT_AVPLAYER_MULTIMEDIA)
0131 
0132             message(STATUS "MediaPlayer type       : QtAVPlayer")
0133             message(STATUS "MediaPlayer libraries  : ${MEDIAPLAYER_LIBRARIES}")
0134             message(STATUS "MediaPlayer definitions: ${MEDIAPLAYER_DEFINITIONS}")
0135             message(STATUS "MediaPlayer flags      : ${MEDIAPLAYER_FLAGS}")
0136 
0137             include_directories(${CMAKE_SOURCE_DIR}/core/libs/video/QtAVPlayer)
0138             include_directories(${CMAKE_SOURCE_DIR}/core/libs/video/player/QtAVPlayer)
0139 
0140         endif()
0141 
0142     endif()
0143 
0144 endif()