mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-23 08:44:04 +02:00
Merge PipeWire backend into the main library.
This commit is contained in:
+1
-24
@@ -607,24 +607,6 @@ target_compile_definitions(miniaudio PRIVATE ${COMPILE_DEFINES})
|
|||||||
|
|
||||||
# Extra Backends
|
# Extra Backends
|
||||||
if(NOT MINIAUDIO_NO_DEVICEIO)
|
if(NOT MINIAUDIO_NO_DEVICEIO)
|
||||||
if(NOT MINIAUDIO_NO_PIPEWIRE)
|
|
||||||
add_library(miniaudio_pipewire STATIC
|
|
||||||
extras/backends/pipewire/miniaudio_pipewire.c
|
|
||||||
extras/backends/pipewire/miniaudio_pipewire.h
|
|
||||||
)
|
|
||||||
|
|
||||||
list(APPEND LIBS_TO_INSTALL miniaudio_pipewire)
|
|
||||||
install(FILES extras/backends/pipewire/miniaudio_pipewire.h DESTINATION include/miniaudio/extras/backends/pipewire)
|
|
||||||
|
|
||||||
target_include_directories(miniaudio_pipewire PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/extras/backends/pipewire)
|
|
||||||
target_compile_options (miniaudio_pipewire PRIVATE ${COMPILE_OPTIONS})
|
|
||||||
target_compile_definitions(miniaudio_pipewire PRIVATE ${COMPILE_DEFINES})
|
|
||||||
|
|
||||||
if(MINIAUDIO_NO_RUNTIME_LINKING AND TARGET PkgConfig::PipeWire AND TARGET PkgConfig::SPA)
|
|
||||||
target_link_libraries(miniaudio_pipewire PRIVATE PkgConfig::PipeWire PkgConfig::SPA)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT MINIAUDIO_NO_SDL2)
|
if(NOT MINIAUDIO_NO_SDL2)
|
||||||
add_library(miniaudio_sdl2 STATIC
|
add_library(miniaudio_sdl2 STATIC
|
||||||
extras/backends/sdl2/miniaudio_sdl2.c
|
extras/backends/sdl2/miniaudio_sdl2.c
|
||||||
@@ -757,8 +739,7 @@ if(MINIAUDIO_NO_RUNTIME_LINKING)
|
|||||||
if(TARGET PkgConfig::PipeWire AND TARGET PkgConfig::SPA)
|
if(TARGET PkgConfig::PipeWire AND TARGET PkgConfig::SPA)
|
||||||
target_link_libraries(miniaudio PRIVATE PkgConfig::PipeWire PkgConfig::SPA)
|
target_link_libraries(miniaudio PRIVATE PkgConfig::PipeWire PkgConfig::SPA)
|
||||||
target_link_libraries(miniaudio_test INTERFACE PkgConfig::PipeWire PkgConfig::SPA)
|
target_link_libraries(miniaudio_test INTERFACE PkgConfig::PipeWire PkgConfig::SPA)
|
||||||
list(APPEND LINKED_LIBS libpipewire-0.3)
|
list(APPEND LINKED_LIBS libpipewire-0.3 libspa-0.2)
|
||||||
list(APPEND LINKED_LIBS libspa-0.2)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -806,10 +787,6 @@ if(MINIAUDIO_BUILD_TESTS)
|
|||||||
function(add_miniaudio_test name source)
|
function(add_miniaudio_test name source)
|
||||||
add_executable(${name} ${TESTS_DIR}/${source})
|
add_executable(${name} ${TESTS_DIR}/${source})
|
||||||
target_link_libraries(${name} PRIVATE miniaudio_test)
|
target_link_libraries(${name} PRIVATE miniaudio_test)
|
||||||
if(TARGET miniaudio_pipewire)
|
|
||||||
target_link_libraries(${name} PRIVATE miniaudio_pipewire)
|
|
||||||
target_compile_definitions(${name} PRIVATE MA_TESTS_INCLUDE_PIPEWIRE)
|
|
||||||
endif()
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Disable C++ tests when forcing C89. This is needed because we'll be passing -std=c89 which will cause errors when trying to compile a C++ file.
|
# Disable C++ tests when forcing C89. This is needed because we'll be passing -std=c89 which will cause errors when trying to compile a C++ file.
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,34 +0,0 @@
|
|||||||
#ifndef miniaudio_backend_pipewire_h
|
|
||||||
#define miniaudio_backend_pipewire_h
|
|
||||||
|
|
||||||
#include "../../../miniaudio.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int _unused;
|
|
||||||
} ma_context_config_pipewire;
|
|
||||||
|
|
||||||
MA_API ma_context_config_pipewire ma_context_config_pipewire_init(void);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
const char* pThreadName; /* If NULL, defaults to "miniaudio-pipewire". */
|
|
||||||
const char* pStreamName; /* If NULL, defaults to "miniaudio" */
|
|
||||||
const char* pMediaRole; /* If NULL, defaults to "Game". */
|
|
||||||
} ma_device_config_pipewire;
|
|
||||||
|
|
||||||
MA_API ma_device_config_pipewire ma_device_config_pipewire_init(void);
|
|
||||||
|
|
||||||
|
|
||||||
extern ma_device_backend_vtable* ma_device_backend_pipewire;
|
|
||||||
MA_API ma_device_backend_vtable* ma_pipewire_get_vtable(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* miniaudio_backend_pipewire_h */
|
|
||||||
+3094
-7
File diff suppressed because it is too large
Load Diff
@@ -52,10 +52,6 @@ are specified the last one on the command line will have priority.
|
|||||||
#include "../common/common.c"
|
#include "../common/common.c"
|
||||||
#include "../../extras/backends/sdl2/miniaudio_sdl2.c"
|
#include "../../extras/backends/sdl2/miniaudio_sdl2.c"
|
||||||
|
|
||||||
#if defined(MA_TESTS_INCLUDE_PIPEWIRE)
|
|
||||||
#include "../../extras/backends/pipewire/miniaudio_pipewire.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef AUTO_CLOSE_TIME_IN_MILLISECONDS
|
#ifndef AUTO_CLOSE_TIME_IN_MILLISECONDS
|
||||||
#define AUTO_CLOSE_TIME_IN_MILLISECONDS 5000
|
#define AUTO_CLOSE_TIME_IN_MILLISECONDS 5000
|
||||||
#endif
|
#endif
|
||||||
@@ -170,6 +166,10 @@ ma_bool32 try_parse_backend(const char* arg, ma_device_backend_config* pBackends
|
|||||||
pBackends[backendCount++] = ma_device_backend_config_init(ma_device_backend_oss, NULL);
|
pBackends[backendCount++] = ma_device_backend_config_init(ma_device_backend_oss, NULL);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
if (strcmp(arg, "pipewire") == 0) {
|
||||||
|
pBackends[backendCount++] = ma_device_backend_config_init(ma_device_backend_pipewire, NULL);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
if (strcmp(arg, "pulseaudio") == 0 || strcmp(arg, "pulse") == 0) {
|
if (strcmp(arg, "pulseaudio") == 0 || strcmp(arg, "pulse") == 0) {
|
||||||
pBackends[backendCount++] = ma_device_backend_config_init(ma_device_backend_pulseaudio, NULL);
|
pBackends[backendCount++] = ma_device_backend_config_init(ma_device_backend_pulseaudio, NULL);
|
||||||
goto done;
|
goto done;
|
||||||
@@ -202,14 +202,6 @@ ma_bool32 try_parse_backend(const char* arg, ma_device_backend_config* pBackends
|
|||||||
pBackends[backendCount++] = ma_device_backend_config_init(ma_device_backend_sdl2, NULL);
|
pBackends[backendCount++] = ma_device_backend_config_init(ma_device_backend_sdl2, NULL);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (strcmp(arg, "pipewire") == 0) {
|
|
||||||
#if defined(MA_TESTS_INCLUDE_PIPEWIRE)
|
|
||||||
pBackends[backendCount++] = ma_device_backend_config_init(ma_device_backend_pipewire, NULL);
|
|
||||||
#else
|
|
||||||
printf("ERROR: Attempting to use PipeWire, but it was not compiled in. Compile with MA_TESTS_INCLUDE_PIPEWIRE.");
|
|
||||||
#endif
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (*pBackendCount < backendCount) {
|
if (*pBackendCount < backendCount) {
|
||||||
@@ -306,15 +298,6 @@ void print_enabled_backends(void)
|
|||||||
printf(" SDL2\n");
|
printf(" SDL2\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MA_TESTS_INCLUDE_PIPEWIRE)
|
|
||||||
{
|
|
||||||
if (ma_device_backend_pipewire != NULL) {
|
|
||||||
printf(" PipeWire\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user