add client-node again

Add a client node again that uses the channel protocol but looks like
a node in the graph.
This commit is contained in:
Wim Taymans 2016-07-22 17:17:44 +02:00
parent 86afa66206
commit 907bd7bfd7
16 changed files with 996 additions and 219 deletions

View file

@ -31,6 +31,7 @@
typedef struct {
PinosGstSink *sink;
guint id;
PinosPort *port;
GstElement *src;
@ -384,6 +385,7 @@ free_sink_port_data (SinkPortData *data)
static PinosPort *
add_port (PinosNode *node,
PinosDirection direction,
guint id,
GError **error)
{
PinosGstSink *sink = PINOS_GST_SINK (node);
@ -392,9 +394,9 @@ add_port (PinosNode *node,
data = g_slice_new0 (SinkPortData);
data->sink = sink;
data->id = id;
data->port = PINOS_NODE_CLASS (pinos_gst_sink_parent_class)
->add_port (node, direction, error);
->add_port (node, direction, id, error);
g_debug ("connecting signals");
g_signal_connect (data->port, "linked", (GCallback) on_linked, data);
@ -418,9 +420,9 @@ add_port (PinosNode *node,
return data->port;
}
static void
static gboolean
remove_port (PinosNode *node,
PinosPort *port)
guint id)
{
PinosGstSink *sink = PINOS_GST_SINK (node);
PinosGstSinkPrivate *priv = sink->priv;
@ -429,7 +431,7 @@ remove_port (PinosNode *node,
for (walk = priv->ports; walk; walk = g_list_next (walk)) {
SinkPortData *data = walk->data;
if (data->port == PINOS_PORT_CAST (port)) {
if (data->id == id) {
free_sink_port_data (data);
priv->ports = g_list_delete_link (priv->ports, walk);
break;
@ -437,6 +439,8 @@ remove_port (PinosNode *node,
}
if (priv->ports == NULL)
pinos_node_report_idle (node);
return TRUE;
}
static void

View file

@ -31,6 +31,7 @@
typedef struct {
PinosGstSource *source;
guint id;
PinosPort *port;
GstElement *convert;
@ -430,9 +431,9 @@ free_source_port_data (SourcePortData *data)
g_slice_free (SourcePortData, data);
}
static void
static gboolean
remove_port (PinosNode *node,
PinosPort *port)
guint id)
{
PinosGstSource *source = PINOS_GST_SOURCE (node);
PinosGstSourcePrivate *priv = source->priv;
@ -441,7 +442,7 @@ remove_port (PinosNode *node,
for (walk = priv->ports; walk; walk = g_list_next (walk)) {
SourcePortData *data = walk->data;
if (data->port == PINOS_PORT_CAST (port)) {
if (data->id == id) {
free_source_port_data (data);
priv->ports = g_list_delete_link (priv->ports, walk);
break;
@ -449,6 +450,8 @@ remove_port (PinosNode *node,
}
if (priv->ports == NULL)
pinos_node_report_idle (node);
return TRUE;
}
static void
@ -550,6 +553,7 @@ create_best_element (GstCaps *caps)
static PinosPort *
add_port (PinosNode *node,
PinosDirection direction,
guint id,
GError **error)
{
PinosGstSource *source = PINOS_GST_SOURCE (node);
@ -573,9 +577,9 @@ add_port (PinosNode *node,
data = g_slice_new0 (SourcePortData);
data->source = source;
data->id = id;
data->port = PINOS_NODE_CLASS (pinos_gst_source_parent_class)
->add_port (node, direction, error);
->add_port (node, direction, id, error);
g_debug ("connecting signals");
g_signal_connect (data->port, "activate", (GCallback) on_activate, data);