Successfully decode with ffmpeg and play audio with miniaudio

This commit is contained in:
2023-09-09 22:17:00 +02:00
parent 84c06b59a0
commit 0d16f8183d
2 changed files with 170 additions and 65 deletions

View File

@@ -1,3 +1,18 @@
cmake_minimum_required(VERSION 3.21)
if (NOT FFMPEG_FIND_COMPONENTS)
set(FFMPEG_FIND_COMPONENTS
AVCODEC
AVDEVICE
AVFILTER
AVFORMAT
AVUTIL
POSTPROC
SWRESAMPLE
SWSCALE
)
endif()
find_path(FFMPEG_INCLUDE_DIR
NAMES
libavcodec
@@ -10,36 +25,14 @@ find_path(FFMPEG_INCLUDE_DIR
libswscale
)
find_library(FFMPEG_AVCODEC_LIBRARY avcodec)
find_library(FFMPEG_AVDEVICE_LIBRARY avdevice)
find_library(FFMPEG_AVFILTER_LIBRARY avfilter)
find_library(FFMPEG_AVFORMAT_LIBRARY avformat)
find_library(FFMPEG_AVUTIL_LIBRARY avutil)
find_library(FFMPEG_POSTPROC_LIBRARY postproc)
find_library(FFMPEG_SWRESAMPLE_LIBRARY swresample)
find_library(FFMPEG_SWSCALE_LIBRARY swscale)
foreach (component ${FFMPEG_FIND_COMPONENTS})
string(TOLOWER ${component} library)
find_library(FFMPEG_${component}_LIBRARY ${library})
endforeach()
#find_library(FFMPEG_AVCODEC_LIBRARY NAMES "avcodec.lib" "libavcodec.a")
#find_library(FFMPEG_AVDEVICE_LIBRARY NAMES "avdevice.lib" "libavdevice.a")
#find_library(FFMPEG_AVFILTER_LIBRARY NAMES "avfilter.lib" "libavfilter.a")
#find_library(FFMPEG_AVFORMAT_LIBRARY NAMES "avformat.lib" "libavformat.a")
#find_library(FFMPEG_AVUTIL_LIBRARY NAMES "avutil.lib" "libavutil.a")
#find_library(FFMPEG_POSTPROC_LIBRARY NAMES "postproc.lib" "libpostproc.a")
#find_library(FFMPEG_SWRESAMPLE_LIBRARY NAMES "swresample.lib" "libswresample.a")
#find_library(FFMPEG_SWSCALE_LIBRARY NAMES "swscale.lib" "libswscale.a")
if (FFMPEG_INCLUDE_DIR AND
FFMPEG_AVCODEC_LIBRARY AND
FFMPEG_AVDEVICE_LIBRARY AND
FFMPEG_AVFILTER_LIBRARY AND
FFMPEG_AVFORMAT_LIBRARY AND
FFMPEG_AVUTIL_LIBRARY AND
FFMPEG_POSTPROC_LIBRARY AND
FFMPEG_SWRESAMPLE_LIBRARY AND
FFMPEG_SWSCALE_LIBRARY)
set(FFMPEG_FOUND TRUE)
else()
set(FFMPEG_FOUND FALSE)
if (WIN32)
#set(bin_path "${FFMPEG_INCLUDE_DIR}/../bin")
# TODO: Copy DLLs
endif()
include(FindPackageHandleStandardArgs)