diff options
author | Wim Taymans <wtaymans@redhat.com> | 2020-08-17 17:40:34 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2020-08-17 17:40:34 +0200 |
commit | 451fee22085c907c02b5caf0874a5cb01774f17a (patch) | |
tree | e4f19bc0b8e5d1da05397b98e4427957f780b225 /pipewire-pulseaudio | |
parent | 62cea9c6d51c201d88ab0819d3a43dc1f8da1e0b (diff) |
pulse: implement some more extensions
Most just return nothing or say that the extension is not supported.
Remove some warnings, they should show up in the log from setting
the error in the context.
Diffstat (limited to 'pipewire-pulseaudio')
-rw-r--r-- | pipewire-pulseaudio/src/ext-device-manager.c | 166 | ||||
-rw-r--r-- | pipewire-pulseaudio/src/ext-device-restore.c | 3 | ||||
-rw-r--r-- | pipewire-pulseaudio/src/ext-stream-restore.c | 5 | ||||
-rw-r--r-- | pipewire-pulseaudio/src/introspect.c | 11 |
4 files changed, 153 insertions, 32 deletions
diff --git a/pipewire-pulseaudio/src/ext-device-manager.c b/pipewire-pulseaudio/src/ext-device-manager.c index 480afb30..942d627a 100644 --- a/pipewire-pulseaudio/src/ext-device-manager.c +++ b/pipewire-pulseaudio/src/ext-device-manager.c @@ -25,6 +25,22 @@ #include "internal.h" +struct ext_data { + pa_context *context; + pa_ext_device_manager_test_cb_t test_cb; + pa_ext_device_manager_read_cb_t read_cb; + pa_context_success_cb_t success_cb; + int error; + void *userdata; +}; + +static void device_test(pa_operation *o, void *userdata) +{ + struct ext_data *d = userdata; + if (d->test_cb) + d->test_cb(o->context, PA_INVALID_INDEX, d->userdata); + pa_operation_done(o); +} SPA_EXPORT pa_operation *pa_ext_device_manager_test( @@ -32,8 +48,31 @@ pa_operation *pa_ext_device_manager_test( pa_ext_device_manager_test_cb_t cb, void *userdata) { - pw_log_warn("Not Implemented"); - return NULL; + pa_operation *o; + struct ext_data *d; + + pa_assert(c); + pa_assert(c->refcount >= 1); + + PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); + + o = pa_operation_new(c, NULL, device_test, sizeof(struct ext_data)); + d = o->userdata; + d->context = c; + d->test_cb = cb; + d->userdata = userdata; + d->error = PA_ERR_NOTIMPLEMENTED; + pa_operation_sync(o); + + return o; +} + +static void device_read(pa_operation *o, void *userdata) +{ + struct ext_data *d = userdata; + if (d->read_cb) + d->read_cb(o->context, NULL, 1, d->userdata); + pa_operation_done(o); } SPA_EXPORT @@ -42,8 +81,31 @@ pa_operation *pa_ext_device_manager_read( pa_ext_device_manager_read_cb_t cb, void *userdata) { - pw_log_warn("Not Implemented"); - return NULL; + pa_operation *o; + struct ext_data *d; + + pa_assert(c); + pa_assert(c->refcount >= 1); + + PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); + + o = pa_operation_new(c, NULL, device_read, sizeof(struct ext_data)); + d = o->userdata; + d->context = c; + d->read_cb = cb; + d->userdata = userdata; + d->error = PA_ERR_NOTIMPLEMENTED; + pa_operation_sync(o); + + return o; +} + +static void on_success(pa_operation *o, void *userdata) +{ + struct ext_data *d = userdata; + if (d->success_cb) + d->success_cb(o->context, d->error, d->userdata); + pa_operation_done(o); } SPA_EXPORT @@ -54,8 +116,23 @@ pa_operation *pa_ext_device_manager_set_device_description( pa_context_success_cb_t cb, void *userdata) { - pw_log_warn("Not Implemented"); - return NULL; + pa_operation *o; + struct ext_data *d; + + pa_assert(c); + pa_assert(c->refcount >= 1); + + PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); + + o = pa_operation_new(c, NULL, on_success, sizeof(struct ext_data)); + d = o->userdata; + d->context = c; + d->success_cb = cb; + d->userdata = userdata; + d->error = PA_ERR_NOTIMPLEMENTED; + pa_operation_sync(o); + + return o; } SPA_EXPORT @@ -65,8 +142,23 @@ pa_operation *pa_ext_device_manager_delete( pa_context_success_cb_t cb, void *userdata) { - pw_log_warn("Not Implemented"); - return NULL; + pa_operation *o; + struct ext_data *d; + + pa_assert(c); + pa_assert(c->refcount >= 1); + + PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); + + o = pa_operation_new(c, NULL, on_success, sizeof(struct ext_data)); + d = o->userdata; + d->context = c; + d->success_cb = cb; + d->userdata = userdata; + d->error = PA_ERR_NOTIMPLEMENTED; + pa_operation_sync(o); + + return o; } SPA_EXPORT @@ -76,8 +168,23 @@ pa_operation *pa_ext_device_manager_enable_role_device_priority_routing( pa_context_success_cb_t cb, void *userdata) { - pw_log_warn("Not Implemented"); - return NULL; + pa_operation *o; + struct ext_data *d; + + pa_assert(c); + pa_assert(c->refcount >= 1); + + PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); + + o = pa_operation_new(c, NULL, on_success, sizeof(struct ext_data)); + d = o->userdata; + d->context = c; + d->success_cb = cb; + d->userdata = userdata; + d->error = PA_ERR_NOTIMPLEMENTED; + pa_operation_sync(o); + + return o; } SPA_EXPORT @@ -88,8 +195,23 @@ pa_operation *pa_ext_device_manager_reorder_devices_for_role( pa_context_success_cb_t cb, void *userdata) { - pw_log_warn("Not Implemented"); - return NULL; + pa_operation *o; + struct ext_data *d; + + pa_assert(c); + pa_assert(c->refcount >= 1); + + PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); + + o = pa_operation_new(c, NULL, on_success, sizeof(struct ext_data)); + d = o->userdata; + d->context = c; + d->success_cb = cb; + d->userdata = userdata; + d->error = PA_ERR_NOTIMPLEMENTED; + pa_operation_sync(o); + + return o; } SPA_EXPORT @@ -99,8 +221,23 @@ pa_operation *pa_ext_device_manager_subscribe( pa_context_success_cb_t cb, void *userdata) { - pw_log_warn("Not Implemented"); - return NULL; + pa_operation *o; + struct ext_data *d; + + pa_assert(c); + pa_assert(c->refcount >= 1); + + PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE); + + o = pa_operation_new(c, NULL, on_success, sizeof(struct ext_data)); + d = o->userdata; + d->context = c; + d->success_cb = cb; + d->userdata = userdata; + d->error = PA_ERR_NOTIMPLEMENTED; + pa_operation_sync(o); + + return o; } SPA_EXPORT @@ -109,5 +246,4 @@ void pa_ext_device_manager_set_subscribe_cb( pa_ext_device_manager_subscribe_cb_t cb, void *userdata) { - pw_log_warn("Not Implemented"); } diff --git a/pipewire-pulseaudio/src/ext-device-restore.c b/pipewire-pulseaudio/src/ext-device-restore.c index a2c0e686..e4b8989f 100644 --- a/pipewire-pulseaudio/src/ext-device-restore.c +++ b/pipewire-pulseaudio/src/ext-device-restore.c @@ -37,7 +37,7 @@ static void restore_test(pa_operation *o, void *userdata) { struct ext_data *d = userdata; if (d->test_cb) - d->test_cb(o->context, EXT_VERSION, d->userdata); + d->test_cb(o->context, PA_INVALID_INDEX, d->userdata); pa_operation_done(o); } @@ -104,7 +104,6 @@ void pa_ext_device_restore_set_subscribe_cb( pa_ext_device_restore_subscribe_cb_t cb, void *userdata) { - pw_log_warn("Not Implemented"); } static void read_formats(pa_operation *o, void *userdata) diff --git a/pipewire-pulseaudio/src/ext-stream-restore.c b/pipewire-pulseaudio/src/ext-stream-restore.c index e5c97751..bc400150 100644 --- a/pipewire-pulseaudio/src/ext-stream-restore.c +++ b/pipewire-pulseaudio/src/ext-stream-restore.c @@ -23,8 +23,6 @@ #include "internal.h" -#define EXT_VERSION 1 - struct stream_data { pa_context *context; pa_ext_stream_restore_test_cb_t test_cb; @@ -38,7 +36,7 @@ static void restore_test(pa_operation *o, void *userdata) struct stream_data *d = userdata; if (d->test_cb) - d->test_cb(o->context, EXT_VERSION, d->userdata); + d->test_cb(o->context, PA_INVALID_INDEX, d->userdata); pa_operation_done(o); } @@ -197,5 +195,4 @@ void pa_ext_stream_restore_set_subscribe_cb( pa_ext_stream_restore_subscribe_cb_t cb, void *userdata) { - pw_log_warn("Not Implemented"); } diff --git a/pipewire-pulseaudio/src/introspect.c b/pipewire-pulseaudio/src/introspect.c index 239052e4..6e2469aa 100644 --- a/pipewire-pulseaudio/src/introspect.c +++ b/pipewire-pulseaudio/src/introspect.c @@ -619,7 +619,6 @@ pa_operation* pa_context_suspend_sink_by_name(pa_context *c, const char *sink_na d->userdata = userdata; pa_operation_sync(o); - pw_log_warn("Not Implemented"); return o; } @@ -636,7 +635,6 @@ pa_operation* pa_context_suspend_sink_by_index(pa_context *c, uint32_t idx, int d->userdata = userdata; pa_operation_sync(o); - pw_log_warn("Not Implemented"); return o; } @@ -1151,7 +1149,6 @@ pa_operation* pa_context_suspend_source_by_name(pa_context *c, const char *sourc d->userdata = userdata; pa_operation_sync(o); - pw_log_warn("Not Implemented"); return o; } @@ -1168,7 +1165,6 @@ pa_operation* pa_context_suspend_source_by_index(pa_context *c, uint32_t idx, in d->userdata = userdata; pa_operation_sync(o); - pw_log_warn("Not Implemented"); return o; } @@ -1425,7 +1421,6 @@ pa_operation* pa_context_load_module(pa_context *c, const char*name, const char d->idx = PA_INVALID_INDEX; pa_operation_sync(o); - pw_log_warn("Not Implemented"); return o; } @@ -1442,7 +1437,6 @@ pa_operation* pa_context_unload_module(pa_context *c, uint32_t idx, pa_context_s d->userdata = userdata; pa_operation_sync(o); - pw_log_warn("Not Implemented"); return o; } @@ -1834,7 +1828,6 @@ pa_operation* pa_context_set_port_latency_offset(pa_context *c, const char *card d->userdata = userdata; pa_operation_sync(o); - pw_log_warn("Not Implemented"); return o; } @@ -2552,7 +2545,6 @@ pa_operation* pa_context_stat(pa_context *c, pa_stat_info_cb_t cb, void *userdat d->userdata = userdata; pa_operation_sync(o); - pw_log_warn("Not Implemented"); return o; } @@ -2587,7 +2579,6 @@ pa_operation* pa_context_get_sample_info_by_name(pa_context *c, const char *name d->userdata = userdata; pa_operation_sync(o); - pw_log_warn("Not Implemented"); return o; } @@ -2604,7 +2595,6 @@ pa_operation* pa_context_get_sample_info_by_index(pa_context *c, uint32_t idx, p d->userdata = userdata; pa_operation_sync(o); - pw_log_warn("Not Implemented"); return o; } @@ -2633,7 +2623,6 @@ pa_operation* pa_context_get_sample_info_list(pa_context *c, pa_sample_info_cb_t d->userdata = userdata; pa_operation_sync(o); - pw_log_warn("Not Implemented"); return o; } |