mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
context: add option to disable registry
This commit is contained in:
parent
c29fed1ac8
commit
02d4dc0efd
9 changed files with 44 additions and 23 deletions
|
|
@ -33,6 +33,8 @@
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PinosContext this;
|
PinosContext this;
|
||||||
|
|
||||||
|
bool no_proxy;
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
PinosConnection *connection;
|
PinosConnection *connection;
|
||||||
SpaSource source;
|
SpaSource source;
|
||||||
|
|
@ -304,8 +306,12 @@ registry_event_global (void *object,
|
||||||
{
|
{
|
||||||
PinosProxy *registry_proxy = object;
|
PinosProxy *registry_proxy = object;
|
||||||
PinosContext *this = registry_proxy->context;
|
PinosContext *this = registry_proxy->context;
|
||||||
|
PinosContextImpl *impl = SPA_CONTAINER_OF (this, PinosContextImpl, this);
|
||||||
PinosProxy *proxy = NULL;
|
PinosProxy *proxy = NULL;
|
||||||
|
|
||||||
|
if (impl->no_proxy)
|
||||||
|
return;
|
||||||
|
|
||||||
pinos_log_debug ("got global %u %s", id, type);
|
pinos_log_debug ("got global %u %s", id, type);
|
||||||
|
|
||||||
if (!strcmp (type, PINOS_TYPE__Node)) {
|
if (!strcmp (type, PINOS_TYPE__Node)) {
|
||||||
|
|
@ -342,7 +348,7 @@ registry_event_global (void *object,
|
||||||
proxy->implementation = &link_events;
|
proxy->implementation = &link_events;
|
||||||
}
|
}
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
pinos_registry_do_bind (this->registry_proxy, id, proxy->id);
|
pinos_registry_do_bind (registry_proxy, id, proxy->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
@ -547,7 +553,8 @@ pinos_context_destroy (PinosContext *context)
|
||||||
* Returns: %TRUE on success.
|
* Returns: %TRUE on success.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
pinos_context_connect (PinosContext *context)
|
pinos_context_connect (PinosContext *context,
|
||||||
|
PinosContextFlags flags)
|
||||||
{
|
{
|
||||||
struct sockaddr_un addr;
|
struct sockaddr_un addr;
|
||||||
socklen_t size;
|
socklen_t size;
|
||||||
|
|
@ -589,7 +596,7 @@ pinos_context_connect (PinosContext *context)
|
||||||
goto error_close;
|
goto error_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pinos_context_connect_fd (context, fd);
|
return pinos_context_connect_fd (context, flags, fd);
|
||||||
|
|
||||||
error_close:
|
error_close:
|
||||||
close (fd);
|
close (fd);
|
||||||
|
|
@ -606,8 +613,9 @@ error_close:
|
||||||
* Returns: %TRUE on success.
|
* Returns: %TRUE on success.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
pinos_context_connect_fd (PinosContext *context,
|
pinos_context_connect_fd (PinosContext *context,
|
||||||
int fd)
|
PinosContextFlags flags,
|
||||||
|
int fd)
|
||||||
{
|
{
|
||||||
PinosContextImpl *impl = SPA_CONTAINER_OF (context, PinosContextImpl, this);
|
PinosContextImpl *impl = SPA_CONTAINER_OF (context, PinosContextImpl, this);
|
||||||
|
|
||||||
|
|
@ -643,16 +651,20 @@ pinos_context_connect_fd (PinosContext *context,
|
||||||
pinos_core_do_client_update (context->core_proxy,
|
pinos_core_do_client_update (context->core_proxy,
|
||||||
&context->properties->dict);
|
&context->properties->dict);
|
||||||
|
|
||||||
context->registry_proxy = pinos_proxy_new (context,
|
if (!(flags & PINOS_CONTEXT_FLAG_NO_REGISTRY)) {
|
||||||
SPA_ID_INVALID,
|
context->registry_proxy = pinos_proxy_new (context,
|
||||||
context->type.registry);
|
SPA_ID_INVALID,
|
||||||
if (context->registry_proxy == NULL)
|
context->type.registry);
|
||||||
goto no_registry;
|
if (context->registry_proxy == NULL)
|
||||||
|
goto no_registry;
|
||||||
|
|
||||||
context->registry_proxy->implementation = ®istry_events;
|
context->registry_proxy->implementation = ®istry_events;
|
||||||
|
|
||||||
pinos_core_do_get_registry (context->core_proxy,
|
pinos_core_do_get_registry (context->core_proxy,
|
||||||
context->registry_proxy->id);
|
context->registry_proxy->id);
|
||||||
|
|
||||||
|
}
|
||||||
|
impl->no_proxy = !!(flags & PINOS_CONTEXT_FLAG_NO_PROXY);
|
||||||
|
|
||||||
pinos_core_do_sync (context->core_proxy, 0);
|
pinos_core_do_sync (context->core_proxy, 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,12 @@ typedef enum {
|
||||||
PINOS_CONTEXT_STATE_CONNECTED = 2,
|
PINOS_CONTEXT_STATE_CONNECTED = 2,
|
||||||
} PinosContextState;
|
} PinosContextState;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
PINOS_CONTEXT_FLAG_NONE = 0,
|
||||||
|
PINOS_CONTEXT_FLAG_NO_REGISTRY = (1 << 0),
|
||||||
|
PINOS_CONTEXT_FLAG_NO_PROXY = (1 << 1),
|
||||||
|
} PinosContextFlags;
|
||||||
|
|
||||||
const char * pinos_context_state_as_string (PinosContextState state);
|
const char * pinos_context_state_as_string (PinosContextState state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -97,8 +103,10 @@ PinosContext * pinos_context_new (PinosLoop *loop,
|
||||||
PinosProperties *properties);
|
PinosProperties *properties);
|
||||||
void pinos_context_destroy (PinosContext *context);
|
void pinos_context_destroy (PinosContext *context);
|
||||||
|
|
||||||
bool pinos_context_connect (PinosContext *context);
|
bool pinos_context_connect (PinosContext *context,
|
||||||
|
PinosContextFlags flags);
|
||||||
bool pinos_context_connect_fd (PinosContext *context,
|
bool pinos_context_connect_fd (PinosContext *context,
|
||||||
|
PinosContextFlags flags,
|
||||||
int fd);
|
int fd);
|
||||||
bool pinos_context_disconnect (PinosContext *context);
|
bool pinos_context_disconnect (PinosContext *context);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,12 @@ typedef enum {
|
||||||
const char * pinos_stream_state_as_string (PinosStreamState state);
|
const char * pinos_stream_state_as_string (PinosStreamState state);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PINOS_STREAM_FLAG_NONE = 0,
|
PINOS_STREAM_FLAG_NONE = 0,
|
||||||
PINOS_STREAM_FLAG_AUTOCONNECT = (1 << 0),
|
PINOS_STREAM_FLAG_AUTOCONNECT = (1 << 0),
|
||||||
} PinosStreamFlags;
|
} PinosStreamFlags;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PINOS_STREAM_MODE_BUFFER = 0,
|
PINOS_STREAM_MODE_BUFFER = 0,
|
||||||
PINOS_STREAM_MODE_RINGBUFFER = 1,
|
PINOS_STREAM_MODE_RINGBUFFER = 1,
|
||||||
} PinosStreamMode;
|
} PinosStreamMode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -401,7 +401,7 @@ main (int argc, char *argv[])
|
||||||
&data.on_state_changed,
|
&data.on_state_changed,
|
||||||
on_state_changed);
|
on_state_changed);
|
||||||
|
|
||||||
pinos_context_connect (data.context);
|
pinos_context_connect (data.context, PINOS_CONTEXT_FLAG_NO_REGISTRY);
|
||||||
|
|
||||||
pinos_loop_enter (data.loop);
|
pinos_loop_enter (data.loop);
|
||||||
while (data.running) {
|
while (data.running) {
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,8 @@ main (int argc, char *argv[])
|
||||||
&data.on_state_changed,
|
&data.on_state_changed,
|
||||||
on_state_changed);
|
on_state_changed);
|
||||||
|
|
||||||
pinos_context_connect (data.context);
|
pinos_context_connect (data.context,
|
||||||
|
PINOS_CONTEXT_FLAG_NO_REGISTRY);
|
||||||
|
|
||||||
pinos_loop_enter (data.loop);
|
pinos_loop_enter (data.loop);
|
||||||
while (data.running) {
|
while (data.running) {
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,7 @@ gst_pinos_device_provider_probe (GstDeviceProvider * provider)
|
||||||
if (!(c = pinos_context_new (l, self->client_name, NULL)))
|
if (!(c = pinos_context_new (l, self->client_name, NULL)))
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
pinos_context_connect (c);
|
pinos_context_connect (c, 0);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
PinosContextState state;
|
PinosContextState state;
|
||||||
|
|
@ -479,7 +479,7 @@ gst_pinos_device_provider_start (GstDeviceProvider * provider)
|
||||||
&self->ctx_subscription,
|
&self->ctx_subscription,
|
||||||
on_context_subscription);
|
on_context_subscription);
|
||||||
|
|
||||||
pinos_context_connect (self->context);
|
pinos_context_connect (self->context, 0);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
PinosContextState state;
|
PinosContextState state;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -823,7 +823,7 @@ gst_pinos_sink_open (GstPinosSink * pinossink)
|
||||||
|
|
||||||
pinos_signal_add (&pinossink->ctx->state_changed, &pinossink->ctx_state_changed, on_ctx_state_changed);
|
pinos_signal_add (&pinossink->ctx->state_changed, &pinossink->ctx_state_changed, on_ctx_state_changed);
|
||||||
|
|
||||||
pinos_context_connect (pinossink->ctx);
|
pinos_context_connect (pinossink->ctx, PINOS_CONTEXT_FLAG_NO_REGISTRY);
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
PinosContextState state = pinossink->ctx->state;
|
PinosContextState state = pinossink->ctx->state;
|
||||||
|
|
|
||||||
|
|
@ -1037,7 +1037,7 @@ gst_pinos_src_open (GstPinosSrc * pinossrc)
|
||||||
|
|
||||||
pinos_signal_add (&pinossrc->ctx->state_changed, &pinossrc->ctx_state_changed, on_ctx_state_changed);
|
pinos_signal_add (&pinossrc->ctx->state_changed, &pinossrc->ctx_state_changed, on_ctx_state_changed);
|
||||||
|
|
||||||
pinos_context_connect (pinossrc->ctx);
|
pinos_context_connect (pinossrc->ctx, PINOS_CONTEXT_FLAG_NO_REGISTRY);
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
PinosContextState state = pinossrc->ctx->state;
|
PinosContextState state = pinossrc->ctx->state;
|
||||||
|
|
|
||||||
|
|
@ -288,7 +288,7 @@ main (int argc, char *argv[])
|
||||||
&data.on_subscription,
|
&data.on_subscription,
|
||||||
on_subscription);
|
on_subscription);
|
||||||
|
|
||||||
pinos_context_connect (data.context);
|
pinos_context_connect (data.context, 0);
|
||||||
|
|
||||||
pinos_loop_enter (data.loop);
|
pinos_loop_enter (data.loop);
|
||||||
while (data.running) {
|
while (data.running) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue