Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
- Linux-aarch64
- Linux-ppc64le
- Linux-x86_64
- NXDK-i386
- Windows-AMD64
- Windows-ARM64
include:
Expand Down Expand Up @@ -117,6 +118,12 @@ jobs:
arch: x86_64
generator: "Unix Makefiles"
shell: bash
- name: NXDK-i386
os: ubuntu-latest
arch: i386
build_ffmpeg_nxdk: 'ON'
generator: "Unix Makefiles"
shell: bash
- name: Windows-AMD64
os: windows-2022
arch: x86_64
Expand Down Expand Up @@ -173,7 +180,9 @@ jobs:

- name: Prepare Dependencies Linux
id: cross_compile
if: runner.os == 'Linux' && !startsWith(matrix.shell, 'freebsd') && !startsWith(matrix.name, 'Alpine')
if: >-
runner.os == 'Linux' && matrix.build_ffmpeg_nxdk != 'ON' &&
!startsWith(matrix.shell, 'freebsd') && !startsWith(matrix.name, 'Alpine')
run: |
echo "::group::distro detection"
# detect dist name like bionic, focal, etc
Expand Down Expand Up @@ -349,14 +358,20 @@ jobs:
echo "::endgroup::"

- name: Setup Dependencies Linux
if: runner.os == 'Linux' && !startsWith(matrix.shell, 'freebsd') && !startsWith(matrix.name, 'Alpine')
if: >-
runner.os == 'Linux' &&
!startsWith(matrix.shell, 'freebsd') && !startsWith(matrix.name, 'Alpine')
run: |
echo "::group::apt update"
sudo apt-get update
echo "::endgroup::"

echo "::group::install dependencies"
sudo aptitude install -y --without-recommends ${{ steps.cross_compile.outputs.DEPENDENCIES }}
if [[ "${{ matrix.build_ffmpeg_nxdk }}" == 'ON' ]]; then
sudo apt-get install -y --no-install-recommends clang lld llvm nasm pkg-config
else
sudo aptitude install -y --without-recommends ${{ steps.cross_compile.outputs.DEPENDENCIES }}
fi
echo "::endgroup::"

- name: Setup Dependencies MacOS
Expand Down Expand Up @@ -574,6 +589,7 @@ jobs:
-G "${{ matrix.generator }}" \
-DBUILD_ALL=OFF \
-DBUILD_${{ matrix.build }}=ON \
-DBUILD_FFMPEG_NXDK=${{ matrix.build_ffmpeg_nxdk || 'OFF' }} \
-DBUILD_FFMPEG_CUDA_LLVM=${build_ffmpeg_cuda_llvm} \
-DCMAKE_TOOLCHAIN_FILE=${{ env.CMAKE_TOOLCHAIN_FILE }} \
-DCMAKE_INSTALL_PREFIX="${{ env.ROOT_PATH }}/build/dist" \
Expand All @@ -592,6 +608,7 @@ jobs:
${{ env.MAKE_CMD }} -C build install

- name: Verify FFmpeg package
if: matrix.build_ffmpeg_nxdk != 'ON'
run: |
set -e
cd "$GITHUB_WORKSPACE"
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ option(BUILD_ALL_SUNSHINE "Build all Sunshine dependencies" OFF)

# FFmpeg options
option(BUILD_FFMPEG "Build FFmpeg" OFF)
option(BUILD_FFMPEG_NXDK "Build the FFmpeg decoder package for the original Xbox" OFF)
option(BUILD_FFMPEG_ENCODERS "Build FFmpeg encoders" ON)
option(BUILD_FFMPEG_DECODERS "Build FFmpeg decoders" ON)
option(BUILD_FFMPEG_TOOLS "Build ffmpeg and ffprobe with formats, filters, and protocols" ON)
Expand Down Expand Up @@ -213,6 +214,6 @@ message(STATUS "Detected architecture: ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "CI Matrix name should be: '${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}'")

# FFmpeg
if(BUILD_ALL OR BUILD_ALL_SUNSHINE OR BUILD_FFMPEG)
if(BUILD_ALL OR BUILD_ALL_SUNSHINE OR BUILD_FFMPEG OR BUILD_FFMPEG_NXDK)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ffmpeg/_main.cmake)
endif()
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,33 @@ This is a common set of pre-compiled dependencies for [Sunshine](https://github.

Download the matching `<platform>-ffmpeg.tar.gz` archive from a
[release](https://github.com/LizardByte/build-deps/releases), and extract its `ffmpeg` directory.
The package contains `include`, `lib`, `lib/pkgconfig`, `bin`, and `share/licenses`. CI builds encoders,
decoders, and tools together for each platform. Pin the release tag and archive SHA256 in reproducible builds.
The native packages contain `include`, `lib`, `lib/pkgconfig`, `bin`, and `share/licenses`.
CI builds native encoders, decoders, and tools together. Pin the release tag and archive SHA256
in reproducible builds.

For applications linking the static libraries, point `PKG_CONFIG_PATH` at the extracted `lib/pkgconfig`
directory and use `pkg-config --static` to obtain the complete link dependencies. The pkg-config files are
relocatable. Platform graphics and system development libraries may still be required when linking hardware
acceleration support. Windows archives use the MSYS2 MinGW toolchain and include the static oneVPL dispatcher.

To build the dependencies from source:
### Original Xbox

Use `NXDK-i386-ffmpeg.tar.gz` for nxdk projects. It includes i386 COFF archives for
`libavcodec`, `libavutil`, `libswscale`, and `libswresample`, built for the Xbox's Pentium III.
The decoder profile supports H.264, H.263, MPEG-2, and Opus. Link with your nxdk runtime and the
included `libffmpeg-nxdk-compat.a` for aligned allocation and timing. The package records its
source revisions in `ffmpeg/share/ffmpeg-nxdk/sources.txt`.

To reproduce the archive's install tree from a checkout on Ubuntu, run:

```bash
sudo apt-get install clang cmake git lld llvm make nasm pkg-config
cmake -S . -B build-nxdk -DBUILD_FFMPEG_NXDK=ON -DCMAKE_INSTALL_PREFIX="$PWD/build-nxdk/dist"
cmake --build build-nxdk
cmake --install build-nxdk
```

### Build from source for your project

Add this repository as a submodule to your project, then follow [Build](#build).

Expand All @@ -47,6 +65,7 @@ git submodule add https://github.com/LizardByte/build-deps.git third-party/build

This repository uses the MIT License. See the individual projects for the licenses that apply to
dependency sources and patches.
The [Xbox FFmpeg compatibility code](cmake/ffmpeg/nxdk/NOTICE.md) retains its GNU GPL version 3 license.


## Build
Expand Down
7 changes: 7 additions & 0 deletions cmake/ffmpeg/_main.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
CPMGetPackage(ffmpeg)

if(BUILD_FFMPEG_NXDK)
# The Xbox profile selects its built-in codecs and parsers in ffmpeg.cmake.
foreach(component ENCODERS DECODERS TOOLS OPUS AMF NV_CODEC_HEADERS LIBVA VULKAN V4L2)
set(BUILD_FFMPEG_${component} OFF)
endforeach()
endif()

if(NOT BUILD_FFMPEG_ENCODERS)
foreach(component MF SVT_AV1 X264 X265 CBS)
set(BUILD_FFMPEG_${component} OFF)
Expand Down
Loading