#include "modules/portal/pipewire_stubs.h"
#include <dlfcn.h>
#include <cstdarg>
#include "base/compiler_specific.h"
#include "rtc_base/logging.h"
extern "C" {
#include <pipewire/pipewire.h>
}
namespace {
void LogDlerror(const char* symbol) { … }
}
extern "C" {
static int (*pw_core_disconnect_ptr)(pw_core *core) = …;
static void (*pw_loop_destroy_ptr)(pw_loop *loop) = …;
static pw_loop * (*pw_loop_new_ptr)(const spa_dict *props) = …;
static void (*pw_init_ptr)(int *argc, char **argv[]) = …;
static const char* (*pw_get_library_version_ptr)() = …;
static pw_properties * (*pw_properties_new_string_ptr)(const char *args) = …;
static void (*pw_stream_add_listener_ptr)(pw_stream *stream, spa_hook *listener, const pw_stream_events *events, void *data) = …;
static int (*pw_stream_connect_ptr)(pw_stream *stream, enum pw_direction direction, uint32_t target_id, enum pw_stream_flags flags, const spa_pod **params, uint32_t n_params) = …;
static int (*pw_stream_disconnect_ptr)(pw_stream *stream) = …;
static pw_buffer * (*pw_stream_dequeue_buffer_ptr)(pw_stream *stream) = …;
static void (*pw_stream_destroy_ptr)(pw_stream *stream) = …;
static pw_stream * (*pw_stream_new_ptr)(pw_core *core, const char *name, pw_properties *props) = …;
static int (*pw_stream_queue_buffer_ptr)(pw_stream *stream, pw_buffer *buffer) = …;
static int (*pw_stream_set_active_ptr)(pw_stream *stream, bool active) = …;
static int (*pw_stream_update_params_ptr)(pw_stream *stream, const spa_pod **params, uint32_t n_params) = …;
static uint32_t (*pw_stream_get_node_id_ptr)(pw_stream *stream) = …;
static pw_stream_state (*pw_stream_get_state_ptr)(pw_stream *stream, const char **error) = …;
static const char * (*pw_stream_state_as_string_ptr)(enum pw_stream_state state) = …;
static void (*pw_thread_loop_destroy_ptr)(pw_thread_loop *loop) = …;
static pw_thread_loop * (*pw_thread_loop_new_ptr)(const char *name, const spa_dict *props) = …;
static int (*pw_thread_loop_start_ptr)(pw_thread_loop *loop) = …;
static void (*pw_thread_loop_stop_ptr)(pw_thread_loop *loop) = …;
static void (*pw_thread_loop_lock_ptr)(pw_thread_loop *loop) = …;
static void (*pw_thread_loop_unlock_ptr)(pw_thread_loop *loop) = …;
static pw_loop * (*pw_thread_loop_get_loop_ptr)(pw_thread_loop *loop) = …;
static void (*pw_thread_loop_signal_ptr)(pw_thread_loop *loop, bool wait_for_accept) = …;
static void (*pw_thread_loop_wait_ptr)(pw_thread_loop *loop) = …;
static void (*pw_context_destroy_ptr)(pw_context *context) = …;
static pw_context * (*pw_context_new_ptr)(pw_loop *main_loop, pw_properties *props, size_t user_data_size) = …;
static pw_core * (*pw_context_connect_ptr)(pw_context *context, pw_properties *properties, size_t user_data_size) = …;
static pw_core * (*pw_context_connect_fd_ptr)(pw_context *context, int fd, pw_properties *properties, size_t user_data_size) = …;
static void (*pw_proxy_destroy_ptr)(struct pw_proxy *proxy) = …;
extern int pw_core_disconnect(pw_core *core) __attribute__((weak));
DISABLE_CFI_ICALL
int pw_core_disconnect(pw_core *core) { … }
extern void pw_loop_destroy(pw_loop *loop) __attribute__((weak));
DISABLE_CFI_ICALL
void pw_loop_destroy(pw_loop *loop) { … }
extern pw_loop * pw_loop_new(const spa_dict *props) __attribute__((weak));
DISABLE_CFI_ICALL
pw_loop * pw_loop_new(const spa_dict *props) { … }
extern void pw_init(int *argc, char **argv[]) __attribute__((weak));
DISABLE_CFI_ICALL
void pw_init(int *argc, char **argv[]) { … }
extern const char* pw_get_library_version() __attribute__((weak));
DISABLE_CFI_ICALL
const char* pw_get_library_version() { … }
extern pw_properties * pw_properties_new_string(const char *args) __attribute__((weak));
DISABLE_CFI_ICALL
pw_properties * pw_properties_new_string(const char *args) { … }
extern void pw_stream_add_listener(pw_stream *stream, spa_hook *listener, const pw_stream_events *events, void *data) __attribute__((weak));
DISABLE_CFI_ICALL
void pw_stream_add_listener(pw_stream *stream, spa_hook *listener, const pw_stream_events *events, void *data) { … }
extern int pw_stream_connect(pw_stream *stream, enum pw_direction direction, uint32_t target_id, enum pw_stream_flags flags, const spa_pod **params, uint32_t n_params) __attribute__((weak));
DISABLE_CFI_ICALL
int pw_stream_connect(pw_stream *stream, enum pw_direction direction, uint32_t target_id, enum pw_stream_flags flags, const spa_pod **params, uint32_t n_params) { … }
extern int pw_stream_disconnect(pw_stream *stream) __attribute__((weak));
DISABLE_CFI_ICALL
int pw_stream_disconnect(pw_stream *stream) { … }
extern pw_buffer * pw_stream_dequeue_buffer(pw_stream *stream) __attribute__((weak));
DISABLE_CFI_ICALL
pw_buffer * pw_stream_dequeue_buffer(pw_stream *stream) { … }
extern void pw_stream_destroy(pw_stream *stream) __attribute__((weak));
DISABLE_CFI_ICALL
void pw_stream_destroy(pw_stream *stream) { … }
extern pw_stream * pw_stream_new(pw_core *core, const char *name, pw_properties *props) __attribute__((weak));
DISABLE_CFI_ICALL
pw_stream * pw_stream_new(pw_core *core, const char *name, pw_properties *props) { … }
extern int pw_stream_queue_buffer(pw_stream *stream, pw_buffer *buffer) __attribute__((weak));
DISABLE_CFI_ICALL
int pw_stream_queue_buffer(pw_stream *stream, pw_buffer *buffer) { … }
extern int pw_stream_set_active(pw_stream *stream, bool active) __attribute__((weak));
DISABLE_CFI_ICALL
int pw_stream_set_active(pw_stream *stream, bool active) { … }
extern int pw_stream_update_params(pw_stream *stream, const spa_pod **params, uint32_t n_params) __attribute__((weak));
DISABLE_CFI_ICALL
int pw_stream_update_params(pw_stream *stream, const spa_pod **params, uint32_t n_params) { … }
extern uint32_t pw_stream_get_node_id(pw_stream *stream) __attribute__((weak));
DISABLE_CFI_ICALL
uint32_t pw_stream_get_node_id(pw_stream *stream) { … }
extern pw_stream_state pw_stream_get_state(pw_stream *stream, const char **error) __attribute__((weak));
DISABLE_CFI_ICALL
pw_stream_state pw_stream_get_state(pw_stream *stream, const char **error) { … }
extern const char * pw_stream_state_as_string(enum pw_stream_state state) __attribute__((weak));
DISABLE_CFI_ICALL
const char * pw_stream_state_as_string(enum pw_stream_state state) { … }
extern void pw_thread_loop_destroy(pw_thread_loop *loop) __attribute__((weak));
DISABLE_CFI_ICALL
void pw_thread_loop_destroy(pw_thread_loop *loop) { … }
extern pw_thread_loop * pw_thread_loop_new(const char *name, const spa_dict *props) __attribute__((weak));
DISABLE_CFI_ICALL
pw_thread_loop * pw_thread_loop_new(const char *name, const spa_dict *props) { … }
extern int pw_thread_loop_start(pw_thread_loop *loop) __attribute__((weak));
DISABLE_CFI_ICALL
int pw_thread_loop_start(pw_thread_loop *loop) { … }
extern void pw_thread_loop_stop(pw_thread_loop *loop) __attribute__((weak));
DISABLE_CFI_ICALL
void pw_thread_loop_stop(pw_thread_loop *loop) { … }
extern void pw_thread_loop_lock(pw_thread_loop *loop) __attribute__((weak));
DISABLE_CFI_ICALL
void pw_thread_loop_lock(pw_thread_loop *loop) { … }
extern void pw_thread_loop_unlock(pw_thread_loop *loop) __attribute__((weak));
DISABLE_CFI_ICALL
void pw_thread_loop_unlock(pw_thread_loop *loop) { … }
extern pw_loop * pw_thread_loop_get_loop(pw_thread_loop *loop) __attribute__((weak));
DISABLE_CFI_ICALL
pw_loop * pw_thread_loop_get_loop(pw_thread_loop *loop) { … }
extern void pw_thread_loop_signal(pw_thread_loop *loop, bool wait_for_accept) __attribute__((weak));
DISABLE_CFI_ICALL
void pw_thread_loop_signal(pw_thread_loop *loop, bool wait_for_accept) { … }
extern void pw_thread_loop_wait(pw_thread_loop *loop) __attribute__((weak));
DISABLE_CFI_ICALL
void pw_thread_loop_wait(pw_thread_loop *loop) { … }
extern void pw_context_destroy(pw_context *context) __attribute__((weak));
DISABLE_CFI_ICALL
void pw_context_destroy(pw_context *context) { … }
extern pw_context * pw_context_new(pw_loop *main_loop, pw_properties *props, size_t user_data_size) __attribute__((weak));
DISABLE_CFI_ICALL
pw_context * pw_context_new(pw_loop *main_loop, pw_properties *props, size_t user_data_size) { … }
extern pw_core * pw_context_connect(pw_context *context, pw_properties *properties, size_t user_data_size) __attribute__((weak));
DISABLE_CFI_ICALL
pw_core * pw_context_connect(pw_context *context, pw_properties *properties, size_t user_data_size) { … }
extern pw_core * pw_context_connect_fd(pw_context *context, int fd, pw_properties *properties, size_t user_data_size) __attribute__((weak));
DISABLE_CFI_ICALL
pw_core * pw_context_connect_fd(pw_context *context, int fd, pw_properties *properties, size_t user_data_size) { … }
extern void pw_proxy_destroy(struct pw_proxy *proxy) __attribute__((weak));
DISABLE_CFI_ICALL
void pw_proxy_destroy(struct pw_proxy *proxy) { … }
}
namespace modules_portal {
bool IsPipewireInitialized() { … }
void InitializePipewire(void* module) { … }
void UninitializePipewire() { … }
}
namespace modules_portal {
StubHandleMap;
static void CloseLibraries(StubHandleMap* stub_handles) { … }
bool InitializeStubs(const StubPathMap& path_map) { … }
}