Skip to content

Commit 76b0a8f

Browse files
authored
Add play .opus audio files support (#2488)
1 parent 4811a4a commit 76b0a8f

27 files changed

+7327
-37
lines changed

3rdparty/CMakeLists.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,21 @@ if (AX_ENABLE_AUDIO)
413413
endif()
414414
endif()
415415

416-
417-
# The ogg decoder
416+
# The ogg contains vorbis & opus(optional) decoders
418417
ax_add_3rd(ogg)
418+
419+
# opus
420+
if(AX_ENABLE_OPUS)
421+
_1kfetch(opus)
422+
ax_add_3rd(${opus_SOURCE_DIR} NO_LINK TARGETS opus OPTIONS
423+
"OPUS_INSTALL_PKG_CONFIG_MODULE OFF"
424+
"OPUS_INSTALL_CMAKE_CONFIG_MODULE OFF"
425+
"OPUS_BUILD_PROGRAMS OFF"
426+
"OPUS_BUILD_TESTING OFF"
427+
"OPUS_CUSTOM_MODES OFF"
428+
)
429+
target_link_libraries(ogg opus)
430+
endif()
419431
endif()
420432

421433
if(WINDOWS OR LINUX OR ANDROID OR WASM)

3rdparty/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,17 @@
162162
- Version: 1.9.3
163163
- License: Apache-2.0
164164

165-
## ogg & vorbis
165+
## ogg
166166
- ogg
167167
- [![Upstream](https://img.shields.io/github/v/release/xiph/ogg?label=Upstream)](https://github.com/xiph/ogg)
168168
- Version: 1.3.5
169169
- License: BSD-3-Clause
170170

171+
- opus
172+
- [![Upstream](https://img.shields.io/github/v/release/xiph/opus?label=Upstream)](https://github.com/xiph/opus)
173+
- Version: 1.5.2
174+
- License: BSD-3-Clause
175+
171176
- vorbis
172177
- [![Upstream](https://img.shields.io/github/v/release/xiph/vorbis?label=Upstream)](https://github.com/xiph/vorbis)
173178
- Version: 1.3.7-83a82dd (1569)

3rdparty/ogg/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ project(${target_name})
77
set(${target_name}_src
88
src/ogg/bitwise.c
99
src/ogg/framing.c
10+
)
11+
12+
list(APPEND ${target_name}_src
1013
src/vorbis/analysis.c
1114
src/vorbis/bitrate.c
1215
src/vorbis/block.c
@@ -31,11 +34,26 @@ set(${target_name}_src
3134
src/vorbis/window.c
3235
)
3336

37+
if(AX_ENABLE_OPUS)
38+
list(APPEND ${target_name}_src
39+
src/opus/info.c
40+
src/opus/internal.c
41+
src/opus/opusfile.c
42+
src/opus/stream.c
43+
)
44+
endif()
45+
3446
add_library(${target_name} STATIC
3547
${${target_name}_src}
3648
)
3749

3850
target_include_directories(${target_name}
3951
PUBLIC "${CMAKE_CURRENT_LIST_DIR}/include"
52+
PRIVATE "${CMAKE_CURRENT_LIST_DIR}/include/opus"
4053
PRIVATE "${CMAKE_CURRENT_LIST_DIR}/src/vorbis"
54+
PRIVATE "${CMAKE_CURRENT_LIST_DIR}/src/opus"
4155
)
56+
57+
if(AX_ENABLE_OPUS)
58+
set_target_properties(${target_name} PROPERTIES INTERFACE_COMPILE_DEFINITIONS AX_ENABLE_OPUS=1)
59+
endif()

0 commit comments

Comments
 (0)