add SDL_mixer

This commit is contained in:
Sven Balzer 2025-04-03 03:50:59 +02:00
parent 90d167857e
commit 14728d17f5
739 changed files with 194492 additions and 1 deletions

View File

@ -5,7 +5,6 @@ set(CMAKE_C_STANDARD 11)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
option(TRACY_ENABLE "Enable Tracy profiling" OFF)
@ -14,6 +13,20 @@ set(SDL_SHARED OFF)
set(SDL_STATIC ON)
add_subdirectory(libs/SDL3)
# SDL_mixer
set(BUILD_SHARED_LIBS ${SDL_SHARED})
set(SDLMIXER_VENDORED ON)
set(SDLMIXER_FLAC OFF)
set(SDLMIXER_GME OFF)
set(SDLMIXER_MIDI OFF)
set(SDLMIXER_MOD OFF)
set(SDLMIXER_MP3 OFF)
set(SDLMIXER_OPUS ON)
set(SDLMIXER_VORBIS OFF)
set(SDLMIXER_WAVE ON)
set(SDLMIXER_WAVPACK OFF)
add_subdirectory(libs/SDL_mixer)
# Dear ImGui
add_library(imgui STATIC
libs/imgui/imgui.cpp
@ -82,6 +95,7 @@ add_executable(mikemon
target_link_libraries(mikemon
PRIVATE
SDL3::SDL3
SDL3_mixer::SDL3_mixer
stb_image
imgui
TracyClient

View File

@ -0,0 +1,81 @@
---
AlignConsecutiveMacros: Consecutive
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
# Custom brace breaking
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Never
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: false
BeforeElse: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
# Make the closing brace of container literals go to a new line
Cpp11BracedListStyle: false
# Never format includes
IncludeBlocks: Preserve
# clang-format version 4.0 through 12.0:
#SortIncludes: false
# clang-format version 13.0+:
#SortIncludes: Never
# No length limit, in case it breaks macros, you can
# disable it with /* clang-format off/on */ comments
ColumnLimit: 0
IndentWidth: 4
ContinuationIndentWidth: 4
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: NoIndent
PointerAlignment: Right
SpaceAfterCStyleCast: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeParens: ControlStatements
SpaceAroundPointerQualifiers: Default
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
UseCRLF: false
UseTab: Never
---

View File

@ -0,0 +1,45 @@
# For format see editorconfig.org
# Copyright 2022 Collabora Ltd.
# SPDX-License-Identifier: Zlib
root = true
[README.txt]
end_of_line = crlf
[*.{c,cc,cg,cpp,gradle,h,java,m,metal,pl,py,S,sh,txt}]
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{html,js,json,m4,yml,yaml,vcxproj,vcxproj.filters}]
indent_size = 2
indent_style = space
trim_tailing_whitespace = true
[{CMakeLists.txt,cmake/*.cmake}]
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[{cmake/*.cmake.in}]
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[{Makefile.*,*.mk,*.sln,*.pbxproj,*.plist}]
indent_size = 8
indent_style = tab
tab_width = 8
[*.{markdown,md}]
indent_size = 4
indent_style = space
# Markdown syntax treats tabs as 4 spaces
tab_width = 4
[{*.bat,*.rc}]
end_of_line = crlf

View File

@ -0,0 +1,62 @@
name: 'Setup ninja'
description: 'Download ninja and add it to the PATH environment variable'
inputs:
version:
description: 'Ninja version'
default: '1.12.1'
runs:
using: 'composite'
steps:
- name: 'Calculate variables'
id: calc
shell: sh
run: |
case "${{ runner.os }}-${{ runner.arch }}" in
"Linux-X86" | "Linux-X64")
archive="ninja-linux.zip"
;;
"Linux-ARM64")
archive="ninja-linux-aarch64.zip"
;;
"macOS-X86" | "macOS-X64" | "macOS-ARM64")
archive="ninja-mac.zip"
;;
"Windows-X86" | "Windows-X64")
archive="ninja-win.zip"
;;
"Windows-ARM64")
archive="ninja-winarm64.zip"
;;
*)
echo "Unsupported ${{ runner.os }}-${{ runner.arch }}"
exit 1;
;;
esac
echo "archive=${archive}" >> ${GITHUB_OUTPUT}
echo "cache-key=${archive}-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT}
- name: 'Restore cached ${{ steps.calc.outputs.archive }}'
id: cache-restore
uses: actions/cache/restore@v4
with:
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
key: ${{ steps.calc.outputs.cache-key }}
- name: 'Download ninja ${{ inputs.version }} for ${{ runner.os }} (${{ runner.arch }})'
if: ${{ (!steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false') }}
shell: pwsh
run: |
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
- name: 'Cache ${{ steps.calc.outputs.archive }}'
if: ${{ (!steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false') }}
uses: actions/cache/save@v4
with:
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
key: ${{ steps.calc.outputs.cache-key }}
- name: 'Extract ninja'
shell: pwsh
run: |
7z "-o${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" x "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
- name: 'Set output variables'
id: final
shell: pwsh
run: |
echo "${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" >> $env:GITHUB_PATH

33
libs/SDL_mixer/.github/fetch_yasm.ps1 vendored Normal file
View File

@ -0,0 +1,33 @@
$ErrorActionPreference = "Stop"
$project_root = "$psScriptRoot\.."
Write-Output "project_root: $project_root"
$yasm_version = "1.3.0"
$yasm_dlexe = "yasm-$yasm_version-win64.exe"
$yasm_url = "https://github.com/yasm/yasm/releases/download/v$yasm_version/$yasm_dlexe"
$yasm_exename = "yasm.exe"
$yasm_exepath = "$project_root/yasm.exe"
$yasm_dlpath = "$project_root\$yasm_dlexe"
echo "yasm_dlpath: $yasm_dlpath"
echo "yasm_exename: $yasm_exename"
echo "yasm_exepath: $yasm_exepath"
echo "Cleaning previous artifacts"
if (Test-Path $yasm_dlpath) {
Remove-Item $yasm_dlpath -Force
}
if (Test-Path $yasm_exepath) {
Remove-Item $yasm_exepath -Force
}
Write-Output "Downloading $yasm_dlexe ($yasm_url)"
Invoke-WebRequest -Uri $yasm_url -OutFile $yasm_dlpath
Write-Output "Moving $yasm_dlexe to $yasm_exename"
Rename-Item $yasm_dlpath $yasm_exename
Write-Output "Done"

View File

@ -0,0 +1,160 @@
name: Build
on: [push, pull_request]
jobs:
Build:
name: ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
defaults:
run:
shell: ${{ matrix.platform.shell }}
strategy:
fail-fast: false
matrix:
platform:
- { name: Windows (MSVC), os: windows-2019, shell: sh, cmake: '-DPerl_ROOT=C:/Strawberry/perl/bin/ -DSDLMIXER_VENDORED=ON -GNinja', msvc: 1, shared: 1, static: 0, artifact: 'SDL3_mixer-VC-x64' }
- { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, shared: 1, static: 0, artifact: 'SDL3_mixer-mingw64',
cmake: '-DSDLMIXER_VENDORED=OFF -G "Ninja Multi-Config"' }
- { name: Linux, os: ubuntu-20.04, shell: sh, cmake: '-DSDLMIXER_VENDORED=ON -GNinja', shared: 1, static: 0, artifact: 'SDL3_mixer-linux-x64' }
- { name: 'Linux (static)', os: ubuntu-20.04, shell: sh, cmake: '-DSDLMIXER_VENDORED=ON -DBUILD_SHARED_LIBS=OFF -GNinja', shared: 0, static: 1, artifact: 'SDL3_mixer-static-linux-x64' }
- { name: Macos, os: macos-latest, shell: sh, cmake: '-DSDLMIXER_VENDORED=ON -GNinja', shared: 1, static: 0, artifact: 'SDL3_mixer-macos' }
steps:
- uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.platform.msvc }}
with:
arch: x64
- name: Set up MSYS2
if: ${{ matrix.platform.shell == 'msys2 {0}' }}
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.platform.msystem }}
install: >-
${{ matrix.platform.msys-env }}-cmake
${{ matrix.platform.msys-env }}-gcc
${{ matrix.platform.msys-env }}-flac
${{ matrix.platform.msys-env }}-fluidsynth
${{ matrix.platform.msys-env }}-libgme
${{ matrix.platform.msys-env }}-libvorbis
${{ matrix.platform.msys-env }}-libxmp
${{ matrix.platform.msys-env }}-mpg123
${{ matrix.platform.msys-env }}-opusfile
${{ matrix.platform.msys-env }}-wavpack
${{ matrix.platform.msys-env }}-ninja
${{ matrix.platform.msys-env }}-perl
${{ matrix.platform.msys-env }}-pkg-config
- name: Set up Ninja
uses: aseprite/get-ninja@main
if: ${{ !contains(matrix.platform.shell, 'msys2') }}
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
cmake-generator: Ninja
version: 3-head
sdl-test: true
shell: ${{ matrix.platform.shell }}
- name: Set up Macos dependencies
if: ${{ runner.os == 'macOS' }}
run: |
brew install \
libtool \
ninja \
flac \
fluidsynth \
game-music-emu \
libvorbis \
libxmp \
mpg123 \
opusfile \
wavpack \
${NULL+}
- name: Set up Linux dependencies
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get -y install \
cmake \
libasound2-dev \
libflac-dev \
libfluidsynth-dev \
libgme-dev \
libmpg123-dev \
libopusfile-dev \
libvorbis-dev \
libxmp-dev \
libwavpack-dev \
ninja-build \
pkg-config \
${NULL+}
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Check that versioning is consistent
# We only need to run this once: arbitrarily use the Linux build
if: ${{ runner.os == 'Linux' }}
run: ./build-scripts/test-versioning.sh
- name: Set up yasm for mpg123
if: ${{ matrix.platform.msvc }}
shell: pwsh
run: |
.github/fetch_yasm.ps1
echo "${{ github.workspace }}" >> $Env:GITHUB_PATH
- name: Configure (CMake)
run: |
set -- \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DSDLMIXER_FLAC=ON \
-DSDLMIXER_FLAC_LIBFLAC=ON \
-DSDLMIXER_GME=ON \
-DSDLMIXER_MOD_XMP=ON \
-DSDLMIXER_MP3_MPG123=ON \
-DSDLMIXER_OPUS=ON \
-DSDLMIXER_VORBIS=VORBISFILE \
-DSDLMIXER_STRICT=ON \
-DSDLMIXER_WERROR=ON \
-DSDLMIXER_INSTALL_MAN=ON \
-DCMAKE_INSTALL_PREFIX=prefix_cmake \
${NULL+}
cmake -B build \
"$@" \
${{ matrix.platform.cmake }}
- name: Build (CMake)
id: build
run: |
cmake --build build/ --config Release --parallel --verbose
- name: Install (CMake)
run: |
set -eu
rm -fr prefix_cmake
cmake --install build/ --config Release
echo "SDL3_mixer_ROOT=$(pwd)/prefix_cmake" >> $GITHUB_ENV
( cd prefix_cmake; find . ) | LC_ALL=C sort -u
- name: Package (CPack)
if: ${{ always() && steps.build.outcome == 'success' }}
run: |
cmake --build build/ --target package
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build \
-DCMAKE_BUILD_TYPE=Release \
-DTEST_SHARED=${{ matrix.platform.shared }} \
-DTEST_STATIC=${{ matrix.platform.static }}
cmake --build cmake_config_build --verbose --config Release
- uses: actions/upload-artifact@v4
if: ${{ always() && steps.build.outcome == 'success' }}
with:
if-no-files-found: error
name: ${{ matrix.platform.artifact }}
path: build/dist/SDL3_mixer*

View File

@ -0,0 +1,762 @@
name: 'release'
run-name: 'Create SDL_mixer release artifacts for ${{ inputs.commit }}'
on:
workflow_dispatch:
inputs:
commit:
description: 'Commit of SDL_mixer'
required: true
jobs:
src:
runs-on: ubuntu-latest
outputs:
project: ${{ steps.releaser.outputs.project }}
version: ${{ steps.releaser.outputs.version }}
src-tar-gz: ${{ steps.releaser.outputs.src-tar-gz }}
src-tar-xz: ${{ steps.releaser.outputs.src-tar-xz }}
src-zip: ${{ steps.releaser.outputs.src-zip }}
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Set up SDL sources'
uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
path: 'SDL'
fetch-depth: 0
- name: 'Build Source archive'
id: releaser
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
python build-scripts/build-release.py \
--actions source \
--commit ${{ inputs.commit }} \
--root "${{ github.workspace }}/SDL" \
--github \
--debug
- name: 'Store source archives'
uses: actions/upload-artifact@v4
with:
name: sources
path: '${{ github.workspace}}/dist'
- name: 'Generate summary'
run: |
echo "Run the following commands to download all artifacts:" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "mkdir -p /tmp/${{ steps.releaser.outputs.project }}-${{ steps.releaser.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "cd /tmp/${{ steps.releaser.outputs.project }}-${{ steps.releaser.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "gh run -R ${{ github.repository }} download ${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
linux-verify:
needs: [src]
runs-on: ubuntu-latest
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '/tmp'
- name: 'Unzip ${{ needs.src.outputs.src-zip }}'
id: zip
run: |
set -e
mkdir /tmp/zipdir
cd /tmp/zipdir
unzip "/tmp/${{ needs.src.outputs.src-zip }}"
echo "path=/tmp/zipdir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
id: tar
run: |
set -e
mkdir -p /tmp/tardir
tar -C /tmp/tardir -v -x -f "/tmp/${{ needs.src.outputs.src-tar-gz }}"
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
- name: 'Compare contents of ${{ needs.src.outputs.src-zip }} and ${{ needs.src.outputs.src-tar-gz }}'
run: |
set -e
diff "${{ steps.zip.outputs.path }}" "${{ steps.tar.outputs.path }}"
- name: 'Test versioning'
shell: bash
run: |
${{ steps.tar.outputs.path }}/build-scripts/test-versioning.sh
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Download dependencies'
id: deps
env:
GH_TOKEN: ${{ github.token }}
run: |
python build-scripts/build-release.py \
--actions download \
--commit ${{ inputs.commit }} \
--root "${{ steps.tar.outputs.path }}" \
--github \
--debug
- name: 'Install Linux dependencies'
run: |
sudo apt-get update -y
sudo apt-get install -y \
gnome-desktop-testing libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev \
libusb-1.0-0-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev \
libxss-dev libwayland-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev \
libflac-dev \
fluidsynth libfluidsynth-dev \
libgme-dev \
libmpg123-dev \
libopusfile-dev \
libvorbis-dev \
libxmp-dev \
libwavpack-dev
- name: 'Extract dependencies, build and install them'
id: deps-build
run: |
tar -C /tmp -v -x -f "${{ steps.deps.outputs.dep-path }}/SDL3-${{ steps.deps.outputs.dep-sdl-version }}.tar.gz"
cmake -S /tmp/SDL3-${{ steps.deps.outputs.dep-sdl-version }} -B /tmp/SDL-build -DCMAKE_INSTALL_PREFIX=/tmp/deps-prefix
cmake --build /tmp/SDL-build
cmake --install /tmp/SDL-build
echo "path=/tmp/deps-prefix" >>$GITHUB_OUTPUT
- name: 'CMake (configure + build)'
run: |
cmake \
-S ${{ steps.tar.outputs.path }} \
-B /tmp/build \
-DSDL3MIXER_SAMPLES=ON \
-DSDL3MIXER_TESTS=ON \
-DCMAKE_PREFIX_PATH="${{ steps.deps-build.outputs.path }}"
cmake --build /tmp/build --verbose
# ctest --test-dir /tmp/build --no-tests=error --output-on-failure
dmg:
needs: [src]
runs-on: macos-latest
outputs:
dmg: ${{ steps.releaser.outputs.dmg }}
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Install nasm'
run: |
brew install nasm
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
id: tar
run: |
mkdir -p "${{ github.workspace }}/tardir"
tar -C "${{ github.workspace }}/tardir" -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
echo "path=${{ github.workspace }}/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
- name: 'Download external dependencies'
run: |
sh "${{ steps.tar.outputs.path }}/external/download.sh" --depth 1
- name: 'Build SDL3_mixer.dmg'
id: releaser
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
python build-scripts/build-release.py \
--actions dmg \
--commit ${{ inputs.commit }} \
--root "${{ steps.tar.outputs.path }}" \
--github \
--debug
- name: 'Store DMG image file'
uses: actions/upload-artifact@v4
with:
name: dmg
path: '${{ github.workspace }}/dist'
dmg-verify:
needs: [dmg, src]
runs-on: macos-latest
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
id: src
run: |
mkdir -p /tmp/tardir
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
- name: 'Download dependencies'
id: deps
env:
GH_TOKEN: ${{ github.token }}
run: |
python build-scripts/build-release.py \
--actions download \
--commit ${{ inputs.commit }} \
--root "${{ steps.src.outputs.path }}" \
--github \
--debug
- name: 'Mount dependencies'
id: deps-mount
run: |
hdiutil attach "${{ steps.deps.outputs.dep-path }}/SDL3-${{ steps.deps.outputs.dep-sdl-version }}.dmg"
sdl_mount_pount="/Volumes/SDL3"
if [ ! -d "$sdl_mount_pount/SDL3.xcframework" ]; then
echo "Cannot find SDL3.xcframework!"
exit 1
fi
echo "path=${sdl_mount_pount}" >>$GITHUB_OUTPUT
- name: 'Download ${{ needs.dmg.outputs.dmg }}'
uses: actions/download-artifact@v4
with:
name: dmg
path: '${{ github.workspace }}'
- name: 'Mount ${{ needs.dmg.outputs.dmg }}'
id: mount
run: |
hdiutil attach '${{ github.workspace }}/${{ needs.dmg.outputs.dmg }}'
mount_point="/Volumes/${{ needs.src.outputs.project }}"
if [ ! -d "$mount_point/${{ needs.src.outputs.project }}.xcframework" ]; then
echo "Cannot find ${{ needs.src.outputs.project }}.xcframework!"
exit 1
fi
echo "mount-point=${mount_point}">>$GITHUB_OUTPUT
- name: 'Verify presence of optional frameworks'
run: |
OPTIONAL_FRAMEWORKS="gme opus wavpack xmp"
rc=0
for opt in $OPTIONAL_FRAMEWORKS; do
fw_path="${{ steps.mount.outputs.mount-point }}/optional/${opt}.xcframework"
if [ -d "${fw_path}" ]; then
echo "$fw_path OK"
else
echo "$fw_path MISSING"
rc=1
fi
done
exit $rc
- name: 'CMake (configure + build) Darwin'
run: |
set -e
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-DTEST_SHARED=TRUE \
-DTEST_SHARED=TRUE \
-DTEST_STATIC=FALSE \
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }};${{ steps.deps-mount.outputs.path }}" \
-DCMAKE_SYSTEM_NAME=Darwin \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-Werror=dev \
-B build_darwin
cmake --build build_darwin --config Release --verbose
- name: 'CMake (configure + build) iOS'
run: |
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-DTEST_SHARED=TRUE \
-DTEST_STATIC=FALSE \
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }};${{ steps.deps-mount.outputs.path }}" \
-DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_OSX_ARCHITECTURES="arm64" \
-Werror=dev \
-B build_ios
cmake --build build_ios --config Release --verbose
- name: 'CMake (configure + build) tvOS'
run: |
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-DTEST_SHARED=TRUE \
-DTEST_STATIC=FALSE \
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }};${{ steps.deps-mount.outputs.path }}" \
-DCMAKE_SYSTEM_NAME=tvOS \
-DCMAKE_OSX_ARCHITECTURES="arm64" \
-Werror=dev \
-B build_tvos
cmake --build build_tvos --config Release --verbose
- name: 'CMake (configure + build) iOS simulator'
run: |
sysroot=$(xcodebuild -version -sdk iphonesimulator Path)
echo "sysroot=$sysroot"
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-DTEST_SHARED=TRUE \
-DTEST_STATIC=FALSE \
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }};${{ steps.deps-mount.outputs.path }}" \
-DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DCMAKE_OSX_SYSROOT="${sysroot}" \
-Werror=dev \
-B build_ios_simulator
cmake --build build_ios_simulator --config Release --verbose
- name: 'CMake (configure + build) tvOS simulator'
run: |
sysroot=$(xcodebuild -version -sdk appletvsimulator Path)
echo "sysroot=$sysroot"
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-DTEST_SHARED=TRUE \
-DTEST_STATIC=FALSE \
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount-point }};${{ steps.deps-mount.outputs.path }}" \
-DCMAKE_SYSTEM_NAME=tvOS \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DCMAKE_OSX_SYSROOT="${sysroot}" \
-Werror=dev \
-B build_tvos_simulator
cmake --build build_tvos_simulator --config Release --verbose
msvc:
needs: [src]
runs-on: windows-2019
outputs:
VC-x86: ${{ steps.releaser.outputs.VC-x86 }}
VC-x64: ${{ steps.releaser.outputs.VC-x64 }}
VC-devel: ${{ steps.releaser.outputs.VC-devel }}
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Unzip ${{ needs.src.outputs.src-zip }}'
id: zip
run: |
New-Item C:\temp -ItemType Directory -ErrorAction SilentlyContinue
cd C:\temp
unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
echo "path=C:\temp\${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$Env:GITHUB_OUTPUT
- name: 'Download external dependencies'
run: |
${{ steps.zip.outputs.path }}/external/Get-GitModules.ps1
- name: 'Build MSVC binary archives'
id: releaser
env:
GH_TOKEN: ${{ github.token }}
run: |
python build-scripts/build-release.py `
--actions download msvc `
--commit ${{ inputs.commit }} `
--root "${{ steps.zip.outputs.path }}" `
--github `
--debug
- name: 'Store MSVC archives'
uses: actions/upload-artifact@v4
with:
name: msvc
path: '${{ github.workspace }}/dist'
msvc-verify:
needs: [msvc, src]
runs-on: windows-latest
steps:
- name: 'Fetch .github/actions/setup-ninja/action.yml'
uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
sparse-checkout: |
.github/actions/setup-ninja/action.yml
build-scripts/build-release.py
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Set up ninja
uses: ./.github/actions/setup-ninja
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Unzip ${{ needs.src.outputs.src-zip }}'
id: src
run: |
mkdir '${{ github.workspace }}/sources'
cd '${{ github.workspace }}/sources'
unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
echo "path=${{ github.workspace }}/sources/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
- name: 'Download dependencies'
id: deps
env:
GH_TOKEN: ${{ github.token }}
run: |
python build-scripts/build-release.py `
--actions download `
--commit ${{ inputs.commit }} `
--root "${{ steps.src.outputs.path }}" `
--github `
--debug
- name: 'Extract dependencies'
id: deps-extract
run: |
mkdir '${{ github.workspace }}/deps-vc'
cd '${{ github.workspace }}/deps-vc'
unzip "${{ steps.deps.outputs.dep-path }}/SDL3-devel-${{ steps.deps.outputs.dep-sdl-version }}-VC.zip"
echo "path=${{ github.workspace }}/deps-vc" >>$env:GITHUB_OUTPUT
- name: 'Download MSVC binaries'
uses: actions/download-artifact@v4
with:
name: msvc
path: '${{ github.workspace }}'
- name: 'Unzip ${{ needs.msvc.outputs.VC-devel }}'
id: bin
run: |
mkdir '${{ github.workspace }}/vc'
cd '${{ github.workspace }}/vc'
unzip "${{ github.workspace }}/${{ needs.msvc.outputs.VC-devel }}"
echo "path=${{ github.workspace }}/vc/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
- name: 'Configure vcvars x86'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64_x86
- name: 'CMake (configure + build + tests) x86'
run: |
cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
-B build_x86 `
-GNinja `
-DCMAKE_BUILD_TYPE=Debug `
-Werror=dev `
-DTEST_SHARED=TRUE `
-DTEST_STATIC=FALSE `
-DCMAKE_SUPPRESS_REGENERATION=TRUE `
-DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }};${{ steps.deps-extract.outputs.path }}"
Start-Sleep -Seconds 2
cmake --build build_x86 --config Release --verbose
- name: 'Configure vcvars x64'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: 'CMake (configure + build + tests) x64'
run: |
cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
-B build_x64 `
-GNinja `
-DCMAKE_BUILD_TYPE=Debug `
-Werror=dev `
-DTEST_SHARED=TRUE `
-DTEST_STATIC=FALSE `
-DCMAKE_SUPPRESS_REGENERATION=TRUE `
-DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }};${{ steps.deps-extract.outputs.path }}"
Start-Sleep -Seconds 2
cmake --build build_x64 --config Release --verbose
- name: 'Configure vcvars arm64'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64_arm64
- name: 'CMake (configure + build + tests) arm64'
run: |
cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
-B build_arm64 `
-GNinja `
-DCMAKE_BUILD_TYPE=Debug `
-Werror=dev `
-DTEST_SHARED=TRUE `
-DTEST_STATIC=FALSE `
-DCMAKE_SUPPRESS_REGENERATION=TRUE `
-DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }};${{ steps.deps-extract.outputs.path }}"
Start-Sleep -Seconds 2
cmake --build build_arm64 --config Release --verbose
mingw:
needs: [src]
runs-on: ubuntu-24.04 # FIXME: current ubuntu-latest ships an outdated mingw, replace with ubuntu-latest once 24.04 becomes the new default
outputs:
mingw-devel-tar-gz: ${{ steps.releaser.outputs.mingw-devel-tar-gz }}
mingw-devel-tar-xz: ${{ steps.releaser.outputs.mingw-devel-tar-xz }}
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Install Mingw toolchain'
run: |
sudo apt-get update -y
sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
id: tar
run: |
mkdir -p /tmp/tardir
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
- name: 'Build MinGW binary archives'
id: releaser
env:
GH_TOKEN: ${{ github.token }}
run: |
python build-scripts/build-release.py \
--actions download mingw \
--commit ${{ inputs.commit }} \
--root "${{ steps.tar.outputs.path }}" \
--github \
--debug
- name: 'Store MinGW archives'
uses: actions/upload-artifact@v4
with:
name: mingw
path: '${{ github.workspace }}/dist'
mingw-verify:
needs: [mingw, src]
runs-on: ubuntu-latest
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Install Mingw toolchain'
run: |
sudo apt-get update -y
sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
id: src
run: |
mkdir -p /tmp/tardir
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
- name: 'Download dependencies'
id: deps
env:
GH_TOKEN: ${{ github.token }}
run: |
python build-scripts/build-release.py \
--actions download \
--commit ${{ inputs.commit }} \
--root "${{ steps.src.outputs.path }}" \
--github \
--debug
- name: 'Untar and install dependencies'
id: deps-extract
run: |
mkdir -p /tmp/deps-mingw/cmake
mkdir -p /tmp/deps-mingw/i686-w64-mingw32
mkdir -p /tmp/deps-mingw/x86_64-w64-mingw32
mkdir -p /tmp/deps-mingw-extract/sdl3
tar -C /tmp/deps-mingw-extract/sdl3 -v -x -f "${{ steps.deps.outputs.dep-path }}/SDL3-devel-${{ steps.deps.outputs.dep-sdl-version }}-mingw.tar.gz"
make -C /tmp/deps-mingw-extract/sdl3/SDL3-${{ steps.deps.outputs.dep-sdl-version }} install-all DESTDIR=/tmp/deps-mingw
# FIXME: this should be fixed in SDL3 releases after 3.1.3
mkdir -p /tmp/deps-mingw/cmake
cp -rv /tmp/deps-mingw-extract/sdl3/SDL3-${{ steps.deps.outputs.dep-sdl-version }}/cmake/* /tmp/deps-mingw/cmake
- name: 'Download MinGW binaries'
uses: actions/download-artifact@v4
with:
name: mingw
path: '${{ github.workspace }}'
- name: 'Untar and install ${{ needs.mingw.outputs.mingw-devel-tar-gz }}'
id: bin
run: |
mkdir -p /tmp/mingw-tardir
tar -C /tmp/mingw-tardir -v -x -f "${{ github.workspace }}/${{ needs.mingw.outputs.mingw-devel-tar-gz }}"
make -C /tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }} install-all DESTDIR=/tmp/deps-mingw
- name: 'CMake (configure + build) i686'
run: |
set -e
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-DCMAKE_BUILD_TYPE="Release" \
-DTEST_SHARED=TRUE \
-DTEST_STATIC=FALSE \
-DCMAKE_PREFIX_PATH="/tmp/deps-mingw" \
-DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-i686.cmake" \
-Werror=dev \
-B build_x86
cmake --build build_x86 --config Release --verbose
- name: 'CMake (configure + build) x86_64'
run: |
set -e
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-DCMAKE_BUILD_TYPE="Release" \
-DTEST_SHARED=TRUE \
-DTEST_STATIC=FALSE \
-DCMAKE_PREFIX_PATH="/tmp/deps-mingw" \
-DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-x86_64.cmake" \
-Werror=dev \
-B build_x64
cmake --build build_x64 --config Release --verbose
android:
needs: [src]
runs-on: ubuntu-latest
outputs:
android-aar: ${{ steps.releaser.outputs.android-aar }}
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 'Fetch build-release.py'
uses: actions/checkout@v4
with:
sparse-checkout: 'build-scripts/build-release.py'
- name: 'Setup Android NDK'
uses: nttld/setup-ndk@v1
with:
local-cache: true
ndk-version: r21e
- name: 'Setup Java JDK'
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: 'Install ninja'
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
id: tar
run: |
mkdir -p /tmp/tardir
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
- name: 'Build Android prefab binary archive(s)'
id: releaser
env:
GH_TOKEN: ${{ github.token }}
run: |
python build-scripts/build-release.py \
--actions download android \
--commit ${{ inputs.commit }} \
--root "${{ steps.tar.outputs.path }}" \
--github \
--debug
- name: 'Store Android archive(s)'
uses: actions/upload-artifact@v4
with:
name: android
path: '${{ github.workspace }}/dist'
android-verify:
needs: [android, src]
runs-on: ubuntu-latest
steps:
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: 'Download source archives'
uses: actions/download-artifact@v4
with:
name: sources
path: '${{ github.workspace }}'
- name: 'Download Android .aar archive'
uses: actions/download-artifact@v4
with:
name: android
path: '${{ github.workspace }}'
- name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
id: src
run: |
mkdir -p /tmp/tardir
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
- name: 'Extract Android SDK from AAR'
id: sdk
run: |
unzip -o "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}"
python "${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}.aar" -o /tmp/SDL3_mixer-android
echo "prefix=/tmp/SDL3_mixer-android" >>$GITHUB_OUTPUT
- name: 'Download dependencies'
id: deps
env:
GH_TOKEN: ${{ github.token }}
run: |
python "${{ steps.src.outputs.path }}/build-scripts/build-release.py" \
--actions download \
--commit ${{ inputs.commit }} \
--root "${{ steps.src.outputs.path }}" \
--github \
--debug
- name: 'Extract dependencies'
id: deps-extract
run: |
unzip -o "${{ steps.deps.outputs.dep-path }}/SDL3-devel-${{ steps.deps.outputs.dep-sdl-version }}-android.zip"
python "SDL3-${{ steps.deps.outputs.dep-sdl-version }}.aar" -o /tmp/SDL3-android
echo "sdl3-prefix=/tmp/SDL3-android" >>$GITHUB_OUTPUT
- name: 'Install ninja'
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build
- name: 'CMake (configure + build) x86, x64, arm32, arm64'
run: |
android_abis="x86 x86_64 armeabi-v7a arm64-v8a"
for android_abi in ${android_abis}; do
echo "Configuring ${android_abi}..."
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
-GNinja \
-DTEST_FULL=TRUE \
-DTEST_STATIC=FALSE \
-DCMAKE_PREFIX_PATH="${{ steps.sdk.outputs.prefix }};${{ steps.deps-extract.outputs.sdl3-prefix }}" \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=${android_abi} \
-DCMAKE_BUILD_TYPE=Release \
-B "${android_abi}"
echo "Building ${android_abi}..."
cmake --build "${android_abi}" --config Release --verbose
done

27
libs/SDL_mixer/.gitignore vendored Normal file
View File

@ -0,0 +1,27 @@
build*
!build-scripts/
aclocal.m4
autom4te*
config.cache
config.log
config.status
Makefile
libtool
.deps
.libs
*.lo
*.o
*.la
*.lai
Debug
Release
*.user
*.ncb
*.suo
*.sdf
.DS_Store
xcuserdata
*.xcworkspace
.vs
.vscode
Xcode/build.xcconfig

40
libs/SDL_mixer/.gitmodules vendored Normal file
View File

@ -0,0 +1,40 @@
[submodule "external/flac"]
path = external/flac
url = https://github.com/libsdl-org/flac.git
branch = 1.3.4-SDL
[submodule "external/ogg"]
path = external/ogg
url = https://github.com/libsdl-org/ogg.git
branch = v1.3.5-SDL
[submodule "external/vorbis"]
path = external/vorbis
url = https://github.com/libsdl-org/vorbis.git
branch = v1.3.7-SDL
[submodule "external/opus"]
path = external/opus
url = https://github.com/libsdl-org/opus.git
branch = v1.4-SDL
[submodule "external/opusfile"]
path = external/opusfile
url = https://github.com/libsdl-org/opusfile.git
branch = v0.12-SDL
[submodule "external/tremor"]
path = external/tremor
url = https://github.com/libsdl-org/tremor.git
branch = v1.2.1-SDL
[submodule "external/mpg123"]
path = external/mpg123
url = https://github.com/libsdl-org/mpg123.git
branch = v1.31.3-SDL
[submodule "libxmp"]
path = external/libxmp
url = https://github.com/libsdl-org/libxmp.git
branch = 4.6.2-SDL
[submodule "external/wavpack"]
path = external/wavpack
url = https://github.com/libsdl-org/wavpack.git
branch = 5.7.0-sdl
[submodule "external/libgme"]
path = external/libgme
url = https://github.com/libsdl-org/game-music-emu.git
branch = v0.6.4-SDL

View File

@ -0,0 +1,22 @@
projectfullname = SDL_mixer
projectshortname = SDL_mixer
incsubdir = include/SDL3_mixer
wikisubdir = SDL3_mixer
apiprefixregex = (Mix_|MIX_)
mainincludefname = SDL3_mixer/SDL_mixer.h
versionfname = include/SDL3_mixer/SDL_mixer.h
versionmajorregex = \A\#define\s+SDL_MIXER_MAJOR_VERSION\s+(\d+)\Z
versionminorregex = \A\#define\s+SDL_MIXER_MINOR_VERSION\s+(\d+)\Z
versionmicroregex = \A\#define\s+SDL_MIXER_MICRO_VERSION\s+(\d+)\Z
selectheaderregex = \ASDL_mixer\.h\Z
projecturl = https://libsdl.org/projects/SDL_mixer
wikiurl = https://wiki.libsdl.org/SDL_mixer
bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new
warn_about_missing = 0
wikipreamble = (This function is part of SDL_mixer, a separate library from SDL.)
wikiheaderfiletext = Defined in [<SDL3_mixer/%fname%>](https://github.com/libsdl-org/SDL_mixer/blob/main/include/SDL3_mixer/%fname%)
manpageheaderfiletext = Defined in SDL3_mixer/%fname%
quickrefenabled = 1
quickreftitle = SDL3_mixer API Quick Reference
quickrefurl = https://libsdl.org/
quickrefdesc = The latest version of this document can be found at https://wiki.libsdl.org/SDL3_mixer/QuickReference

182
libs/SDL_mixer/Android.mk Normal file
View File

@ -0,0 +1,182 @@
# Save the local path
SDL_MIXER_LOCAL_PATH := $(call my-dir)
# Enable this if you want to support loading WAV music
SUPPORT_WAV ?= true
# Enable this if you want to support loading FLAC music via dr_flac
SUPPORT_FLAC_DRFLAC ?= true
# Enable this if you want to support loading FLAC music with libFLAC
SUPPORT_FLAC_LIBFLAC ?= false
FLAC_LIBRARY_PATH := external/flac
# Enable this if you want to support loading OGG Vorbis music via stb_vorbis
SUPPORT_OGG_STB ?= true
# Enable this if you want to support loading OGG Vorbis music via Tremor
SUPPORT_OGG ?= false
OGG_LIBRARY_PATH := external/ogg
VORBIS_LIBRARY_PATH := external/tremor
# Enable this if you want to support loading MP3 music via dr_mp3
SUPPORT_MP3_DRMP3 ?= true
# Enable this if you want to support loading MP3 music via MPG123
SUPPORT_MP3_MPG123 ?= false
MPG123_LIBRARY_PATH := external/mpg123
# Enable this if you want to support loading WavPack music via libwavpack
SUPPORT_WAVPACK ?= true
WAVPACK_LIBRARY_PATH := external/wavpack
# Enable this if you want to support loading music via libgme
SUPPORT_GME ?= true
GME_LIBRARY_PATH := external/libgme
# Enable this if you want to support loading MOD music via XMP-lite
SUPPORT_MOD_XMP ?= false
XMP_LIBRARY_PATH := external/libxmp
# Enable this if you want to support TiMidity
SUPPORT_MID_TIMIDITY ?= false
TIMIDITY_LIBRARY_PATH := src/codecs/timidity
# Build the library
ifeq ($(SUPPORT_FLAC_LIBFLAC),true)
include $(SDL_MIXER_LOCAL_PATH)/$(FLAC_LIBRARY_PATH)/Android.mk
endif
# Build the library
ifeq ($(SUPPORT_OGG),true)
include $(SDL_MIXER_LOCAL_PATH)/$(OGG_LIBRARY_PATH)/Android.mk
include $(SDL_MIXER_LOCAL_PATH)/$(VORBIS_LIBRARY_PATH)/Android.mk
endif
# Build the library
ifeq ($(SUPPORT_MP3_MPG123),true)
include $(SDL_MIXER_LOCAL_PATH)/$(MPG123_LIBRARY_PATH)/Android.mk
endif
# Build the library
ifeq ($(SUPPORT_WAVPACK),true)
include $(SDL_MIXER_LOCAL_PATH)/$(WAVPACK_LIBRARY_PATH)/Android.mk
endif
# Build the library
ifeq ($(SUPPORT_GME),true)
include $(SDL_MIXER_LOCAL_PATH)/$(GME_LIBRARY_PATH)/Android.mk
endif
# Build the library
ifeq ($(SUPPORT_MOD_XMP),true)
include $(SDL_MIXER_LOCAL_PATH)/$(XMP_LIBRARY_PATH)/Android.mk
endif
# Build the library
ifeq ($(SUPPORT_MID_TIMIDITY),true)
include $(SDL_MIXER_LOCAL_PATH)/$(TIMIDITY_LIBRARY_PATH)/Android.mk
endif
# Restore local path
LOCAL_PATH := $(SDL_MIXER_LOCAL_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := SDL3_mixer
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src/ \
$(LOCAL_PATH)/src/codecs \
LOCAL_SRC_FILES := \
$(subst $(LOCAL_PATH)/,, \
$(wildcard $(LOCAL_PATH)/src/*.c) \
$(wildcard $(LOCAL_PATH)/src/codecs/*.c) \
)
LOCAL_CFLAGS :=
LOCAL_LDLIBS :=
LOCAL_LDFLAGS := -Wl,--no-undefined -Wl,--version-script=$(LOCAL_PATH)/src/SDL_mixer.sym
LOCAL_STATIC_LIBRARIES :=
LOCAL_SHARED_LIBRARIES := SDL3
ifeq ($(SUPPORT_WAV),true)
LOCAL_CFLAGS += -DMUSIC_WAV
endif
ifeq ($(SUPPORT_FLAC_DRFLAC),true)
LOCAL_CFLAGS += -DMUSIC_FLAC_DRFLAC
endif
ifeq ($(SUPPORT_FLAC_LIBFLAC),true)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(FLAC_LIBRARY_PATH)/include
LOCAL_CFLAGS += -DMUSIC_FLAC_LIBFLAC
LOCAL_STATIC_LIBRARIES += libFLAC
endif
ifeq ($(SUPPORT_OGG_STB),true)
LOCAL_CFLAGS += -DMUSIC_OGG -DOGG_USE_STB
endif
ifeq ($(SUPPORT_OGG),true)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(OGG_LIBRARY_PATH)/include
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(VORBIS_LIBRARY_PATH)
LOCAL_CFLAGS += -DMUSIC_OGG -DOGG_USE_TREMOR -DOGG_HEADER="<ivorbisfile.h>"
LOCAL_STATIC_LIBRARIES += ogg vorbisidec
endif
ifeq ($(SUPPORT_MP3_DRMP3),true)
LOCAL_CFLAGS += -DMUSIC_MP3_DRMP3
endif
# This needs to be a shared library to comply with the LGPL license
ifeq ($(SUPPORT_MP3_MPG123),true)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(MPG123_LIBRARY_PATH)/android
LOCAL_CFLAGS += -DMUSIC_MP3_MPG123
LOCAL_SHARED_LIBRARIES += mpg123
endif
ifeq ($(SUPPORT_WAVPACK),true)
LOCAL_CFLAGS += -DMUSIC_WAVPACK -DMUSIC_WAVPACK_DSD -DWAVPACK_HEADER=\"../external/wavpack/include/wavpack.h\"
LOCAL_STATIC_LIBRARIES += wavpack
endif
ifeq ($(SUPPORT_GME),true)
LOCAL_CFLAGS += -DMUSIC_GME
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(GME_LIBRARY_PATH)
LOCAL_STATIC_LIBRARIES += libgme
endif
ifeq ($(SUPPORT_MOD_XMP),true)
LOCAL_CFLAGS += -DMUSIC_MOD_XMP -DLIBXMP_HEADER=\"../external/libxmp/include/xmp.h\"
LOCAL_STATIC_LIBRARIES += xmp
endif
ifeq ($(SUPPORT_MID_TIMIDITY),true)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(TIMIDITY_LIBRARY_PATH)
LOCAL_CFLAGS += -DMUSIC_MID_TIMIDITY
LOCAL_STATIC_LIBRARIES += timidity
endif
LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)/include
include $(BUILD_SHARED_LIBRARY)
###########################
#
# SDL3_mixer static library
#
###########################
LOCAL_MODULE := SDL3_mixer_static
LOCAL_MODULE_FILENAME := libSDL3_mixer
LOCAL_LDLIBS :=
LOCAL_EXPORT_LDLIBS :=
include $(BUILD_STATIC_LIBRARY)

View File

@ -0,0 +1,4 @@
3.0.0:
* Removed support for libmodplug as a MOD music backend.
* Go back to using dr_mp3 as the default backend for MP3 music
* Updated for SDL 3.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

View File

@ -0,0 +1,59 @@
# Versioning
## Since 2.5.0
`SDL_mixer` follows an "odd/even" versioning policy, similar to GLib, GTK, Flatpak
and older versions of the Linux kernel:
* The major version (first part) increases when backwards compatibility
is broken, which will happen infrequently.
* If the minor version (second part) is divisible by 2
(for example 2.6.x, 2.8.x), this indicates a version that
is believed to be stable and suitable for production use.
* In stable releases, the patchlevel or micro version (third part)
indicates bugfix releases. Bugfix releases should not add or
remove ABI, so the ".0" release (for example 2.6.0) should be
forwards-compatible with all the bugfix releases from the
same cycle (for example 2.6.1).
* The minor version increases when new API or ABI is added, or when
other significant changes are made. Newer minor versions are
backwards-compatible, but not fully forwards-compatible.
For example, programs built against `SDL_mixer` 2.6.x should work fine
with 2.8.x, but programs built against 2.8.x will not necessarily
work with 2.6.x.
* If the minor version (second part) is not divisible by 2
(for example 2.5.x, 2.7.x), this indicates a development prerelease
that is not suitable for stable software distributions.
Use with caution.
* The patchlevel or micro version (third part) increases with
each prerelease.
* Each prerelease might add new API and/or ABI.
* Prereleases are backwards-compatible with older stable branches.
For example, 2.7.x will be backwards-compatible with 2.6.x.
* Prereleases are not guaranteed to be backwards-compatible with
each other. For example, new API or ABI added in 2.5.1
might be removed or changed in 2.5.2.
If this would be a problem for you, please do not use prereleases.
* Only upgrade to a prerelease if you can guarantee that you will
promptly upgrade to the stable release that follows it.
For example, do not upgrade to 2.5.x unless you will be able to
upgrade to 2.6.0 when it becomes available.
* Software distributions that have a freeze policy (in particular Linux
distributions with a release cycle, such as Debian and Fedora)
should usually only package stable releases, and not prereleases.
## Before 2.5.0
Older versions of `SDL_mixer` used the patchlevel (micro version,
third part) for feature releases, and did not distinguish between feature
and bugfix releases.

28
libs/SDL_mixer/README.txt Normal file
View File

@ -0,0 +1,28 @@
SDL_mixer 3.0
The latest version of this library is available from GitHub:
https://github.com/libsdl-org/SDL_mixer/releases
Due to popular demand, here is a simple multi-channel audio mixer.
It supports 8 channels of 16 bit stereo audio, plus a single channel of music. It can load FLAC, MP3, Ogg, VOC, and WAV format audio. It can also load MIDI, MOD, and Opus audio, depending on build options (see the note below for details.)
See the header file SDL_mixer.h and the examples playwave.c and playmus.c for documentation on this mixer library. This documentation is also available online at https://wiki.libsdl.org/SDL3_mixer
The process of mixing MIDI files to wave output is very CPU intensive, so if playing regular WAVE files sound great, but playing MIDI files sound choppy, try using 8-bit audio, mono audio, or lower frequencies.
If you have built with FluidSynth support, you'll need to set the SDL_SOUNDFONTS environment variable to a Sound Font 2 (.sf2) file containing the musical instruments you want to use for MIDI playback.
(On some Linux distributions you can install the fluid-soundfont-gm package)
To play MIDI files using Timidity, you'll need to get a complete set of GUS patches from:
http://www.libsdl.org/projects/mixer/timidity/timidity.tar.gz
and unpack them in /usr/local/lib under UNIX, and C:\ under Win32.
This library is under the zlib license, see the file "LICENSE.txt" for details.
Note:
Support for software MIDI, MOD, and Opus are not included by default because of the size of the decode libraries, but you can get them by running external/download.sh
- When building with CMake, you can enable the appropriate SDLMIXER_* options defined in CMakeLists.txt. SDLMIXER_VENDORED allows switching between system and vendored libraries.
- When building with Visual Studio, you will need to build the libraries and then add the appropriate LOAD_* preprocessor define to the Visual Studio project.
- When building with Xcode, you can edit the config at the top of the project to enable them, and you will need to include the appropriate framework in your application.
- For Android, you can edit the config at the top of Android.mk to enable them.

View File

@ -0,0 +1,358 @@
#!/bin/bash
set -e
if ! [ "x${ANDROID_NDK_HOME}" != "x" -a -d "${ANDROID_NDK_HOME}" ]; then
echo "ANDROID_NDK_HOME environment variable is not set"
exit 1
fi
if ! [ "x${ANDROID_HOME}" != "x" -a -d "${ANDROID_HOME}" ]; then
echo "ANDROID_HOME environment variable is not set"
exit 1
fi
ANDROID_PLATFORM="${ANDROID_PLATFORM:-16}"
if [ "x${android_platform}" = "x" ]; then
ANDROID_API="$(ls "${ANDROID_HOME}/platforms" | grep -E "^android-[0-9]+$" | sed 's/android-//' | sort -n -r | head -1)"
if [ "x${ANDROID_API}" = "x" ]; then
echo "No Android platform found in $ANDROID_HOME/platforms"
exit 1
fi
else
if ! [ -d "${ANDROID_HOME}/platforms/android-${ANDROID_API}" ]; then
echo "Android api version ${ANDROID_API} is not available (${ANDROID_HOME}/platforms/android-${ANDROID_API} does not exist)" >2
exit 1
fi
fi
android_platformdir="${ANDROID_HOME}/platforms/android-${ANDROID_API}"
echo "Building with ANDROID_PLATFORM=${ANDROID_PLATFORM}"
echo "android_platformdir=${android_platformdir}"
scriptdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
sdlmixer_root=$(cd -P -- "$(dirname -- "$0")/.." && printf '%s\n' "$(pwd -P)")
build_root="${sdlmixer_root}/build-android-prefab"
android_abis="armeabi-v7a arm64-v8a x86 x86_64"
android_api=19
android_ndk=21
android_stl="c++_shared"
sdlmixer_major=$(sed -ne 's/^#define SDL_MIXER_MAJOR_VERSION *//p' "${sdlmixer_root}/include/SDL3_mixer/SDL_mixer.h")
sdlmixer_minor=$(sed -ne 's/^#define SDL_MIXER_MINOR_VERSION *//p' "${sdlmixer_root}/include/SDL3_mixer/SDL_mixer.h")
sdlmixer_micro=$(sed -ne 's/^#define SDL_MIXER_MICRO_VERSION *//p' "${sdlmixer_root}/include/SDL3_mixer/SDL_mixer.h")
sdlmixer_version="${sdlmixer_major}.${sdlmixer_minor}.${sdlmixer_micro}"
echo "Building Android prefab package for SDL_mixer version $sdlmixer_version"
if test ! -d "${sdl_build_root}"; then
echo "sdl_build_root is not defined or is not a directory."
echo "Set this environment folder to the root of an android SDL${sdlmixer_major} prefab build"
echo "This usually is SDL/build-android-prefab"
exit 1
fi
prefabhome="${build_root}/prefab-${sdlmixer_version}"
rm -rf "$prefabhome"
mkdir -p "${prefabhome}"
build_cmake_projects() {
for android_abi in $android_abis; do
rm -rf "${build_root}/build_${android_abi}/prefix"
for build_shared_libs in ON OFF; do
echo "Configuring CMake project for $android_abi (shared=${build_shared_libs})"
cmake -S "${sdlmixer_root}" -B "${build_root}/build_${android_abi}/shared_${build_shared_libs}" \
-DSDLMIXER_DEPS_SHARED=ON \
-DSDLMIXER_VENDORED=ON \
-DSDLMIXER_FLAC=ON \
-DWITH_ASM=OFF \
-DSDLMIXER_FLAC_LIBFLAC=ON \
-DSDLMIXER_MOD=ON \
-DSDLMIXER_MOD_XMP=ON \
-DSDLMIXER_MP3=ON \
-DSDLMIXER_MP3_MPG123=ON \
-DSDLMIXER_MIDI=ON \
-DSDLMIXER_MIDI_TIMIDITY=ON \
-DSDLMIXER_OPUS=ON \
-DSDLMIXER_VORBIS=STB \
-DSDLMIXER_WAVPACK=ON \
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake" \
-DSDL${sdlmixer_major}_DIR="${sdl_build_root}/build_${android_abi}/prefix/lib/cmake/SDL${sdlmixer_major}" \
-DANDROID_PLATFORM=${ANDROID_PLATFORM} \
-DANDROID_ABI=${android_abi} \
-DBUILD_SHARED_LIBS=${build_shared_libs} \
-DCMAKE_INSTALL_PREFIX="${build_root}/build_${android_abi}/prefix" \
-DCMAKE_INSTALL_INCLUDEDIR=include \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_BUILD_TYPE=Release \
-DSDL${sdlmixer_major}MIXER_SAMPLES=OFF \
-GNinja
echo "Building CMake project for $android_abi (shared=${build_shared_libs})"
cmake --build "${build_root}/build_${android_abi}/shared_${build_shared_libs}"
echo "Installing CMake project for $android_abi (shared=${build_shared_libs})"
cmake --install "${build_root}/build_${android_abi}/shared_${build_shared_libs}"
done
done
}
pom_filename="SDL${sdlmixer_major}_mixer-${sdlmixer_version}.pom"
pom_filepath="${prefabhome}/${pom_filename}"
create_pom_xml() {
echo "Creating ${pom_filename}"
cat >"${pom_filepath}" <<EOF
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.libsdl.android</groupId>
<artifactId>SDL${sdlmixer_major}_mixer</artifactId>
<version>${sdlmixer_version}</version>
<packaging>aar</packaging>
<name>SDL${sdlmixer_major}_mixer</name>
<description>The AAR for SDL${sdlmixer_major}_mixer</description>
<url>https://libsdl.org/</url>
<licenses>
<license>
<name>zlib License</name>
<url>https://github.com/libsdl-org/SDL_mixer/blob/main/LICENSE.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>Sam Lantinga</name>
<email>slouken@libsdl.org</email>
<organization>SDL</organization>
<organizationUrl>https://www.libsdl.org</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/libsdl-org/SDL_mixer</connection>
<developerConnection>scm:git:ssh://github.com:libsdl-org/SDL_mixer.git</developerConnection>
<url>https://github.com/libsdl-org/SDL_mixer</url>
</scm>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>4.6.0</version>
<extensions>true</extensions>
<configuration>
<sign>
<debug>false</debug>
</sign>
</configuration>
</plugin>
</project>
EOF
}
create_aar_androidmanifest() {
echo "Creating AndroidManifest.xml"
cat >"${aar_root}/AndroidManifest.xml" <<EOF
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="org.libsdl.android" android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="16"
android:targetSdkVersion="29"/>
</manifest>
EOF
}
echo "Creating AAR root directory"
aar_root="${prefabhome}/SDL${sdlmixer_major}_mixer-${sdlmixer_version}"
mkdir -p "${aar_root}"
aar_metainfdir_path=${aar_root}/META-INF
mkdir -p "${aar_metainfdir_path}"
cp "${sdlmixer_root}/LICENSE.txt" "${aar_metainfdir_path}"
prefabworkdir="${aar_root}/prefab"
mkdir -p "${prefabworkdir}"
cat >"${prefabworkdir}/prefab.json" <<EOF
{
"schema_version": 2,
"name": "SDL${sdlmixer_major}_mixer",
"version": "${sdlmixer_version}",
"dependencies": ["SDL${sdlmixer_major}"]
}
EOF
modulesworkdir="${prefabworkdir}/modules"
mkdir -p "${modulesworkdir}"
create_shared_sdl_mixer_module() {
echo "Creating SDL${sdlmixer_major}_mixer prefab module"
for android_abi in $android_abis; do
sdl_moduleworkdir="${modulesworkdir}/SDL${sdlmixer_major}_mixer"
mkdir -p "${sdl_moduleworkdir}"
abi_build_prefix="${build_root}/build_${android_abi}/prefix"
cat >"${sdl_moduleworkdir}/module.json" <<EOF
{
"export_libraries": ["//SDL${sdlmixer_major}:SDL${sdlmixer_major}"],
"library_name": "libSDL${sdlmixer_major}_mixer"
}
EOF
mkdir -p "${sdl_moduleworkdir}/include/SDL${sdlmixer_major}"
cp -r "${abi_build_prefix}/include/SDL${sdlmixer_major}/"* "${sdl_moduleworkdir}/include/SDL${sdlmixer_major}"
abi_sdllibdir="${sdl_moduleworkdir}/libs/android.${android_abi}"
mkdir -p "${abi_sdllibdir}"
cat >"${abi_sdllibdir}/abi.json" <<EOF
{
"abi": "${android_abi}",
"api": ${android_api},
"ndk": ${android_ndk},
"stl": "${android_stl}",
"static": false
}
EOF
cp "${abi_build_prefix}/lib/libSDL${sdlmixer_major}_mixer.so" "${abi_sdllibdir}"
done
}
create_static_sdl_mixer_module() {
echo "Creating SDL${sdlmixer_major}_mixer-static prefab module"
for android_abi in $android_abis; do
sdl_moduleworkdir="${modulesworkdir}/SDL${sdlmixer_major}_mixer-static"
mkdir -p "${sdl_moduleworkdir}"
abi_build_prefix="${build_root}/build_${android_abi}/prefix"
cat >"${sdl_moduleworkdir}/module.json" <<EOF
{
"export_libraries": ["//SDL${sdlmixer_major}:SDL${sdlmixer_major}-static"],
"library_name": "libSDL${sdlmixer_major}_mixer"
}
EOF
mkdir -p "${sdl_moduleworkdir}/include/SDL${sdlmixer_major}"
cp -r "${abi_build_prefix}/include/SDL${sdlmixer_major}/"* "${sdl_moduleworkdir}/include/SDL${sdlmixer_major}"
abi_sdllibdir="${sdl_moduleworkdir}/libs/android.${android_abi}"
mkdir -p "${abi_sdllibdir}"
cat >"${abi_sdllibdir}/abi.json" <<EOF
{
"abi": "${android_abi}",
"api": ${android_api},
"ndk": ${android_ndk},
"stl": "${android_stl}",
"static": true
}
EOF
cp "${abi_build_prefix}/lib/libSDL${sdlmixer_major}_mixer.a" "${abi_sdllibdir}"
done
}
create_shared_module() {
modulename=$1
libraryname=$2
export_libraries=$3
echo "Creating $modulename prefab module"
export_libraries_json="[]"
if test "x$export_libraries" != "x"; then
export_libraries_json="["
for export_library in $export_libraries; do
if test "x$export_libraries_json" != "x["; then
export_libraries_json="$export_libraries_json, "
fi
export_libraries_json="$export_libraries_json\"$export_library\""
done
export_libraries_json="$export_libraries_json]"
fi
for android_abi in $android_abis; do
sdl_moduleworkdir="${modulesworkdir}/$modulename"
mkdir -p "${sdl_moduleworkdir}"
abi_build_prefix="${build_root}/build_${android_abi}/prefix"
cat >"${sdl_moduleworkdir}/module.json" <<EOF
{
"export_libraries": $export_libraries_json,
"library_name": "$libraryname"
}
EOF
abi_sdllibdir="${sdl_moduleworkdir}/libs/android.${android_abi}"
mkdir -p "${abi_sdllibdir}"
cat >"${abi_sdllibdir}/abi.json" <<EOF
{
"abi": "${android_abi}",
"api": ${android_api},
"ndk": ${android_ndk},
"stl": "${android_stl}"
}
EOF
cp "${abi_build_prefix}/lib/$libraryname.so" "${abi_sdllibdir}"
done
}
build_cmake_projects
create_pom_xml
create_aar_androidmanifest
create_shared_sdl_mixer_module
create_static_sdl_mixer_module
create_shared_module external_libogg libogg ""
cp "${sdlmixer_root}/external/ogg/COPYING" "${aar_metainfdir_path}/LICENSE.libogg.txt"
create_shared_module external_libflac libFLAC ":external_libogg"
for ext in FDL GPL LGPL Xiph; do
cp "${sdlmixer_root}/external/flac/COPYING.$ext" "${aar_metainfdir_path}/LICENSE.libflac.$ext.txt"
done
create_shared_module external_libmpg123 libmpg123 ""
cp "${sdlmixer_root}/external/mpg123/COPYING" "${aar_metainfdir_path}/LICENSE.libmpg123.txt"
create_shared_module external_libopus libopus ":external_libogg"
cp "${sdlmixer_root}/external/opus/COPYING" "${aar_metainfdir_path}/LICENSE.libopus.txt"
create_shared_module external_libopusfile libopusfile ":external_libopus"
cp "${sdlmixer_root}/external/opusfile/COPYING" "${aar_metainfdir_path}/LICENSE.libopusfile.txt"
create_shared_module external_libxmp libxmp ""
tail -n15 "${sdlmixer_root}/external/libxmp/README" >"${aar_metainfdir_path}/LICENSE.libxmp.txt"
create_shared_module external_libwavpack libwavpack ""
tail -n15 "${sdlmixer_root}/external/wavpack/COPYING" >"${aar_metainfdir_path}/LICENSE.wavpack.txt"
pushd "${aar_root}"
aar_filename="SDL${sdlmixer_major}_mixer-${sdlmixer_version}.aar"
zip -r "${aar_filename}" AndroidManifest.xml prefab META-INF
zip -Tv "${aar_filename}" 2>/dev/null ;
mv "${aar_filename}" "${prefabhome}"
popd
maven_filename="SDL${sdlmixer_major}_mixer-${sdlmixer_version}.zip"
pushd "${prefabhome}"
zip_filename="SDL${sdlmixer_major}_mixer-${sdlmixer_version}.zip"
zip "${maven_filename}" "${aar_filename}" "${pom_filename}" 2>/dev/null;
zip -Tv "${zip_filename}" 2>/dev/null;
popd
echo "Prefab zip is ready at ${prefabhome}/${aar_filename}"
echo "Maven archive is ready at ${prefabhome}/${zip_filename}"

View File

@ -0,0 +1,18 @@
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86)
find_program(CMAKE_C_COMPILER NAMES i686-w64-mingw32-gcc)
find_program(CMAKE_CXX_COMPILER NAMES i686-w64-mingw32-g++)
find_program(CMAKE_RC_COMPILER NAMES i686-w64-mingw32-windres windres)
if(NOT CMAKE_C_COMPILER)
message(FATAL_ERROR "Failed to find CMAKE_C_COMPILER.")
endif()
if(NOT CMAKE_CXX_COMPILER)
message(FATAL_ERROR "Failed to find CMAKE_CXX_COMPILER.")
endif()
if(NOT CMAKE_RC_COMPILER)
message(FATAL_ERROR "Failed to find CMAKE_RC_COMPILER.")
endif()

View File

@ -0,0 +1,18 @@
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
find_program(CMAKE_C_COMPILER NAMES x86_64-w64-mingw32-gcc)
find_program(CMAKE_CXX_COMPILER NAMES x86_64-w64-mingw32-g++)
find_program(CMAKE_RC_COMPILER NAMES x86_64-w64-mingw32-windres windres)
if(NOT CMAKE_C_COMPILER)
message(FATAL_ERROR "Failed to find CMAKE_C_COMPILER.")
endif()
if(NOT CMAKE_CXX_COMPILER)
message(FATAL_ERROR "Failed to find CMAKE_CXX_COMPILER.")
endif()
if(NOT CMAKE_RC_COMPILER)
message(FATAL_ERROR "Failed to find CMAKE_RC_COMPILER.")
endif()

View File

@ -0,0 +1,45 @@
#!/usr/bin/env python3
import argparse
from pathlib import Path
import json
import logging
import re
import subprocess
ROOT = Path(__file__).resolve().parents[1]
def determine_remote() -> str:
text = (ROOT / "build-scripts/release-info.json").read_text()
release_info = json.loads(text)
if "remote" in release_info:
return release_info["remote"]
project_with_version = release_info["name"]
project, _ = re.subn("([^a-zA-Z_])", "", project_with_version)
return f"libsdl-org/{project}"
def main():
default_remote = determine_remote()
parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument("--ref", required=True, help=f"Name of branch or tag containing release.yml")
parser.add_argument("--remote", "-R", default=default_remote, help=f"Remote repo (default={default_remote})")
parser.add_argument("--commit", help=f"Input 'commit' of release.yml (default is the hash of the ref)")
args = parser.parse_args()
if args.commit is None:
args.commit = subprocess.check_output(["git", "rev-parse", args.ref], cwd=ROOT, text=True).strip()
print(f"Running release.yml workflow:")
print(f" remote = {args.remote}")
print(f" ref = {args.ref}")
print(f" commit = {args.commit}")
subprocess.check_call(["gh", "-R", args.remote, "workflow", "run", "release.yml", "--ref", args.ref, "-f", f"commit={args.commit}"], cwd=ROOT)
if __name__ == "__main__":
raise SystemExit(main())

View File

@ -0,0 +1,77 @@
The Simple DirectMedia Layer (SDL for short) is a cross-platform library
designed to make it easy to write multi-media software, such as games
and emulators.
The Simple DirectMedia Layer library source code is available from:
https://www.libsdl.org/
This library is distributed under the terms of the zlib license:
http://www.zlib.net/zlib_license.html
# @<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar
This Android archive allows use of @<@PROJECT_NAME@>@ in your Android project, without needing to copy any SDL source.
## Gradle integration
For integration with CMake/ndk-build, it uses [prefab](https://google.github.io/prefab/).
Copy the aar archive (@<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar) to a `app/libs` directory of your project.
In `app/build.gradle` of your Android project, add:
```
android {
/* ... */
buildFeatures {
prefab true
}
}
dependencies {
implementation files('libs/@<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar')
/* ... */
}
```
If you're using CMake, add the following to your CMakeLists.txt:
```
find_package(@<@PROJECT_NAME@>@ REQUIRED CONFIG)
target_link_libraries(yourgame PRIVATE @<@PROJECT_NAME@>@::@<@PROJECT_NAME@>@)
```
If you use ndk-build, add the following before `include $(BUILD_SHARED_LIBRARY)` to your `Android.mk`:
```
LOCAL_SHARED_LIBARARIES := @<@PROJECT_NAME@>@
```
And add the following at the bottom:
```
# https://google.github.io/prefab/build-systems.html
# Add the prefab modules to the import path.
$(call import-add-path,/out)
# Import @<@PROJECT_NAME@>@ so we can depend on it.
$(call import-module,prefab/@<@PROJECT_NAME@>@)
```
---
## Other build systems (advanced)
If you want to build a project without Gradle,
running the following command will extract the Android archive into a more common directory structure.
```
python @<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar -o android_prefix
```
Add `--help` for a list of all available options.
Look at the example programs in ./examples (of the source archive), and check out online documentation:
https://wiki.libsdl.org/SDL3/FrontPage
Join the SDL discourse server if you want to join the community:
https://discourse.libsdl.org/
That's it!
Sam Lantinga <slouken@libsdl.org>

View File

@ -0,0 +1,104 @@
#!/usr/bin/env python
"""
Create a @<@PROJECT_NAME@>@ SDK prefix from an Android archive
This file is meant to be placed in a the root of an android .aar archive
Example usage:
```sh
python @<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar -o /usr/opt/android-sdks
cmake -S my-project \
-DCMAKE_PREFIX_PATH=/usr/opt/android-sdks \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \
-B build-arm64 -DANDROID_ABI=arm64-v8a \
-DCMAKE_BUILD_TYPE=Releaase
cmake --build build-arm64
```
"""
import argparse
import io
import json
import os
import pathlib
import re
import stat
import zipfile
AAR_PATH = pathlib.Path(__file__).resolve().parent
ANDROID_ARCHS = { "armeabi-v7a", "arm64-v8a", "x86", "x86_64" }
def main():
parser = argparse.ArgumentParser(
description="Convert a @<@PROJECT_NAME@>@ Android .aar archive into a SDK",
allow_abbrev=False,
)
parser.add_argument("--version", action="version", version="@<@PROJECT_NAME@>@ @<@PROJECT_VERSION@>@")
parser.add_argument("-o", dest="output", type=pathlib.Path, required=True, help="Folder where to store the SDK")
args = parser.parse_args()
print(f"Creating a @<@PROJECT_NAME@>@ SDK at {args.output}...")
prefix = args.output
incdir = prefix / "include"
libdir = prefix / "lib"
RE_LIB_MODULE_ARCH = re.compile(r"prefab/modules/(?P<module>[A-Za-z0-9_-]+)/libs/android\.(?P<arch>[a-zA-Z0-9_-]+)/(?P<filename>lib[A-Za-z0-9_]+\.(?:so|a))")
RE_INC_MODULE_ARCH = re.compile(r"prefab/modules/(?P<module>[A-Za-z0-9_-]+)/include/(?P<header>[a-zA-Z0-9_./-]+)")
RE_LICENSE = re.compile(r"(?:.*/)?(?P<filename>(?:license|copying)(?:\.md|\.txt)?)", flags=re.I)
RE_PROGUARD = re.compile(r"(?:.*/)?(?P<filename>proguard.*\.(?:pro|txt))", flags=re.I)
RE_CMAKE = re.compile(r"(?:.*/)?(?P<filename>.*\.cmake)", flags=re.I)
with zipfile.ZipFile(AAR_PATH) as zf:
project_description = json.loads(zf.read("description.json"))
project_name = project_description["name"]
project_version = project_description["version"]
licensedir = prefix / "share/licenses" / project_name
cmakedir = libdir / "cmake" / project_name
javadir = prefix / "share/java" / project_name
javadocdir = prefix / "share/javadoc" / project_name
def read_zipfile_and_write(path: pathlib.Path, zippath: str):
data = zf.read(zippath)
path.parent.mkdir(parents=True, exist_ok=True)
path.write_bytes(data)
for zip_info in zf.infolist():
zippath = zip_info.filename
if m := RE_LIB_MODULE_ARCH.match(zippath):
lib_path = libdir / m["arch"] / m["filename"]
read_zipfile_and_write(lib_path, zippath)
if m["filename"].endswith(".so"):
os.chmod(lib_path, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH)
elif m := RE_INC_MODULE_ARCH.match(zippath):
header_path = incdir / m["header"]
read_zipfile_and_write(header_path, zippath)
elif m:= RE_LICENSE.match(zippath):
license_path = licensedir / m["filename"]
read_zipfile_and_write(license_path, zippath)
elif m:= RE_PROGUARD.match(zippath):
proguard_path = javadir / m["filename"]
read_zipfile_and_write(proguard_path, zippath)
elif m:= RE_CMAKE.match(zippath):
cmake_path = cmakedir / m["filename"]
read_zipfile_and_write(cmake_path, zippath)
elif zippath == "classes.jar":
versioned_jar_path = javadir / f"{project_name}-{project_version}.jar"
unversioned_jar_path = javadir / f"{project_name}.jar"
read_zipfile_and_write(versioned_jar_path, zippath)
os.symlink(src=versioned_jar_path.name, dst=unversioned_jar_path)
elif zippath == "classes-sources.jar":
jarpath = javadir / f"{project_name}-{project_version}-sources.jar"
read_zipfile_and_write(jarpath, zippath)
elif zippath == "classes-doc.jar":
jarpath = javadocdir / f"{project_name}-{project_version}-javadoc.jar"
read_zipfile_and_write(jarpath, zippath)
print("... done")
return 0
if __name__ == "__main__":
raise SystemExit(main())

View File

@ -0,0 +1,133 @@
# SDL CMake configuration file:
# This file is meant to be placed in lib/cmake/SDL3_mixer subfolder of a reconstructed Android SDL3_mixer SDK
cmake_minimum_required(VERSION 3.0...3.28)
include(FeatureSummary)
set_package_properties(SDL3_mixer PROPERTIES
URL "https://www.libsdl.org/projects/SDL_mixer/"
DESCRIPTION "SDL_mixer is a sample multi-channel audio mixer library"
)
# Copied from `configure_package_config_file`
macro(set_and_check _var _file)
set(${_var} "${_file}")
if(NOT EXISTS "${_file}")
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
endif()
endmacro()
# Copied from `configure_package_config_file`
macro(check_required_components _NAME)
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(NOT ${_NAME}_${comp}_FOUND)
if(${_NAME}_FIND_REQUIRED_${comp})
set(${_NAME}_FOUND FALSE)
endif()
endif()
endforeach()
endmacro()
set(SDL3_mixer_FOUND TRUE)
set(SDLMIXER_VENDORED TRUE)
set(SDLMIXER_FLAC_LIBFLAC FALSE)
set(SDLMIXER_FLAC_DRFLAC TRUE)
set(SDLMIXER_GME FALSE)
set(SDLMIXER_MOD FALSE)
set(SDLMIXER_MOD_XMP FALSE)
set(SDLMIXER_MOD_XMP_LITE FALSE)
set(SDLMIXER_MP3 TRUE)
set(SDLMIXER_MP3_DRMP3 TRUE)
set(SDLMIXER_MP3_MPG123 FALSE)
set(SDLMIXER_MIDI FALSE)
set(SDLMIXER_MIDI_FLUIDSYNTH FALSE)
set(SDLMIXER_MIDI_NATIVE FALSE)
set(SDLMIXER_MIDI_TIMIDITY TRUE)
set(SDLMIXER_OPUS FALSE)
set(SDLMIXER_VORBIS STB)
set(SDLMIXER_VORBIS_STB TRUE)
set(SDLMIXER_VORBIS_TREMOR FALSE)
set(SDLMIXER_VORBIS_VORBISFILE FALSE)
set(SDLMIXER_WAVE TRUE)
set(SDL3_mixer_FOUND TRUE)
if(SDL_CPU_X86)
set(_sdl_arch_subdir "x86")
elseif(SDL_CPU_X64)
set(_sdl_arch_subdir "x86_64")
elseif(SDL_CPU_ARM32)
set(_sdl_arch_subdir "armeabi-v7a")
elseif(SDL_CPU_ARM64)
set(_sdl_arch_subdir "arm64-v8a")
else()
set(SDL3_mixer_FOUND FALSE)
return()
endif()
get_filename_component(_sdl3mixer_prefix "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
get_filename_component(_sdl3mixer_prefix "${_sdl3mixer_prefix}/.." ABSOLUTE)
get_filename_component(_sdl3mixer_prefix "${_sdl3mixer_prefix}/.." ABSOLUTE)
set_and_check(_sdl3mixer_prefix "${_sdl3mixer_prefix}")
set_and_check(_sdl3mixer_include_dirs "${_sdl3mixer_prefix}/include")
set_and_check(_sdl3mixer_lib "${_sdl3mixer_prefix}/lib/${_sdl_arch_subdir}/libSDL3_mixer.so")
unset(_sdl_arch_subdir)
unset(_sdl3mixer_prefix)
# All targets are created, even when some might not be requested though COMPONENTS.
# This is done for compatibility with CMake generated SDL3_mixer-target.cmake files.
set(SDL3_mixer_SDL3_mixer-shared_FOUND FALSE)
if(EXISTS "${_sdl3mixer_lib}")
if(NOT TARGET SDL3_mixer::SDL3_mixer-shared)
add_library(SDL3_mixer::SDL3_mixer-shared SHARED IMPORTED)
set_target_properties(SDL3_mixer::SDL3_mixer-shared
PROPERTIES
IMPORTED_LOCATION "${_sdl3mixer_lib}"
INTERFACE_INCLUDE_DIRECTORIES "${_sdl3mixer_include_dirs}"
COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED"
INTERFACE_SDL3_SHARED "ON"
COMPATIBLE_INTERFACE_STRING "SDL_VERSION"
INTERFACE_SDL_VERSION "SDL3"
)
endif()
set(SDL3_mixer_SDL3_mixer-shared_FOUND TRUE)
endif()
unset(_sdl3mixer_include_dirs)
unset(_sdl3mixer_lib)
set(SDL3_mixer_SDL3_mixer-static_FOUND FALSE)
if(SDL3_mixer_SDL3_mixer-shared_FOUND)
set(SDL3_mixer_SDL3_mixer_FOUND TRUE)
endif()
function(_sdl_create_target_alias_compat NEW_TARGET TARGET)
if(CMAKE_VERSION VERSION_LESS "3.18")
# Aliasing local targets is not supported on CMake < 3.18, so make it global.
add_library(${NEW_TARGET} INTERFACE IMPORTED)
set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}")
else()
add_library(${NEW_TARGET} ALIAS ${TARGET})
endif()
endfunction()
# Make sure SDL3_mixer::SDL3_mixer always exists
if(NOT TARGET SDL3_mixer::SDL3_mixer)
if(TARGET SDL3_mixer::SDL3_mixer-shared)
_sdl_create_target_alias_compat(SDL3_mixer::SDL3_mixer SDL3_mixer::SDL3_mixer-shared)
endif()
endif()
check_required_components(SDL3_mixer)

View File

@ -0,0 +1,38 @@
# SDL3_mixer CMake version configuration file:
# This file is meant to be placed in a lib/cmake/SDL3_mixer subfolder of a reconstructed Android SDL3_mixer SDK
set(PACKAGE_VERSION "@<@PROJECT_VERSION@>@")
if(PACKAGE_FIND_VERSION_RANGE)
# Package version must be in the requested version range
if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN)
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX)
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX)))
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
endif()
else()
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
endif()
# if the using project doesn't have CMAKE_SIZEOF_VOID_P set, fail.
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/sdlcpu.cmake")
SDL_DetectTargetCPUArchitectures(_detected_archs)
# check that the installed version has a compatible architecture as the one which is currently searching:
if(NOT(SDL_CPU_X86 OR SDL_CPU_X64 OR SDL_CPU_ARM32 OR SDL_CPU_ARM64))
set(PACKAGE_VERSION "${PACKAGE_VERSION} (X86,X64,ARM32,ARM64)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

View File

@ -0,0 +1,5 @@
{
"name": "@<@PROJECT_NAME@>@",
"version": "@<@PROJECT_VERSION@>@",
"git-hash": "@<@PROJECT_COMMIT@>@"
}

View File

@ -0,0 +1,19 @@
# SDL3_mixer CMake configuration file:
# This file is meant to be placed in a cmake subfolder of SDL3_mixer-devel-3.x.y-mingw
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(sdl3_mixer_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3_mixer/SDL3_mixerConfig.cmake")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(sdl3_mixer_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3_mixer/SDL3_mixerConfig.cmake")
else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "")
set(SDL3_mixer_FOUND FALSE)
return()
endif()
if(NOT EXISTS "${sdl3_mixer_config_path}")
message(WARNING "${sdl3_mixer_config_path} does not exist: MinGW development package is corrupted")
set(SDL3_mixer_FOUND FALSE)
return()
endif()
include("${sdl3_mixer_config_path}")

View File

@ -0,0 +1,19 @@
# SDL3_mixer CMake version configuration file:
# This file is meant to be placed in a cmake subfolder of SDL3_mixer-devel-3.x.y-mingw
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(sdl3_mixer_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3_mixer/SDL3_mixerConfigVersion.cmake")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(sdl3_mixer_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3_mixer/SDL3_mixerConfigVersion.cmake")
else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
return()
endif()
if(NOT EXISTS "${sdl3_mixer_config_path}")
message(WARNING "${sdl3_mixer_config_path} does not exist: MinGW development package is corrupted")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
return()
endif()
include("${sdl3_mixer_config_path}")

View File

@ -0,0 +1,114 @@
# @<@PROJECT_NAME@>@ CMake configuration file:
# This file is meant to be placed in a cmake subfolder of @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip
include(FeatureSummary)
set_package_properties(SDL3_mixer PROPERTIES
URL "https://www.libsdl.org/projects/SDL_mixer/"
DESCRIPTION "SDL_mixer is a sample multi-channel audio mixer library"
)
cmake_minimum_required(VERSION 3.0...3.28)
# Copied from `configure_package_config_file`
macro(check_required_components _NAME)
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(NOT ${_NAME}_${comp}_FOUND)
if(${_NAME}_FIND_REQUIRED_${comp})
set(${_NAME}_FOUND FALSE)
endif()
endif()
endforeach()
endmacro()
set(SDL3_mixer_FOUND TRUE)
set(SDLMIXER_VENDORED TRUE)
set(SDLMIXER_FLAC_LIBFLAC FALSE)
set(SDLMIXER_FLAC_DRFLAC TRUE)
set(SDLMIXER_GME FALSE)
set(SDLMIXER_MOD TRUE)
set(SDLMIXER_MOD_XMP TRUE)
set(SDLMIXER_MOD_XMP_LITE FALSE)
set(SDLMIXER_MP3 TRUE)
set(SDLMIXER_MP3_DRMP3 TRUE)
set(SDLMIXER_MP3_MPG123 FALSE)
set(SDLMIXER_MIDI TRUE)
set(SDLMIXER_MIDI_FLUIDSYNTH FALSE)
set(SDLMIXER_MIDI_NATIVE TRUE)
set(SDLMIXER_MIDI_TIMIDITY TRUE)
set(SDLMIXER_OPUS TRUE)
set(SDLMIXER_VORBIS STB)
set(SDLMIXER_VORBIS_STB TRUE)
set(SDLMIXER_VORBIS_TREMOR FALSE)
set(SDLMIXER_VORBIS_VORBISFILE FALSE)
set(SDLMIXER_WAVE TRUE)
if(SDL_CPU_X86)
set(_sdl3_mixer_arch_subdir "x86")
elseif(SDL_CPU_X64 OR SDL_CPU_ARM64EC)
set(_sdl3_mixer_arch_subdir "x64")
elseif(SDL_CPU_ARM64)
set(_sdl3_mixer_arch_subdir "arm64")
else()
set(SDL3_mixer_FOUND FALSE)
return()
endif()
set(_sdl3_mixer_incdir "${CMAKE_CURRENT_LIST_DIR}/../include")
set(_sdl3_mixer_library "${CMAKE_CURRENT_LIST_DIR}/../lib/${_sdl3_mixer_arch_subdir}/SDL3_mixer.lib")
set(_sdl3_mixer_dll "${CMAKE_CURRENT_LIST_DIR}/../lib/${_sdl3_mixer_arch_subdir}/SDL3_mixer.dll")
# All targets are created, even when some might not be requested though COMPONENTS.
# This is done for compatibility with CMake generated SDL3_mixer-target.cmake files.
set(SDL3_mixer_SDL3_mixer-shared_FOUND TRUE)
if(NOT TARGET SDL3_mixer::SDL3_mixer-shared)
add_library(SDL3_mixer::SDL3_mixer-shared SHARED IMPORTED)
set_target_properties(SDL3_mixer::SDL3_mixer-shared
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_sdl3_mixer_incdir}"
IMPORTED_IMPLIB "${_sdl3_mixer_library}"
IMPORTED_LOCATION "${_sdl3_mixer_dll}"
COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED"
INTERFACE_SDL3_SHARED "ON"
)
endif()
set(SDL3_mixer_SDL3_mixer-static_FOUND FALSE)
if(SDL3_mixer_SDL3_mixer-shared_FOUND OR SDL3_mixer_SDL3_mixer-static_FOUND)
set(SDL3_mixer_SDL3_mixer_FOUND TRUE)
endif()
function(_sdl_create_target_alias_compat NEW_TARGET TARGET)
if(CMAKE_VERSION VERSION_LESS "3.18")
# Aliasing local targets is not supported on CMake < 3.18, so make it global.
add_library(${NEW_TARGET} INTERFACE IMPORTED)
set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}")
else()
add_library(${NEW_TARGET} ALIAS ${TARGET})
endif()
endfunction()
# Make sure SDL3_mixer::SDL3_mixer always exists
if(NOT TARGET SDL3_mixer::SDL3_mixer)
if(TARGET SDL3_mixer::SDL3_mixer-shared)
_sdl_create_target_alias_compat(SDL3_mixer::SDL3_mixer SDL3_mixer::SDL3_mixer-shared)
endif()
endif()
unset(_sdl3_mixer_arch_subdir)
unset(_sdl3_mixer_incdir)
unset(_sdl3_mixer_library)
unset(_sdl3_mixer_dll)
check_required_components(SDL3_mixer)

View File

@ -0,0 +1,36 @@
# @<@PROJECT_NAME@>@ CMake version configuration file:
# This file is meant to be placed in a cmake subfolder of @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip
set(PACKAGE_VERSION "@<@PROJECT_VERSION@>@")
include("${CMAKE_CURRENT_LIST_DIR}/sdlcpu.cmake")
SDL_DetectTargetCPUArchitectures(_detected_archs)
if(PACKAGE_FIND_VERSION_RANGE)
# Package version must be in the requested version range
if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN)
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX)
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX)))
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
endif()
else()
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
endif()
#include("${CMAKE_CURRENT_LIST_DIR}/sdlcpu.cmake")
#SDL_DetectTargetCPUArchitectures(_detected_archs)
# check that the installed version has a compatible architecture as the one which is currently searching:
if(NOT(SDL_CPU_X86 OR SDL_CPU_X64 OR SDL_CPU_ARM64 OR SDL_CPU_ARM64EC))
set(PACKAGE_VERSION "${PACKAGE_VERSION} (X86,X64,ARM64)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

View File

@ -0,0 +1,292 @@
{
"name": "SDL3_mixer",
"remote": "libsdl-org/SDL_mixer",
"dependencies": {
"SDL": {
"startswith": "3.",
"repo": "libsdl-org/SDL"
}
},
"version": {
"file": "include/SDL3_mixer/SDL_mixer.h",
"re_major": "^#define SDL_MIXER_MAJOR_VERSION\\s+([0-9]+)$",
"re_minor": "^#define SDL_MIXER_MINOR_VERSION\\s+([0-9]+)$",
"re_micro": "^#define SDL_MIXER_MICRO_VERSION\\s+([0-9]+)$"
},
"source": {
"checks": [
"src/mixer.c",
"include/SDL3_mixer/SDL_mixer.h",
"examples/playmus.c"
]
},
"dmg": {
"project": "Xcode/SDL_mixer.xcodeproj",
"path": "Xcode/build/SDL3_mixer.dmg",
"scheme": "SDL3_mixer.dmg",
"build-xcconfig": "Xcode/pkg-support/build.xcconfig",
"dependencies": {
"SDL": {
"artifact": "SDL3-*.dmg"
}
}
},
"mingw": {
"cmake": {
"archs": ["x86", "x64"],
"args": [
"-DBUILD_SHARED_LIBS=ON",
"-DSDLMIXER_SNDFILE=ON",
"-DSDLMIXER_FLAC=ON",
"-DSDLMIXER_FLAC_DRFLAC=ON",
"-DSDLMIXER_GME=OFF",
"-DSDLMIXER_MOD=OFF",
"-DSDLMIXER_MOD_XMP=OFF",
"-DSDLMIXER_MP3=ON",
"-DSDLMIXER_MP3_DRMP3=ON",
"-DSDLMIXER_MP3_MPG123=OFF",
"-DSDLMIXER_MIDI=ON",
"-DSDLMIXER_MIDI_NATIVE=ON",
"-DSDLMIXER_OPUS=OFF",
"-DSDLMIXER_VORBIS=STB",
"-DSDLMIXER_WAVE=ON",
"-DSDLMIXER_WAVPACK=OFF",
"-DSDLMIXER_RELOCATABLE=ON",
"-DSDLMIXER_SAMPLES=OFF",
"-DSDLMIXER_VENDORED=ON"
],
"shared-static": "args"
},
"files": {
"": [
"CHANGES.txt",
"LICENSE.txt",
"README.txt",
"build-scripts/pkg-support/mingw/Makefile"
],
"cmake": [
"build-scripts/pkg-support/mingw/cmake/SDL3_mixerConfig.cmake",
"build-scripts/pkg-support/mingw/cmake/SDL3_mixerConfigVersion.cmake"
]
},
"dependencies": {
"SDL": {
"artifact": "SDL3-devel-*-mingw.tar.gz",
"install-command": "make install-@<@ARCH@>@ DESTDIR=@<@PREFIX@>@"
}
}
},
"msvc": {
"msbuild": {
"archs": [
"x86",
"x64"
],
"projects": [
"VisualC/SDL_mixer.vcxproj"
],
"prebuilt": [
"VisualC/external/optional/@<@ARCH@>@/*"
],
"files-lib": {
"": [
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3_mixer.dll"
],
"optional": [
"VisualC/external/optional/@<@ARCH@>@/libgme.dll",
"VisualC/external/optional/@<@ARCH@>@/libogg-0.dll",
"VisualC/external/optional/@<@ARCH@>@/libopus-0.dll",
"VisualC/external/optional/@<@ARCH@>@/libopusfile-0.dll",
"VisualC/external/optional/@<@ARCH@>@/libwavpack-1.dll",
"VisualC/external/optional/@<@ARCH@>@/libxmp.dll",
"VisualC/external/optional/@<@ARCH@>@/LICENSE.gme.txt",
"VisualC/external/optional/@<@ARCH@>@/LICENSE.ogg-vorbis.txt",
"VisualC/external/optional/@<@ARCH@>@/LICENSE.opus.txt",
"VisualC/external/optional/@<@ARCH@>@/LICENSE.opusfile.txt",
"VisualC/external/optional/@<@ARCH@>@/LICENSE.wavpack.txt",
"VisualC/external/optional/@<@ARCH@>@/LICENSE.xmp.txt"
]
},
"files-devel": {
"lib/@<@ARCH@>@": [
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3_mixer.dll",
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3_mixer.lib",
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL3_mixer.pdb"
],
"lib/@<@ARCH@>@/optional": [
"VisualC/external/optional/@<@ARCH@>@/libgme.dll",
"VisualC/external/optional/@<@ARCH@>@/libogg-0.dll",
"VisualC/external/optional/@<@ARCH@>@/libopus-0.dll",
"VisualC/external/optional/@<@ARCH@>@/libopusfile-0.dll",
"VisualC/external/optional/@<@ARCH@>@/libwavpack-1.dll",
"VisualC/external/optional/@<@ARCH@>@/libxmp.dll",
"VisualC/external/optional/@<@ARCH@>@/LICENSE.gme.txt",
"VisualC/external/optional/@<@ARCH@>@/LICENSE.ogg-vorbis.txt",
"VisualC/external/optional/@<@ARCH@>@/LICENSE.opus.txt",
"VisualC/external/optional/@<@ARCH@>@/LICENSE.opusfile.txt",
"VisualC/external/optional/@<@ARCH@>@/LICENSE.wavpack.txt",
"VisualC/external/optional/@<@ARCH@>@/LICENSE.xmp.txt"
]
}
},
"cmake": {
"archs": [
"arm64"
],
"args": [
"-DSDLMIXER_SNDFILE=ON",
"-DSDLMIXER_FLAC=ON",
"-DSDLMIXER_FLAC_DRFLAC=ON",
"-DSDLMIXER_GME=ON",
"-DSDLMIXER_MOD=ON",
"-DSDLMIXER_MOD_XMP=ON",
"-DSDLMIXER_MP3=ON",
"-DSDLMIXER_MP3_DRMP3=ON",
"-DSDLMIXER_MP3_MPG123=OFF",
"-DSDLMIXER_MIDI=ON",
"-DSDLMIXER_MIDI_NATIVE=ON",
"-DSDLMIXER_OPUS=ON",
"-DSDLMIXER_VORBIS=STB",
"-DSDLMIXER_WAVE=ON",
"-DSDLMIXER_WAVPACK=ON",
"-DSDLMIXER_RELOCATABLE=ON",
"-DSDLMIXER_SAMPLES=OFF",
"-DSDLMIXER_DEPS_SHARED=ON",
"-DSDLMIXER_VENDORED=ON"
],
"files-lib": {
"": [
"bin/SDL3_mixer.dll"
],
"optional": [
"bin/gme.dll",
"bin/libxmp.dll",
"bin/ogg-0.dll",
"bin/opus-0.dll",
"bin/opusfile-0.dll",
"bin/libwavpack-1.dll"
]
},
"files-devel": {
"lib/@<@ARCH@>@": [
"bin/SDL3_mixer.dll",
"bin/SDL3_mixer.pdb",
"lib/SDL3_mixer.lib"
],
"lib/@<@ARCH@>@/optional": [
"bin/gme.dll",
"bin/libxmp.dll",
"bin/ogg-0.dll",
"bin/opus-0.dll",
"bin/opusfile-0.dll",
"bin/libwavpack-1.dll"
]
}
},
"files-lib": {
"": [
"README.txt"
]
},
"files-devel": {
"": [
"CHANGES.txt",
"LICENSE.txt",
"README.txt"
],
"cmake": [
"build-scripts/pkg-support/msvc/cmake/SDL3_mixerConfig.cmake.in:SDL3_mixerConfig.cmake",
"build-scripts/pkg-support/msvc/cmake/SDL3_mixerConfigVersion.cmake.in:SDL3_mixerConvigVersion.cmake",
"cmake/sdlcpu.cmake"
],
"include/SDL3_mixer": [
"include/SDL3_mixer/SDL_mixer.h"
]
},
"dependencies": {
"SDL": {
"artifact": "SDL3-devel-*-VC.zip",
"copy": [
{
"src": "lib/@<@ARCH@>@/SDL3.*",
"dst": "../SDL/VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@"
},
{
"src": "include/SDL3/*",
"dst": "../SDL/include/SDL3"
}
]
}
}
},
"android": {
"cmake": {
"args": [
"-DBUILD_SHARED_LIBS=ON",
"-DSDLMIXER_SNDFILE=ON",
"-DSDLMIXER_FLAC=ON",
"-DSDLMIXER_FLAC_DRFLAC=ON",
"-DSDLMIXER_GME=OFF",
"-DSDLMIXER_MOD=OFF",
"-DSDLMIXER_MOD_XMP=OFF",
"-DSDLMIXER_MP3=ON",
"-DSDLMIXER_MP3_DRMP3=ON",
"-DSDLMIXER_MP3_MPG123=OFF",
"-DSDLMIXER_MIDI=ON",
"-DSDLMIXER_MIDI_NATIVE=ON",
"-DSDLMIXER_OPUS=OFF",
"-DSDLMIXER_VORBIS=STB",
"-DSDLMIXER_WAVE=ON",
"-DSDLMIXER_WAVPACK=OFF",
"-DSDLMIXER_SAMPLES=OFF",
"-DSDLMIXER_VENDORED=ON"
]
},
"modules": {
"SDL3_mixer-shared": {
"type": "library",
"library": "lib/libSDL3_mixer.so",
"includes": {
"SDL3_mixer": ["include/SDL3_mixer/*.h"]
}
},
"SDL3_mixer": {
"type": "interface",
"export-libraries": [":SDL3_mixer-shared"]
}
},
"abis": [
"armeabi-v7a",
"arm64-v8a",
"x86",
"x86_64"
],
"api-minimum": 19,
"api-target": 29,
"ndk-minimum": 21,
"aar-files": {
"": [
"build-scripts/pkg-support/android/aar/__main__.py.in:__main__.py",
"build-scripts/pkg-support/android/aar/description.json.in:description.json"
],
"META-INF": [
"LICENSE.txt"
],
"cmake": [
"cmake/sdlcpu.cmake",
"build-scripts/pkg-support/android/aar/cmake/SDL3_mixerConfig.cmake",
"build-scripts/pkg-support/android/aar/cmake/SDL3_mixerConfigVersion.cmake.in:SDL3_mixerConfigVersion.cmake"
]
},
"files": {
"": [
"build-scripts/pkg-support/android/README.md.in:README.md"
]
},
"dependencies": {
"SDL": {
"artifact": "SDL3-devel-*-android.zip"
}
}
}
}

View File

@ -0,0 +1,142 @@
#!/bin/sh
# Copyright 2022 Collabora Ltd.
# SPDX-License-Identifier: Zlib
set -eu
cd `dirname $0`/..
# Needed so sed doesn't report illegal byte sequences on macOS
export LC_CTYPE=C
header=include/SDL3_mixer/SDL_mixer.h
ref_major=$(sed -ne 's/^#define SDL_MIXER_MAJOR_VERSION *//p' $header)
ref_minor=$(sed -ne 's/^#define SDL_MIXER_MINOR_VERSION *//p' $header)
ref_micro=$(sed -ne 's/^#define SDL_MIXER_MICRO_VERSION *//p' $header)
ref_version="${ref_major}.${ref_minor}.${ref_micro}"
tests=0
failed=0
ok () {
tests=$(( tests + 1 ))
echo "ok - $*"
}
not_ok () {
tests=$(( tests + 1 ))
echo "not ok - $*"
failed=1
}
major=$(sed -ne 's/^set(MAJOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
minor=$(sed -ne 's/^set(MINOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
micro=$(sed -ne 's/^set(MICRO_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
ref_sdl_req=$(sed -ne 's/^set(SDL_REQUIRED_VERSION \([0-9.]*\))$/\1/p' CMakeLists.txt)
version="${major}.${minor}.${micro}"
if [ "$ref_version" = "$version" ]; then
ok "CMakeLists.txt $version"
else
not_ok "CMakeLists.txt $version disagrees with SDL_mixer.h $ref_version"
fi
for rcfile in src/version.rc; do
tuple=$(sed -ne 's/^ *FILEVERSION *//p' "$rcfile" | tr -d '\r')
ref_tuple="${ref_major},${ref_minor},${ref_micro},0"
if [ "$ref_tuple" = "$tuple" ]; then
ok "$rcfile FILEVERSION $tuple"
else
not_ok "$rcfile FILEVERSION $tuple disagrees with SDL_mixer.h $ref_tuple"
fi
tuple=$(sed -ne 's/^ *PRODUCTVERSION *//p' "$rcfile" | tr -d '\r')
if [ "$ref_tuple" = "$tuple" ]; then
ok "$rcfile PRODUCTVERSION $tuple"
else
not_ok "$rcfile PRODUCTVERSION $tuple disagrees with SDL_mixer.h $ref_tuple"
fi
tuple=$(sed -Ene 's/^ *VALUE "FileVersion", "([0-9, ]*)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r')
ref_tuple="${ref_major}, ${ref_minor}, ${ref_micro}, 0"
if [ "$ref_tuple" = "$tuple" ]; then
ok "$rcfile FileVersion $tuple"
else
not_ok "$rcfile FileVersion $tuple disagrees with SDL_mixer.h $ref_tuple"
fi
tuple=$(sed -Ene 's/^ *VALUE "ProductVersion", "([0-9, ]*)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r')
if [ "$ref_tuple" = "$tuple" ]; then
ok "$rcfile ProductVersion $tuple"
else
not_ok "$rcfile ProductVersion $tuple disagrees with SDL_mixer.h $ref_tuple"
fi
done
version=$(sed -Ene '/CFBundleShortVersionString/,+1 s/.*<string>(.*)<\/string>.*/\1/p' Xcode/Info-Framework.plist)
if [ "$ref_version" = "$version" ]; then
ok "Info-Framework.plist CFBundleShortVersionString $version"
else
not_ok "Info-Framework.plist CFBundleShortVersionString $version disagrees with SDL_mixer.h $ref_version"
fi
version=$(sed -Ene '/CFBundleVersion/,+1 s/.*<string>(.*)<\/string>.*/\1/p' Xcode/Info-Framework.plist)
if [ "$ref_version" = "$version" ]; then
ok "Info-Framework.plist CFBundleVersion $version"
else
not_ok "Info-Framework.plist CFBundleVersion $version disagrees with SDL_mixer.h $ref_version"
fi
# For simplicity this assumes we'll never break ABI before SDL 3.
dylib_compat=$(sed -Ene 's/.*DYLIB_COMPATIBILITY_VERSION = (.*);$/\1/p' Xcode/SDL_mixer.xcodeproj/project.pbxproj)
case "$ref_minor" in
(*[02468])
major="$(( ref_minor * 100 + 1 ))"
minor="0"
;;
(*)
major="$(( ref_minor * 100 + ref_micro + 1 ))"
minor="0"
;;
esac
ref="${major}.${minor}.0
${major}.${minor}.0"
if [ "$ref" = "$dylib_compat" ]; then
ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is consistent"
else
not_ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is inconsistent, expected $ref, got $dylib_compat"
fi
dylib_cur=$(sed -Ene 's/.*DYLIB_CURRENT_VERSION = (.*);$/\1/p' Xcode/SDL_mixer.xcodeproj/project.pbxproj)
case "$ref_minor" in
(*[02468])
major="$(( ref_minor * 100 + 1 ))"
minor="$ref_micro"
;;
(*)
major="$(( ref_minor * 100 + ref_micro + 1 ))"
minor="0"
;;
esac
ref="${major}.${minor}.0
${major}.${minor}.0"
if [ "$ref" = "$dylib_cur" ]; then
ok "project.pbxproj DYLIB_CURRENT_VERSION is consistent"
else
not_ok "project.pbxproj DYLIB_CURRENT_VERSION is inconsistent, expected $ref, got $dylib_cur"
fi
echo "1..$tests"
exit "$failed"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
if(CPACK_PACKAGE_FILE_NAME MATCHES ".*-src$")
message(FATAL_ERROR "Creating source archives is not supported.")
endif()
set(PROJECT_NAME "@PROJECT_NAME@")
set(PROJECT_VERSION "@PROJECT_VERSION@")
set(PROJECT_SOURCE_DIR "@PROJECT_SOURCE_DIR@")
set(SDL_CMAKE_PLATFORM "@SDL_CMAKE_PLATFORM@")
set(SDL_CPU_NAMES "@SDL_CPU_NAMES@")
list(SORT SDL_CPU_NAMES)
string(TOLOWER "${SDL_CMAKE_PLATFORM}" SDL_CMAKE_PLATFORM)
string(TOLOWER "${SDL_CPU_NAMES}" SDL_CPU_NAMES)
if(lower_sdl_cmake_platform STREQUAL lower_sdl_cpu_names)
set(SDL_CPU_NAMES_WITH_DASHES)
endif()
string(REPLACE ";" "-" SDL_CPU_NAMES_WITH_DASHES "${SDL_CPU_NAMES}")
if(SDL_CPU_NAMES_WITH_DASHES)
set(SDL_CPU_NAMES_WITH_DASHES "-${SDL_CPU_NAMES_WITH_DASHES}")
endif()
set(MSVC @MSVC@)
set(MINGW @MINGW@)
if(MSVC)
set(SDL_CMAKE_PLATFORM "${SDL_CMAKE_PLATFORM}-VC")
elseif(MINGW)
set(SDL_CMAKE_PLATFORM "${SDL_CMAKE_PLATFORM}-mingw")
endif()
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}-${SDL_CMAKE_PLATFORM}${SDL_CPU_NAMES_WITH_DASHES}")
if(CPACK_GENERATOR STREQUAL "DragNDrop")
set(CPACK_DMG_VOLUME_NAME "@PROJECT_NAME@ @PROJECT_VERSION@")
# FIXME: use pre-built/create .DS_Store through AppleScript (CPACK_DMG_DS_STORE/CPACK_DMG_DS_STORE_SETUP_SCRIPT)
set(CPACK_DMG_DS_STORE "${PROJECT_SOURCE_DIR}/Xcode/SDL/pkg-support/resources/SDL_DS_Store")
endif()

View File

@ -0,0 +1,44 @@
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_FLAC QUIET flac)
find_library(FLAC_LIBRARY
NAMES FLAC
HINTS ${PC_FLAC_LIBDIR}
)
find_path(FLAC_INCLUDE_PATH
NAMES FLAC/all.h
HINTS ${PC_FLAC_INCLUDEDIR}
)
if(PC_FLAC_FOUND)
get_flags_from_pkg_config("${FLAC_LIBRARY}" "PC_FLAC" "_flac")
endif()
set(FLAC_COMPILE_OPTIONS "${_flac_compile_options}" CACHE STRING "Extra compile options of FLAC")
set(FLAC_LINK_LIBRARIES "${_flac_link_libraries}" CACHE STRING "Extra link libraries of FLAC")
set(FLAC_LINK_OPTIONS "${_flac_link_options}" CACHE STRING "Extra link flags of FLAC")
set(FLAC_LINK_DIRECTORIES "${_flac_link_directories}" CACHE PATH "Extra link directories of FLAC")
find_package_handle_standard_args(FLAC
REQUIRED_VARS FLAC_LIBRARY FLAC_INCLUDE_PATH
)
if(FLAC_FOUND)
if(NOT TARGET FLAC::FLAC)
add_library(FLAC::FLAC UNKNOWN IMPORTED)
set_target_properties(FLAC::FLAC PROPERTIES
IMPORTED_LOCATION "${FLAC_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_PATH}"
INTERFACE_COMPILE_OPTIONS "${FLAC_COMPILE_OPTIONS}"
INTERFACE_LINK_LIBRARIES "${FLAC_LINK_LIBRARIES}"
INTERFACE_LINK_OPTIONS "${FLAC_LINK_OPTIONS}"
INTERFACE_LINK_DIRECTORIES "${FLAC_LINK_DIRECTORIES}"
)
endif()
endif()

View File

@ -0,0 +1,44 @@
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_FLUIDSYNTH QUIET fluidsynth)
find_library(FluidSynth_LIBRARY
NAMES fluidsynth libfluidsynth
HINTS ${PC_FLUIDSYNTH_LIBDIR}
)
find_path(FluidSynth_INCLUDE_PATH
NAMES fluidsynth.h
HINTS ${PC_FLUIDSYNTH_INCLUDEDIR}
)
if(PC_FLUIDSYNTH_FOUND)
get_flags_from_pkg_config("${FluidSynth_LIBRARY}" "PC_FLUIDSYNTH" "_fluidsynth")
endif()
set(FluidSynth_COMPILE_OPTIONS "${_fluidsynth_compile_options}" CACHE STRING "Extra compile options of FluidSynth")
set(FluidSynth_LINK_LIBRARIES "${_fluidsynth_link_libraries}" CACHE STRING "Extra link libraries of FluidSynth")
set(FluidSynth_LINK_OPTIONS "${_fluidsynth_link_options}" CACHE STRING "Extra link flags of FluidSynth")
set(FluidSynth_LINK_DIRECTORIES "${_fluidsynth_link_directories}" CACHE PATH "Extra link directories of FluidSynth")
find_package_handle_standard_args(FluidSynth
REQUIRED_VARS FluidSynth_LIBRARY FluidSynth_INCLUDE_PATH
)
if(FluidSynth_FOUND)
if(NOT TARGET FluidSynth::libfluidsynth)
add_library(FluidSynth::libfluidsynth UNKNOWN IMPORTED)
set_target_properties(FluidSynth::libfluidsynth PROPERTIES
IMPORTED_LOCATION "${FluidSynth_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${FluidSynth_INCLUDE_PATH}"
INTERFACE_COMPILE_OPTIONS "${FluidSynth_COMPILE_OPTIONS}"
INTERFACE_LINK_LIBRARIES "${FluidSynth_LINK_LIBRARIES}"
INTERFACE_LINK_OPTIONS "${FluidSynth_LINK_OPTIONS}"
INTERFACE_LINK_DIRECTORIES "${FluidSynth_LINK_DIRECTORIES}"
)
endif()
endif()

View File

@ -0,0 +1,50 @@
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_OGG QUIET ogg)
find_library(Ogg_LIBRARY
NAMES ogg
HINTS ${PC_OGG_LIBDIR}
)
find_path(Ogg_INCLUDE_PATH
NAMES ogg/ogg.h
HINTS ${PC_OGG_INCLUDEDIR}
)
if(PC_OGG_FOUND)
get_flags_from_pkg_config("${Ogg_LIBRARY}" "PC_OGG" "_ogg")
endif()
set(Ogg_COMPILE_OPTIONS "${_ogg_compile_options}" CACHE STRING "Extra compile options of ogg")
set(Ogg_LINK_LIBRARIES "${_ogg_link_libraries}" CACHE STRING "Extra link libraries of ogg")
set(Ogg_LINK_OPTIONS "${_ogg_link_options}" CACHE STRING "Extra link flags of ogg")
set(Ogg_LINK_DIRECTORIES "${_ogg_link_directories}" CACHE PATH "Extra link directories of ogg")
find_package_handle_standard_args(Ogg
REQUIRED_VARS Ogg_LIBRARY Ogg_INCLUDE_PATH
)
if(Ogg_FOUND)
set(Ogg_dirs ${Ogg_INCLUDE_PATH})
if(EXISTS "${Ogg_INCLUDE_PATH}/ogg")
list(APPEND Ogg_dirs "${Ogg_INCLUDE_PATH}/ogg")
endif()
if(NOT TARGET Ogg::ogg)
add_library(Ogg::ogg UNKNOWN IMPORTED)
set_target_properties(Ogg::ogg PROPERTIES
IMPORTED_LOCATION "${Ogg_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${Ogg_dirs}"
INTERFACE_COMPILE_OPTIONS "${Ogg_COMPILE_OPTIONS}"
INTERFACE_LINK_LIBRARIES "${Ogg_LINK_LIBRARIES}"
INTERFACE_LINK_OPTIONS "${Ogg_LINK_OPTIONS}"
INTERFACE_LINK_DIRECTORIES "${Ogg_LINK_DIRECTORIES}"
)
endif()
endif()
set(Ogg_INCLUDE_DIRS ${Ogg_INCLUDE_PATH})

View File

@ -0,0 +1,53 @@
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_OPUS QUIET opus)
find_library(Opus_LIBRARY
NAMES opus
HINTS ${PC_OPUS_LIBDIR}
)
find_path(Opus_INCLUDE_PATH
NAMES opus.h
PATH_SUFFIXES opus
HINTS ${PC_OPUS_INCLUDEDIR}
)
if(EXISTS "${Opus_INCLUDE_PATH}/opus")
list(APPEND Opus_INCLUDE_PATH "${Opus_INCLUDE_PATH}/opus")
endif()
if(PC_OPUS_FOUND)
get_flags_from_pkg_config("${Opus_LIBRARY}" "PC_OPUS" "_opus")
endif()
set(Opus_COMPILE_OPTIONS "${_opus_compile_options}" CACHE STRING "Extra compile options of opus")
set(Opus_LINK_LIBRARIES "${_opus_link_libraries}" CACHE STRING "Extra link libraries of opus")
set(Opus_LINK_OPTIONS "${_opus_link_options}" CACHE STRING "Extra link flags of opus")
set(Opus_LINK_DIRECTORIES "${_opus_link_directories}" CACHE PATH "Extra link directories of opus")
find_package(Ogg ${required})
find_package_handle_standard_args(Opus
REQUIRED_VARS Opus_LIBRARY Opus_INCLUDE_PATH Ogg_FOUND
)
if(Opus_FOUND)
set(Opus_dirs ${Opus_INCLUDE_PATH})
if(NOT TARGET Opus::opus)
add_library(Opus::opus UNKNOWN IMPORTED)
set_target_properties(Opus::opus PROPERTIES
IMPORTED_LOCATION "${Opus_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${Opus_dirs}"
INTERFACE_COMPILE_OPTIONS "${Opus_COMPILE_OPTIONS}:$<TARGET_PROPERTY:Ogg::ogg,INTERFACE_INCLUDE_DIRECTORIES>"
INTERFACE_LINK_LIBRARIES "${Opus_LINK_LIBRARIES}"
INTERFACE_LINK_OPTIONS "${Opus_LINK_OPTIONS}"
INTERFACE_LINK_DIRECTORIES "${Opus_LINK_DIRECTORIES}"
)
endif()
endif()
set(Opus_INCLUDE_DIRS ${Opus_INCLUDE_PATH})

View File

@ -0,0 +1,51 @@
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_OPUSFILE QUIET opusfile)
find_library(OpusFile_LIBRARY
NAMES opusfile
HINTS ${PC_OPUSFILE_LIBDIR}
)
find_path(OpusFile_INCLUDE_PATH
NAMES opus/opusfile.h
HINTS ${PC_OPUSFILE_INCLUDEDIR}
)
if(PC_OPUSFILE_FOUND)
get_flags_from_pkg_config("${OpusFile_LIBRARY}" "PC_OPUSFILE" "_opusfile")
endif()
set(OpusFile_COMPILE_OPTIONS "${_opusfile_compile_options}" CACHE STRING "Extra compile options of opusfile")
set(OpusFile_LINK_LIBRARIES "${_opusfile_link_libraries}" CACHE STRING "Extra link libraries of opusfile")
set(OpusFile_LINK_OPTIONS "${_opusfile_link_options}" CACHE STRING "Extra link flags of opusfile")
set(OpusFile_LINK_DIRECTORIES "${_opusfile_link_directories}" CACHE PATH "Extra link directories of opusfile")
find_package(Ogg)
find_package(Opus)
find_package_handle_standard_args(OpusFile
REQUIRED_VARS OpusFile_LIBRARY OpusFile_INCLUDE_PATH Ogg_FOUND Opus_FOUND
)
if(OpusFile_FOUND)
set(OpusFile_dirs ${OpusFile_INCLUDE_PATH})
if(EXISTS "${OpusFile_INCLUDE_PATH}/opus")
list(APPEND OpusFile_dirs "${OpusFile_INCLUDE_PATH}/opus")
endif()
if(NOT TARGET OpusFile::opusfile)
add_library(OpusFile::opusfile UNKNOWN IMPORTED)
set_target_properties(OpusFile::opusfile PROPERTIES
IMPORTED_LOCATION "${OpusFile_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${OpusFile_dirs};$<TARGET_PROPERTY:Ogg::ogg,INTERFACE_INCLUDE_DIRECTORIES>;$<TARGET_PROPERTY:Opus::opus,INTERFACE_INCLUDE_DIRECTORIES>"
INTERFACE_COMPILE_OPTIONS "${OpusFile_COMPILE_OPTIONS}"
INTERFACE_LINK_LIBRARIES "${OpusFile_LINK_LIBRARIES}"
INTERFACE_LINK_OPTIONS "${OpusFile_LINK_OPTIONS}"
INTERFACE_LINK_DIRECTORIES "${OpusFile_LINK_DIRECTORIES}"
)
endif()
endif()

View File

@ -0,0 +1,44 @@
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_SNDFILE QUIET sndfile)
find_library(SndFile_LIBRARY
NAMES sndfile sndfile-1
HINTS ${PC_SNDFILE_LIBDIR}
)
find_path(SndFile_INCLUDE_PATH
NAMES sndfile.h
HINTS ${PC_SNDFILE_INCLUDEDIR}
)
if(PC_SNDFILE_FOUND)
get_flags_from_pkg_config("${SndFile_LIBRARY}" "PC_SNDFILE" "_sndfile")
endif()
set(SndFile_COMPILE_OPTIONS "${_sndfile_compile_options}" CACHE STRING "Extra compile options of libsndfile")
set(SndFile_LINK_LIBRARIES "${_sndfile_link_libraries}" CACHE STRING "Extra link libraries of libsndfile")
set(SndFile_LINK_OPTIONS "${_sndfile_link_options}" CACHE STRING "Extra link flags of libsndfile")
set(SndFile_LINK_DIRECTORIES "${_sndfile_link_directories}" CACHE PATH "Extra link directories of libsndfile")
find_package_handle_standard_args(SndFile
REQUIRED_VARS SndFile_LIBRARY SndFile_INCLUDE_PATH
)
if(SndFile_FOUND)
if(NOT TARGET SndFile::sndfile)
add_library(SndFile::sndfile UNKNOWN IMPORTED)
set_target_properties(SndFile::sndfile PROPERTIES
IMPORTED_LOCATION "${SndFile_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${SndFile_INCLUDE_PATH}"
INTERFACE_COMPILE_OPTIONS "${SndFile_COMPILE_OPTIONS}"
INTERFACE_LINK_LIBRARIES "${SndFile_LINK_LIBRARIES}"
INTERFACE_LINK_OPTIONS "${SndFile_LINK_OPTIONS}"
INTERFACE_LINK_DIRECTORIES "${SndFile_LINK_DIRECTORIES}"
)
endif()
endif()

View File

@ -0,0 +1,44 @@
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_VORBIS QUIET vorbisfile)
find_library(Vorbis_vorbisfile_LIBRARY
NAMES vorbisfile
HINTS ${PC_VORBIS_LIBDIR}
)
find_path(Vorbis_vorbisfile_INCLUDE_PATH
NAMES vorbis/vorbisfile.h
HINTS ${PC_VORBIS_INCLUDEDIR}
)
if(PC_VORBIS_FOUND)
get_flags_from_pkg_config("${Vorbis_vorbisfile_LIBRARY}" "PC_VORBIS" "_vorbisfile")
endif()
set(Vorbis_vorbisfile_COMPILE_OPTIONS "${_vorbisfile_compile_options}" CACHE STRING "Extra compile options of vorbisfile")
set(Vorbis_vorbisfile_LINK_LIBRARIES "${_vorbisfile_link_libraries}" CACHE STRING "Extra link libraries of vorbisfile")
set(Vorbis_vorbisfile_LINK_OPTIONS "${_vorbisfile_link_options}" CACHE STRING "Extra link flags of vorbisfile")
set(Vorbis_vorbisfile_LINK_DIRECTORIES "${_vorbisfile_link_directories}" CACHE PATH "Extra link directories of vorbisfile")
find_package_handle_standard_args(Vorbis
REQUIRED_VARS Vorbis_vorbisfile_LIBRARY Vorbis_vorbisfile_INCLUDE_PATH
)
if (Vorbis_FOUND)
if (NOT TARGET Vorbis::vorbisfile)
add_library(Vorbis::vorbisfile UNKNOWN IMPORTED)
set_target_properties(Vorbis::vorbisfile PROPERTIES
IMPORTED_LOCATION "${Vorbis_vorbisfile_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_vorbisfile_INCLUDE_PATH}"
INTERFACE_COMPILE_OPTIONS "${Vorbis_vorbisfile_COMPILE_OPTIONS}"
INTERFACE_LINK_LIBRARIES "${Vorbis_vorbisfile_LINK_LIBRARIES}"
INTERFACE_LINK_OPTIONS "${Vorbis_vorbisfile_LINK_OPTIONS}"
INTERFACE_LINK_DIRECTORIES "${Vorbis_vorbisfile_LINK_DIRECTORIES}"
)
endif()
endif()

View File

@ -0,0 +1,48 @@
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_GME QUIET libgme)
find_library(gme_LIBRARY
NAMES gme
HINTS ${PC_GME_LIBDIR}
)
find_path(gme_INCLUDE_PATH
NAMES gme/gme.h
HINTS ${PC_GME_INCLUDEDIR}
)
if(PC_GME_FOUND)
get_flags_from_pkg_config("${gme_LIBRARY}" "PC_GME" "_gme")
endif()
set(gme_COMPILE_OPTIONS "${_gme_compile_options}" CACHE STRING "Extra compile options of gme")
set(gme_LINK_LIBRARIES "${_gme_link_libraries}" CACHE STRING "Extra link libraries of gme")
set(gme_LINK_OPTIONS "${_gme_link_options}" CACHE STRING "Extra link flags of gme")
set(gme_LINK_DIRECTORIES "${_gme_link_directories}" CACHE PATH "Extra link directories of gme")
find_package_handle_standard_args(gme
REQUIRED_VARS gme_LIBRARY gme_INCLUDE_PATH
)
if(gme_FOUND)
set(gme_dirs ${gme_INCLUDE_PATH})
if(EXISTS "${gme_INCLUDE_PATH}/gme")
list(APPEND gme_dirs "${gme_INCLUDE_PATH}/gme")
endif()
if(NOT TARGET gme::gme)
add_library(gme::gme UNKNOWN IMPORTED)
set_target_properties(gme::gme PROPERTIES
IMPORTED_LOCATION "${gme_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${gme_dirs}"
INTERFACE_COMPILE_OPTIONS "${gme_COMPILE_OPTIONS}"
INTERFACE_LINK_LIBRARIES "${gme_LINK_LIBRARIES}"
INTERFACE_LINK_OPTIONS "${gme_LINK_OPTIONS}"
INTERFACE_LINK_DIRECTORIES "${gme_LINK_DIRECTORIES}"
)
endif()
endif()

View File

@ -0,0 +1,45 @@
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_XMPLITE QUIET libxmp-lite)
find_library(libxmp_lite_LIBRARY
NAMES xmp-lite libxmp-lite
HINTS ${PC_XMPLITE_LIBDIR}
)
find_path(libxmp_lite_INCLUDE_PATH
NAMES xmp.h
PATH_SUFFIXES libxmp-lite
HINTS ${PC_XMPLITE_INCLUDEDIR}
)
if(PC_XMPLITE_FOUND)
get_flags_from_pkg_config("${libxmp_lite_LIBRARY}" "PC_XMPLITE" "_libxmp_lite")
endif()
set(libxmp_lite_COMPILE_OPTIONS "${_libxmp_lite_compile_options}" CACHE STRING "Extra compile options of libxmp_lite")
set(libxmp_lite_LINK_LIBRARIES "${_libxmp_lite_link_libraries}" CACHE STRING "Extra link libraries of libxmp_lite")
set(libxmp_lite_LINK_OPTIONS "${_libxmp_lite_link_options}" CACHE STRING "Extra link flags of libxmp_lite")
set(libxmp_lite_LINK_DIRECTORIES "${_libxmp_lite_link_directories}" CACHE PATH "Extra link directories of libxmp_lite")
find_package_handle_standard_args(libxmp-lite
REQUIRED_VARS libxmp_lite_LIBRARY libxmp_lite_INCLUDE_PATH
)
if(libxmp-lite_FOUND)
if(NOT TARGET libxmp-lite::libxmp-lite)
add_library(libxmp-lite::libxmp-lite UNKNOWN IMPORTED)
set_target_properties(libxmp-lite::libxmp-lite PROPERTIES
IMPORTED_LOCATION "${libxmp_lite_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${libxmp_lite_INCLUDE_PATH}"
INTERFACE_COMPILE_OPTIONS "${libxmp_lite_COMPILE_OPTIONS}"
INTERFACE_LINK_LIBRARIES "${libxmp_lite_LINK_LIBRARIES}"
INTERFACE_LINK_OPTIONS "${libxmp_lite_LINK_OPTIONS}"
INTERFACE_LINK_DIRECTORIES "${libxmp_lite_LINK_DIRECTORIES}"
)
endif()
endif()

View File

@ -0,0 +1,44 @@
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_XMP QUIET libxmp)
find_library(libxmp_LIBRARY
NAMES xmp
HINTS ${PC_XMP_LIBDIR}
)
find_path(libxmp_INCLUDE_PATH
NAMES xmp.h
HINTS ${PC_XMP_INCLUDEDIR}
)
if(PC_XMP_FOUND)
get_flags_from_pkg_config("${libxmp_LIBRARY}" "PC_XMP" "_libxmp")
endif()
set(libxmp_COMPILE_OPTIONS "${_libxmp_compile_options}" CACHE STRING "Extra compile options of libxmp")
set(libxmp_LINK_LIBRARIES "${_libxmp_link_libraries}" CACHE STRING "Extra link libraries of libxmp")
set(libxmp_LINK_OPTIONS "${_libxmp_link_options}" CACHE STRING "Extra link flags of libxmp")
set(libxmp_LINK_DIRECTORIES "${_libxmp_link_directories}" CACHE PATH "Extra link flags of libxmp")
find_package_handle_standard_args(libxmp
REQUIRED_VARS libxmp_LIBRARY libxmp_INCLUDE_PATH
)
if(libxmp_FOUND)
if(NOT TARGET libxmp::libxmp)
add_library(libxmp::libxmp UNKNOWN IMPORTED)
set_target_properties(libxmp::libxmp PROPERTIES
IMPORTED_LOCATION "${libxmp_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${libxmp_INCLUDE_PATH}"
INTERFACE_COMPILE_OPTIONS "${libxmp_COMPILE_OPTIONS}"
INTERFACE_LINK_LIBRARIES "${libxmp_LINK_LIBRARIES}"
INTERFACE_LINK_OPTIONS "${libxmp_LINK_OPTIONS}"
INTERFACE_LINK_DIRECTORIES "${libxmp_LINK_DIRECTORIES}"
)
endif()
endif()

View File

@ -0,0 +1,44 @@
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_MPG123 QUIET libmpg123)
find_library(mpg123_LIBRARY
NAMES mpg123
HINTS ${PC_MPG123_LIBDIR}
)
find_path(mpg123_INCLUDE_PATH
NAMES mpg123.h
HINTS ${PC_MPG123_INCLUDEDIR}
)
if(PC_MPG123_FOUND)
get_flags_from_pkg_config("${mpg123_LIBRARY}" "PC_MPG123" "_mpg123")
endif()
set(mpg123_COMPILE_OPTIONS "${_mpg123_compile_options}" CACHE STRING "Extra compile options of mpg123")
set(mpg123_LINK_LIBRARIES "${_mpg123_link_libraries}" CACHE STRING "Extra link libraries of mpg123")
set(mpg123_LINK_OPTIONS "${_mpg123_link_options}" CACHE STRING "Extra link flags of mpg123")
set(mpg123_LINK_DIRECTORIES "${_mpg123_link_directories}" CACHE PATH "Extra link directories of mpg123")
find_package_handle_standard_args(mpg123
REQUIRED_VARS mpg123_LIBRARY mpg123_INCLUDE_PATH
)
if(mpg123_FOUND)
if(NOT TARGET MPG123::libmpg123)
add_library(MPG123::libmpg123 UNKNOWN IMPORTED)
set_target_properties(MPG123::libmpg123 PROPERTIES
IMPORTED_LOCATION "${mpg123_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${mpg123_INCLUDE_PATH}"
INTERFACE_COMPILE_OPTIONS "${mpg123_COMPILE_OPTIONS}"
INTERFACE_LINK_LIBRARIES "${mpg123_LINK_LIBRARIES}"
INTERFACE_LINK_OPTIONS "${mpg123_LINK_OPTIONS}"
INTERFACE_LINK_DIRECTORIES "${mpg123_LINK_DIRECTORIES}"
)
endif()
endif()

View File

@ -0,0 +1,44 @@
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_TREMOR QUIET vorbisidec)
find_library(tremor_LIBRARY
NAMES vorbisidec libvorbisidec
HINTS ${PC_TREMOR_LIBDIR}
)
find_path(tremor_INCLUDE_PATH
NAMES tremor/ivorbisfile.h
HINTS ${PC_TREMOR_INCLUDEDIR}
)
if(PC_TREMOR_FOUND)
get_flags_from_pkg_config("${tremor_LIBRARY}" "PC_TREMOR" "_tremor")
endif()
set(tremor_COMPILE_OPTIONS "${_tremor_compile_options}" CACHE STRING "Extra compile options of vorbis")
set(tremor_LINK_LIBRARIES "${_tremor_link_libraries}" CACHE STRING "Extra link libraries of vorbis")
set(tremor_LINK_OPTIONS "${_tremor_link_options}" CACHE STRING "Extra link flags of vorbis")
set(tremor_LINK_DIRECTORIES "${_tremor_link_directories}" CACHE PATH "Extra link directories of vorbis")
find_package_handle_standard_args(tremor
REQUIRED_VARS tremor_LIBRARY tremor_INCLUDE_PATH
)
if (tremor_FOUND)
if (NOT TARGET tremor::tremor)
add_library(tremor::tremor UNKNOWN IMPORTED)
set_target_properties(tremor::tremor PROPERTIES
IMPORTED_LOCATION "${tremor_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${tremor_INCLUDE_PATH}"
INTERFACE_COMPILE_OPTIONS "${tremor_COMPILE_OPTIONS}"
INTERFACE_LINK_LIBRARIES "${tremor_LINK_LIBRARIES}"
INTERFACE_LINK_OPTIONS "${tremor_LINK_OPTIONS}"
INTERFACE_LINK_DIRECTORIES "${tremor_LINK_DIRECTORIES}"
)
endif()
endif()

View File

@ -0,0 +1,37 @@
include(FindPackageHandleStandardArgs)
if(WIN32)
set(wavpack_find_names wavpack libwavpack wavpackdll)
else()
set(wavpack_find_names wavpack)
endif()
find_library(wavpack_LIBRARY
NAMES ${wavpack_find_names}
)
find_path(wavpack_INCLUDE_PATH
NAMES wavpack/wavpack.h
)
set(wavpack_COMPILE_OPTIONS "" CACHE STRING "Extra compile options of wavpack")
set(wavpack_LINK_LIBRARIES "" CACHE STRING "Extra link libraries of wavpack")
set(wavpack_LINK_OPTIONS "" CACHE STRING "Extra link flags of wavpack")
find_package_handle_standard_args(wavpack
REQUIRED_VARS wavpack_LIBRARY wavpack_INCLUDE_PATH
)
if (wavpack_FOUND)
if (NOT TARGET WavPack::WavPack)
add_library(WavPack::WavPack UNKNOWN IMPORTED)
set_target_properties(WavPack::WavPack PROPERTIES
IMPORTED_LOCATION "${wavpack_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${wavpack_INCLUDE_PATH}"
INTERFACE_COMPILE_OPTIONS "${wavpack_COMPILE_OPTIONS}"
INTERFACE_LINK_LIBRARIES "${wavpack_LINK_LIBRARIES}"
INTERFACE_LINK_OPTIONS "${wavpack_LINK_OPTIONS}"
)
endif()
endif()

View File

@ -0,0 +1,284 @@
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision(<refspecvar> <hashvar> [ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_describe_working_tree(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the working tree (--dirty option),
# and adjusting the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# git_local_changes(<var>)
#
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
# Uses the return code of "git diff-index --quiet HEAD --".
# Does not regard untracked files.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2020 Ryan Pavlik <ryan.pavlik@gmail.com> <abiryan@ryand.net>
# http://academic.cleardefinition.com
#
# Copyright 2009-2013, Iowa State University.
# Copyright 2013-2020, Ryan Pavlik
# Copyright 2013-2020, Contributors
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
# Function _git_find_closest_git_dir finds the next closest .git directory
# that is part of any directory in the path defined by _start_dir.
# The result is returned in the parent scope variable whose name is passed
# as variable _git_dir_var. If no .git directory can be found, the
# function returns an empty string via _git_dir_var.
#
# Example: Given a path C:/bla/foo/bar and assuming C:/bla/.git exists and
# neither foo nor bar contain a file/directory .git. This will return
# C:/bla/.git
#
function(_git_find_closest_git_dir _start_dir _git_dir_var)
set(cur_dir "${_start_dir}")
set(git_dir "${_start_dir}/.git")
while(NOT EXISTS "${git_dir}")
# .git dir not found, search parent directories
set(git_previous_parent "${cur_dir}")
get_filename_component(cur_dir "${cur_dir}" DIRECTORY)
if(cur_dir STREQUAL git_previous_parent)
# We have reached the root directory, we are not in git
set(${_git_dir_var}
""
PARENT_SCOPE)
return()
endif()
set(git_dir "${cur_dir}/.git")
endwhile()
set(${_git_dir_var}
"${git_dir}"
PARENT_SCOPE)
endfunction()
function(get_git_head_revision _refspecvar _hashvar)
_git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
if("${ARGN}" STREQUAL "ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR")
set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR TRUE)
else()
set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR FALSE)
endif()
if(NOT "${GIT_DIR}" STREQUAL "")
file(RELATIVE_PATH _relative_to_source_dir "${CMAKE_SOURCE_DIR}"
"${GIT_DIR}")
if("${_relative_to_source_dir}" MATCHES "[.][.]" AND NOT ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR)
# We've gone above the CMake root dir.
set(GIT_DIR "")
endif()
endif()
if("${GIT_DIR}" STREQUAL "")
set(${_refspecvar}
"GITDIR-NOTFOUND"
PARENT_SCOPE)
set(${_hashvar}
"GITDIR-NOTFOUND"
PARENT_SCOPE)
return()
endif()
# Check if the current source dir is a git submodule or a worktree.
# In both cases .git is a file instead of a directory.
#
if(NOT IS_DIRECTORY ${GIT_DIR})
# The following git command will return a non empty string that
# points to the super project working tree if the current
# source dir is inside a git submodule.
# Otherwise the command will return an empty string.
#
execute_process(
COMMAND "${GIT_EXECUTABLE}" rev-parse
--show-superproject-working-tree
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT "${out}" STREQUAL "")
# If out is empty, GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a submodule
file(READ ${GIT_DIR} submodule)
string(REGEX REPLACE "gitdir: (.*)$" "\\1" GIT_DIR_RELATIVE
${submodule})
string(STRIP ${GIT_DIR_RELATIVE} GIT_DIR_RELATIVE)
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE}
ABSOLUTE)
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
else()
# GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a worktree
file(READ ${GIT_DIR} worktree_ref)
# The .git directory contains a path to the worktree information directory
# inside the parent git repo of the worktree.
#
string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir
${worktree_ref})
string(STRIP ${git_worktree_dir} git_worktree_dir)
_git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR)
set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD")
endif()
else()
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
endif()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")
endif()
if(NOT EXISTS "${HEAD_SOURCE_FILE}")
return()
endif()
set(HEAD_FILE "${GIT_DATA}/HEAD")
configure_file("${HEAD_SOURCE_FILE}" "${HEAD_FILE}" COPYONLY)
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
"${GIT_DATA}/grabRef.cmake" @ONLY)
include("${GIT_DATA}/grabRef.cmake")
set(${_refspecvar}
"${HEAD_REF}"
PARENT_SCOPE)
set(${_hashvar}
"${HEAD_HASH}"
PARENT_SCOPE)
endfunction()
function(git_describe _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var}
"GIT-NOTFOUND"
PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var}
"HEAD-HASH-NOTFOUND"
PARENT_SCOPE)
return()
endif()
# TODO sanitize
#if((${ARGN}" MATCHES "&&") OR
# (ARGN MATCHES "||") OR
# (ARGN MATCHES "\\;"))
# message("Please report the following error to the project!")
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
#endif()
#message(STATUS "Arguments to execute_process: ${ARGN}")
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --tags --always ${hash} ${ARGN}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var}
"${out}"
PARENT_SCOPE)
endfunction()
function(git_describe_working_tree _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
if(NOT GIT_FOUND)
set(${_var}
"GIT-NOTFOUND"
PARENT_SCOPE)
return()
endif()
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --dirty ${ARGN}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var}
"${out}"
PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var}
"${out}"
PARENT_SCOPE)
endfunction()
function(git_local_changes _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var}
"GIT-NOTFOUND"
PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var}
"HEAD-HASH-NOTFOUND"
PARENT_SCOPE)
return()
endif()
execute_process(
COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD --
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(res EQUAL 0)
set(${_var}
"CLEAN"
PARENT_SCOPE)
else()
set(${_var}
"DIRTY"
PARENT_SCOPE)
endif()
endfunction()

View File

@ -0,0 +1,43 @@
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright 2009-2012, Iowa State University
# Copyright 2011-2015, Contributors
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# SPDX-License-Identifier: BSL-1.0
set(HEAD_HASH)
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
else()
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_HASH "${CMAKE_MATCH_1}")
endif()
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()

View File

@ -0,0 +1,34 @@
# Helper for Find modules
function(get_flags_from_pkg_config _library _pc_prefix _out_prefix)
if("${_library}" MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$")
set(_cflags ${_pc_prefix}_STATIC_CFLAGS_OTHER)
set(_link_libraries ${_pc_prefix}_STATIC_LIBRARIES)
set(_link_options ${_pc_prefix}_STATIC_LDFLAGS_OTHER)
set(_library_dirs ${_pc_prefix}_STATIC_LIBRARY_DIRS)
else()
set(_cflags ${_pc_prefix}_CFLAGS_OTHER)
set(_link_libraries ${_pc_prefix}_LIBRARIES)
set(_link_options ${_pc_prefix}_LDFLAGS_OTHER)
set(_library_dirs ${_pc_prefix}_LIBRARY_DIRS)
endif()
# The *_LIBRARIES lists always start with the library itself
list(POP_FRONT "${_link_libraries}")
# Work around CMake's flag deduplication when pc files use `-framework A` instead of `-Wl,-framework,A`
string(REPLACE "-framework;" "-Wl,-framework," "_filtered_link_options" "${${_link_options}}")
set(${_out_prefix}_compile_options
"${${_cflags}}"
PARENT_SCOPE)
set(${_out_prefix}_link_libraries
"${${_link_libraries}}"
PARENT_SCOPE)
set(${_out_prefix}_link_options
"${_filtered_link_options}"
PARENT_SCOPE)
set(${_out_prefix}_link_directories
"${${_library_dirs}}"
PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,355 @@
# This file is shared amongst SDL_image/SDL_mixer/SDL_ttf
include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
include(CMakePushCheckState)
macro(sdl_calculate_derived_version_variables MAJOR MINOR MICRO)
set(SO_VERSION_MAJOR "0")
set(SO_VERSION_MINOR "${MINOR_VERSION}")
set(SO_VERSION_MICRO "${MICRO_VERSION}")
set(SO_VERSION "${SO_VERSION_MAJOR}.${SO_VERSION_MINOR}.${SO_VERSION_MICRO}")
if(MINOR MATCHES "[02468]$")
math(EXPR DYLIB_COMPAT_VERSION_MAJOR "100 * ${MINOR} + 1")
set(DYLIB_COMPAT_VERSION_MINOR "0")
math(EXPR DYLIB_CURRENT_VERSION_MAJOR "${DYLIB_COMPAT_VERSION_MAJOR}")
set(DYLIB_CURRENT_VERSION_MINOR "${MICRO}")
else()
math(EXPR DYLIB_COMPAT_VERSION_MAJOR "100 * ${MINOR} + ${MICRO} + 1")
set(DYLIB_COMPAT_VERSION_MINOR "0")
math(EXPR DYLIB_CURRENT_VERSION_MAJOR "${DYLIB_COMPAT_VERSION_MAJOR}")
set(DYLIB_CURRENT_VERSION_MINOR "0")
endif()
set(DYLIB_COMPAT_VERSION_MICRO "0")
set(DYLIB_CURRENT_VERSION_MICRO "0")
set(DYLIB_CURRENT_VERSION "${DYLIB_CURRENT_VERSION_MAJOR}.${DYLIB_CURRENT_VERSION_MINOR}.${DYLIB_CURRENT_VERSION_MICRO}")
set(DYLIB_COMPAT_VERSION "${DYLIB_COMPAT_VERSION_MAJOR}.${DYLIB_COMPAT_VERSION_MINOR}.${DYLIB_COMPAT_VERSION_MICRO}")
endmacro()
function(read_absolute_symlink DEST PATH)
file(READ_SYMLINK "${PATH}" p)
if(NOT IS_ABSOLUTE "${p}")
get_filename_component(pdir "${PATH}" DIRECTORY)
set(p "${pdir}/${p}")
endif()
get_filename_component(p "${p}" ABSOLUTE)
set("${DEST}" "${p}" PARENT_SCOPE)
endfunction()
function(win32_implib_identify_dll DEST IMPLIB)
cmake_parse_arguments(ARGS "NOTFATAL" "" "" ${ARGN})
if(CMAKE_DLLTOOL)
execute_process(
COMMAND "${CMAKE_DLLTOOL}" --identify "${IMPLIB}"
RESULT_VARIABLE retcode
OUTPUT_VARIABLE stdout
ERROR_VARIABLE stderr)
if(NOT retcode EQUAL 0)
if(NOT ARGS_NOTFATAL)
message(FATAL_ERROR "${CMAKE_DLLTOOL} failed.")
else()
set("${DEST}" "${DEST}-NOTFOUND" PARENT_SCOPE)
return()
endif()
endif()
string(STRIP "${stdout}" result)
set(${DEST} "${result}" PARENT_SCOPE)
elseif(MSVC)
get_filename_component(CMAKE_C_COMPILER_DIRECTORY "${CMAKE_C_COMPILER}" DIRECTORY CACHE)
find_program(CMAKE_DUMPBIN NAMES dumpbin PATHS "${CMAKE_C_COMPILER_DIRECTORY}")
if(CMAKE_DUMPBIN)
execute_process(
COMMAND "${CMAKE_DUMPBIN}" "-headers" "${IMPLIB}"
RESULT_VARIABLE retcode
OUTPUT_VARIABLE stdout
ERROR_VARIABLE stderr)
if(NOT retcode EQUAL 0)
if(NOT ARGS_NOTFATAL)
message(FATAL_ERROR "dumpbin failed.")
else()
set(${DEST} "${DEST}-NOTFOUND" PARENT_SCOPE)
return()
endif()
endif()
string(REGEX MATCH "DLL name[ ]+:[ ]+([^\n]+)\n" match "${stdout}")
if(NOT match)
if(NOT ARGS_NOTFATAL)
message(FATAL_ERROR "dumpbin did not find any associated dll for ${IMPLIB}.")
else()
set(${DEST} "${DEST}-NOTFOUND" PARENT_SCOPE)
return()
endif()
endif()
set(result "${CMAKE_MATCH_1}")
set(${DEST} "${result}" PARENT_SCOPE)
else()
message(FATAL_ERROR "Cannot find dumpbin, please set CMAKE_DUMPBIN cmake variable")
endif()
else()
if(NOT ARGS_NOTFATAL)
message(FATAL_ERROR "Don't know how to identify dll from import library. Set CMAKE_DLLTOOL (for mingw) or CMAKE_DUMPBIN (for MSVC)")
else()
set(${DEST} "${DEST}-NOTFOUND")
endif()
endif()
endfunction()
function(get_actual_target)
set(dst "${ARGV0}")
set(target "${${dst}}")
set(input "${target}")
get_target_property(alias "${target}" ALIASED_TARGET)
while(alias)
set(target "${alias}")
get_target_property(alias "${target}" ALIASED_TARGET)
endwhile()
message(DEBUG "get_actual_target(\"${input}\") -> \"${target}\"")
set("${dst}" "${target}" PARENT_SCOPE)
endfunction()
function(target_get_dynamic_library DEST TARGET)
set(result)
get_actual_target(TARGET)
if(WIN32)
# Use the target dll of the import library
set(props_to_check IMPORTED_IMPLIB)
if(CMAKE_BUILD_TYPE)
list(APPEND props_to_check IMPORTED_IMPLIB_${CMAKE_BUILD_TYPE})
endif()
list(APPEND props_to_check IMPORTED_LOCATION)
if(CMAKE_BUILD_TYPE)
list(APPEND props_to_check IMPORTED_LOCATION_${CMAKE_BUILD_TYPE})
endif()
foreach (config_type ${CMAKE_CONFIGURATION_TYPES} RELEASE DEBUG RELWITHDEBINFO MINSIZEREL)
list(APPEND props_to_check IMPORTED_IMPLIB_${config_type})
list(APPEND props_to_check IMPORTED_LOCATION_${config_type})
endforeach()
foreach(prop_to_check ${props_to_check})
if(NOT result)
get_target_property(propvalue "${TARGET}" ${prop_to_check})
if(propvalue AND EXISTS "${propvalue}")
win32_implib_identify_dll(result "${propvalue}" NOTFATAL)
endif()
endif()
endforeach()
else()
# 1. find the target library a file might be symbolic linking to
# 2. find all other files in the same folder that symolic link to it
# 3. sort all these files, and select the 1st item on Linux, and last on Macos
set(location_properties IMPORTED_LOCATION)
if(CMAKE_BUILD_TYPE)
list(APPEND location_properties IMPORTED_LOCATION_${CMAKE_BUILD_TYPE})
endif()
foreach (config_type ${CMAKE_CONFIGURATION_TYPES} RELEASE DEBUG RELWITHDEBINFO MINSIZEREL)
list(APPEND location_properties IMPORTED_LOCATION_${config_type})
endforeach()
if(APPLE)
set(valid_shared_library_regex "\\.[0-9]+\\.dylib$")
else()
set(valid_shared_library_regex "\\.so\\.([0-9.]+)?[0-9]")
endif()
foreach(location_property ${location_properties})
if(NOT result)
get_target_property(library_path "${TARGET}" ${location_property})
message(DEBUG "get_target_property(${TARGET} ${location_propert}) -> ${library_path}")
if(EXISTS "${library_path}")
get_filename_component(library_path "${library_path}" ABSOLUTE)
while (IS_SYMLINK "${library_path}")
read_absolute_symlink(library_path "${library_path}")
endwhile()
message(DEBUG "${TARGET} -> ${library_path}")
get_filename_component(libdir "${library_path}" DIRECTORY)
file(GLOB subfiles "${libdir}/*")
set(similar_files "${library_path}")
foreach(subfile ${subfiles})
if(IS_SYMLINK "${subfile}")
read_absolute_symlink(subfile_target "${subfile}")
while(IS_SYMLINK "${subfile_target}")
read_absolute_symlink(subfile_target "${subfile_target}")
endwhile()
get_filename_component(subfile_target "${subfile_target}" ABSOLUTE)
if(subfile_target STREQUAL library_path AND subfile MATCHES "${valid_shared_library_regex}")
list(APPEND similar_files "${subfile}")
endif()
endif()
endforeach()
list(SORT similar_files)
message(DEBUG "files that are similar to \"${library_path}\"=${similar_files}")
if(APPLE)
list(REVERSE similar_files)
endif()
list(GET similar_files 0 item)
get_filename_component(result "${item}" NAME)
endif()
endif()
endforeach()
endif()
if(result)
string(TOLOWER "${result}" result_lower)
if(WIN32 OR OS2)
if(NOT result_lower MATCHES ".*dll")
message(FATAL_ERROR "\"${result}\" is not a .dll library")
endif()
elseif(APPLE)
if(NOT result_lower MATCHES ".*dylib.*")
message(FATAL_ERROR "\"${result}\" is not a .dylib shared library")
endif()
else()
if(NOT result_lower MATCHES ".*so.*")
message(FATAL_ERROR "\"${result}\" is not a .so shared library")
endif()
endif()
else()
get_target_property(target_type ${TARGET} TYPE)
if(target_type MATCHES "SHARED_LIBRARY|MODULE_LIBRARY")
# OK
elseif(target_type MATCHES "STATIC_LIBRARY|OBJECT_LIBRARY|INTERFACE_LIBRARY|EXECUTABLE")
message(SEND_ERROR "${TARGET} is not a shared library, but has type=${target_type}")
else()
message(WARNING "Unable to extract dynamic library from target=${TARGET}, type=${target_type}.")
endif()
# TARGET_SONAME_FILE is not allowed for DLL target platforms.
if(WIN32)
set(result "$<TARGET_FILE_NAME:${TARGET}>")
else()
set(result "$<TARGET_SONAME_FILE_NAME:${TARGET}>")
endif()
endif()
set(${DEST} ${result} PARENT_SCOPE)
endfunction()
function(sdl_check_project_in_subfolder relative_subfolder name vendored_option)
cmake_parse_arguments(ARG "" "FILE" "" ${ARGN})
if(NOT ARG_FILE)
set(ARG_FILE "CMakeLists.txt")
endif()
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/${relative_subfolder}/${ARG_FILE}")
message(FATAL_ERROR "Could not find ${ARG_FILE} for ${name} in ${relative_subfolder}.\n"
"Run the download script in the external folder, or re-configure with -D${vendored_option}=OFF to use system packages.")
endif()
endfunction()
macro(sdl_check_linker_flag flag var)
# FIXME: Use CheckLinkerFlag module once cmake minimum version >= 3.18
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_LINK_OPTIONS "${flag}")
check_c_source_compiles("int main() { return 0; }" ${var} FAIL_REGEX "(unsupported|syntax error|unrecognized option)")
cmake_pop_check_state()
endmacro()
function(SDL_detect_linker)
if(CMAKE_VERSION VERSION_LESS 3.29)
if(NOT DEFINED SDL_CMAKE_C_COMPILER_LINKER_ID)
execute_process(COMMAND ${CMAKE_LINKER} -v OUTPUT_VARIABLE LINKER_OUTPUT ERROR_VARIABLE LINKER_OUTPUT)
string(REGEX REPLACE "[\r\n]" " " LINKER_OUTPUT "${LINKER_OUTPUT}")
if(LINKER_OUTPUT MATCHES ".*Microsoft.*")
set(linker MSVC)
else()
set(linker GNUlike)
endif()
message(STATUS "Linker identification: ${linker}")
set(SDL_CMAKE_C_COMPILER_LINKER_ID "${linker}" CACHE STRING "Linker identification")
mark_as_advanced(SDL_CMAKE_C_COMPILER_LINKER_ID)
endif()
set(CMAKE_C_COMPILER_LINKER_ID "${SDL_CMAKE_C_COMPILER_LINKER_ID}" PARENT_SCOPE)
endif()
endfunction()
function(check_linker_support_version_script VAR)
SDL_detect_linker()
if(CMAKE_C_COMPILER_LINKER_ID MATCHES "^(MSVC)$")
set(LINKER_SUPPORTS_VERSION_SCRIPT FALSE)
else()
cmake_push_check_state(RESET)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.sym" "n_0 {\n global:\n func;\n local: *;\n};\n")
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/dummy.sym")
check_c_source_compiles("int func(void) {return 0;} int main(int argc,char*argv[]){(void)argc;(void)argv;return func();}" LINKER_SUPPORTS_VERSION_SCRIPT FAIL_REGEX "(unsupported|syntax error|unrecognized option)")
cmake_pop_check_state()
endif()
set(${VAR} "${LINKER_SUPPORTS_VERSION_SCRIPT}" PARENT_SCOPE)
endfunction()
function(sdl_target_link_options_no_undefined TARGET)
if(NOT MSVC AND NOT CMAKE_SYSTEM_NAME MATCHES ".*OpenBSD.*")
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang")
target_link_options(${TARGET} PRIVATE "-Wl,-undefined,error")
else()
sdl_check_linker_flag("-Wl,--no-undefined" HAVE_WL_NO_UNDEFINED)
if(HAVE_WL_NO_UNDEFINED AND NOT ((CMAKE_C_COMPILER_ID MATCHES "Clang") AND WIN32))
target_link_options(${TARGET} PRIVATE "-Wl,--no-undefined")
endif()
endif()
endif()
endfunction()
function(sdl_target_link_option_version_file TARGET VERSION_SCRIPT)
check_linker_support_version_script(HAVE_WL_VERSION_SCRIPT)
if(HAVE_WL_VERSION_SCRIPT)
target_link_options(${TARGET} PRIVATE "-Wl,--version-script=${VERSION_SCRIPT}")
set_property(TARGET ${TARGET} APPEND PROPERTY LINK_DEPENDS "${VERSION_SCRIPT}")
else()
if(LINUX OR ANDROID)
message(FATAL_ERROR "Linker does not support '-Wl,--version-script=xxx.sym'. This is required on the current host platform.")
endif()
endif()
endfunction()
function(sdl_add_warning_options TARGET)
cmake_parse_arguments(ARGS "" "WARNING_AS_ERROR" "" ${ARGN})
if(MSVC)
target_compile_options(${TARGET} PRIVATE /W2)
else()
target_compile_options(${TARGET} PRIVATE -Wall -Wextra)
endif()
if(ARGS_WARNING_AS_ERROR)
if(MSVC)
target_compile_options(${TARGET} PRIVATE /WX)
else()
target_compile_options(${TARGET} PRIVATE -Werror)
endif()
endif()
endfunction()
function(sdl_no_deprecated_errors TARGET)
check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
if(HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
target_compile_options(${TARGET} PRIVATE "-Wno-error=deprecated-declarations")
endif()
endfunction()
function(sdl_get_git_revision_hash VARNAME)
set("${VARNAME}" "" CACHE STRING "${PROJECT_NAME} revision")
set(revision "${${VARNAME}}")
if(NOT revision)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION.txt")
# If VERSION.txt exists, it contains the SDL version
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION.txt" revision_version)
string(STRIP "${revision_version}" revision_version)
else()
# If VERSION.txt does not exist, use git to calculate a version
git_describe(revision_version)
if(NOT revision_version)
set(revision_version "${PROJECT_VERSION}-no-vcs")
endif()
endif()
set(revision "${revision_version}")
endif()
set("${VARNAME}" "${revision}" PARENT_SCOPE)
endfunction()
function(SDL_install_pdb TARGET DIRECTORY)
get_property(type TARGET ${TARGET} PROPERTY TYPE)
if(type MATCHES "^(SHARED_LIBRARY|EXECUTABLE)$")
install(FILES $<TARGET_PDB_FILE:${TARGET}> DESTINATION "${DIRECTORY}" OPTIONAL)
elseif(type STREQUAL "STATIC_LIBRARY")
# FIXME: Use $<TARGET_COMPILE_PDB_FILE:${TARGET} once it becomes available (https://gitlab.kitware.com/cmake/cmake/-/issues/25244)
if(CMAKE_GENERATOR MATCHES "^Visual Studio.*")
install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/${TARGET}.pdb\")")
else()
install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET}.dir/${TARGET}.pdb\")")
endif()
endif()
endfunction()

View File

@ -0,0 +1,156 @@
# sdl3_mixer cmake project-config input for CMakeLists.txt script
@PACKAGE_INIT@
include(FeatureSummary)
set_package_properties(SDL3_mixer PROPERTIES
URL "https://www.libsdl.org/projects/SDL_mixer/"
DESCRIPTION "SDL_mixer is a sample multi-channel audio mixer library"
)
set(SDL3_mixer_FOUND ON)
set(SDLMIXER_VENDORED @SDLMIXER_VENDORED@)
set(SDLMIXER_SNDFILE @SDLMIXER_SNDFILE_ENABLED@)
set(SDLMIXER_FLAC @SDLMIXER_FLAC_ENABLED@)
set(SDLMIXER_FLAC_LIBFLAC @SDLMIXER_FLAC_LIBFLAC_ENABLED@)
set(SDLMIXER_FLAC_DRFLAC @SDLMIXER_FLAC_DRFLAC_ENABLED@)
set(SDLMIXER_GME @SDLMIXER_GME_ENABLED@)
set(SDLMIXER_MOD @SDLMIXER_MOD_ENABLED@)
set(SDLMIXER_MOD_XMP @SDLMIXER_MOD_XMP_ENABLED@)
set(SDLMIXER_MOD_XMP_LITE @SDLMIXER_MOD_XMP_ENABLED@)
set(SDLMIXER_MP3 @SDLMIXER_MP3_ENABLED@)
set(SDLMIXER_MP3_DRMP3 @SDLMIXER_MP3_DRMP3_ENABLED@)
set(SDLMIXER_MP3_MPG123 @SDLMIXER_MP3_MPG123_ENABLED@)
set(SDLMIXER_MIDI @SDLMIXER_MIDI_ENABLED@)
set(SDLMIXER_MIDI_FLUIDSYNTH @SDLMIXER_MIDI_FLUIDSYNTH_ENABLED@)
set(SDLMIXER_MIDI_NATIVE @SDLMIXER_MIDI_NATIVE_ENABLED@)
set(SDLMIXER_MIDI_TIMIDITY @SDLMIXER_MIDI_TIMIDITY_ENABLED@)
set(SDLMIXER_OPUS @SDLMIXER_OPUS_ENABLED@)
set(SDLMIXER_VORBIS @SDLMIXER_VORBIS_ENABLED@)
set(SDLMIXER_VORBIS_STB @SDLMIXER_VORBIS_STB_ENABLED@)
set(SDLMIXER_VORBIS_TREMOR @SDLMIXER_VORBIS_TREMOR_ENABLED@)
set(SDLMIXER_VORBIS_VORBISFILE @SDLMIXER_VORBIS_VORBISFILE_ENABLED@)
set(SDLMIXER_WAVE @SDLMIXER_WAVE_ENABLED@)
set(SDLMIXER_WAVPACK @SDLMIXER_WAVPACK_ENABLED@)
set(SDLMIXER_SDL3_REQUIRED_VERSION @SDL_REQUIRED_VERSION@)
set(SDL3_mixer_SDL3_mixer-shared_FOUND FALSE)
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3_mixer-shared-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/SDL3_mixer-shared-targets.cmake")
set(SDL3_mixer_SDL3_mixer-shared_FOUND TRUE)
endif()
set(SDL3_mixer_SDL3_mixer-static FALSE)
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3_mixer-static-targets.cmake")
if(SDLMIXER_VENDORED)
if(SDLMIXER_GME)
include(CheckLanguage)
check_language(CXX)
if(NOT CMAKE_CXX_COMPILER)
message(WARNING "CXX language not enabled. Linking to SDL3_mixer::SDL3_mixer-static might fail.")
endif()
endif()
else()
set(_sdl_cmake_module_path "${CMAKE_MODULE_PATH}")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
include(CMakeFindDependencyMacro)
include(PkgConfigHelper)
if(NOT DEFINED CMAKE_FIND_PACKAGE_PREFER_CONFIG)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
endif()
if(SDLMIXER_SNDFILE AND NOT TARGET SndFile::sndfile)
find_dependency(SndFile)
endif()
if(SDLMIXER_FLAC_LIBFLAC AND NOT TARGET FLAC::FLAC)
find_dependency(FLAC)
endif()
if(SDLMIXER_MOD_XMP AND NOT TARGET libxmp::libxmp)
find_dependency(libxmp)
endif()
if(SDLMIXER_MOD_XMP_LITE AND NOT TARGET libxmp-lite::libxmp-lite)
find_dependency(libxmp-lite)
endif()
if(SDLMIXER_MP3_MPG123 AND NOT TARGET MPG123::mpg123)
find_dependency(mpg123)
endif()
if(SDLMIXER_MIDI_FLUIDSYNTH AND NOT TARGET FluidSynth::libfluidsynth)
find_dependency(FluidSynth)
endif()
if(SDLMIXER_VORBIS_TREMOR AND NOT TARGET tremor::tremor)
find_dependency(tremor)
endif()
if(SDLMIXER_VORBIS_VORBISFILE AND NOT TARGET Vorbis::vorbisfile)
find_dependency(Vorbis)
endif()
if(SDLMIXER_OPUS AND NOT TARGET OpusFile::opusfile)
find_dependency(OpusFile)
endif()
if(SDLMIXER_WAVPACK AND NOT TARGET WavPack::WavPack)
find_dependency(wavpack)
endif()
set(CMAKE_MODULE_PATH "${_sdl_cmake_module_path}")
unset(_sdl_cmake_module_path)
if(HAIKU AND SDLMIXER_MIDI_NATIVE)
include(CheckLanguage)
check_language(CXX)
if(NOT CMAKE_CXX_COMPILER)
message(WARNING "CXX language not enabled. Linking to SDL3_mixer::SDL3_mixer-static might fail.")
endif()
endif()
endif()
include("${CMAKE_CURRENT_LIST_DIR}/SDL3_mixer-static-targets.cmake")
set(SDL3_mixer_SDL3_mixer-static TRUE)
endif()
function(_sdl_create_target_alias_compat NEW_TARGET TARGET)
if(CMAKE_VERSION VERSION_LESS "3.18")
# Aliasing local targets is not supported on CMake < 3.18, so make it global.
add_library(${NEW_TARGET} INTERFACE IMPORTED)
set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}")
else()
add_library(${NEW_TARGET} ALIAS ${TARGET})
endif()
endfunction()
# Make sure SDL3_mixer::SDL3_mixer always exists
if(NOT TARGET SDL3_mixer::SDL3_mixer)
if(TARGET SDL3_mixer::SDL3_mixer-shared)
_sdl_create_target_alias_compat(SDL3_mixer::SDL3_mixer SDL3_mixer::SDL3_mixer-shared)
elseif(TARGET SDL3_mixer::SDL3_mixer-static)
_sdl_create_target_alias_compat(SDL3_mixer::SDL3_mixer SDL3_mixer::SDL3_mixer-static)
endif()
endif()
if(NOT SDL3_mixer_COMPONENTS AND NOT TARGET SDL3_mixer::SDL3_mixer-shared AND NOT TARGET SDL3_mixer::SDL3_mixer-static)
set(SDL3_image_FOUND FALSE)
endif()
@PACKAGE_INIT@
check_required_components(SDL3_mixer)

View File

@ -0,0 +1,13 @@
prefix=@SDL_PKGCONFIG_PREFIX@
exec_prefix=${prefix}
libdir=@LIBDIR_FOR_PKG_CONFIG@
includedir=@INCLUDEDIR_FOR_PKG_CONFIG@
Name: @PROJECT_NAME@
Description: mixer library for Simple DirectMedia Layer
Version: @PROJECT_VERSION@
Requires: sdl3 >= @SDL_REQUIRED_VERSION@
Libs: -L${libdir} -lSDL3_mixer
Requires.private: @PC_REQUIRES@
Libs.private: @PC_LIBS@
Cflags: -I${includedir}

View File

@ -0,0 +1,156 @@
function(SDL_DetectTargetCPUArchitectures DETECTED_ARCHS)
set(known_archs EMSCRIPTEN ARM32 ARM64 ARM64EC LOONGARCH64 POWERPC32 POWERPC64 X86 X64)
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
foreach(known_arch IN LISTS known_archs)
set(SDL_CPU_${known_arch} "0")
endforeach()
set(detected_archs)
foreach(osx_arch IN LISTS CMAKE_OSX_ARCHITECTURES)
if(osx_arch STREQUAL "x86_64")
set(SDL_CPU_X64 "1")
list(APPEND detected_archs "X64")
elseif(osx_arch STREQUAL "arm64")
set(SDL_CPU_ARM64 "1")
list(APPEND detected_archs "ARM64")
endif()
endforeach()
set("${DETECTED_ARCHS}" "${detected_archs}" PARENT_SCOPE)
return()
endif()
set(detected_archs)
foreach(known_arch IN LISTS known_archs)
if(SDL_CPU_${known_arch})
list(APPEND detected_archs "${known_arch}")
endif()
endforeach()
if(detected_archs)
set("${DETECTED_ARCHS}" "${detected_archs}" PARENT_SCOPE)
return()
endif()
set(arch_check_ARM32 "defined(__arm__) || defined(_M_ARM)")
set(arch_check_ARM64 "defined(__aarch64__) || defined(_M_ARM64)")
set(arch_check_ARM64EC "defined(_M_ARM64EC)")
set(arch_check_EMSCRIPTEN "defined(__EMSCRIPTEN__)")
set(arch_check_LOONGARCH64 "defined(__loongarch64)")
set(arch_check_POWERPC32 "(defined(__PPC__) || defined(__powerpc__)) && !defined(__powerpc64__)")
set(arch_check_POWERPC64 "defined(__PPC64__) || defined(__powerpc64__)")
set(arch_check_X86 "defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)")
set(arch_check_X64 "(defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)) && !defined(_M_ARM64EC)")
set(src_vars "")
set(src_main "")
foreach(known_arch IN LISTS known_archs)
set(detected_${known_arch} "0")
string(APPEND src_vars "
#if ${arch_check_${known_arch}}
#define ARCH_${known_arch} \"1\"
#else
#define ARCH_${known_arch} \"0\"
#endif
const char *arch_${known_arch} = \"INFO<${known_arch}=\" ARCH_${known_arch} \">\";
")
string(APPEND src_main "
result += arch_${known_arch}[argc];")
endforeach()
set(src_arch_detect "${src_vars}
int main(int argc, char *argv[]) {
int result = 0;
(void)argv;
${src_main}
return result;
}")
if(CMAKE_C_COMPILER)
set(ext ".c")
elseif(CMAKE_CXX_COMPILER)
set(ext ".cpp")
else()
enable_language(C)
set(ext ".c")
endif()
set(path_src_arch_detect "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/SDL_detect_arch${ext}")
file(WRITE "${path_src_arch_detect}" "${src_arch_detect}")
set(path_dir_arch_detect "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/SDL_detect_arch")
set(path_bin_arch_detect "${path_dir_arch_detect}/bin")
set(detected_archs)
set(msg "Detecting Target CPU Architecture")
message(STATUS "${msg}")
include(CMakePushCheckState)
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
cmake_push_check_state(RESET)
try_compile(SDL_CPU_CHECK_ALL
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/SDL_detect_arch"
SOURCES "${path_src_arch_detect}"
COPY_FILE "${path_bin_arch_detect}"
)
cmake_pop_check_state()
if(NOT SDL_CPU_CHECK_ALL)
message(STATUS "${msg} - <ERROR>")
message(WARNING "Failed to compile source detecting the target CPU architecture")
else()
set(re "INFO<([A-Z0-9]+)=([01])>")
file(STRINGS "${path_bin_arch_detect}" infos REGEX "${re}")
foreach(info_arch_01 IN LISTS infos)
string(REGEX MATCH "${re}" A "${info_arch_01}")
if(NOT "${CMAKE_MATCH_1}" IN_LIST known_archs)
message(WARNING "Unknown architecture: \"${CMAKE_MATCH_1}\"")
continue()
endif()
set(arch "${CMAKE_MATCH_1}")
set(arch_01 "${CMAKE_MATCH_2}")
set(detected_${arch} "${arch_01}")
endforeach()
foreach(known_arch IN LISTS known_archs)
if(detected_${known_arch})
list(APPEND detected_archs ${known_arch})
endif()
endforeach()
endif()
if(detected_archs)
foreach(known_arch IN LISTS known_archs)
set("SDL_CPU_${known_arch}" "${detected_${known_arch}}" CACHE BOOL "Detected architecture ${known_arch}")
endforeach()
message(STATUS "${msg} - ${detected_archs}")
else()
include(CheckCSourceCompiles)
cmake_push_check_state(RESET)
foreach(known_arch IN LISTS known_archs)
if(NOT detected_archs)
set(cache_variable "SDL_CPU_${known_arch}")
set(test_src "
int main(int argc, char *argv[]) {
#if ${arch_check_${known_arch}}
return 0;
#else
choke
#endif
}
")
check_c_source_compiles("${test_src}" "${cache_variable}")
if(${cache_variable})
set(SDL_CPU_${known_arch} "1" CACHE BOOL "Detected architecture ${known_arch}")
set(detected_archs ${known_arch})
else()
set(SDL_CPU_${known_arch} "0" CACHE BOOL "Detected architecture ${known_arch}")
endif()
endif()
endforeach()
cmake_pop_check_state()
endif()
set("${DETECTED_ARCHS}" "${detected_archs}" PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,68 @@
include(CMakeParseArguments)
include(GNUInstallDirs)
function(SDL_generate_manpages)
cmake_parse_arguments(ARG "" "RESULT_VARIABLE;NAME;BUILD_DOCDIR;HEADERS_DIR;SOURCE_DIR;SYMBOL;OPTION_FILE;WIKIHEADERS_PL_PATH;REVISION" "" ${ARGN})
set(wikiheaders_extra_args)
if(NOT ARG_NAME)
set(ARG_NAME "${PROJECT_NAME}")
endif()
if(NOT ARG_SOURCE_DIR)
set(ARG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
if(NOT ARG_OPTION_FILE)
set(ARG_OPTION_FILE "${PROJECT_SOURCE_DIR}/.wikiheaders-options")
endif()
if(NOT ARG_HEADERS_DIR)
message(FATAL_ERROR "Missing required HEADERS_DIR argument")
endif()
# FIXME: get rid of SYMBOL and let the perl script figure out the dependencies
if(NOT ARG_SYMBOL)
message(FATAL_ERROR "Missing required SYMBOL argument")
endif()
if(ARG_REVISION)
list(APPEND wikiheaders_extra_args "--rev=${ARG_REVISION}")
endif()
if(NOT ARG_BUILD_DOCDIR)
set(ARG_BUILD_DOCDIR "${CMAKE_CURRENT_BINARY_DIR}/docs")
endif()
set(BUILD_WIKIDIR "${ARG_BUILD_DOCDIR}/wiki")
set(BUILD_MANDIR "${ARG_BUILD_DOCDIR}/man")
find_package(Perl)
file(GLOB HEADER_FILES "${ARG_HEADERS_DIR}/*.h")
set(result FALSE)
if(PERL_FOUND AND EXISTS "${ARG_WIKIHEADERS_PL_PATH}")
add_custom_command(
OUTPUT "${BUILD_WIKIDIR}/${ARG_SYMBOL}.md"
COMMAND "${CMAKE_COMMAND}" -E make_directory "${BUILD_WIKIDIR}"
COMMAND "${PERL_EXECUTABLE}" "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_SOURCE_DIR}" "${BUILD_WIKIDIR}" "--options=${ARG_OPTION_FILE}" --copy-to-wiki ${wikiheaders_extra_args}
DEPENDS ${HEADER_FILES} "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_OPTION_FILE}"
COMMENT "Generating ${ARG_NAME} wiki markdown files"
)
add_custom_command(
OUTPUT "${BUILD_MANDIR}/man3/${ARG_SYMBOL}.3"
COMMAND "${PERL_EXECUTABLE}" "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_SOURCE_DIR}" "${BUILD_WIKIDIR}" "--options=${ARG_OPTION_FILE}" "--manpath=${BUILD_MANDIR}" --copy-to-manpages ${wikiheaders_extra_args}
DEPENDS "${BUILD_WIKIDIR}/${ARG_SYMBOL}.md" "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_OPTION_FILE}"
COMMENT "Generating ${ARG_NAME} man pages"
)
add_custom_target(${ARG_NAME}-docs ALL DEPENDS "${BUILD_MANDIR}/man3/${ARG_SYMBOL}.3")
install(DIRECTORY "${BUILD_MANDIR}/" DESTINATION "${CMAKE_INSTALL_MANDIR}")
set(result TRUE)
endif()
if(ARG_RESULT_VARIABLE)
set(${ARG_RESULT_VARIABLE} ${result} PARENT_SCOPE)
endif()
endfunction()

View File

@ -0,0 +1,106 @@
macro(SDL_DetectCMakePlatform)
set(SDL_CMAKE_PLATFORM )
# Get the platform
if(WIN32)
set(SDL_CMAKE_PLATFORM Windows)
elseif(PSP)
set(SDL_CMAKE_PLATFORM psp)
elseif(APPLE)
if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*")
set(SDL_CMAKE_PLATFORM Darwin)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
set(SDL_CMAKE_PLATFORM MacosX)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*")
set(SDL_CMAKE_PLATFORM tvOS)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*iOS.*")
set(SDL_CMAKE_PLATFORM iOS)
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*")
set(SDL_CMAKE_PLATFORM Haiku)
elseif(NINTENDO_3DS)
set(SDL_CMAKE_PLATFORM n3ds)
elseif(PS2)
set(SDL_CMAKE_PLATFORM ps2)
elseif(VITA)
set(SDL_CMAKE_PLATFORM Vita)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
set(SDL_CMAKE_PLATFORM Linux)
elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*")
set(SDL_CMAKE_PLATFORM FreeBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
set(SDL_CMAKE_PLATFORM NetBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
set(SDL_CMAKE_PLATFORM OpenBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*GNU.*")
set(SDL_CMAKE_PLATFORM GNU)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
set(SDL_CMAKE_PLATFORM BSDi)
elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD")
set(SDL_CMAKE_PLATFORM FreeBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "SYSV5.*")
set(SDL_CMAKE_PLATFORM SYSV5)
elseif(CMAKE_SYSTEM_NAME MATCHES "Solaris.*|SunOS.*")
set(SDL_CMAKE_PLATFORM Solaris)
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX.*")
set(SDL_CMAKE_PLATFORM HPUX)
elseif(CMAKE_SYSTEM_NAME MATCHES "AIX.*")
set(SDL_CMAKE_PLATFORM AIX)
elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*")
set(SDL_CMAKE_PLATFORM Minix)
elseif(CMAKE_SYSTEM_NAME MATCHES "Android.*")
set(SDL_CMAKE_PLATFORM Android)
elseif(CMAKE_SYSTEM_NAME MATCHES "Emscripten.*")
set(SDL_CMAKE_PLATFORM Emscripten)
elseif(CMAKE_SYSTEM_NAME MATCHES "QNX.*")
set(SDL_CMAKE_PLATFORM QNX)
elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*")
message(FATAL_ERROR "BeOS support has been removed as of SDL 2.0.2.")
endif()
if(SDL_CMAKE_PLATFORM)
string(TOUPPER "${SDL_CMAKE_PLATFORM}" _upper_platform)
set(${_upper_platform} TRUE)
else()
set(SDL_CMAKE_PLATFORM} "unknown")
endif()
endmacro()
function(SDL_DetectCPUArchitecture)
set(sdl_cpu_names)
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
if(osx_arch STREQUAL "x86_64")
list(APPEND sdl_cpu_names "x64")
elseif(osx_arch STREQUAL "arm64")
list(APPEND sdl_cpu_names "arm64")
endif()
endforeach()
endif()
set(sdl_known_archs x64 x86 arm64 arm32 emscripten powerpc64 powerpc32 loongarch64)
if(NOT sdl_cpu_names)
set(found FALSE)
foreach(sdl_known_arch ${sdl_known_archs})
if(NOT found)
string(TOUPPER "${sdl_known_arch}" sdl_known_arch_upper)
set(var_name "SDL_CPU_${sdl_known_arch_upper}")
check_cpu_architecture(${sdl_known_arch} ${var_name})
if(${var_name})
list(APPEND sdl_cpu_names ${sdl_known_arch})
set(found TRUE)
endif()
endif()
endforeach()
endif()
foreach(sdl_known_arch ${sdl_known_archs})
string(TOUPPER "${sdl_known_arch}" sdl_known_arch_upper)
set(var_name "SDL_CPU_${sdl_known_arch_upper}")
if(sdl_cpu_names MATCHES "(^|;)${sdl_known_arch}($|;)") # FIXME: use if(IN_LIST)
set(${var_name} 1 PARENT_SCOPE)
else()
set(${var_name} 0 PARENT_SCOPE)
endif()
endforeach()
set(SDL_CPU_NAMES ${sdl_cpu_names} PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,44 @@
# This cmake build script is meant for verifying the various CMake configuration script.
cmake_minimum_required(VERSION 3.12...3.28)
project(sdl_test LANGUAGES C)
cmake_policy(SET CMP0074 NEW)
# Override CMAKE_FIND_ROOT_PATH_MODE to allow search for SDL3_mixer outside of sysroot
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER)
include(FeatureSummary)
option(TEST_SHARED "Test linking to shared SDL3_mixer library" ON)
add_feature_info("TEST_SHARED" TEST_SHARED "Test linking with shared library")
option(TEST_STATIC "Test linking to static SDL3_mixer libary" ON)
add_feature_info("TEST_STATIC" TEST_STATIC "Test linking with static library")
if(ANDROID)
macro(add_executable NAME)
set(args ${ARGN})
list(REMOVE_ITEM args WIN32)
add_library(${NAME} SHARED ${args})
unset(args)
endmacro()
endif()
if(TEST_SHARED)
find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3)
find_package(SDL3_mixer REQUIRED CONFIG)
add_executable(main_shared main.c)
target_link_libraries(main_shared PRIVATE SDL3_mixer::SDL3_mixer-shared SDL3::SDL3)
endif()
if(TEST_STATIC)
find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3)
# some static vendored libraries use c++ (enable CXX after `find_package` might show a warning)
enable_language(CXX)
find_package(SDL3_mixer REQUIRED CONFIG)
add_executable(main_static main.c)
target_link_libraries(main_static PRIVATE SDL3_mixer::SDL3_mixer-static SDL3::SDL3)
endif()
feature_summary(WHAT ALL)

View File

@ -0,0 +1,17 @@
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <SDL3_mixer/SDL_mixer.h>
int main(int argc, char *argv[])
{
if (!SDL_Init(0)) {
SDL_Log("SDL_Init: could not initialize SDL: %s\n", SDL_GetError());
return 1;
}
if (Mix_Init(0) == 0) {
SDL_Log("Mix_Init: no sound/music loaders supported (%s)\n", SDL_GetError());
}
Mix_Quit();
SDL_Quit();
return 0;
}

View File

@ -0,0 +1,312 @@
/*
PLAYMUS: A test application for the SDL mixer library.
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/* Quiet windows compiler warnings */
#define _CRT_SECURE_NO_WARNINGS
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef unix
#include <unistd.h>
#endif
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <SDL3_mixer/SDL_mixer.h>
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
static int audio_open = 0;
static Mix_Music *music = NULL;
static int next_track = 0;
static void CleanUp(int exitcode)
{
if(Mix_PlayingMusic()) {
Mix_FadeOutMusic(1500);
SDL_Delay(1500);
}
if (music) {
Mix_FreeMusic(music);
music = NULL;
}
if (audio_open) {
Mix_CloseAudio();
audio_open = 0;
}
SDL_Quit();
exit(exitcode);
}
static void Usage(char *argv0)
{
SDL_Log("Usage: %s [-i] [-l] [-8] [-f32] [-r rate] [-c channels] [-b buffers] [-v N] [-io] <musicfile>\n", argv0);
}
/*#define SEEK_TEST */
static void Menu(void)
{
char buf[10];
printf("Available commands: (p)ause (r)esume (h)alt volume(v#) > ");
if (fgets(buf, sizeof(buf), stdin)) {
switch(buf[0]) {
#if defined(SEEK_TEST)
case '0': Mix_SetMusicPosition(0); break;
case '1': Mix_SetMusicPosition(10);break;
case '2': Mix_SetMusicPosition(20);break;
case '3': Mix_SetMusicPosition(30);break;
case '4': Mix_SetMusicPosition(40);break;
#endif /* SEEK_TEST */
case 'p': case 'P':
Mix_PauseMusic();
break;
case 'r': case 'R':
Mix_ResumeMusic();
break;
case 'h': case 'H':
Mix_HaltMusic();
break;
case 'v': case 'V':
Mix_VolumeMusic(SDL_atoi(buf+1));
break;
}
}
printf("Music playing: %s Paused: %s\n", Mix_PlayingMusic() ? "yes" : "no",
Mix_PausedMusic() ? "yes" : "no");
}
#ifdef HAVE_SIGNAL_H
static void IntHandler(int sig)
{
switch (sig) {
case SIGINT:
next_track++;
break;
}
}
#endif
int main(int argc, char *argv[])
{
int audio_volume = MIX_MAX_VOLUME;
int looping = 0;
bool interactive = false;
bool use_io = false;
int i;
const char *typ;
const char *tag_title = NULL;
const char *tag_artist = NULL;
const char *tag_album = NULL;
const char *tag_copyright = NULL;
double loop_start, loop_end, loop_length, current_position;
SDL_AudioSpec spec;
(void) argc;
/* Initialize variables */
spec.freq = MIX_DEFAULT_FREQUENCY;
spec.format = MIX_DEFAULT_FORMAT;
spec.channels = MIX_DEFAULT_CHANNELS;
/* Check command line usage */
for (i = 1; argv[i] && (*argv[i] == '-'); ++i) {
if ((SDL_strcmp(argv[i], "-r") == 0) && argv[i+1]) {
++i;
spec.freq = SDL_atoi(argv[i]);
} else
if (SDL_strcmp(argv[i], "-m") == 0) {
spec.channels = 1;
} else
if ((SDL_strcmp(argv[i], "-c") == 0) && argv[i+1]) {
++i;
spec.channels = SDL_atoi(argv[i]);
} else
if ((SDL_strcmp(argv[i], "-b") == 0) && argv[i+1]) {
++i;
/*ignored now. audio_buffers = SDL_atoi(argv[i]); */
} else
if ((SDL_strcmp(argv[i], "-v") == 0) && argv[i+1]) {
++i;
audio_volume = SDL_atoi(argv[i]);
} else
if (SDL_strcmp(argv[i], "-l") == 0) {
looping = -1;
} else
if (SDL_strcmp(argv[i], "-i") == 0) {
interactive = true;
} else
if (SDL_strcmp(argv[i], "-8") == 0) {
spec.format = SDL_AUDIO_U8;
} else
if (SDL_strcmp(argv[i], "-f32") == 0) {
spec.format = SDL_AUDIO_F32;
} else
if (SDL_strcmp(argv[i], "-io") == 0) {
use_io = 1;
} else {
Usage(argv[0]);
return 1;
}
}
if (!argv[i]) {
Usage(argv[0]);
return 1;
}
/* Initialize the SDL library */
if (!SDL_Init(SDL_INIT_AUDIO)) {
SDL_Log("Couldn't initialize SDL: %s\n",SDL_GetError());
return 255;
}
#ifdef HAVE_SIGNAL_H
signal(SIGINT, IntHandler);
signal(SIGTERM, CleanUp);
#endif
/* Open the audio device */
if (!Mix_OpenAudio(0, &spec)) {
SDL_Log("Couldn't open audio: %s\n", SDL_GetError());
return 2;
} else {
Mix_QuerySpec(&spec.freq, &spec.format, &spec.channels);
SDL_Log("Opened audio at %d Hz %d bit%s %s audio buffer\n", spec.freq,
(spec.format&0xFF),
(SDL_AUDIO_ISFLOAT(spec.format) ? " (float)" : ""),
(spec.channels > 2) ? "surround" : (spec.channels > 1) ? "stereo" : "mono");
}
audio_open = 1;
/* Set the music volume */
Mix_VolumeMusic(audio_volume);
while (argv[i]) {
next_track = 0;
/* Load the requested music file */
if (use_io) {
music = Mix_LoadMUS_IO(SDL_IOFromFile(argv[i], "rb"), true);
} else {
music = Mix_LoadMUS(argv[i]);
}
if (music == NULL) {
SDL_Log("Couldn't load %s: %s\n", argv[i], SDL_GetError());
CleanUp(2);
}
switch (Mix_GetMusicType(music)) {
case MUS_WAV:
typ = "WAV";
break;
case MUS_MOD:
typ = "MOD";
break;
case MUS_FLAC:
typ = "FLAC";
break;
case MUS_MID:
typ = "MIDI";
break;
case MUS_OGG:
typ = "OGG Vorbis";
break;
case MUS_MP3:
typ = "MP3";
break;
case MUS_OPUS:
typ = "OPUS";
break;
case MUS_WAVPACK:
typ = "WavPack";
break;
case MUS_NONE:
default:
typ = "NONE";
break;
}
SDL_Log("Detected music type: %s", typ);
tag_title = Mix_GetMusicTitleTag(music);
if (tag_title && SDL_strlen(tag_title) > 0) {
SDL_Log("Title: %s", tag_title);
}
tag_artist = Mix_GetMusicArtistTag(music);
if (tag_artist && SDL_strlen(tag_artist) > 0) {
SDL_Log("Artist: %s", tag_artist);
}
tag_album = Mix_GetMusicAlbumTag(music);
if (tag_album && SDL_strlen(tag_album) > 0) {
SDL_Log("Album: %s", tag_album);
}
tag_copyright = Mix_GetMusicCopyrightTag(music);
if (tag_copyright && SDL_strlen(tag_copyright) > 0) {
SDL_Log("Copyright: %s", tag_copyright);
}
loop_start = Mix_GetMusicLoopStartTime(music);
loop_end = Mix_GetMusicLoopEndTime(music);
loop_length = Mix_GetMusicLoopLengthTime(music);
/* Play and then exit */
SDL_Log("Playing %s, duration %f\n", argv[i], Mix_MusicDuration(music));
if (loop_start > 0.0 && loop_end > 0.0 && loop_length > 0.0) {
SDL_Log("Loop points: start %g s, end %g s, length %g s\n", loop_start, loop_end, loop_length);
}
Mix_FadeInMusic(music,looping,2000);
while (!next_track && (Mix_PlayingMusic() || Mix_PausedMusic())) {
if (interactive) {
Menu();
} else {
current_position = Mix_GetMusicPosition(music);
if (current_position >= 0.0) {
printf("Position: %g seconds \r", current_position);
fflush(stdout);
}
SDL_Delay(100);
}
}
Mix_FreeMusic(music);
music = NULL;
/* If the user presses Ctrl-C more than once, exit. */
SDL_Delay(500);
if (next_track > 1) {
break;
}
i++;
}
CleanUp(0);
/* Not reached, but fixes compiler warnings */
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -0,0 +1,454 @@
/*
PLAYWAVE: A test application for the SDL mixer library.
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <SDL3_mixer/SDL_mixer.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef unix
#include <unistd.h>
#endif
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
static int audio_open = 0;
static Mix_Chunk *g_wave = NULL;
static bool verbose = false;
static bool test_position = false;
static bool test_distance = false;
static bool test_panning = false;
static void report_decoders(void)
{
int i, total;
SDL_Log("Supported decoders...\n");
total = Mix_GetNumChunkDecoders();
for (i = 0; i < total; i++) {
SDL_Log(" - chunk decoder: %s\n", Mix_GetChunkDecoder(i));
}
total = Mix_GetNumMusicDecoders();
for (i = 0; i < total; i++) {
SDL_Log(" - music decoder: %s\n", Mix_GetMusicDecoder(i));
}
}
static void output_versions(const char *libname, int compiled, int linked)
{
SDL_Log("This program was compiled against %s %d.%d.%d,\n"
" and is dynamically linked to %d.%d.%d.\n", libname,
SDL_VERSIONNUM_MAJOR(compiled),
SDL_VERSIONNUM_MINOR(compiled),
SDL_VERSIONNUM_MICRO(compiled),
SDL_VERSIONNUM_MAJOR(linked),
SDL_VERSIONNUM_MINOR(linked),
SDL_VERSIONNUM_MICRO(linked));
}
static void test_versions(void)
{
output_versions("SDL", SDL_VERSION, SDL_GetVersion());
output_versions("SDL_mixer", SDL_MIXER_VERSION, Mix_Version());
}
static int channel_is_done = 0;
static void SDLCALL channel_complete_callback (int chan)
{
if (verbose) {
Mix_Chunk *done_chunk = Mix_GetChunk(chan);
SDL_Log("We were just alerted that Mixer channel #%d is done.\n", chan);
SDL_Log("Channel's chunk pointer is (%p).\n", (void *) done_chunk);
SDL_Log(" Which %s correct.\n", (g_wave == done_chunk) ? "is" : "is NOT");
}
channel_is_done = 1;
}
/* rcg06192001 abstract this out for testing purposes. */
static int still_playing(void)
{
return Mix_Playing(0);
}
static void do_panning_update(void)
{
static Uint8 leftvol = 128;
static Uint8 rightvol = 128;
static Sint8 leftincr = -1;
static Sint8 rightincr = 1;
static int panningok = 1;
static Uint64 next_panning_update = 0;
if (panningok && (SDL_GetTicks() >= next_panning_update)) {
panningok = Mix_SetPanning(0, leftvol, rightvol);
if (!panningok) {
SDL_Log("Mix_SetPanning(0, %d, %d) failed!\n",
(int) leftvol, (int) rightvol);
SDL_Log("Reason: [%s].\n", SDL_GetError());
}
if ((leftvol == 255) || (leftvol == 0)) {
if (leftvol == 255) {
SDL_Log("All the way in the left speaker.\n");
}
leftincr *= -1;
}
if ((rightvol == 255) || (rightvol == 0)) {
if (rightvol == 255) {
SDL_Log("All the way in the right speaker.\n");
}
rightincr *= -1;
}
leftvol += leftincr;
rightvol += rightincr;
next_panning_update = SDL_GetTicks() + 10;
}
}
static void do_distance_update(void)
{
static Uint8 distance = 1;
static Sint8 distincr = 1;
static int distanceok = 1;
static Uint64 next_distance_update = 0;
if ((distanceok) && (SDL_GetTicks() >= next_distance_update)) {
distanceok = Mix_SetDistance(0, distance);
if (!distanceok) {
SDL_Log("Mix_SetDistance(0, %d) failed!\n", (int) distance);
SDL_Log("Reason: [%s].\n", SDL_GetError());
}
if (distance == 0) {
SDL_Log("Distance at nearest point.\n");
distincr *= -1;
}
else if (distance == 255) {
SDL_Log("Distance at furthest point.\n");
distincr *= -1;
}
distance += distincr;
next_distance_update = SDL_GetTicks() + 15;
}
}
static void do_position_update(void)
{
static Sint16 distance = 1;
static Sint8 distincr = 1;
static Sint16 angle = 0;
static Sint8 angleincr = 1;
static int positionok = 1;
static Uint64 next_position_update = 0;
if (positionok && (SDL_GetTicks() >= next_position_update)) {
positionok = Mix_SetPosition(0, angle, (Uint8)distance);
if (!positionok) {
SDL_Log("Mix_SetPosition(0, %d, %d) failed!\n",
(int) angle, (int) distance);
SDL_Log("Reason: [%s].\n", SDL_GetError());
}
if (angle == 0) {
SDL_Log("Due north; now rotating clockwise...\n");
angleincr = 1;
}
else if (angle == 360) {
SDL_Log("Due north; now rotating counter-clockwise...\n");
angleincr = -1;
}
distance += distincr;
if (distance < 0) {
distance = 0;
distincr = 3;
SDL_Log("Distance is very, very near. Stepping away by threes...\n");
} else if (distance > 255) {
distance = 255;
distincr = -3;
SDL_Log("Distance is very, very far. Stepping towards by threes...\n");
}
angle += angleincr;
next_position_update = SDL_GetTicks() + 30;
}
}
static void CleanUp(int exitcode)
{
if (g_wave) {
Mix_FreeChunk(g_wave);
g_wave = NULL;
}
if (audio_open) {
Mix_CloseAudio();
audio_open = 0;
}
SDL_Quit();
exit(exitcode);
}
/*
* rcg06182001 This is sick, but cool.
*
* Actually, it's meant to be an example of how to manipulate a voice
* without having to use the mixer effects API. This is more processing
* up front, but no extra during the mixing process. Also, in a case like
* this, when you need to touch the whole sample at once, it's the only
* option you've got. And, with the effects API, you are altering a copy of
* the original sample for each playback, and thus, your changes aren't
* permanent; here, you've got a reversed sample, and that's that until
* you either reverse it again, or reload it.
*/
static void flip_sample(Mix_Chunk *wave)
{
SDL_AudioFormat format;
int channels, i, incr;
Uint8 *start = wave->abuf;
Uint8 *end = wave->abuf + wave->alen;
Mix_QuerySpec(NULL, &format, &channels);
incr = SDL_AUDIO_BITSIZE(format) * channels;
end -= incr;
switch (incr) {
case 8:
for (i = wave->alen / 2; i >= 0; i -= 1) {
Uint8 tmp = *start;
*start = *end;
*end = tmp;
start++;
end--;
}
break;
case 16:
for (i = wave->alen / 2; i >= 0; i -= 2) {
Uint16 tmp = *start;
*((Uint16 *) start) = *((Uint16 *) end);
*((Uint16 *) end) = tmp;
start += 2;
end -= 2;
}
break;
case 32:
for (i = wave->alen / 2; i >= 0; i -= 4) {
Uint32 tmp = *start;
*((Uint32 *) start) = *((Uint32 *) end);
*((Uint32 *) end) = tmp;
start += 4;
end -= 4;
}
break;
case 64:
for (i = wave->alen / 2; i >= 0; i -= 8) {
Uint64 tmp = *start;
*((Uint64 *) start) = *((Uint64 *) end);
*((Uint64 *) end) = tmp;
start += 8;
end -= 8;
}
break;
default:
SDL_Log("Unhandled format in sample flipping.\n");
return;
}
}
int main(int argc, char *argv[])
{
SDL_AudioSpec spec;
int loops = 0;
int i;
int reverse_stereo = 0;
int reverse_sample = 0;
const char *filename = NULL;
/* Enable standard application logging */
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
#ifdef HAVE_SETBUF
setbuf(stdout, NULL); /* rcg06132001 for debugging purposes. */
setbuf(stderr, NULL); /* rcg06192001 for debugging purposes, too. */
#endif
/* Initialize variables */
spec.freq = MIX_DEFAULT_FREQUENCY;
spec.format = MIX_DEFAULT_FORMAT;
spec.channels = MIX_DEFAULT_CHANNELS;
/* Parse commandline */
for (i = 1; i < argc;) {
int consumed = 0;
if (SDL_strcmp("-r", argv[i]) == 0) {
spec.freq = SDL_atoi(argv[i + 1]);
consumed = 2;
} else if (SDL_strcmp("-m", argv[i]) == 0) {
spec.channels = 1;
consumed = 1;
} else if (SDL_strcmp("-c", argv[i]) == 0) {
spec.channels = SDL_atoi(argv[i + 1]);
consumed = 2;
} else if (SDL_strcmp("-l", argv[i]) == 0) {
loops = -1;
consumed = 1;
} else if (SDL_strcmp("-8", argv[i]) == 0) {
spec.format = SDL_AUDIO_U8;
consumed = 1;
} else if (SDL_strcmp("-f32", argv[i]) == 0) {
spec.format = SDL_AUDIO_F32;
consumed = 1;
} else if (SDL_strcmp("-f", argv[i]) == 0) {
reverse_stereo = 1;
consumed = 1;
} else if (SDL_strcmp("-F", argv[i]) == 0) {
reverse_sample = 1;
consumed = 1;
} else if (SDL_strcmp("--panning", argv[i]) == 0) {
test_panning = true;
consumed = 1;
} else if (SDL_strcmp("--distance", argv[i]) == 0) {
test_distance = true;
consumed = 1;
} else if (SDL_strcmp("--position", argv[i]) == 0) {
test_position = true;
consumed = 1;
} else if (SDL_strcmp("--version", argv[i]) == 0) {
test_versions();
CleanUp(0);
consumed = 1;
} else if (SDL_strcmp("--verbose", argv[i]) == 0) {
verbose = true;
consumed = 1;
} else if (argv[i][0] != '-' && !filename) {
filename = argv[i];
consumed = 1;
}
if (consumed <= 0) {
SDL_Log("Usage: %s [-r rate] [-m] [-c channels] [-l] [-8] [-f32] [-f] [-F] [--distance] [--panning] [--position] [--version] <wavefile>", argv[0]);
return 1;
}
i += consumed;
}
if (test_position && (test_distance || test_panning)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "position cannot be combined with distance or panning");
CleanUp(1);
}
/* Initialize the SDL library */
if (!SDL_Init(SDL_INIT_AUDIO)) {
SDL_Log("Couldn't initialize SDL: %s\n",SDL_GetError());
return 255;
}
#ifdef HAVE_SIGNAL_H
signal(SIGINT, CleanUp);
signal(SIGTERM, CleanUp);
#endif
/* Open the audio device */
if (!Mix_OpenAudio(0, &spec)) {
SDL_Log("Couldn't open audio: %s\n", SDL_GetError());
CleanUp(2);
} else {
Mix_QuerySpec(&spec.freq, &spec.format, &spec.channels);
SDL_Log("Opened audio at %d Hz %d bit%s %s", spec.freq,
(spec.format&0xFF),
(SDL_AUDIO_ISFLOAT(spec.format) ? " (float)" : ""),
(spec.channels > 2) ? "surround" :
(spec.channels > 1) ? "stereo" : "mono");
if (loops) {
SDL_Log(" (looping)\n");
} else {
putchar('\n');
}
}
audio_open = 1;
if (verbose) {
report_decoders();
}
/* Load the requested wave file */
g_wave = Mix_LoadWAV(filename);
if (g_wave == NULL) {
SDL_Log("Couldn't load %s: %s\n", filename, SDL_GetError());
CleanUp(2);
}
if (reverse_sample) {
flip_sample(g_wave);
}
Mix_ChannelFinished(channel_complete_callback);
if ((!Mix_SetReverseStereo(MIX_CHANNEL_POST, reverse_stereo)) &&
(reverse_stereo))
{
SDL_Log("Failed to set up reverse stereo effect!\n");
SDL_Log("Reason: [%s].\n", SDL_GetError());
}
/* Play and then exit */
Mix_PlayChannel(0, g_wave, loops);
while (still_playing()) {
if (test_panning) {
do_panning_update();
}
if (test_distance) {
do_distance_update();
}
if (test_position) {
do_position_update();
}
SDL_Delay(1);
} /* while still_playing() loop... */
CleanUp(0);
/* Not reached, but fixes compiler warnings */
return 0;
}
/* end of playwave.c ... */

View File

@ -0,0 +1,41 @@
<#
.SYNOPSIS
Downloads the Git modules specified in ../.gitmodules
.DESCRIPTION
Parses and downloads the Github repositories specified in the .gitmodules file
.EXAMPLE
PS> .\Get-GitModules.ps1
< Downloads and parses the repositories in the .gitmodules file. >
#>
#------- Variables -------------------------------------------------------------
[String] $PathRegex = "path\s*=\s*(?<path>.*)"
[String] $URLRegex = "url\s*=\s*(?<url>.*)"
[String] $BranchRegex = "branch\s*=\s*(?<Branch>.*)"
[String[]] $Arguments = $args
#------- Script ----------------------------------------------------------------
if (-not $Arguments) {
[String[]]$Arguments = "--depth", "1"
}
foreach ($Line in Get-Content $PSScriptRoot\..\.gitmodules) {
if ($Line -match $PathRegex) {
$Match = Select-String -InputObject $Line -Pattern $PathRegex
$Path = $Match.Matches[0].Groups[1].Value
}
elseif ($Line -match $URLRegex) {
$Match = Select-String -InputObject $Line -Pattern $URLRegex
$URL = $Match.Matches[0].Groups[1].Value
}
elseif ($Line -match $BranchRegex) {
$Match = Select-String -InputObject $Line -Pattern $BranchRegex
$Branch = $Match.Matches[0].Groups[1].Value
Write-Host "git clone --filter=blob:none $URL $Path -b $Branch --recursive $Arguments" `
-ForegroundColor Blue
git clone --filter=blob:none $URL $PSScriptRoot/../$Path -b $Branch --recursive $Arguments
}
}

23
libs/SDL_mixer/external/download.sh vendored Normal file
View File

@ -0,0 +1,23 @@
#!/bin/sh
set -e
ARGUMENTS="$*"
cd $(dirname "$0")/..
cat .gitmodules | \
while true; do
read module || break
read line; set -- $line
path=$3
read line; set -- $line
url=$3
read line; set -- $line
branch=$3
if [ -z "$ARGUMENTS" ]; then
ARGUMENTS="--depth 1"
fi
git clone --filter=blob:none $url $path -b $branch --recursive $ARGUMENTS
done

50
libs/SDL_mixer/external/ogg/.gitignore vendored Normal file
View File

@ -0,0 +1,50 @@
aclocal.m4
autom4te.cache
ChangeLog
compile
config.guess
config.h
config.h.in
config.h.in~
config.log
config.status
config.sub
configure
depcomp
install-sh
libogg.spec
libtool
ltmain.sh
Makefile
Makefile.in
missing
mkinstalldirs
ogg.pc
ogg-uninstalled.pc
stamp-h1
.project
include/ogg/config_types.h
src/*.o
src/*.lo
src/lib*.la
src/.libs
src/.deps
src/test_*
macosx/build/
/m4
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
CMakeSettings.json
*[Bb]uild*/
.vs/
.vscode/

View File

@ -0,0 +1,26 @@
default:
tags:
- docker
# Image from https://hub.docker.com/_/gcc/ based on Debian.
image: gcc:9
autoconf:
stage: build
before_script:
- apt-get update &&
apt-get install -y zip cmake
script:
- ./autogen.sh
- ./configure
- make
- make distcheck
cmake:
stage: build
before_script:
- apt-get update &&
apt-get install -y cmake ninja-build
script:
- mkdir build
- cmake -S . -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release
- cmake --build build

25
libs/SDL_mixer/external/ogg/.travis.yml vendored Normal file
View File

@ -0,0 +1,25 @@
language: c
os:
- linux
- osx
compiler:
- gcc
- clang
env:
- BUILD=AUTOTOOLS
- BUILD=CMAKE
script:
- if [[ "$BUILD" == "AUTOTOOLS" ]] ; then ./autogen.sh ; fi
- if [[ "$BUILD" == "AUTOTOOLS" ]] ; then ./configure ; fi
- if [[ "$BUILD" == "AUTOTOOLS" ]] ; then make distcheck ; fi
- if [[ "$BUILD" == "CMAKE" ]] ; then mkdir build ; fi
- if [[ "$BUILD" == "CMAKE" ]] ; then pushd build ; fi
- if [[ "$BUILD" == "CMAKE" ]] ; then cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DCPACK_PACKAGE_CONTACT="Xiph.Org Foundation" .. ; fi
- if [[ "$BUILD" == "CMAKE" ]] ; then cmake --build . ; fi
- if [[ "$BUILD" == "CMAKE" ]] ; then ctest ; fi
- if [[ "$BUILD" == "CMAKE" && "$TRAVIS_OS_NAME" == "linux" ]] ; then cpack -G DEB ; fi
- if [[ "$BUILD" == "CMAKE" ]] ; then popd ; fi

7
libs/SDL_mixer/external/ogg/AUTHORS vendored Normal file
View File

@ -0,0 +1,7 @@
Monty <monty@xiph.org>
Greg Maxwell <greg@xiph.org>
Ralph Giles <giles@xiph.org>
Cristian Adam <cristian.adam@gmail.com>
Tim Terriberry <tterribe@xiph.org>
and the rest of the Xiph.Org Foundation.

17
libs/SDL_mixer/external/ogg/Android.mk vendored Normal file
View File

@ -0,0 +1,17 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ogg
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/android
LOCAL_CFLAGS :=
LOCAL_SRC_FILES += \
src/framing.c \
src/bitwise.c
LOCAL_EXPORT_C_INCLUDES += $(LOCAL_C_INCLUDES)
include $(BUILD_STATIC_LIBRARY)

112
libs/SDL_mixer/external/ogg/CHANGES vendored Normal file
View File

@ -0,0 +1,112 @@
Version 1.3.5 (2020 June 3)
* Fix unsigned typedef problem on macOS.
* Fix overflow check in ogg_sync_buffer.
* Clean up cmake and autotools build files.
* Remove Symbian and Apple XCode build files.
* Fix documentation cross-reference links.
Version 1.3.4 (2019 August 30)
* Faster slice-by-8 CRC32 implementation.
see https://lwn.net/Articles/453931/ for motivation.
* Add CMake build.
* Deprecate Visual Studio project files in favor of CMake.
* configure --disable-crc option for fuzzing.
* Various build fixes.
* Documentation and example code fixes.
Version 1.3.3 (2017 November 7)
* Fix an issue with corrupt continued packet handling.
* Update Windows projects and build settings.
* Remove Mac OS 9 build support.
Version 1.3.2 (2014 May 27)
* Fix an bug in oggpack_writecopy().
Version 1.3.1 (2013 May 12)
* Guard against very large packets.
* Respect the configure --docdir override.
* Documentation fixes.
* More Windows build fixes.
Version 1.3.0 (2011 August 4)
* Add ogg_stream_flush_fill() call
This produces longer packets on flush, similar to
what ogg_stream_pageout_fill() does for single pages.
* Windows build fixes
Version 1.2.2 (2010 December 07)
* Build fix (types correction) for Mac OS X
* Update win32 project files to Visual Studio 2008
* ogg_stream_pageout_fill documentation fix
Version 1.2.1 (2010 November 01)
* Various build updates (see SVN)
* Add ogg_stream_pageout_fill() to API to allow applications
greater explicit flexibility in page sizing.
* Documentation updates including multiplexing description,
terminology and API (incl. ogg_packet_clear(),
ogg_stream_pageout_fill())
* Correct possible buffer overwrite in stream encoding on 32 bit
when a single packet exceed 250MB.
* Correct read-buffer overrun [without side effects] under
similar circumstances.
* Update unit testing to work properly with new page spill
heuristic.
Version 1.2.0 (2010 March 25)
* Alter default flushing behavior to span less often and use larger page
sizes when packet sizes are large.
* Build fixes for additional compilers
* Documentation updates
Version 1.1.4 (2009 June 24)
* New async error reporting mechanism. Calls made after a fatal error are
now safely handled in the event an error code is ignored
* Added allocation checks useful to some embedded applications
* fix possible read past end of buffer when reading 0 bits
* Updates to API documentation
* Build fixes
Version 1.1.3 (2005 November 27)
* Correct a bug in the granulepos field of pages where no packet ends
* New VS2003 and XCode builds, minor fixes to other builds
* documentation fixes and cleanup
Version 1.1.2 (2004 September 23)
* fix a bug with multipage packet assembly after seek
Version 1.1.1 (2004 September 12)
* various bugfixes
* important bugfix for 64-bit platforms
* various portability fixes
* autotools cleanup from Thomas Vander Stichele
* Symbian OS build support from Colin Ward at CSIRO
* new multiplexed Ogg stream documentation
Version 1.1 (2003 November 17)
* big-endian bitpacker routines for Theora
* various portability fixes
* improved API documentation
* RFC 3533 documentation of the format by Silvia Pfeiffer at CSIRO
* RFC 3534 documentation of the application/ogg mime-type by Linus Walleij
Version 1.0 (2002 July 19)
* First stable release
* little-endian bitpacker routines for Vorbis
* basic Ogg bitstream sync and coding support

View File

@ -0,0 +1,210 @@
cmake_minimum_required(VERSION 2.8.12...3.5)
project(libogg)
# Required modules
include(GNUInstallDirs)
include(CheckIncludeFiles)
include(CMakePackageConfigHelpers)
include(CTest)
# Build options
option(BUILD_SHARED_LIBS "Build shared library" OFF)
if(APPLE)
option(BUILD_FRAMEWORK "Build Framework bundle for OSX" OFF)
endif()
# Install options
option(INSTALL_DOCS "Install documentation" ON)
option(INSTALL_PKG_CONFIG_MODULE "Install ogg.pc file" ON)
option(INSTALL_CMAKE_PACKAGE_MODULE "Install CMake package configuration module" ON)
# Extract project version from configure.ac
file(READ configure.ac CONFIGURE_AC_CONTENTS)
string(REGEX MATCH "AC_INIT\\(\\[libogg\\],\\[([0-9]*).([0-9]*).([0-9]*)" DUMMY ${CONFIGURE_AC_CONTENTS})
set(PROJECT_VERSION_MAJOR ${CMAKE_MATCH_1})
set(PROJECT_VERSION_MINOR ${CMAKE_MATCH_2})
set(PROJECT_VERSION_PATCH ${CMAKE_MATCH_3})
set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
# Extract library version from configure.ac
string(REGEX MATCH "LIB_CURRENT=([0-9]*)" DUMMY ${CONFIGURE_AC_CONTENTS})
set(LIB_CURRENT ${CMAKE_MATCH_1})
string(REGEX MATCH "LIB_AGE=([0-9]*)" DUMMY ${CONFIGURE_AC_CONTENTS})
set(LIB_AGE ${CMAKE_MATCH_1})
string(REGEX MATCH "LIB_REVISION=([0-9]*)" DUMMY ${CONFIGURE_AC_CONTENTS})
set(LIB_REVISION ${CMAKE_MATCH_1})
math(EXPR LIB_SOVERSION "${LIB_CURRENT} - ${LIB_AGE}")
set(LIB_VERSION "${LIB_SOVERSION}.${LIB_AGE}.${LIB_REVISION}")
# Helper function to configure pkg-config files
function(configure_pkg_config_file pkg_config_file_in)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${CMAKE_INSTALL_FULL_BINDIR})
set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
set(VERSION ${PROJECT_VERSION})
string(REPLACE ".in" "" pkg_config_file ${pkg_config_file_in})
configure_file(${pkg_config_file_in} ${pkg_config_file} @ONLY)
endfunction()
message(STATUS "Configuring ${PROJECT_NAME} ${PROJECT_VERSION}")
# Configure config_type.h
check_include_files(inttypes.h INCLUDE_INTTYPES_H)
check_include_files(stdint.h INCLUDE_STDINT_H)
check_include_files(sys/types.h INCLUDE_SYS_TYPES_H)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(SIZE16 int16_t)
set(USIZE16 uint16_t)
set(SIZE32 int32_t)
set(USIZE32 uint32_t)
set(SIZE64 int64_t)
set(USIZE64 uint64_t)
include(CheckSizes)
configure_file(include/ogg/config_types.h.in include/ogg/config_types.h @ONLY)
set(OGG_HEADERS
${CMAKE_CURRENT_BINARY_DIR}/include/ogg/config_types.h
"${CMAKE_CURRENT_SOURCE_DIR}/include/ogg/ogg.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/ogg/os_types.h"
)
set(OGG_SOURCES
src/bitwise.c
src/framing.c
src/crctable.h
)
if(WIN32 AND BUILD_SHARED_LIBS)
list(APPEND OGG_SOURCES win32/ogg.def)
endif()
if(BUILD_FRAMEWORK)
set(BUILD_SHARED_LIBS TRUE)
endif()
add_library(ogg ${OGG_HEADERS} ${OGG_SOURCES})
add_library(Ogg::ogg ALIAS ogg)
target_include_directories(ogg PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
set_target_properties(
ogg PROPERTIES
SOVERSION ${LIB_SOVERSION}
VERSION ${LIB_VERSION}
#PUBLIC_HEADER "${OGG_HEADERS}"
)
if(WIN32 AND BUILD_SHARED_LIBS)
# FIXME: keep soversion in sync with autotools
set_property(TARGET ogg PROPERTY RUNTIME_OUTPUT_NAME "ogg-0")
# Requires CMake 3.27, so not sufficient
set_property(TARGET ogg PROPERTY DLL_NAME_WITH_SOVERSION FALSE)
endif()
if(BUILD_FRAMEWORK)
set_target_properties(ogg PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION ${PROJECT_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.xiph.ogg
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PROJECT_VERSION}
MACOSX_FRAMEWORK_BUNDLE_VERSION ${PROJECT_VERSION}
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
OUTPUT_NAME Ogg
)
endif()
configure_pkg_config_file(ogg.pc.in)
install(TARGETS ogg
EXPORT OggTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
FRAMEWORK DESTINATION ${CMAKE_INSTALL_PREFIX}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ogg
)
if(0) # libsdl-org: cannot export a target twice (fixes 'export called with target "vorbis" which requires target "ogg" that is not in this export set, but in multiple other export sets')
export(EXPORT OggTargets NAMESPACE Ogg:: FILE OggTargets.cmake)
endif()
if(INSTALL_CMAKE_PACKAGE_MODULE)
set(CMAKE_INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/Ogg)
install(EXPORT OggTargets
DESTINATION ${CMAKE_INSTALL_CONFIGDIR}
NAMESPACE Ogg::
)
include(CMakePackageConfigHelpers)
configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/OggConfig.cmake.in ${PROJECT_BINARY_DIR}/OggConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_CONFIGDIR}
PATH_VARS CMAKE_INSTALL_FULL_INCLUDEDIR
)
write_basic_package_version_file(${PROJECT_BINARY_DIR}/OggConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
install(FILES ${PROJECT_BINARY_DIR}/OggConfig.cmake ${PROJECT_BINARY_DIR}/OggConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_CONFIGDIR}
)
endif()
if(INSTALL_PKG_CONFIG_MODULE)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ogg.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
endif()
if(INSTALL_DOCS)
set(OGG_DOCS
doc/framing.html
doc/index.html
doc/oggstream.html
doc/ogg-multiplex.html
doc/fish_xiph_org.png
doc/multiplex1.png
doc/packets.png
doc/pages.png
doc/stream.png
doc/vorbisword2.png
doc/white-ogg.png
doc/white-xifish.png
doc/rfc3533.txt
doc/rfc5334.txt
doc/skeleton.html
)
install(FILES ${OGG_DOCS} DESTINATION ${CMAKE_INSTALL_DOCDIR}/html)
install(DIRECTORY doc/libogg DESTINATION ${CMAKE_INSTALL_DOCDIR}/html)
endif()
if(BUILD_TESTING)
add_executable(test_bitwise src/bitwise.c ${OGG_HEADERS})
target_compile_definitions(test_bitwise PRIVATE _V_SELFTEST)
target_include_directories(test_bitwise PRIVATE
include
${CMAKE_CURRENT_BINARY_DIR}/include
)
add_test(NAME test_bitwise COMMAND $<TARGET_FILE:test_bitwise>)
add_executable(test_framing src/framing.c ${OGG_HEADERS})
target_compile_definitions(test_framing PRIVATE _V_SELFTEST)
target_include_directories(test_framing PRIVATE
include
${CMAKE_CURRENT_BINARY_DIR}/include
)
add_test(NAME test_framing COMMAND $<TARGET_FILE:test_framing>)
endif()
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
include(CPack)

28
libs/SDL_mixer/external/ogg/COPYING vendored Normal file
View File

@ -0,0 +1,28 @@
Copyright (c) 2002, Xiph.org Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

44
libs/SDL_mixer/external/ogg/Makefile.am vendored Normal file
View File

@ -0,0 +1,44 @@
## Process this file with automake to produce Makefile.in
#AUTOMAKE_OPTIONS = foreign 1.6 dist-zip
AUTOMAKE_OPTIONS = foreign 1.11 dist-zip dist-xz
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src include doc
m4datadir = $(datadir)/aclocal
m4data_DATA = ogg.m4
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = ogg.pc
EXTRA_DIST = README.md AUTHORS CHANGES COPYING \
libogg.spec libogg.spec.in \
ogg.m4 ogg.pc.in ogg-uninstalled.pc.in \
win32 CMakeLists.txt cmake
dist-hook:
for item in $(EXTRA_DIST); do \
if test -d $$item; then \
echo -n "cleaning dir $$item for distribution..."; \
rm -rf `find $(distdir)/$$item -name .svn`; \
echo "OK"; \
fi; \
done
# Verify cmake works with the dist tarball.
cmake_builddir = _build.cmake
distcheck-hook:
$(RM) -rf $(cmake_builddir)
mkdir $(cmake_builddir)
cd $(cmake_builddir) && cmake ../$(top_distdir)
cd $(cmake_builddir) && cmake --build .
cd $(cmake_builddir) && ctest
$(RM) -rf $(cmake_builddir)
debug:
$(MAKE) all CFLAGS="@DEBUG@"
profile:
$(MAKE) all CFLAGS="@PROFILE@"

160
libs/SDL_mixer/external/ogg/README.md vendored Normal file
View File

@ -0,0 +1,160 @@
# Ogg
[![Travis Build Status](https://travis-ci.org/xiph/ogg.svg?branch=master)](https://travis-ci.org/xiph/ogg)
[![Jenkins Build Status](https://mf4.xiph.org/jenkins/job/libogg/badge/icon)](https://mf4.xiph.org/jenkins/job/libogg/)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/xiph/ogg?branch=master&svg=true)](https://ci.appveyor.com/project/rillian/ogg)
Ogg project codecs use the Ogg bitstream format to arrange the raw,
compressed bitstream into a more robust, useful form. For example,
the Ogg bitstream makes seeking, time stamping and error recovery
possible, as well as mixing several sepearate, concurrent media
streams into a single physical bitstream.
## What's here ##
This source distribution includes libogg and nothing else. Other modules
(eg, the modules libvorbis, vorbis-tools for the Vorbis music codec,
libtheora for the Theora video codec) contain the codec libraries for
use with Ogg bitstreams.
Directory:
- `src` The source for libogg, a BSD-license inplementation of the public domain Ogg bitstream format
- `include` Library API headers
- `doc` Ogg specification and libogg API documents
- `win32` Win32 projects and build automation
## Contact ##
The Ogg homepage is located at https://www.xiph.org/ogg/ .
Up to date technical documents, contact information, source code and
pre-built utilities may be found there.
## Building ##
#### Building from tarball distributions ####
./configure
make
and optionally (as root):
make install
This will install the Ogg libraries (static and shared) into
/usr/local/lib, includes into /usr/local/include and API
documentation into /usr/local/share/doc.
#### Building from repository source ####
A standard svn build should consist of nothing more than:
./autogen.sh
./configure
make
and as root if desired :
make install
#### Building on Windows ####
Use the project file in the win32 directory. It should compile out of the box.
#### Cross-compiling from Linux to Windows ####
It is also possible to cross compile from Linux to windows using the MinGW
cross tools and even to run the test suite under Wine, the Linux/*nix
windows emulator.
On Debian and Ubuntu systems, these cross compiler tools can be installed
by doing:
sudo apt-get mingw32 mingw32-binutils mingw32-runtime wine
Once these tools are installed its possible to compile and test by
executing the following commands, or something similar depending on
your system:
./configure --host=i586-mingw32msvc --target=i586-mingw32msvc --build=i586-linux
make
make check
(Build instructions for Ogg codecs such as vorbis are similar and may
be found in those source modules' README files)
## Building with CMake ##
Ogg supports building using [CMake](http://www.cmake.org/). CMake is a meta build system that generates native projects for each platform.
To generate projects just run cmake replacing `YOUR-PROJECT-GENERATOR` with a proper generator from a list [here](http://www.cmake.org/cmake/help/v3.2/manual/cmake-generators.7.html):
mkdir build
cd build
cmake -G YOUR-PROJECT-GENERATOR ..
Note that by default cmake generates projects that will build static libraries.
To generate projects that will build dynamic library use `BUILD_SHARED_LIBS` option like this:
cmake -G YOUR-PROJECT-GENERATOR -DBUILD_SHARED_LIBS=1 ..
After projects are generated use them as usual
#### Building on Windows ####
Use proper generator for your Visual Studio version like:
cmake -G "Visual Studio 12 2013" ..
#### Building on Mac OS X ####
Use Xcode generator. To build framework run:
cmake -G Xcode -DBUILD_FRAMEWORK=1 ..
#### Building on Linux ####
Use Makefile generator which is default one.
cmake ..
make
## Testing ##
This package includes a collection of automated tests.
Running them is not part of building nor installation but optional.
### Unix-like System or MinGW ###
If build under automake:
make check
If build under CMake:
make test
or:
ctest
### Windows with MSBuild ###
If build with configuration type "Debug", then:
ctest -C Debug
If build with configuration type "Release", then:
ctest -C Release
## License ##
THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.
USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS
GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE
IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.
THE OggVorbis SOURCE CODE IS COPYRIGHT (C) 1994-2019
by the Xiph.Org Foundation https://www.xiph.org/

View File

@ -0,0 +1,26 @@
#ifndef __CONFIG_TYPES_H__
#define __CONFIG_TYPES_H__
/* these are filled in by configure */
#define INCLUDE_INTTYPES_H 1
#define INCLUDE_STDINT_H 1
#define INCLUDE_SYS_TYPES_H 1
#if INCLUDE_INTTYPES_H
# include <inttypes.h>
#endif
#if INCLUDE_STDINT_H
# include <stdint.h>
#endif
#if INCLUDE_SYS_TYPES_H
# include <sys/types.h>
#endif
typedef int16_t ogg_int16_t;
typedef uint16_t ogg_uint16_t;
typedef int32_t ogg_int32_t;
typedef uint32_t ogg_uint32_t;
typedef int64_t ogg_int64_t;
typedef uint64_t ogg_uint64_t;
#endif

View File

@ -0,0 +1,33 @@
image: Visual Studio 2015
configuration:
- Debug
- Release
platform:
- Win32
- x64
environment:
matrix:
- BUILD_SYSTEM: MSVC
- BUILD_SYSTEM: CMAKE
build_script:
- if "%BUILD_SYSTEM%" == "MSVC" (
msbuild "%APPVEYOR_BUILD_FOLDER%\win32\VS2015\libogg.sln" /m /v:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /property:Configuration=%CONFIGURATION%;Platform=%PLATFORM%
)
- if "%BUILD_SYSTEM%" == "CMAKE" (
mkdir "%APPVEYOR_BUILD_FOLDER%\build" &&
pushd "%APPVEYOR_BUILD_FOLDER%\build" &&
cmake -A "%PLATFORM%" -G "Visual Studio 14 2015" .. &&
cmake --build . --config "%CONFIGURATION%" -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" &&
popd
)
after_build:
- if "%BUILD_SYSTEM%" == "MSVC" (
7z a ogg.zip win32\VS2015\%PLATFORM%\%CONFIGURATION%\libogg.lib include\ogg\*.h
)
artifacts:
- path: ogg.zip

13
libs/SDL_mixer/external/ogg/autogen.sh vendored Normal file
View File

@ -0,0 +1,13 @@
#!/bin/sh
# Run this to set up the build system: configure, makefiles, etc.
set -e
package="libogg"
srcdir=`dirname $0`
test -n "$srcdir" && cd "$srcdir"
echo "Updating build configuration files for $package, please wait...."
mkdir -p m4
autoreconf -if

View File

@ -0,0 +1,73 @@
include(CheckTypeSize)
check_type_size("int16_t" INT16_SIZE LANGUAGE C)
check_type_size("uint16_t" UINT16_SIZE LANGUAGE C)
check_type_size("u_int16_t" U_INT16_SIZE LANGUAGE C)
check_type_size("int32_t" INT32_SIZE LANGUAGE C)
check_type_size("uint32_t" UINT32_SIZE LANGUAGE C)
check_type_size("u_int32_t" U_INT32_SIZE LANGUAGE C)
check_type_size("int64_t" INT64_SIZE LANGUAGE C)
check_type_size("short" SHORT_SIZE LANGUAGE C)
check_type_size("int" INT_SIZE LANGUAGE C)
check_type_size("long" LONG_SIZE LANGUAGE C)
check_type_size("long long" LONG_LONG_SIZE LANGUAGE C)
if(INT16_SIZE EQUAL 2)
set(SIZE16 "int16_t")
elseif(SHORT_SIZE EQUAL 2)
set(SIZE16 "short")
elseif(INT_SIZE EQUAL 2)
set(SIZE16 "int")
else()
message(FATAL_ERROR "No 16 bit type found on this platform!")
endif()
if(UINT16_SIZE EQUAL 2)
set(USIZE16 "uint16_t")
elseif(SHORT_SIZE EQUAL 2)
set(USIZE16 "unsigned short")
elseif(INT_SIZE EQUAL 2)
set(USIZE16 "unsigned int")
elseif(U_INT_SIZE EQUAL 2)
set(USIZE16 "u_int16_t")
else()
message(FATAL_ERROR "No unsigned 16 bit type found on this platform!")
endif()
if(INT32_SIZE EQUAL 4)
set(SIZE32 "int32_t")
elseif(SHORT_SIZE EQUAL 4)
set(SIZE32 "short")
elseif(INT_SIZE EQUAL 4)
set(SIZE32 "int")
elseif(LONG_SIZE EQUAL 4)
set(SIZE16 "long")
else()
message(FATAL_ERROR "No 32 bit type found on this platform!")
endif()
if(UINT32_SIZE EQUAL 4)
set(USIZE32 "uint32_t")
elseif(SHORT_SIZE EQUAL 4)
set(USIZE32 "unsigned short")
elseif(INT_SIZE EQUAL 4)
set(USIZE32 "unsigned int")
elseif(LONG_SIZE EQUAL 4)
set(USIZE32 "unsigned long")
elseif(U_INT_SIZE EQUAL 4)
set(USIZE32 "u_int32_t")
else()
message(FATAL_ERROR "No unsigned 32 bit type found on this platform!")
endif()
if(INT64_SIZE EQUAL 8)
set(SIZE64 "int64_t")
elseif(INT_SIZE EQUAL 8)
set(SIZE64 "int")
elseif(LONG_SIZE EQUAL 8)
set(SIZE64 "long")
elseif(LONG_LONG_SIZE EQUAL 8)
set(SIZE64 "long long")
else()
message(FATAL_ERROR "No 64 bit type found on this platform!")
endif()

View File

@ -0,0 +1,16 @@
@PACKAGE_INIT@
set(Ogg_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@")
set(OGG_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@")
set(Ogg_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@")
set(OGG_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@")
include(${CMAKE_CURRENT_LIST_DIR}/OggTargets.cmake)
set(Ogg_LIBRARY Ogg::ogg)
set(OGG_LIBRARY Ogg::ogg)
set(Ogg_LIBRARIES Ogg::ogg)
set(OGG_LIBRARIES Ogg::ogg)
check_required_components(Ogg)
set(OGG_FOUND 1)

209
libs/SDL_mixer/external/ogg/configure.ac vendored Normal file
View File

@ -0,0 +1,209 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT([libogg],[1.3.5],[ogg-dev@xiph.org])
LT_INIT
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR(src/framing.c)
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE([enable])
dnl Library versioning
LIB_CURRENT=8
LIB_REVISION=5
LIB_AGE=8
AC_SUBST(LIB_CURRENT)
AC_SUBST(LIB_REVISION)
AC_SUBST(LIB_AGE)
AC_PROG_CC
AM_PROG_CC_C_O
dnl Set some options based on environment
cflags_save="$CFLAGS"
if test -z "$GCC"; then
case $host in
*-*-irix*)
DEBUG="-g -signed"
CFLAGS="-O2 -w -signed"
PROFILE="-p -g3 -O2 -signed"
;;
sparc-sun-solaris*)
DEBUG="-v -g"
CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc"
;;
*)
DEBUG="-g"
CFLAGS="-O"
PROFILE="-g -p"
;;
esac
else
case $host in
*-*-linux*)
DEBUG="-g -Wall -fsigned-char"
CFLAGS="-O2 -Wall -ffast-math -fsigned-char"
PROFILE="-Wall -W -pg -g -O2 -ffast-math -fsigned-char"
;;
sparc-sun-*)
DEBUG="-g -Wall -fsigned-char"
CFLAGS="-O2 -ffast-math -fsigned-char"
PROFILE="-pg -g -O2 -fsigned-char"
;;
*-*-darwin*)
DEBUG="-fno-common -g -Wall -fsigned-char"
CFLAGS="-fno-common -O4 -Wall -fsigned-char -ffast-math"
PROFILE="-fno-common -O4 -Wall -pg -g -fsigned-char -ffast-math"
;;
*)
DEBUG="-g -Wall -fsigned-char"
CFLAGS="-O2 -fsigned-char"
PROFILE="-O2 -g -pg -fsigned-char"
;;
esac
fi
CFLAGS="$CFLAGS $cflags_save"
DEBUG="$DEBUG $cflags_save"
PROFILE="$PROFILE $cflags_save"
dnl Checks for programs.
dnl Checks for libraries.
dnl Checks for header files.
AC_HEADER_STDC
INCLUDE_INTTYPES_H=0
INCLUDE_STDINT_H=0
INCLUDE_SYS_TYPES_H=0
AC_CHECK_HEADER(inttypes.h,INCLUDE_INTTYPES_H=1)
AC_CHECK_HEADER(stdint.h,INCLUDE_STDINT_H=1)
AC_CHECK_HEADER(sys/types.h,INCLUDE_SYS_TYPES_H=1)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
dnl Check for types
AC_CHECK_SIZEOF(int16_t)
AC_CHECK_SIZEOF(uint16_t)
AC_CHECK_SIZEOF(u_int16_t)
AC_CHECK_SIZEOF(int32_t)
AC_CHECK_SIZEOF(uint32_t)
AC_CHECK_SIZEOF(u_int32_t)
AC_CHECK_SIZEOF(int64_t)
AC_CHECK_SIZEOF(uint64_t)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
case 2 in
$ac_cv_sizeof_int16_t) SIZE16="int16_t";;
$ac_cv_sizeof_short) SIZE16="short";;
$ac_cv_sizeof_int) SIZE16="int";;
esac
case 2 in
$ac_cv_sizeof_uint16_t) USIZE16="uint16_t";;
$ac_cv_sizeof_short) USIZE16="unsigned short";;
$ac_cv_sizeof_int) USIZE16="unsigned int";;
$ac_cv_sizeof_u_int16_t) USIZE16="u_int16_t";;
esac
case 4 in
$ac_cv_sizeof_int32_t) SIZE32="int32_t";;
$ac_cv_sizeof_short) SIZE32="short";;
$ac_cv_sizeof_int) SIZE32="int";;
$ac_cv_sizeof_long) SIZE32="long";;
esac
case 4 in
$ac_cv_sizeof_uint32_t) USIZE32="uint32_t";;
$ac_cv_sizeof_short) USIZE32="unsigned short";;
$ac_cv_sizeof_int) USIZE32="unsigned int";;
$ac_cv_sizeof_long) USIZE32="unsigned long";;
$ac_cv_sizeof_u_int32_t) USIZE32="u_int32_t";;
esac
case 8 in
$ac_cv_sizeof_int64_t) SIZE64="int64_t";;
$ac_cv_sizeof_int) SIZE64="int";;
$ac_cv_sizeof_long) SIZE64="long";;
$ac_cv_sizeof_long_long) SIZE64="long long";;
esac
case 8 in
$ac_cv_sizeof_uint64_t) USIZE64="uint64_t";;
$ac_cv_sizeof_unsigned_int) USIZE64="unsigned int";;
$ac_cv_sizeof_unsigned_long) USIZE64="unsigned long";;
$ac_cv_sizeof_unsigned_long_long) USIZE64="unsigned long long";;
esac
if test -z "$SIZE16"; then
AC_MSG_ERROR(No 16 bit type found on this platform!)
fi
if test -z "$USIZE16"; then
AC_MSG_ERROR(No unsigned 16 bit type found on this platform!)
fi
if test -z "$SIZE32"; then
AC_MSG_ERROR(No 32 bit type found on this platform!)
fi
if test -z "$USIZE32"; then
AC_MSG_ERROR(No unsigned 32 bit type found on this platform!)
fi
if test -z "$SIZE64"; then
AC_MSG_WARN(No 64 bit type found on this platform!)
fi
if test -z "$USIZE64"; then
AC_MSG_WARN(No unsigned 64 bit type found on this platform!)
fi
AC_ARG_ENABLE([crc],
[AS_HELP_STRING([--disable-crc],
[Disable CRC in the demuxer])],,
[enable_crc=yes])
AM_CONDITIONAL([DISABLE_CRC], [test "$enable_crc" = "no"])
AS_IF([test "$enable_crc" = "no"],[
AC_DEFINE([DISABLE_CRC], [1], [Do not build with CRC])
])
dnl Checks for library functions.
AC_FUNC_MEMCMP
dnl Make substitutions
AC_SUBST(LIBTOOL_DEPS)
AC_SUBST(INCLUDE_INTTYPES_H)
AC_SUBST(INCLUDE_STDINT_H)
AC_SUBST(INCLUDE_SYS_TYPES_H)
AC_SUBST(SIZE16)
AC_SUBST(USIZE16)
AC_SUBST(SIZE32)
AC_SUBST(USIZE32)
AC_SUBST(SIZE64)
AC_SUBST(USIZE64)
AC_SUBST(OPT)
AC_SUBST(LIBS)
AC_SUBST(DEBUG)
AC_SUBST(CFLAGS)
AC_SUBST(PROFILE)
AC_CONFIG_FILES([
Makefile
src/Makefile
doc/Makefile doc/libogg/Makefile
include/Makefile include/ogg/Makefile include/ogg/config_types.h
libogg.spec
ogg.pc
ogg-uninstalled.pc
])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT

View File

@ -0,0 +1,9 @@
## Process this with automake to create Makefile.in
SUBDIRS = libogg
dist_html_DATA = framing.html index.html oggstream.html ogg-multiplex.html \
fish_xiph_org.png multiplex1.png packets.png pages.png stream.png \
vorbisword2.png white-ogg.png white-xifish.png \
rfc3533.txt rfc5334.txt skeleton.html

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,429 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
<title>Ogg Documentation</title>
<style type="text/css">
body {
margin: 0 18px 0 18px;
padding-bottom: 30px;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #333333;
font-size: .8em;
}
a {
color: #3366cc;
}
img {
border: 0;
}
#xiphlogo {
margin: 30px 0 16px 0;
}
#content p {
line-height: 1.4;
}
h1, h1 a, h2, h2 a, h3, h3 a {
font-weight: bold;
color: #ff9900;
margin: 1.3em 0 8px 0;
}
h1 {
font-size: 1.3em;
}
h2 {
font-size: 1.2em;
}
h3 {
font-size: 1.1em;
}
li {
line-height: 1.4;
}
#copyright {
margin-top: 30px;
line-height: 1.5em;
text-align: center;
font-size: .8em;
color: #888888;
clear: both;
}
</style>
</head>
<body>
<div id="xiphlogo">
<a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
</div>
<h1>Ogg logical bitstream framing</h1>
<h2>Ogg bitstreams</h2>
<p>The Ogg transport bitstream is designed to provide framing, error
protection and seeking structure for higher-level codec streams that
consist of raw, unencapsulated data packets, such as the Vorbis audio
codec or Theora video codec.</p>
<h2>Application example: Vorbis</h2>
<p>Vorbis encodes short-time blocks of PCM data into raw packets of
bit-packed data. These raw packets may be used directly by transport
mechanisms that provide their own framing and packet-separation
mechanisms (such as UDP datagrams). For stream based storage (such as
files) and transport (such as TCP streams or pipes), Vorbis uses the
Ogg bitstream format to provide framing/sync, sync recapture
after error, landmarks during seeking, and enough information to
properly separate data back into packets at the original packet
boundaries without relying on decoding to find packet boundaries.</p>
<h2>Design constraints for Ogg bitstreams</h2>
<ol>
<li>True streaming; we must not need to seek to build a 100%
complete bitstream.</li>
<li>Use no more than approximately 1-2% of bitstream bandwidth for
packet boundary marking, high-level framing, sync and seeking.</li>
<li>Specification of absolute position within the original sample
stream.</li>
<li>Simple mechanism to ease limited editing, such as a simplified
concatenation mechanism.</li>
<li>Detection of corruption, recapture after error and direct, random
access to data at arbitrary positions in the bitstream.</li>
</ol>
<h2>Logical and Physical Bitstreams</h2>
<p>A <em>logical</em> Ogg bitstream is a contiguous stream of
sequential pages belonging only to the logical bitstream. A
<em>physical</em> Ogg bitstream is constructed from one or more
than one logical Ogg bitstream (the simplest physical bitstream
is simply a single logical bitstream). We describe below the exact
formatting of an Ogg logical bitstream. Combining logical
bitstreams into more complex physical bitstreams is described in the
<a href="oggstream.html">Ogg bitstream overview</a>. The exact
mapping of raw Vorbis packets into a valid Ogg Vorbis physical
bitstream is described in the Vorbis I Specification.</p>
<h2>Bitstream structure</h2>
<p>An Ogg stream is structured by dividing incoming packets into
segments of up to 255 bytes and then wrapping a group of contiguous
packet segments into a variable length page preceded by a page
header. Both the header size and page size are variable; the page
header contains sizing information and checksum data to determine
header/page size and data integrity.</p>
<p>The bitstream is captured (or recaptured) by looking for the beginning
of a page, specifically the capture pattern. Once the capture pattern
is found, the decoder verifies page sync and integrity by computing
and comparing the checksum. At that point, the decoder can extract the
packets themselves.</p>
<h3>Packet segmentation</h3>
<p>Packets are logically divided into multiple segments before encoding
into a page. Note that the segmentation and fragmentation process is a
logical one; it's used to compute page header values and the original
page data need not be disturbed, even when a packet spans page
boundaries.</p>
<p>The raw packet is logically divided into [n] 255 byte segments and a
last fractional segment of &lt; 255 bytes. A packet size may well
consist only of the trailing fractional segment, and a fractional
segment may be zero length. These values, called "lacing values" are
then saved and placed into the header segment table.</p>
<p>An example should make the basic concept clear:</p>
<pre>
<tt>
raw packet:
___________________________________________
|______________packet data__________________| 753 bytes
lacing values for page header segment table: 255,255,243
</tt>
</pre>
<p>We simply add the lacing values for the total size; the last lacing
value for a packet is always the value that is less than 255. Note
that this encoding both avoids imposing a maximum packet size as well
as imposing minimum overhead on small packets (as opposed to, eg,
simply using two bytes at the head of every packet and having a max
packet size of 32k. Small packets (&lt;255, the typical case) are
penalized with twice the segmentation overhead). Using the lacing
values as suggested, small packets see the minimum possible
byte-aligned overhead (1 byte) and large packets, over 512 bytes or
so, see a fairly constant ~.5% overhead on encoding space.</p>
<p>Note that a lacing value of 255 implies that a second lacing value
follows in the packet, and a value of &lt; 255 marks the end of the
packet after that many additional bytes. A packet of 255 bytes (or a
multiple of 255 bytes) is terminated by a lacing value of 0:</p>
<pre><tt>
raw packet:
_______________________________
|________packet data____________| 255 bytes
lacing values: 255, 0
</tt></pre>
<p>Note also that a 'nil' (zero length) packet is not an error; it
consists of nothing more than a lacing value of zero in the header.</p>
<h3>Packets spanning pages</h3>
<p>Packets are not restricted to beginning and ending within a page,
although individual segments are, by definition, required to do so.
Packets are not restricted to a maximum size, although excessively
large packets in the data stream are discouraged.</p>
<p>After segmenting a packet, the encoder may decide not to place all the
resulting segments into the current page; to do so, the encoder places
the lacing values of the segments it wishes to belong to the current
page into the current segment table, then finishes the page. The next
page is begun with the first value in the segment table belonging to
the next packet segment, thus continuing the packet (data in the
packet body must also correspond properly to the lacing values in the
spanned pages. The segment data in the first packet corresponding to
the lacing values of the first page belong in that page; packet
segments listed in the segment table of the following page must begin
the page body of the subsequent page).</p>
<p>The last mechanic to spanning a page boundary is to set the header
flag in the new page to indicate that the first lacing value in the
segment table continues rather than begins a packet; a header flag of
0x01 is set to indicate a continued packet. Although mandatory, it
is not actually algorithmically necessary; one could inspect the
preceding segment table to determine if the packet is new or
continued. Adding the information to the packet_header flag allows a
simpler design (with no overhead) that needs only inspect the current
page header after frame capture. This also allows faster error
recovery in the event that the packet originates in a corrupt
preceding page, implying that the previous page's segment table
cannot be trusted.</p>
<p>Note that a packet can span an arbitrary number of pages; the above
spanning process is repeated for each spanned page boundary. Also a
'zero termination' on a packet size that is an even multiple of 255
must appear even if the lacing value appears in the next page as a
zero-length continuation of the current packet. The header flag
should be set to 0x01 to indicate that the packet spanned, even though
the span is a nil case as far as data is concerned.</p>
<p>The encoding looks odd, but is properly optimized for speed and the
expected case of the majority of packets being between 50 and 200
bytes (note that it is designed such that packets of wildly different
sizes can be handled within the model; placing packet size
restrictions on the encoder would have only slightly simplified design
in page generation and increased overall encoder complexity).</p>
<p>The main point behind tracking individual packets (and packet
segments) is to allow more flexible encoding tricks that requiring
explicit knowledge of packet size. An example is simple bandwidth
limiting, implemented by simply truncating packets in the nominal case
if the packet is arranged so that the least sensitive portion of the
data comes last.</p>
<a name="page_header"></a>
<h3>Page header</h3>
<p>The headering mechanism is designed to avoid copying and re-assembly
of the packet data (ie, making the packet segmentation process a
logical one); the header can be generated directly from incoming
packet data. The encoder buffers packet data until it finishes a
complete page at which point it writes the header followed by the
buffered packet segments.</p>
<h4>capture_pattern</h4>
<p>A header begins with a capture pattern that simplifies identifying
pages; once the decoder has found the capture pattern it can do a more
intensive job of verifying that it has in fact found a page boundary
(as opposed to an inadvertent coincidence in the byte stream).</p>
<pre><tt>
byte value
0 0x4f 'O'
1 0x67 'g'
2 0x67 'g'
3 0x53 'S'
</tt></pre>
<h4>stream_structure_version</h4>
<p>The capture pattern is followed by the stream structure revision:</p>
<pre><tt>
byte value
4 0x00
</tt></pre>
<h4>header_type_flag</h4>
<p>The header type flag identifies this page's context in the bitstream:</p>
<pre><tt>
byte value
5 bitflags: 0x01: unset = fresh packet
set = continued packet
0x02: unset = not first page of logical bitstream
set = first page of logical bitstream (bos)
0x04: unset = not last page of logical bitstream
set = last page of logical bitstream (eos)
</tt></pre>
<h4>absolute granule position</h4>
<p>(This is packed in the same way the rest of Ogg data is packed; LSb
of LSB first. Note that the 'position' data specifies a 'sample'
number (eg, in a CD quality sample is four octets, 16 bits for left
and 16 bits for right; in video it would likely be the frame number.
It is up to the specific codec in use to define the semantic meaning
of the granule position value). The position specified is the total
samples encoded after including all packets finished on this page
(packets begun on this page but continuing on to the next page do not
count). The rationale here is that the position specified in the
frame header of the last page tells how long the data coded by the
bitstream is. A truncated stream will still return the proper number
of samples that can be decoded fully.</p>
<p>A special value of '-1' (in two's complement) indicates that no packets
finish on this page.</p>
<pre><tt>
byte value
6 0xXX LSB
7 0xXX
8 0xXX
9 0xXX
10 0xXX
11 0xXX
12 0xXX
13 0xXX MSB
</tt></pre>
<h4>stream serial number</h4>
<p>Ogg allows for separate logical bitstreams to be mixed at page
granularity in a physical bitstream. The most common case would be
sequential arrangement, but it is possible to interleave pages for
two separate bitstreams to be decoded concurrently. The serial
number is the means by which pages physical pages are associated with
a particular logical stream. Each logical stream must have a unique
serial number within a physical stream:</p>
<pre><tt>
byte value
14 0xXX LSB
15 0xXX
16 0xXX
17 0xXX MSB
</tt></pre>
<h4>page sequence no</h4>
<p>Page counter; lets us know if a page is lost (useful where packets
span page boundaries).</p>
<pre><tt>
byte value
18 0xXX LSB
19 0xXX
20 0xXX
21 0xXX MSB
</tt></pre>
<h4>page checksum</h4>
<p>32 bit CRC value (direct algorithm, initial val and final XOR = 0,
generator polynomial=0x04c11db7). The value is computed over the
entire header (with the CRC field in the header set to zero) and then
continued over the page. The CRC field is then filled with the
computed value.</p>
<p>(A thorough discussion of CRC algorithms can be found in <a
href="http://www.ross.net/crc/download/crc_v3.txt">"A
Painless Guide to CRC Error Detection Algorithms"</a> by Ross
Williams <a href="mailto:ross@ross.net">ross@ross.net</a>.)</p>
<pre><tt>
byte value
22 0xXX LSB
23 0xXX
24 0xXX
25 0xXX MSB
</tt></pre>
<h4>page_segments</h4>
<p>The number of segment entries to appear in the segment table. The
maximum number of 255 segments (255 bytes each) sets the maximum
possible physical page size at 65307 bytes or just under 64kB (thus
we know that a header corrupted so as destroy sizing/alignment
information will not cause a runaway bitstream. We'll read in the
page according to the corrupted size information that's guaranteed to
be a reasonable size regardless, notice the checksum mismatch, drop
sync and then look for recapture).</p>
<pre><tt>
byte value
26 0x00-0xff (0-255)
</tt></pre>
<h4>segment_table (containing packet lacing values)</h4>
<p>The lacing values for each packet segment physically appearing in
this page are listed in contiguous order.</p>
<pre><tt>
byte value
27 0x00-0xff (0-255)
[...]
n 0x00-0xff (0-255, n=page_segments+26)
</tt></pre>
<p>Total page size is calculated directly from the known header size and
lacing values in the segment table. Packet data segments follow
immediately after the header.</p>
<p>Page headers typically impose a flat .25-.5% space overhead assuming
nominal ~8k page sizes. The segmentation table needed for exact
packet recovery in the streaming layer adds approximately .5-1%
nominal assuming expected encoder behavior in the 44.1kHz, 128kbps
stereo encodings.</p>
<div id="copyright">
The Xiph Fish Logo is a
trademark (&trade;) of Xiph.Org.<br/>
These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
</div>
</body>
</html>

View File

@ -0,0 +1,105 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
<title>Ogg Documentation</title>
<style type="text/css">
body {
margin: 0 18px 0 18px;
padding-bottom: 30px;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #333333;
font-size: .8em;
}
a {
color: #3366cc;
}
img {
border: 0;
}
#xiphlogo {
margin: 30px 0 16px 0;
}
#content p {
line-height: 1.4;
}
h1, h1 a, h2, h2 a, h3, h3 a {
font-weight: bold;
color: #ff9900;
margin: 1.3em 0 8px 0;
}
h1 {
font-size: 1.3em;
}
h2 {
font-size: 1.2em;
}
h3 {
font-size: 1.1em;
}
li {
line-height: 1.4;
}
#copyright {
margin-top: 30px;
line-height: 1.5em;
text-align: center;
font-size: .8em;
color: #888888;
clear: both;
}
</style>
</head>
<body>
<div id="xiphlogo">
<a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
</div>
<h1>Ogg Documentation</h1>
<h2>Ogg programming documentation</h2>
<ul>
<li><a href="libogg/index.html">Programming with ogg</a></li>
</ul>
<h2>Ogg bitstream documentation</h2>
<ul>
<li><a href="oggstream.html">Ogg bitstream overview</a></li>
<li><a href="framing.html">Ogg bitstream framing</a></li>
<li><a href="ogg-multiplex.html">Ogg multi-stream multiplexing</a></li>
<li><a href="skeleton.html">The Ogg Skeleton Metadata Bitstream</a></li>
</ul>
<h2>RFC documentation</h2>
<ul>
<li><a href="rfc3533.txt">rfc3533: The Ogg Encapsulation Format Version 0</a></li>
<li><a href="rfc5334.txt">rfc5334: Ogg Media Types</a></li>
</ul>
<div id="copyright">
The Xiph Fish Logo is a
trademark (&trade;) of Xiph.Org.<br/>
These pages &copy; 1994 - 2010 Xiph.Org. All rights reserved.
</div>
</body>
</html>

View File

@ -0,0 +1,39 @@
## Process this file with automake to produce Makefile.in
apidocdir = $(htmldir)/libogg
dist_apidoc_DATA = bitpacking.html datastructures.html decoding.html encoding.html\
general.html index.html ogg_iovec_t.html ogg_packet.html ogg_packet_clear.html\
ogg_page.html ogg_page_bos.html ogg_page_checksum_set.html\
ogg_page_continued.html ogg_page_eos.html ogg_page_granulepos.html\
ogg_page_packets.html ogg_page_pageno.html ogg_page_serialno.html\
ogg_page_version.html ogg_stream_check.html ogg_stream_clear.html ogg_stream_destroy.html\
ogg_stream_eos.html ogg_stream_flush.html ogg_stream_flush_fill.html ogg_stream_init.html\
ogg_stream_iovecin.html ogg_stream_packetin.html ogg_stream_packetout.html\
ogg_stream_packetpeek.html ogg_stream_pagein.html\
ogg_stream_pageout.html ogg_stream_pageout_fill.html ogg_stream_reset.html\
ogg_stream_reset_serialno.html ogg_stream_state.html\
ogg_sync_buffer.html ogg_sync_check.html ogg_sync_clear.html ogg_sync_destroy.html\
ogg_sync_init.html ogg_sync_pageout.html ogg_sync_pageseek.html\
ogg_sync_reset.html ogg_sync_state.html ogg_sync_wrote.html\
oggpack_adv.html oggpack_adv1.html oggpack_bits.html\
oggpack_buffer.html oggpack_bytes.html oggpack_get_buffer.html\
oggpack_look.html oggpack_look1.html oggpack_read.html\
oggpack_read1.html oggpack_readinit.html oggpack_reset.html\
oggpack_write.html oggpack_writealign.html oggpack_writecheck.html oggpack_writeclear.html\
oggpack_writecopy.html oggpack_writeinit.html oggpack_writetrunc.html\
overview.html reference.html style.css
update-doc-version:
@YEAR=$$(date +%Y); DAY=$$(date +%Y%m%d); \
for f in $(srcdir)/*.html; do \
sed -e "s/2000-[0-9]\{4\} Xiph.Org/2000-$$YEAR Xiph.Org/g" \
-e "s/libogg release [0-9. -]\+/libogg release $(VERSION) - $$DAY/g"\
< $$f > $$f.tmp; \
if diff -q $$f $$f.tmp > /dev/null; then \
rm $$f.tmp; \
else \
mv $$f.tmp $$f; \
fi; \
done;

View File

@ -0,0 +1,103 @@
<html>
<head>
<title>libogg - Bitpacking Functions</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>Bitpacking Functions</h1>
<p>Libogg contains a basic bitpacking library that is useful for manipulating data within a buffer.
<p>
All the <b>libogg</b> specific functions are declared in "ogg/ogg.h".
<p>
<table border=1 color=black width=50% cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td><b>function</b></td>
<td><b>purpose</b></td>
</tr>
<tr valign=top>
<td><a href="oggpack_writeinit.html">oggpack_writeinit</a></td>
<td>Initializes a buffer for writing using this bitpacking library.</td>
</tr>
<tr valign=top>
<td><a href="oggpack_writecheck.html">oggpack_writecheck</a></td>
<td>Asynchronously checks error status of bitpacker write buffer.</td>
</tr>
<tr valign=top>
<td><a href="oggpack_reset.html">oggpack_reset</a></td>
<td>Clears and resets the buffer to the initial position.</td>
</tr>
<tr valign=top>
<td><a href="oggpack_writeclear.html">oggpack_writeclear</a></td>
<td>Frees the memory used by the buffer.</td>
</tr>
<tr valign=top>
<td><a href="oggpack_readinit.html">oggpack_readinit</a></td>
<td>Initializes a buffer for reading using this bitpacking library.</td>
</tr>
<tr valign=top>
<td><a href="oggpack_write.html">oggpack_write</a></td>
<td>Writes bytes to the specified location within the buffer.</td>
</tr>
<tr valign=top>
<td><a href="oggpack_look.html">oggpack_look</a></td>
<td>Look at a specified number of bits, <=32, without advancing the location pointer.</td>
</tr>
<tr valign=top>
<td><a href="oggpack_look1.html">oggpack_look1</a></td>
<td>Looks at one bit without advancing the location pointer.</td>
</tr>
<tr valign=top>
<td><a href="oggpack_adv.html">oggpack_adv</a></td>
<td>Advances the location pointer by a specified number of bits.</td>
</tr>
<tr valign=top>
<td><a href="oggpack_adv1.html">oggpack_adv1</a></td>
<td>Advances the location pointer by one bit.</td>
</tr>
<tr valign=top>
<td><a href="oggpack_read.html">oggpack_read</a></td>
<td>Reads a specified number of bits from the buffer.</td>
</tr>
<tr valign=top>
<td><a href="oggpack_read1.html">oggpack_read1</a></td>
<td>Reads one bit from the buffer.</td>
</tr>
<tr valign=top>
<td><a href="oggpack_bytes.html">oggpack_bytes</a></td>
<td>Returns the total number of bytes contained within the buffer.</td>
</tr>
<tr valign=top>
<td><a href="oggpack_bits.html">oggpack_bits</a></td>
<td>Returns the total number of bits contained within the buffer.</td>
</tr>
<tr valign=top>
<td><a href="oggpack_get_buffer.html">oggpack_get_buffer</a></td>
<td>Returns a pointer to the buffer encapsulated within the <a href="oggpack_buffer.html">oggpack_buffer</a> struct.</td>
</tr>
</table>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,59 @@
<html>
<head>
<title>libogg - Base Data Structures</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>Base Data Structures</h1>
<p>Libogg uses several data structures to hold data and state information.
<p>
All the <b>libogg</b> specific data structures are declared in "ogg/ogg.h".
<p>
<table border=1 color=black width=50% cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td><b>datatype</b></td>
<td><b>purpose</b></td>
</tr>
<tr valign=top>
<td><a href="ogg_page.html">ogg_page</a></td>
<td>This structure encapsulates data into one ogg bitstream page.</td>
</tr>
<tr valign=top>
<td><a href="ogg_stream_state.html">ogg_stream_state</a></td>
<td>This structure contains current encode/decode data for a logical bitstream.</td>
</tr>
<tr valign=top>
<td><a href="ogg_packet.html">ogg_packet</a></td>
<td>This structure encapsulates the data and metadata for a single Ogg packet.</td>
</tr>
<tr valign=top>
<td><a href="ogg_sync_state.html">ogg_sync_state</a></td>
<td>Contains bitstream synchronization information.</td>
</tr>
</table>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,104 @@
<html>
<head>
<title>libogg - Decoding</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>Decoding</h1>
<p>Libogg contains a set of functions used in the decoding process.
<p>
All the <b>libogg</b> specific functions are declared in "ogg/ogg.h".
<p>
<p>Decoding is based around the ogg synchronization layer. The <a href="ogg_sync_state.html">ogg_sync_state</a> struct coordinates between incoming data and the decoder. We read data into the synchronization layer, submit the data to the stream, and output raw packets to the decoder.
<p>Decoding through the Ogg layer follows a specific logical sequence. A read loop follows these logical steps:
<ul>
<li>Expose a buffer using <a href="ogg_sync_buffer.html">ogg_sync_buffer()</a>.
<li>Read data into the buffer, using fread() or a similar function.
<li>Call <a href="ogg_sync_wrote.html">ogg_sync_wrote()</a> to tell the synchronization layer how many bytes you wrote into the buffer.
<li>Write out the data using <a href="ogg_sync_pageout.html">ogg_sync_pageout</a>.
<li>Submit the completed page to the streaming layer with <a href="ogg_stream_pagein.html">ogg_stream_pagein</a>.
<li>Output a packet of data to the codec-specific decoding layer using <a href="ogg_stream_packetout.html">ogg_stream_packetout</a>.
</ul>
<p>In practice, streams are more complex, and Ogg also must handle headers, incomplete or dropped pages, and other errors in input.
<br><br>
<table border=1 color=black width=50% cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td><b>function</b></td>
<td><b>purpose</b></td>
</tr>
<tr valign=top>
<td><a href="ogg_sync_init.html">ogg_sync_init</a></td>
<td>Initializes an Ogg bitstream.</td>
</tr>
<tr valign=top>
<td><a href="ogg_sync_clear.html">ogg_sync_clear</a></td>
<td>Clears the status information from the synchronization struct.<td>
</tr>
<tr valign=top>
<td><a href="ogg_sync_reset.html">ogg_sync_reset</a></td>
<td>Resets the synchronization status to initial values.</td>
</tr>
<tr valign=top>
<td><a href="ogg_sync_destroy.html">ogg_sync_destroy</a></td>
<td>Frees the synchronization struct.</td>
</tr>
<tr valign=top>
<td><a href="ogg_sync_check.html">ogg_sync_check</a></td>
<td>Check for asynchronous errors.</td>
</tr>
<tr valign=top>
<td><a href="ogg_sync_buffer.html">ogg_sync_buffer</a></td>
<td>Exposes a buffer from the synchronization layer in order to read data.</td>
</tr>
<tr valign=top>
<td><a href="ogg_sync_wrote.html">ogg_sync_wrote</a></td>
<td>Tells the synchronization layer how many bytes were written into the buffer.</td>
</tr>
<tr valign=top>
<td><a href="ogg_sync_pageseek.html">ogg_sync_pageseek</a></td>
<td>Finds the borders of pages and resynchronizes the stream.</td>
</tr>
<tr valign=top>
<td><a href="ogg_sync_pageout.html">ogg_sync_pageout</a></td>
<td>Outputs a page from the synchronization layer.</td>
</tr>
<tr valign=top>
<td><a href="ogg_stream_pagein.html">ogg_stream_pagein</a></td>
<td>Submits a complete page to the stream layer.</td>
</tr>
<tr valign=top>
<td><a href="ogg_stream_packetout.html">ogg_stream_packetout</a></td>
<td>Outputs a packet to the codec-specific decoding engine.</td>
</tr>
<tr valign=top>
<td><a href="ogg_stream_packetpeek.html">ogg_stream_packetpeek</a></td>
<td>Provides access to the next packet in the bitstream without
advancing decoding.</td>
</tr>
</table>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,76 @@
<html>
<head>
<title>libogg - Encoding</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>Encoding</h1>
<p>Libogg contains a set of functions used in the encoding process.
<p>
All the <b>libogg</b> specific functions are declared in "ogg/ogg.h".
<p>
<p>When encoding, the encoding engine will output raw packets which must be placed into an Ogg bitstream.
<p>Raw packets are inserted into the stream, and an <a href="ogg_page.html">ogg_page</a> is output when enough packets have been written to create a full page. The pages output are pointers to buffered packet segments, and can then be written out and saved as an ogg stream.
<p>There are a couple of basic steps:
<ul>
<li>Use the encoding engine to produce a raw packet of data.
<li>Call <a href="ogg_stream_packetin.html">ogg_stream_packetin</a> to submit a raw packet to the stream.
<li>Use <a href="ogg_stream_pageout.html">ogg_stream_pageout</a> to output a page, if enough data has been submitted. Otherwise, continue submitting data.
</ul>
<br><br>
<table border=1 color=black width=50% cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td><b>function</b></td>
<td><b>purpose</b></td>
</tr>
<tr valign=top>
<td><a href="ogg_stream_packetin.html">ogg_stream_packetin</a></td>
<td>Submits a raw packet to the streaming layer, so that it can be formed into a page.</td>
</tr>
<tr valign=top>
<td><a href="ogg_stream_iovecin.html">ogg_stream_iovecin</a></td>
<td>iovec version of ogg_stream_packetin() above.</td>
</tr>
<tr valign=top>
<td><a href="ogg_stream_pageout.html">ogg_stream_pageout</a></td>
<td>Outputs a completed page if the stream contains enough packets to form a full page.<td>
</tr>
<tr valign=top>
<td><a href="ogg_stream_pageout_fill.html">ogg_stream_pageout_fill</a></td>
<td>Similar to ogg_stream_pageout(), but specifies a page spill threshold in bytes.
</tr>
<tr valign=top>
<td><a href="ogg_stream_flush.html">ogg_stream_flush</a></td>
<td>Forces any remaining packets in the stream to be returned as a page of any size.<td>
</tr>
<tr valign=top>
<td><a href="ogg_stream_flush_fill.html">ogg_stream_flush_fill</a></td>
<td>Similar to ogg_stream_flush(), but specifies a page spill threshold in bytes.<td>
</tr>
</table>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,109 @@
<html>
<head>
<title>libogg - General Functions</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>General Functions</h1>
<p>Libogg contains several functions which are generally useful when using Ogg streaming, whether encoding or decoding.
<p>
All the <b>libogg</b> specific functions are declared in "ogg/ogg.h".
<p>
<p>These functions can be used to manipulate some of the basic elements of Ogg - streams and pages. Streams and pages are important during both the encode and decode process.
<br>
<table border=1 color=black width=50% cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td><b>function</b></td>
<td><b>purpose</b></td>
</tr>
<tr valign=top>
<td><a href="ogg_stream_init.html">ogg_stream_init</a></td>
<td>Initializes an Ogg bitstream.</td>
</tr>
<tr valign=top>
<td><a href="ogg_stream_clear.html">ogg_stream_clear</a></td>
<td>Clears the storage within the Ogg stream, but does not free the stream itself.<td>
</tr>
<tr valign=top>
<td><a href="ogg_stream_reset.html">ogg_stream_reset</a></td>
<td>Resets the stream status to its initial position.</td>
</tr>
<tr valign=top>
<td><a href="ogg_stream_destroy.html">ogg_stream_destroy</a></td>
<td>Frees the entire Ogg stream.</td>
</tr>
<tr valign=top>
<td><a href="ogg_stream_check.html">ogg_stream_check</a></td>
<td>Check for asynchronous errors.</td>
</tr>
<tr valign=top>
<td><a href="ogg_stream_eos.html">ogg_stream_eos</a></td>
<td>Indicates whether we are at the end of the stream.</td>
</tr>
<tr valign=top>
<td><a href="ogg_page_version.html">ogg_page_version</a></td>
<td>Returns the version of ogg_page that this stream/page uses</td>
</tr>
<tr valign=top>
<td><a href="ogg_page_continued.html">ogg_page_continued</a></td>
<td>Indicates if the current page contains a continued packet from the last page.</td>
</tr>
<tr valign=top>
<td><a href="ogg_page_packets.html">ogg_page_packets</a></td>
<td>Indicates the number of packets contained in a page.</td>
</tr>
<tr valign=top>
<td><a href="ogg_page_bos.html">ogg_page_bos</a></td>
<td>Indicates if the current page is the beginning of the stream.</td>
</tr>
<tr valign=top>
<td><a href="ogg_page_eos.html">ogg_page_eos</a></td>
<td>Indicates if the current page is the end of the stream.</td>
</tr>
<tr valign=top>
<td><a href="ogg_page_granulepos.html">ogg_page_granulepos</a></td>
<td>Returns the precise playback location of this page.</td>
</tr>
<tr valign=top>
<td><a href="ogg_page_serialno.html">ogg_page_serialno</a></td>
<td>Returns the unique serial number of the logical bitstream associated with this page.</td>
</tr>
<tr valign=top>
<td><a href="ogg_page_pageno.html">ogg_page_pageno</a></td>
<td>Returns the sequential page number for this page.</td>
</tr>
<tr valign=top>
<td><a href="ogg_packet_clear.html">ogg_packet_clear</a></td>
<td>Clears the ogg_packet structure.</td>
</tr>
<tr valign=top>
<td><a href="ogg_page_checksum_set.html">ogg_page_checksum_set</a></td>
<td>Checksums an ogg_page.</td>
</tr>
</table>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,39 @@
<html>
<head>
<title>libogg - Documentation</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>Libogg Documentation</h1>
<p>
Libogg contains necessary functionality to create, decode, and work with Ogg bitstreams.
<p>This document explains how to use the libogg API in detail.
<p>
<a href="overview.html">libogg api overview</a><br>
<a href="reference.html">libogg api reference</a><br>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,62 @@
<html>
<head>
<title>libogg - datatype - ogg_iovec_t</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>ogg_iovec_t</h1>
<p><i>declared in "ogg/ogg.h"</i></p>
<p>
The ogg_iovec_t struct encapsulates a length-encoded buffer. An array
of ogg_iovec_t is used to pass a list of buffers to functions that
accept data in ogg_iovec_t* form.
<p>
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
typedef struct {
void *iov_base;
size_t iov_len;
} ogg_iovec_t;
</b></pre>
</td>
</tr>
</table>
<h3>Relevant Struct Members</h3>
<dl>
<dt><i>iov_base</i></dt>
<dd>Pointer to the buffer data.</dd>
<dt><i>iov_len</i></dt>
<dd>Length of buffer data in bytes.</dd>
</dl>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,75 @@
<html>
<head>
<title>libogg - datatype - ogg_packet</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>ogg_packet</h1>
<p><i>declared in "ogg/ogg.h"</i></p>
<p>
The ogg_packet struct encapsulates the data for a single raw packet of data
and is used to transfer data between the ogg framing layer and the handling codec.
<p>
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
typedef struct {
unsigned char *packet;
long bytes;
long b_o_s;
long e_o_s;
ogg_int64_t granulepos;
ogg_int64_t packetno;
} ogg_packet;
</b></pre>
</td>
</tr>
</table>
<h3>Relevant Struct Members</h3>
<dl>
<dt><i>packet</i></dt>
<dd>Pointer to the packet's data. This is treated as an opaque type by the ogg layer.</dd>
<dt><i>bytes</i></dt>
<dd>Indicates the size of the packet data in bytes. Packets can be of arbitrary size.</dd>
<dt><i>b_o_s</i></dt>
<dd>Flag indicating whether this packet begins a logical bitstream. <tt>1</tt> indicates this is the first packet, <tt>0</tt> indicates any other position in the stream.</dd>
<dt><i>e_o_s</i></dt>
<dd>Flag indicating whether this packet ends a bitstream. <tt>1</tt> indicates the last packet, <tt>0</tt> indicates any other position in the stream.</dd>
<dt><i>granulepos</i></dt>
<dd>A number indicating the position of this packet in the decoded data. This is the last sample, frame or other unit of information ('granule') that can be completely decoded from this packet.</dd>
<dt><i>packetno</i></dt>
<dd>Sequential number of this packet in the ogg bitstream.<dd>
</dl>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,64 @@
<html>
<head>
<title>libogg - function - ogg_packet_clear</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>ogg_packet_clear</h1>
<p><i>declared in "ogg/ogg.h";</i></p>
<p>This function clears the memory used by the <a href="ogg_packet.html">ogg_packet</a> struct,
but does not free the structure itself.
It unconditionally frees the <i>packet</i> data buffer,
then it zeros all structure members.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
void ogg_packet_clear(ogg_packet *op);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>op</i></dt>
<dd>Pointer to the ogg_packet struct to be cleared.</dd>
</dl>
<h3>Return Values</h3>
<blockquote>
<li>
None.</li>
</blockquote>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,75 @@
<html>
<head>
<title>libogg - datatype - ogg_page</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>ogg_page</h1>
<p><i>declared in "ogg/ogg.h"</i></p>
<p>
The ogg_page struct encapsulates the data for an Ogg page.
<p>
Ogg pages are the fundamental unit of framing and interleave in an ogg bitstream.
They are made up of packet segments of 255 bytes each. There can be as many as
255 packet segments per page, for a maximum page size of a little under 64 kB.
This is not a practical limitation as the segments can be joined across
page boundaries allowing packets of arbitrary size. In practice many
applications will not completely fill all pages because they flush the
accumulated packets periodically order to bound latency more tightly.
<p>
<p>For a complete description of ogg pages and headers, please refer to the <a href="../framing.html">framing document</a>.
<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
typedef struct {
unsigned char *header;
long header_len;
unsigned char *body;
long body_len;
} ogg_page;
</b></pre>
</td>
</tr>
</table>
<h3>Relevant Struct Members</h3>
<dl>
<dt><i>header</i></dt>
<dd>Pointer to the page header for this page. The exact contents of this header are defined in the framing spec document.</dd>
<dt><i>header_len</i></dt>
<dd>Length of the page header in bytes.</a>
<dt><i>body</i></dt>
<dd>Pointer to the data for this page.</dd>
<dt><i>body_len</i></dt>
<dd>Length of the body data in bytes.</dd>
</dl>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,65 @@
<html>
<head>
<title>libogg - function - ogg_page_bos</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>ogg_page_bos</h1>
<p><i>declared in "ogg/ogg.h";</i></p>
<p>Indicates whether this page is at the beginning of the logical bitstream.
<p>
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ogg_page_bos(ogg_page *og);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>og</i></dt>
<dd>Pointer to the current ogg_page struct.</dd>
</dl>
<h3>Return Values</h3>
<blockquote>
<li>
greater than 0 if this page is the beginning of a bitstream.</li>
<li>
0 if this page is from any other location in the stream.</li>
</blockquote>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,62 @@
<html>
<head>
<title>libogg - function - ogg_page_checksum_set</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>ogg_page_checksum_set</h1>
<p><i>declared in "ogg/ogg.h";</i></p>
<p>Checksums an ogg_page.
<p>
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ogg_page_checksum_set(ogg_page *og);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>og</i></dt>
<dd>Pointer to an ogg_page struct.</dd>
</dl>
<h3>Return Values</h3>
<blockquote>
None.
</blockquote>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,64 @@
<html>
<head>
<title>libogg - function - ogg_page_version</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>ogg_page_continued</h1>
<p><i>declared in "ogg/ogg.h";</i></p>
<p>Indicates whether this page contains packet data which has been continued from the previous page.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ogg_page_continued(ogg_page *og);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>og</i></dt>
<dd>Pointer to the current ogg_page struct.</dd>
</dl>
<h3>Return Values</h3>
<blockquote>
<li>
1 if this page contains packet data continued from the last page.</li>
<li>
0 if this page does not contain continued data.</li>
</blockquote>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,65 @@
<html>
<head>
<title>libogg - function - ogg_page_eos</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>ogg_page_eos</h1>
<p><i>declared in "ogg/ogg.h";</i></p>
<p>Indicates whether this page is at the end of the logical bitstream.
<p>
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ogg_page_eos(ogg_page *og);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>og</i></dt>
<dd>Pointer to the current ogg_page struct.</dd>
</dl>
<h3>Return Values</h3>
<blockquote>
<li>
greater than zero if this page contains the end of a bitstream.</li>
<li>
0 if this page is from any other location in the stream.</li>
</blockquote>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,65 @@
<html>
<head>
<title>libogg - function - ogg_page_granulepos</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>ogg_page_granulepos</h1>
<p><i>declared in "ogg/ogg.h";</i></p>
<p>Returns the exact granular position of the packet data contained at the end of this page.
<p>This is useful for tracking location when seeking or decoding.
<p>For example, in audio codecs this position is the pcm sample number and in video this is the frame number.
<p>
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
ogg_int64_t ogg_page_granulepos(ogg_page *og);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>og</i></dt>
<dd>Pointer to the current ogg_page struct.</dd>
</dl>
<h3>Return Values</h3>
<blockquote>
<li>
<i>n</i> is the specific last granular position of the decoded data contained in the page.</li>
</blockquote>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,75 @@
<html>
<head>
<title>libogg - function - ogg_page_packets</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>ogg_page_packets</h1>
<p><i>declared in "ogg/ogg.h";</i></p>
<p>Returns the number of packets that are completed on this page. If the
leading packet is begun on a previous page, but ends on this page, it's
counted.
<p>
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ogg_page_packets(ogg_page *og);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>og</i></dt>
<dd>Pointer to the current ogg_page struct.</dd>
</dl>
<h3>Return Values</h3>
<blockquote>
If a page consists of a packet begun on a previous page, and a new packet
begun (but not completed) on this page, the return will be:<br>
<br>
ogg_page_packets(page) will return 1,<br>
ogg_page_continued(paged) will return non-zero.<br>
<br><br>
If a page happens to be a single packet that was begun on a previous page, and
spans to the next page (in the case of a three or more page packet), the
return will be:<br>
<br>
ogg_page_packets(page) will return 0,<br>
ogg_page_continued(page) will return non-zero.<br>
</blockquote>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,63 @@
<html>
<head>
<title>libogg - function - ogg_page_pageno</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>ogg_page_pageno</h1>
<p><i>declared in "ogg/ogg.h";</i></p>
<p>Returns the sequential page number.
<p>This is useful for ordering pages or determining when pages have been lost.
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
long ogg_page_pageno(ogg_page *og);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>og</i></dt>
<dd>Pointer to the current ogg_page struct.</dd>
</dl>
<h3>Return Values</h3>
<blockquote>
<li>
<i>n</i> is the page number for this page.</li>
</blockquote>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,63 @@
<html>
<head>
<title>libogg - function - ogg_page_serialno</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
<table border=0 width=100%>
<tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
<h1>ogg_page_serialno</h1>
<p><i>declared in "ogg/ogg.h";</i></p>
<p>Returns the unique serial number for the logical bitstream of this page. Each page contains the serial number for the logical bitstream that it belongs to.
<p>
<br><br>
<table border=0 color=black cellspacing=0 cellpadding=7>
<tr bgcolor=#cccccc>
<td>
<pre><b>
int ogg_page_serialno(ogg_page *og);
</b></pre>
</td>
</tr>
</table>
<h3>Parameters</h3>
<dl>
<dt><i>og</i></dt>
<dd>Pointer to the current ogg_page struct.</dd>
</dl>
<h3>Return Values</h3>
<blockquote>
<li>
<i>n</i> is the serial number for this page.</li>
</blockquote>
<p>
<br><br>
<hr noshade>
<table border=0 width=100%>
<tr valign=top>
<td><p class=tiny>copyright &copy; 2000-2021 Xiph.Org Foundation</p></td>
<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/">Ogg Container Format</a></p></td>
</tr><tr>
<td><p class=tiny>libogg documentation</p></td>
<td align=right><p class=tiny>libogg release 1.3.5 - 20210603</p></td>
</tr>
</table>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More