More hacking

Move array and map to pinos
Move more things to spa lib
ControlCmd -> Message
Make pinos log, use for plugins as well
work on ringbuffer in alsa and nodes
work on making registry with all objects
This commit is contained in:
Wim Taymans 2016-11-03 19:41:53 +01:00
parent a1c0bef2ed
commit 7e46f9e3ad
81 changed files with 1831 additions and 1030 deletions

View file

@ -31,6 +31,8 @@
#include <spa/include/spa/node.h>
#include <spa/include/spa/monitor.h>
#include <pinos/client/log.h>
#include "spa-alsa-monitor.h"
#define PINOS_SPA_ALSA_MONITOR_GET_PRIVATE(obj) \
@ -109,7 +111,7 @@ add_item (PinosSpaALSAMonitor *this, SpaMonitorItem *item)
void *node_iface, *clock_iface;
PinosProperties *props = NULL;
g_debug ("alsa-monitor %p: add: \"%s\" (%s)", this, item->name, item->id);
pinos_log_debug ("alsa-monitor %p: add: \"%s\" (%s)", this, item->name, item->id);
handle = calloc (1, item->factory->size);
if ((res = spa_handle_factory_init (item->factory,
@ -125,7 +127,7 @@ add_item (PinosSpaALSAMonitor *this, SpaMonitorItem *item)
return;
}
if ((res = spa_handle_get_interface (handle, priv->uri.clock, &clock_iface)) < 0) {
g_debug ("can't get CLOCK interface: %d", res);
pinos_log_debug ("can't get CLOCK interface: %d", res);
clock_iface = NULL;
}
@ -157,7 +159,7 @@ remove_item (PinosSpaALSAMonitor *this, SpaMonitorItem *item)
PinosSpaALSAMonitorPrivate *priv = this->priv;
PinosNode *node;
g_debug ("alsa-monitor %p: remove: \"%s\" (%s)", this, item->name, item->id);
pinos_log_debug ("alsa-monitor %p: remove: \"%s\" (%s)", this, item->name, item->id);
node = g_hash_table_lookup (priv->nodes, item->id);
if (node) {
@ -188,7 +190,7 @@ on_monitor_event (SpaMonitor *monitor,
case SPA_MONITOR_EVENT_TYPE_CHANGED:
{
SpaMonitorItem *item = (SpaMonitorItem *) event;
g_debug ("alsa-monitor %p: changed: \"%s\"", this, item->name);
pinos_log_debug ("alsa-monitor %p: changed: \"%s\"", this, item->name);
break;
}
default:
@ -204,7 +206,7 @@ monitor_constructed (GObject * object)
SpaResult res;
void *state = NULL;
g_debug ("spa-monitor %p: constructed", this);
pinos_log_debug ("spa-monitor %p: constructed", this);
G_OBJECT_CLASS (pinos_spa_alsa_monitor_parent_class)->constructed (object);
@ -216,7 +218,7 @@ monitor_constructed (GObject * object)
if ((res = spa_monitor_enum_items (priv->monitor, &item, &state)) < 0) {
if (res != SPA_RESULT_ENUM_END)
g_debug ("spa_monitor_enum_items: got error %d\n", res);
pinos_log_debug ("spa_monitor_enum_items: got error %d\n", res);
break;
}
add_item (this, item);
@ -278,7 +280,7 @@ monitor_finalize (GObject * object)
PinosSpaALSAMonitor *this = PINOS_SPA_ALSA_MONITOR (object);
PinosSpaALSAMonitorPrivate *priv = this->priv;
g_debug ("spa-monitor %p: dispose", this);
pinos_log_debug ("spa-monitor %p: dispose", this);
spa_handle_clear (priv->handle);
g_free (priv->handle);
g_hash_table_unref (priv->nodes);

View file

@ -100,10 +100,10 @@ setup_node (PinosSpaAudioTestSrc *this)
SpaPropValue value;
if ((res = spa_node_get_props (node->node, &props)) < 0)
g_debug ("got get_props error %d", res);
pinos_log_debug ("got get_props error %d", res);
if ((res = spa_node_set_props (node->node, props)) < 0)
g_debug ("got set_props error %d", res);
pinos_log_debug ("got set_props error %d", res);
#endif
}
@ -149,7 +149,7 @@ src_finalize (GObject * object)
PinosSpaAudioTestSrc *src = PINOS_SPA_AUDIOTESTSRC (object);
PinosSpaAudioTestSrcPrivate *priv = src->priv;
g_debug ("audiotestsrc %p: dispose", src);
pinos_log_debug ("audiotestsrc %p: dispose", src);
spa_handle_clear (priv->handle);
g_free (priv->handle);

View file

@ -26,10 +26,9 @@
#include <unistd.h>
#include <sys/mman.h>
#include <gio/gio.h>
#include <spa/include/spa/node.h>
#include <spa/include/spa/monitor.h>
#include <pinos/client/log.h>
#include "spa-v4l2-monitor.h"
@ -110,7 +109,7 @@ add_item (PinosSpaV4l2Monitor *this, SpaMonitorItem *item)
void *clock_iface;
PinosProperties *props = NULL;
g_debug ("v4l2-monitor %p: add: \"%s\" (%s)", this, item->name, item->id);
pinos_log_debug ("v4l2-monitor %p: add: \"%s\" (%s)", this, item->name, item->id);
handle = calloc (1, item->factory->size);
if ((res = spa_handle_factory_init (item->factory,
@ -158,7 +157,7 @@ remove_item (PinosSpaV4l2Monitor *this, SpaMonitorItem *item)
PinosSpaV4l2MonitorPrivate *priv = this->priv;
PinosNode *node;
g_debug ("v4l2-monitor %p: remove: \"%s\" (%s)", this, item->name, item->id);
pinos_log_debug ("v4l2-monitor %p: remove: \"%s\" (%s)", this, item->name, item->id);
node = g_hash_table_lookup (priv->nodes, item->id);
if (node) {
@ -189,7 +188,7 @@ on_monitor_event (SpaMonitor *monitor,
case SPA_MONITOR_EVENT_TYPE_CHANGED:
{
SpaMonitorItem *item = (SpaMonitorItem *) event;
g_debug ("v4l2-monitor %p: changed: \"%s\"", this, item->name);
pinos_log_debug ("v4l2-monitor %p: changed: \"%s\"", this, item->name);
break;
}
default:
@ -205,7 +204,7 @@ monitor_constructed (GObject * object)
SpaResult res;
void *state = NULL;
g_debug ("spa-monitor %p: constructed", this);
pinos_log_debug ("spa-monitor %p: constructed", this);
G_OBJECT_CLASS (pinos_spa_v4l2_monitor_parent_class)->constructed (object);
@ -217,7 +216,7 @@ monitor_constructed (GObject * object)
if ((res = spa_monitor_enum_items (priv->monitor, &item, &state)) < 0) {
if (res != SPA_RESULT_ENUM_END)
g_debug ("spa_monitor_enum_items: got error %d\n", res);
pinos_log_debug ("spa_monitor_enum_items: got error %d\n", res);
break;
}
add_item (this, item);
@ -279,7 +278,7 @@ monitor_finalize (GObject * object)
PinosSpaV4l2Monitor *this = PINOS_SPA_V4L2_MONITOR (object);
PinosSpaV4l2MonitorPrivate *priv = this->priv;
g_debug ("spa-monitor %p: dispose", this);
pinos_log_debug ("spa-monitor %p: dispose", this);
spa_handle_clear (priv->handle);
g_free (priv->handle);
g_hash_table_unref (priv->nodes);