Bug 1790496 - P6 - add new signatures to mozpipewire.cpp;r=mjf

Differential Revision: https://phabricator.services.mozilla.com/D163977
This commit is contained in:
Nico Grunbaum 2023-01-19 21:23:59 +00:00
parent 679051037b
commit 9584afd2c6

View File

@ -69,11 +69,13 @@ static int (*pw_stream_connect_fn)(struct pw_stream *stream,
enum pw_stream_flags flags,
const struct spa_pod **params,
uint32_t n_params);
static int (*pw_stream_disconnect_fn)(struct pw_stream *stream);
static struct pw_buffer* (*pw_stream_dequeue_buffer_fn)(struct pw_stream *stream);
static void (*pw_stream_destroy_fn)(struct pw_stream *stream);
static struct pw_stream* (*pw_stream_new_fn)(struct pw_core *core,
const char *name,
struct pw_properties *props);
static int (*pw_stream_queue_buffer_fn)(struct pw_stream *stream,
struct pw_buffer *buffer);
static int (*pw_stream_update_params_fn)(struct pw_stream *stream,
@ -87,7 +89,10 @@ static int (*pw_thread_loop_start_fn)(struct pw_thread_loop *loop);
static void (*pw_thread_loop_stop_fn)(struct pw_thread_loop *loop);
static void (*pw_thread_loop_lock_fn)(struct pw_thread_loop *loop);
static void (*pw_thread_loop_unlock_fn)(struct pw_thread_loop *loop);
static void (*pw_thread_loop_wait_fn)(struct pw_thread_loop *loop);
static void (*pw_thread_loop_signal_fn)(struct pw_thread_loop *loop, bool wait_for_accept);
static struct pw_properties* (*pw_properties_new_string_fn)(const char *str);
static const char* (*pw_get_library_version_fn)();
bool IsPwLibraryLoaded() {
static bool isLoaded =
@ -99,6 +104,7 @@ bool IsPwLibraryLoaded() {
IS_FUNC_LOADED(pw_init_fn) &&
IS_FUNC_LOADED(pw_stream_add_listener_fn) &&
IS_FUNC_LOADED(pw_stream_connect_fn) &&
IS_FUNC_LOADED(pw_stream_disconnect_fn) &&
IS_FUNC_LOADED(pw_stream_dequeue_buffer_fn) &&
IS_FUNC_LOADED(pw_stream_destroy_fn) &&
IS_FUNC_LOADED(pw_stream_new_fn) &&
@ -111,7 +117,10 @@ bool IsPwLibraryLoaded() {
IS_FUNC_LOADED(pw_thread_loop_stop_fn) &&
IS_FUNC_LOADED(pw_thread_loop_lock_fn) &&
IS_FUNC_LOADED(pw_thread_loop_unlock_fn) &&
IS_FUNC_LOADED(pw_properties_new_string_fn));
IS_FUNC_LOADED(pw_thread_loop_signal_fn) &&
IS_FUNC_LOADED(pw_thread_loop_wait_fn) &&
IS_FUNC_LOADED(pw_properties_new_string_fn) &&
IS_FUNC_LOADED(pw_get_library_version_fn));
return isLoaded;
}
@ -136,6 +145,7 @@ bool LoadPWLibrary() {
GET_FUNC(pw_init, pwLib);
GET_FUNC(pw_stream_add_listener, pwLib);
GET_FUNC(pw_stream_connect, pwLib);
GET_FUNC(pw_stream_disconnect, pwLib);
GET_FUNC(pw_stream_dequeue_buffer, pwLib);
GET_FUNC(pw_stream_destroy, pwLib);
GET_FUNC(pw_stream_new, pwLib);
@ -148,7 +158,10 @@ bool LoadPWLibrary() {
GET_FUNC(pw_thread_loop_stop, pwLib);
GET_FUNC(pw_thread_loop_lock, pwLib);
GET_FUNC(pw_thread_loop_unlock, pwLib);
GET_FUNC(pw_thread_loop_signal, pwLib);
GET_FUNC(pw_thread_loop_wait, pwLib);
GET_FUNC(pw_properties_new_string, pwLib);
GET_FUNC(pw_get_library_version, pwLib);
}
return IsPwLibraryLoaded();
@ -242,6 +255,15 @@ pw_stream_connect(struct pw_stream *stream,
params, n_params);
}
int
pw_stream_disconnect(struct pw_stream *stream)
{
if (!LoadPWLibrary()) {
return 0;
}
return pw_stream_disconnect_fn(stream);
}
struct pw_buffer *
pw_stream_dequeue_buffer(struct pw_stream *stream)
{
@ -356,6 +378,23 @@ pw_thread_loop_unlock(struct pw_thread_loop *loop)
return pw_thread_loop_unlock_fn(loop);
}
void
pw_thread_loop_signal(struct pw_thread_loop *loop, bool wait_for_accept)
{
if (!LoadPWLibrary()) {
return;
}
return pw_thread_loop_signal_fn(loop, wait_for_accept);
}
void
pw_thread_loop_wait(struct pw_thread_loop *loop)
{
if (!LoadPWLibrary()) {
return;
}
return pw_thread_loop_wait_fn(loop);
}
struct pw_properties *
pw_properties_new_string(const char *str)
@ -366,3 +405,12 @@ pw_properties_new_string(const char *str)
return pw_properties_new_string_fn(str);
}
const char*
pw_get_library_version()
{
if (!LoadPWLibrary()) {
return nullptr;
}
return pw_get_library_version_fn();
}