From 35702d95a8ae34279c0a21035a3b7f9a7286dcfa Mon Sep 17 00:00:00 2001 From: Mikhail Burakov Date: Sun, 12 May 2024 17:10:01 +0200 Subject: Make pipewire and audio capturing optional --- audio.c | 4 ++++ audio.h | 7 +++++++ makefile | 6 +++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/audio.c b/audio.c index 358382a..0395748 100644 --- a/audio.c +++ b/audio.c @@ -15,6 +15,8 @@ * along with streamer. If not, see . */ +#ifdef USE_PIPEWIRE + #include "audio.h" #include @@ -277,3 +279,5 @@ void AudioContextDestroy(struct AudioContext* audio_context) { free(audio_context); pw_deinit(); } + +#endif // USE_PIPEWIRE diff --git a/audio.h b/audio.h index 377a62f..1bb71b2 100644 --- a/audio.h +++ b/audio.h @@ -27,10 +27,17 @@ struct AudioContextCallbacks { void (*OnAudioReady)(void* user, const void* buffer, size_t size); }; +#ifdef USE_PIPEWIRE struct AudioContext* AudioContextCreate( const struct AudioContextCallbacks* callbacks, void* user); int AudioContextGetEventsFd(struct AudioContext* audio_context); bool AudioContextProcessEvents(struct AudioContext* audio_context); void AudioContextDestroy(struct AudioContext* audio_context); +#else // USE_PIPEWIRE +#define AudioContextCreate(...) ((void*)~0) +#define AudioContextGetEventsFd(...) -1 +#define AudioContextProcessEvents(...) false +#define AudioContextDestroy(...) +#endif #endif // STREAMER_AUDIO_H_ diff --git a/makefile b/makefile index 1c5b018..fddd5a0 100644 --- a/makefile +++ b/makefile @@ -12,7 +12,6 @@ libs:=\ gbm \ glesv2 \ libdrm \ - libpipewire-0.3 \ libva \ libva-drm @@ -34,6 +33,11 @@ ifdef USE_WAYLAND CFLAGS+=-DUSE_WAYLAND endif +ifdef USE_PIPEWIRE + libs+=libpipewire-0.3 + CFLAGS+=-DUSE_PIPEWIRE +endif + #CFLAGS+=-DUSE_EGL_MESA_PLATFORM_SURFACELESS CFLAGS+=$(shell pkg-config --cflags $(libs)) LDFLAGS+=$(shell pkg-config --libs $(libs)) -- cgit v1.2.3