LibMedia: Link to avformat as well

This allows us to process container formats in future commits.
This commit is contained in:
Jelle Raaijmakers 2024-09-09 16:03:15 +02:00 committed by Andreas Kling
parent 3bf910706f
commit 1b267abf36
Notes: github-actions[bot] 2024-09-12 08:02:21 +00:00
4 changed files with 23 additions and 11 deletions

View file

@ -26,8 +26,8 @@ runs:
sudo apt-get update sudo apt-get update
sudo apt-get install autoconf autoconf-archive automake build-essential ccache clang-18 clang++-18 cmake curl fonts-liberation2 \ sudo apt-get install autoconf autoconf-archive automake build-essential ccache clang-18 clang++-18 cmake curl fonts-liberation2 \
gcc-13 g++-13 libavcodec-dev libegl1-mesa-dev libgl1-mesa-dev libpulse-dev libssl-dev libstdc++-13-dev lld-18 nasm ninja-build \ gcc-13 g++-13 libavcodec-dev libavformat-dev libegl1-mesa-dev libgl1-mesa-dev libpulse-dev libssl-dev libstdc++-13-dev lld-18 \
qt6-base-dev qt6-tools-dev-tools tar unzip zip nasm ninja-build qt6-base-dev qt6-tools-dev-tools tar unzip zip
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100 sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100

View file

@ -14,7 +14,7 @@ CMake 3.25 or newer must be available in $PATH.
### Debian/Ubuntu: ### Debian/Ubuntu:
```bash ```bash
sudo apt install autoconf autoconf-archive automake build-essential ccache cmake curl fonts-liberation2 git libavcodec-dev libgl1-mesa-dev nasm ninja-build pkg-config qt6-base-dev qt6-tools-dev-tools qt6-wayland tar unzip zip sudo apt install autoconf autoconf-archive automake build-essential ccache cmake curl fonts-liberation2 git libavcodec-dev libavformat-dev libgl1-mesa-dev nasm ninja-build pkg-config qt6-base-dev qt6-tools-dev-tools qt6-wayland tar unzip zip
``` ```
#### CMake 3.25 or newer: #### CMake 3.25 or newer:
@ -83,12 +83,12 @@ sudo pacman -S --needed autoconf-archive automake base-devel ccache cmake curl f
### Fedora or derivatives: ### Fedora or derivatives:
``` ```
sudo dnf install autoconf-archive automake ccache cmake curl libavcodec-free-devel liberation-sans-fonts libglvnd-devel nasm ninja-build qt6-qtbase-devel qt6-qtmultimedia-devel qt6-qttools-devel qt6-qtwayland-devel tar unzip zip zlib-ng-compat-static sudo dnf install autoconf-archive automake ccache cmake curl libavcodec-free-devel libavformat-free-devel liberation-sans-fonts libglvnd-devel nasm ninja-build qt6-qtbase-devel qt6-qtmultimedia-devel qt6-qttools-devel qt6-qtwayland-devel tar unzip zip zlib-ng-compat-static
``` ```
### openSUSE: ### openSUSE:
``` ```
sudo zypper install autoconf-archive automake ccache cmake curl ffmpeg-7-libavcodec-devel gcc13 gcc13-c++ liberation-fonts libglvnd-devel nasm ninja qt6-base-devel qt6-multimedia-devel qt6-tools-devel qt6-wayland-devel tar unzip zip sudo zypper install autoconf-archive automake ccache cmake curl ffmpeg-7-libavcodec-devel ffmpeg-7-libavformat-devel gcc13 gcc13-c++ liberation-fonts libglvnd-devel nasm ninja qt6-base-devel qt6-multimedia-devel qt6-tools-devel qt6-wayland-devel tar unzip zip
``` ```
The build process requires at least python3.7; openSUSE Leap only features Python 3.6 as default, so it is recommendable to install package python311 and create a virtual environment (venv) in this case. The build process requires at least python3.7; openSUSE Leap only features Python 3.6 as default, so it is recommendable to install package python311 and create a virtual environment (venv) in this case.

13
Meta/CMake/ffmpeg.cmake Normal file
View file

@ -0,0 +1,13 @@
include_guard()
find_package(PkgConfig REQUIRED)
pkg_check_modules(AVCODEC IMPORTED_TARGET libavcodec)
pkg_check_modules(AVFORMAT IMPORTED_TARGET libavformat)
if (AVCODEC_FOUND AND AVFORMAT_FOUND)
set(HAS_FFMPEG ON CACHE BOOL "" FORCE)
add_compile_definitions(USE_FFMPEG=1)
if (AVCODEC_VERSION VERSION_GREATER_EQUAL "59.24.100")
add_compile_definitions(USE_FFMPEG_CH_LAYOUT=1)
endif()
endif()

View file

@ -1,3 +1,5 @@
include(ffmpeg)
set(SOURCES set(SOURCES
Audio/GenericTypes.cpp Audio/GenericTypes.cpp
Audio/SampleFormats.cpp Audio/SampleFormats.cpp
@ -26,7 +28,7 @@ if (HAVE_PULSEAUDIO)
) )
endif() endif()
if (NOT ANDROID) if (HAS_FFMPEG)
list(APPEND SOURCES FFmpeg/FFmpegVideoDecoder.cpp) list(APPEND SOURCES FFmpeg/FFmpegVideoDecoder.cpp)
else() else()
list(APPEND SOURCES FFmpeg/FFmpegVideoDecoderStub.cpp) list(APPEND SOURCES FFmpeg/FFmpegVideoDecoderStub.cpp)
@ -35,11 +37,8 @@ endif()
serenity_lib(LibMedia media) serenity_lib(LibMedia media)
target_link_libraries(LibMedia PRIVATE LibCore LibCrypto LibRIFF LibIPC LibGfx LibThreading LibUnicode) target_link_libraries(LibMedia PRIVATE LibCore LibCrypto LibRIFF LibIPC LibGfx LibThreading LibUnicode)
if (NOT ANDROID) if (HAS_FFMPEG)
# Third-party target_link_libraries(LibMedia PRIVATE PkgConfig::AVCODEC PkgConfig::AVFORMAT)
find_package(PkgConfig REQUIRED)
pkg_check_modules(AVCODEC REQUIRED IMPORTED_TARGET libavcodec)
target_link_libraries(LibMedia PRIVATE PkgConfig::AVCODEC)
endif() endif()
if (HAVE_PULSEAUDIO) if (HAVE_PULSEAUDIO)