mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
cleanups
This commit is contained in:
parent
1d61fd3696
commit
ee67929a7c
11 changed files with 24 additions and 147 deletions
|
|
@ -116,7 +116,7 @@ core_dispatch_func (void *object,
|
|||
case PINOS_MESSAGE_NOTIFY_GLOBAL:
|
||||
{
|
||||
PinosMessageNotifyGlobal *ng = message;
|
||||
pinos_log_warn ("global %u %s", ng->id, ng->type);
|
||||
pinos_log_debug ("got global %u %s", ng->id, ng->type);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
@ -165,8 +165,6 @@ on_context_data (SpaSource *source,
|
|||
void *p = alloca (size);
|
||||
PinosProxy *proxy;
|
||||
|
||||
pinos_log_error ("context %p: got message %d from %u", this, type, id);
|
||||
|
||||
if (!pinos_connection_parse_message (conn, p)) {
|
||||
pinos_log_error ("context %p: failed to parse message", this);
|
||||
continue;
|
||||
|
|
@ -193,7 +191,6 @@ context_send_func (void *object,
|
|||
{
|
||||
PinosContextImpl *impl = SPA_CONTAINER_OF (data, PinosContextImpl, this);
|
||||
|
||||
pinos_log_error ("context %p: send message %d to %u", &impl->this, type, id);
|
||||
pinos_connection_add_message (impl->connection,
|
||||
id,
|
||||
type,
|
||||
|
|
|
|||
|
|
@ -94,5 +94,4 @@ bool pinos_context_disconnect (PinosContext *contex
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __PINOS_CONTEXT_H__ */
|
||||
|
|
|
|||
|
|
@ -1,94 +0,0 @@
|
|||
/* Pinos
|
||||
* Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __PINOS_OBJECT_H__
|
||||
#define __PINOS_OBJECT_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <pinos/client/signal.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _PinosObject PinosObject;
|
||||
typedef struct _PinosInterface PinosInterface;
|
||||
|
||||
typedef enum {
|
||||
PINOS_OBJECT_FLAG_NONE = 0,
|
||||
PINOS_OBJECT_FLAG_DESTROYING = (1 << 0),
|
||||
} PinosObjectFlags;
|
||||
|
||||
typedef void (*PinosDestroyFunc) (PinosObject *object);
|
||||
|
||||
struct _PinosInterface {
|
||||
uint32_t type;
|
||||
void *iface;
|
||||
};
|
||||
|
||||
struct _PinosObject {
|
||||
uint32_t id;
|
||||
PinosObjectFlags flags;
|
||||
PinosDestroyFunc destroy;
|
||||
PINOS_SIGNAL (destroy_signal, (PinosListener *listener,
|
||||
PinosObject *object));
|
||||
unsigned int n_interfaces;
|
||||
PinosInterface *interfaces;
|
||||
};
|
||||
|
||||
static inline void
|
||||
pinos_object_init (PinosObject *object,
|
||||
PinosDestroyFunc destroy,
|
||||
unsigned int n_interfaces,
|
||||
PinosInterface *interfaces)
|
||||
{
|
||||
object->id = SPA_ID_INVALID;
|
||||
object->flags = 0;
|
||||
object->destroy = destroy;
|
||||
pinos_signal_init (&object->destroy_signal);
|
||||
object->n_interfaces = n_interfaces;
|
||||
object->interfaces = interfaces;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
pinos_object_get_interface (PinosObject *object,
|
||||
uint32_t type)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < object->n_interfaces; i++)
|
||||
if (object->interfaces[i].type == type)
|
||||
return object->interfaces[i].iface;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void
|
||||
pinos_object_destroy (PinosObject *object)
|
||||
{
|
||||
object->flags |= PINOS_OBJECT_FLAG_DESTROYING;
|
||||
pinos_signal_emit (&object->destroy_signal, object);
|
||||
if (object->destroy)
|
||||
object->destroy (object);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PINOS_OBJECT_H__ */
|
||||
|
|
@ -37,13 +37,6 @@ extern "C" {
|
|||
|
||||
#include <spa/include/spa/id-map.h>
|
||||
|
||||
#define PINOS_DBUS_SERVICE "org.pinos"
|
||||
#define PINOS_DBUS_OBJECT_PREFIX "/org/pinos"
|
||||
#define PINOS_DBUS_OBJECT_SERVER PINOS_DBUS_OBJECT_PREFIX "/server"
|
||||
#define PINOS_DBUS_OBJECT_CLIENT PINOS_DBUS_OBJECT_PREFIX "/client"
|
||||
#define PINOS_DBUS_OBJECT_NODE PINOS_DBUS_OBJECT_PREFIX "/node"
|
||||
#define PINOS_DBUS_OBJECT_LINK PINOS_DBUS_OBJECT_PREFIX "/link"
|
||||
|
||||
void pinos_init (int *argc, char **argv[]);
|
||||
|
||||
char * pinos_client_name (void);
|
||||
|
|
|
|||
|
|
@ -34,13 +34,6 @@ struct _PinosListener {
|
|||
void (*notify) (void *);
|
||||
};
|
||||
|
||||
#if 0
|
||||
struct _PinosSignal {
|
||||
SpaList listeners;
|
||||
void (*notify) (PinosListener *listener, void *object, void *data);
|
||||
};
|
||||
#endif
|
||||
|
||||
#define PINOS_SIGNAL(name,func) \
|
||||
union { \
|
||||
SpaList listeners; \
|
||||
|
|
|
|||
|
|
@ -406,15 +406,6 @@ handle_rtnode_event (PinosStream *stream,
|
|||
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
|
||||
|
||||
switch (event->type) {
|
||||
case SPA_NODE_EVENT_TYPE_INVALID:
|
||||
case SPA_NODE_EVENT_TYPE_ASYNC_COMPLETE:
|
||||
case SPA_NODE_EVENT_TYPE_ERROR:
|
||||
case SPA_NODE_EVENT_TYPE_BUFFERING:
|
||||
case SPA_NODE_EVENT_TYPE_REQUEST_REFRESH:
|
||||
case SPA_NODE_EVENT_TYPE_REQUEST_CLOCK_UPDATE:
|
||||
pinos_log_warn ("unexpected node event %d", event->type);
|
||||
break;
|
||||
|
||||
case SPA_NODE_EVENT_TYPE_HAVE_OUTPUT:
|
||||
case SPA_NODE_EVENT_TYPE_NEED_INPUT:
|
||||
pinos_log_warn ("unhandled node event %d", event->type);
|
||||
|
|
@ -436,6 +427,9 @@ handle_rtnode_event (PinosStream *stream,
|
|||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
pinos_log_warn ("unexpected node event %d", event->type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -501,7 +495,6 @@ handle_socket (PinosStream *stream, int rtfd)
|
|||
false,
|
||||
on_rtsocket_condition,
|
||||
stream);
|
||||
pinos_log_debug ("socket %d", impl->rtfd);
|
||||
|
||||
impl->timeout_source = pinos_loop_add_timer (stream->context->loop,
|
||||
on_timeout,
|
||||
|
|
@ -831,7 +824,7 @@ stream_dispatch_func (void *object,
|
|||
info.size = p->size;
|
||||
|
||||
if (impl->trans)
|
||||
pinos_transport_free (impl->trans);
|
||||
pinos_transport_destroy (impl->trans);
|
||||
impl->trans = pinos_transport_new_from_info (&info);
|
||||
|
||||
pinos_log_debug ("transport update %d %p", impl->rtfd, impl->trans);
|
||||
|
|
@ -907,6 +900,7 @@ pinos_stream_connect (PinosStream *stream,
|
|||
items[0].value = port_path;
|
||||
ccn.props = &dict;
|
||||
ccn.id = impl->node_proxy->id;
|
||||
|
||||
pinos_proxy_send_message (stream->context->core_proxy,
|
||||
PINOS_MESSAGE_CREATE_CLIENT_NODE,
|
||||
&ccn,
|
||||
|
|
@ -969,7 +963,6 @@ pinos_stream_finish_format (PinosStream *stream,
|
|||
*
|
||||
* Start capturing from @stream.
|
||||
*
|
||||
*
|
||||
* Returns: %true on success.
|
||||
*/
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <pinos/client/log.h>
|
||||
|
|
@ -101,6 +102,7 @@ pinos_transport_new (unsigned int max_inputs,
|
|||
impl->offset = 0;
|
||||
|
||||
trans = &impl->trans;
|
||||
pinos_signal_init (&trans->destroy_signal);
|
||||
|
||||
pinos_memblock_alloc (PINOS_MEMBLOCK_FLAG_WITH_FD |
|
||||
PINOS_MEMBLOCK_FLAG_MAP_READWRITE |
|
||||
|
|
@ -121,11 +123,9 @@ pinos_transport_new_from_info (PinosTransportInfo *info)
|
|||
PinosTransport *trans;
|
||||
void *tmp;
|
||||
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
|
||||
impl = calloc (1, sizeof (PinosTransportImpl));
|
||||
trans = &impl->trans;
|
||||
pinos_signal_init (&trans->destroy_signal);
|
||||
|
||||
impl->mem.flags = PINOS_MEMBLOCK_FLAG_MAP_READWRITE |
|
||||
PINOS_MEMBLOCK_FLAG_WITH_FD;
|
||||
|
|
@ -133,7 +133,7 @@ pinos_transport_new_from_info (PinosTransportInfo *info)
|
|||
impl->mem.size = info->size;
|
||||
impl->mem.ptr = mmap (NULL, info->size, PROT_READ | PROT_WRITE, MAP_SHARED, info->memfd, info->offset);
|
||||
if (impl->mem.ptr == MAP_FAILED) {
|
||||
pinos_log_warn ("transport %p: failed to map fd %d", impl, info->memfd);
|
||||
pinos_log_warn ("transport %p: failed to map fd %d: %s", impl, info->memfd, strerror (errno));
|
||||
goto mmap_failed;
|
||||
}
|
||||
|
||||
|
|
@ -158,13 +158,10 @@ mmap_failed:
|
|||
|
||||
|
||||
void
|
||||
pinos_transport_free (PinosTransport *trans)
|
||||
pinos_transport_destroy (PinosTransport *trans)
|
||||
{
|
||||
PinosTransportImpl *impl = (PinosTransportImpl *) trans;
|
||||
|
||||
if (impl == NULL)
|
||||
return;
|
||||
|
||||
pinos_memblock_free (&impl->mem);
|
||||
free (impl);
|
||||
}
|
||||
|
|
@ -175,9 +172,6 @@ pinos_transport_get_info (PinosTransport *trans,
|
|||
{
|
||||
PinosTransportImpl *impl = (PinosTransportImpl *) trans;
|
||||
|
||||
if (impl == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
info->memfd = impl->mem.fd;
|
||||
info->offset = impl->offset;
|
||||
info->size = impl->mem.size;
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ typedef struct _PinosTransportArea PinosTransportArea;
|
|||
#include <spa/port.h>
|
||||
#include <spa/node.h>
|
||||
|
||||
#include <pinos/client/connection.h>
|
||||
#include <pinos/client/mem.h>
|
||||
#include <pinos/client/signal.h>
|
||||
|
||||
#define PINOS_TRANSPORT_CMD_NONE 0
|
||||
#define PINOS_TRANSPORT_CMD_NEED_DATA (1<<0)
|
||||
|
|
@ -61,6 +61,9 @@ struct _PinosTransportArea {
|
|||
};
|
||||
|
||||
struct _PinosTransport {
|
||||
PINOS_SIGNAL (destroy_signal, (PinosListener *listener,
|
||||
PinosTransport *trans));
|
||||
|
||||
PinosTransportArea *area;
|
||||
SpaPortInput *inputs;
|
||||
SpaPortOutput *outputs;
|
||||
|
|
@ -74,7 +77,7 @@ PinosTransport * pinos_transport_new (unsigned int max_inputs,
|
|||
unsigned int max_outputs);
|
||||
PinosTransport * pinos_transport_new_from_info (PinosTransportInfo *info);
|
||||
|
||||
void pinos_transport_free (PinosTransport *trans);
|
||||
void pinos_transport_destroy (PinosTransport *trans);
|
||||
|
||||
SpaResult pinos_transport_get_info (PinosTransport *trans,
|
||||
PinosTransportInfo *info);
|
||||
|
|
|
|||
|
|
@ -43,6 +43,13 @@
|
|||
|
||||
#include "pinos/dbus/org-pinos.h"
|
||||
|
||||
#define PINOS_DBUS_SERVICE "org.pinos"
|
||||
#define PINOS_DBUS_OBJECT_PREFIX "/org/pinos"
|
||||
#define PINOS_DBUS_OBJECT_SERVER PINOS_DBUS_OBJECT_PREFIX "/server"
|
||||
#define PINOS_DBUS_OBJECT_CLIENT PINOS_DBUS_OBJECT_PREFIX "/client"
|
||||
#define PINOS_DBUS_OBJECT_NODE PINOS_DBUS_OBJECT_PREFIX "/node"
|
||||
#define PINOS_DBUS_OBJECT_LINK PINOS_DBUS_OBJECT_PREFIX "/link"
|
||||
|
||||
typedef struct {
|
||||
PinosCore *core;
|
||||
SpaList link;
|
||||
|
|
|
|||
|
|
@ -989,14 +989,7 @@ client_node_dispatch_func (void *object,
|
|||
SpaProxy *this = &impl->proxy;
|
||||
|
||||
switch (type) {
|
||||
case PINOS_MESSAGE_INVALID:
|
||||
case PINOS_MESSAGE_ADD_PORT:
|
||||
case PINOS_MESSAGE_REMOVE_PORT:
|
||||
case PINOS_MESSAGE_SET_FORMAT:
|
||||
case PINOS_MESSAGE_SET_PROPERTY:
|
||||
case PINOS_MESSAGE_NODE_COMMAND:
|
||||
case PINOS_MESSAGE_PORT_COMMAND:
|
||||
case PINOS_MESSAGE_TRANSPORT_UPDATE:
|
||||
default:
|
||||
spa_log_error (this->log, "proxy %p: got unexpected command %d", this, type);
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
#include "spa/include/spa/list.h"
|
||||
#include "spa/include/spa/ringbuffer.h"
|
||||
#include "pinos/client/log.h"
|
||||
#include "pinos/client/object.h"
|
||||
#include "pinos/server/main-loop.h"
|
||||
|
||||
typedef struct _WorkItem WorkItem;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue