summaryrefslogtreecommitdiff
path: root/externals/ffmpeg
diff options
context:
space:
mode:
authorGravatar bunnei2021-12-15 00:02:53 -0800
committerGravatar GitHub2021-12-15 00:02:53 -0800
commit2f32133ad5e13503c56bc5c910407a27cc23908b (patch)
tree486a47945aa83e2842f54dce2e9f153d396a1886 /externals/ffmpeg
parentMerge pull request #7565 from liushuyu/fix-linux-decoding (diff)
downloadyuzu-2f32133ad5e13503c56bc5c910407a27cc23908b.tar.gz
yuzu-2f32133ad5e13503c56bc5c910407a27cc23908b.tar.xz
yuzu-2f32133ad5e13503c56bc5c910407a27cc23908b.zip
Revert "video_core/codecs: refactor ffmpeg searching and handling in cmake"
Diffstat (limited to 'externals/ffmpeg')
m---------externals/ffmpeg0
-rw-r--r--externals/ffmpeg/CMakeLists.txt209
m---------externals/ffmpeg/ffmpeg0
3 files changed, 0 insertions, 209 deletions
diff --git a/externals/ffmpeg b/externals/ffmpeg
new file mode 160000
Subproject 79e8d17024e6c6328a40fcee191ffd70798a9c6
diff --git a/externals/ffmpeg/CMakeLists.txt b/externals/ffmpeg/CMakeLists.txt
deleted file mode 100644
index 7da89d2c5..000000000
--- a/externals/ffmpeg/CMakeLists.txt
+++ /dev/null
@@ -1,209 +0,0 @@
1if (NOT WIN32)
2 # Build FFmpeg from externals
3 message(STATUS "Using FFmpeg from externals")
4
5 if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64)")
6 # FFmpeg has source that requires one of nasm or yasm to assemble it.
7 # REQUIRED throws an error if not found here during configuration rather than during compilation.
8 find_program(ASSEMBLER NAMES nasm yasm)
9 if ("${ASSEMBLER}" STREQUAL "ASSEMBLER-NOTFOUND")
10 message(FATAL_ERROR "One of either `nasm` or `yasm` not found but is required.")
11 endif()
12 endif()
13
14 find_program(AUTOCONF autoconf)
15 if ("${AUTOCONF}" STREQUAL "AUTOCONF-NOTFOUND")
16 message(FATAL_ERROR "Required program `autoconf` not found.")
17 endif()
18
19 set(FFmpeg_PREFIX ${PROJECT_SOURCE_DIR}/externals/ffmpeg/ffmpeg)
20 set(FFmpeg_BUILD_DIR ${PROJECT_BINARY_DIR}/externals/ffmpeg-build)
21 set(FFmpeg_MAKEFILE ${FFmpeg_BUILD_DIR}/Makefile)
22 make_directory(${FFmpeg_BUILD_DIR})
23
24 # Read version string from external
25 file(READ ${FFmpeg_PREFIX}/RELEASE FFmpeg_VERSION)
26 set(FFmpeg_FOUND NO)
27 if (NOT FFmpeg_VERSION STREQUAL "")
28 set(FFmpeg_FOUND YES)
29 endif()
30
31 unset(FFmpeg_LIBRARIES CACHE)
32 foreach(COMPONENT ${FFmpeg_COMPONENTS})
33 set(FFmpeg_${COMPONENT}_PREFIX "${FFmpeg_BUILD_DIR}/lib${COMPONENT}")
34 set(FFmpeg_${COMPONENT}_LIB_NAME "lib${COMPONENT}.a")
35 set(FFmpeg_${COMPONENT}_LIBRARY "${FFmpeg_${COMPONENT}_PREFIX}/${FFmpeg_${COMPONENT}_LIB_NAME}")
36
37 set(FFmpeg_LIBRARIES
38 ${FFmpeg_LIBRARIES}
39 ${FFmpeg_${COMPONENT}_LIBRARY}
40 CACHE PATH "Paths to FFmpeg libraries" FORCE)
41 endforeach()
42
43 Include(FindPkgConfig REQUIRED)
44 pkg_check_modules(LIBVA libva)
45 pkg_check_modules(CUDA cuda)
46 pkg_check_modules(FFNVCODEC ffnvcodec)
47 pkg_check_modules(VDPAU vdpau)
48
49 set(FFmpeg_HWACCEL_LIBRARIES)
50 set(FFmpeg_HWACCEL_FLAGS)
51 set(FFmpeg_HWACCEL_INCLUDE_DIRS)
52 set(FFmpeg_HWACCEL_LDFLAGS)
53
54 if(LIBVA_FOUND)
55 pkg_check_modules(LIBDRM libdrm REQUIRED)
56 find_package(X11 REQUIRED)
57 pkg_check_modules(LIBVA-DRM libva-drm REQUIRED)
58 pkg_check_modules(LIBVA-X11 libva-x11 REQUIRED)
59 list(APPEND FFmpeg_HWACCEL_LIBRARIES
60 ${LIBDRM_LIBRARIES}
61 ${X11_LIBRARIES}
62 ${LIBVA-DRM_LIBRARIES}
63 ${LIBVA-X11_LIBRARIES}
64 ${LIBVA_LIBRARIES})
65 set(FFmpeg_HWACCEL_FLAGS
66 --enable-hwaccel=h264_vaapi
67 --enable-hwaccel=vp8_vaapi
68 --enable-hwaccel=vp9_vaapi
69 --enable-libdrm)
70 list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS
71 ${LIBDRM_INCLUDE_DIRS}
72 ${X11_INCLUDE_DIRS}
73 ${LIBVA-DRM_INCLUDE_DIRS}
74 ${LIBVA-X11_INCLUDE_DIRS}
75 ${LIBVA_INCLUDE_DIRS}
76 )
77 message(STATUS "VA-API found")
78 else()
79 set(FFmpeg_HWACCEL_FLAGS --disable-vaapi)
80 endif()
81
82 if (FFNVCODEC_FOUND)
83 list(APPEND FFmpeg_HWACCEL_FLAGS
84 --enable-cuvid
85 --enable-ffnvcodec
86 --enable-nvdec
87 --enable-hwaccel=h264_nvdec
88 --enable-hwaccel=vp8_nvdec
89 --enable-hwaccel=vp9_nvdec
90 )
91 list(APPEND FFmpeg_HWACCEL_LIBRARIES ${FFNVCODEC_LIBRARIES})
92 list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${FFNVCODEC_INCLUDE_DIRS})
93 list(APPEND FFmpeg_HWACCEL_LDFLAGS ${FFNVCODEC_LDFLAGS})
94 message(STATUS "ffnvcodec libraries version ${FFNVCODEC_VERSION} found")
95 # ffnvenc could load CUDA libraries at the runtime using dlopen/dlsym or LoadLibrary/GetProcAddress
96 # here we handle the hard-linking senario where CUDA is linked during compilation
97 if (CUDA_FOUND)
98 list(APPEND FFmpeg_HWACCEL_FLAGS --extra-cflags=-I${CUDA_INCLUDE_DIRS})
99 list(APPEND FFmpeg_HWACCEL_LIBRARIES ${CUDA_LIBRARIES})
100 list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${CUDA_INCLUDE_DIRS})
101 list(APPEND FFmpeg_HWACCEL_LDFLAGS ${CUDA_LDFLAGS})
102 message(STATUS "CUDA libraries found, hard-linking will be performed")
103 endif(CUDA_FOUND)
104 endif()
105
106 if (VDPAU_FOUND)
107 list(APPEND FFmpeg_HWACCEL_FLAGS
108 --enable-vdpau
109 --enable-hwaccel=h264_vdpau
110 --enable-hwaccel=vp9_vdpau
111 )
112 list(APPEND FFmpeg_HWACCEL_LIBRARIES ${VDPAU_LIBRARIES})
113 list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${VDPAU_INCLUDE_DIRS})
114 list(APPEND FFmpeg_HWACCEL_LDFLAGS ${VDPAU_LDFLAGS})
115 message(STATUS "vdpau libraries version ${VDPAU_VERSION} found")
116 else()
117 list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vdpau)
118 endif()
119
120 # `configure` parameters builds only exactly what yuzu needs from FFmpeg
121 # `--disable-vdpau` is needed to avoid linking issues
122 add_custom_command(
123 OUTPUT
124 ${FFmpeg_MAKEFILE}
125 COMMAND
126 /bin/bash ${FFmpeg_PREFIX}/configure
127 --disable-avdevice
128 --disable-avfilter
129 --disable-avformat
130 --disable-doc
131 --disable-everything
132 --disable-ffmpeg
133 --disable-ffprobe
134 --disable-network
135 --disable-postproc
136 --disable-swresample
137 --enable-decoder=h264
138 --enable-decoder=vp8
139 --enable-decoder=vp9
140 --cc="${CMAKE_C_COMPILER}"
141 --cxx="${CMAKE_CXX_COMPILER}"
142 ${FFmpeg_HWACCEL_FLAGS}
143 WORKING_DIRECTORY
144 ${FFmpeg_BUILD_DIR}
145 )
146 unset(FFmpeg_HWACCEL_FLAGS)
147
148 # Workaround for Ubuntu 18.04's older version of make not being able to call make as a child
149 # with context of the jobserver. Also helps ninja users.
150 execute_process(
151 COMMAND
152 nproc
153 OUTPUT_VARIABLE
154 SYSTEM_THREADS)
155
156 set(FFmpeg_BUILD_LIBRARIES ${FFmpeg_LIBRARIES})
157 add_custom_command(
158 OUTPUT
159 ${FFmpeg_BUILD_LIBRARIES}
160 COMMAND
161 make -j${SYSTEM_THREADS}
162 WORKING_DIRECTORY
163 ${FFmpeg_BUILD_DIR}
164 )
165
166 set(FFmpeg_INCLUDE_DIR
167 "${FFmpeg_PREFIX};${FFmpeg_BUILD_DIR};${FFmpeg_HWACCEL_INCLUDE_DIRS}"
168 CACHE PATH "Path to FFmpeg headers" FORCE)
169
170 set(FFmpeg_LDFLAGS
171 "${FFmpeg_HWACCEL_LDFLAGS}"
172 CACHE STRING "FFmpeg linker flags" FORCE)
173
174 # ALL makes this custom target build every time
175 # but it won't actually build if the DEPENDS parameter is up to date
176 add_custom_target(ffmpeg-configure ALL DEPENDS ${FFmpeg_MAKEFILE})
177 add_custom_target(ffmpeg-build ALL DEPENDS ${FFmpeg_BUILD_LIBRARIES} ffmpeg-configure)
178 link_libraries(${FFmpeg_LIBVA_LIBRARIES})
179 set(FFmpeg_LIBRARIES ${FFmpeg_BUILD_LIBRARIES} ${FFmpeg_HWACCEL_LIBRARIES}
180 CACHE PATH "Paths to FFmpeg libraries" FORCE)
181 unset(FFmpeg_BUILD_LIBRARIES)
182 unset(FFmpeg_HWACCEL_FLAGS)
183 unset(FFmpeg_HWACCEL_INCLUDE_DIRS)
184 unset(FFmpeg_HWACCEL_LDFLAGS)
185 unset(FFmpeg_HWACCEL_LIBRARIES)
186
187 if (FFmpeg_FOUND)
188 message(STATUS "Found FFmpeg version ${FFmpeg_VERSION}")
189 else()
190 message(FATAL_ERROR "FFmpeg not found")
191 endif()
192else(WIN32)
193 # Use yuzu FFmpeg binaries
194 set(FFmpeg_EXT_NAME "ffmpeg-4.4")
195 set(FFmpeg_PATH "${CMAKE_BINARY_DIR}/externals/${FFmpeg_EXT_NAME}")
196 download_bundled_external("ffmpeg/" ${FFmpeg_EXT_NAME} "")
197 set(FFmpeg_FOUND YES)
198 set(FFmpeg_INCLUDE_DIR "${FFmpeg_PATH}/include" CACHE PATH "Path to FFmpeg headers" FORCE)
199 set(FFmpeg_LIBRARY_DIR "${FFmpeg_PATH}/bin" CACHE PATH "Path to FFmpeg library directory" FORCE)
200 set(FFmpeg_LDFLAGS "" CACHE STRING "FFmpeg linker flags" FORCE)
201 set(FFmpeg_DLL_DIR "${FFmpeg_PATH}/bin" CACHE PATH "Path to FFmpeg dll's" FORCE)
202 set(FFmpeg_LIBRARIES
203 ${FFmpeg_LIBRARY_DIR}/swscale.lib
204 ${FFmpeg_LIBRARY_DIR}/avcodec.lib
205 ${FFmpeg_LIBRARY_DIR}/avutil.lib
206 CACHE PATH "Paths to FFmpeg libraries" FORCE)
207endif(WIN32)
208
209unset(FFmpeg_COMPONENTS)
diff --git a/externals/ffmpeg/ffmpeg b/externals/ffmpeg/ffmpeg
deleted file mode 160000
Subproject dc91b913b6260e85e1304c74ff7bb3c22a8c9fb