summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Burakov <mburakov@mailbox.org>2024-05-12 17:10:01 +0200
committerMikhail Burakov <mburakov@mailbox.org>2024-05-12 17:10:01 +0200
commit35702d95a8ae34279c0a21035a3b7f9a7286dcfa (patch)
treeb57d737bddcaccb54055b1f7657b327f38ed2192
parent3a0242c399e274323d8a68cc45a063b1b2c3bbcd (diff)
Make pipewire and audio capturing optional
-rw-r--r--audio.c4
-rw-r--r--audio.h7
-rw-r--r--makefile6
3 files changed, 16 insertions, 1 deletions
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 <https://www.gnu.org/licenses/>.
*/
+#ifdef USE_PIPEWIRE
+
#include "audio.h"
#include <errno.h>
@@ -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))