OctopusComponent *component;
gchar **sources;
gchar **sinks;
+ gchar *pipeline_desc;
unsigned i;
g_debug("Route mapping changed");
g_object_get(G_OBJECT(route), "backend", &backend,
"sources", &sources,
- "sinks", &sinks, NULL);
+ "sinks", &sinks,
+ "pipeline-description", &pipeline_desc, NULL);
g_assert(OCTOPUS_IS_BACKEND_GST(backend));
- for(i = 0; sources[i]; ++i) {
- GSList *chain = NULL;
- unsigned j;
+ if(pipeline_desc) {
+ RouteDataGst *data;
+ GError *err;
- component = octopus_backend_get_component_by_endpoint(backend, sources[i], OCTOPUS_ENDPOINT_SOURCE);
- if(!component)
- continue;
+ g_debug("Using forced pipeline description: %s", pipeline_desc);
- for(j = 0; sinks[j]; ++j) {
- if((chain = octopus_backend_build_component_chain(backend, component, sinks[j]))) {
- realize_component_chain(backend, route, chain, NULL);
- g_slist_free(chain);
- break;
+ data = (RouteDataGst *)g_object_get_data(G_OBJECT(route), "data");
+ if(data->pipeline) {
+ gst_element_set_state(data->pipeline, GST_STATE_NULL);
+ gst_object_unref(data->pipeline);
+ }
+
+ data->pipeline = gst_parse_launch(pipeline_desc, &err);
+ if(data->pipeline)
+ data->ready = TRUE;
+ else
+ g_warning("Pipeline is invalid: %s", err->message);
+
+ } else {
+ for(i = 0; sources[i]; ++i) {
+ GSList *chain = NULL;
+ unsigned j;
+
+ component = octopus_backend_get_component_by_endpoint(backend, sources[i], OCTOPUS_ENDPOINT_SOURCE);
+ if(!component)
+ continue;
+
+ for(j = 0; sinks[j]; ++j) {
+ if((chain = octopus_backend_build_component_chain(backend, component, sinks[j]))) {
+ realize_component_chain(backend, route, chain, NULL);
+ g_slist_free(chain);
+ break;
+ }
}
}
}
-
- /* TODO */
}
static void
<arg type="as" direction="out" name="sources" />
<arg type="as" direction="out" name="destinations" />
</method>
+
+ <!-- Special-casing and demo hacking -->
+ <method name="ForcePipeline">
+ <arg type="u" direction="in" name="id" />
+ <arg type="s" direction="in" name="pipline_desc" />
+ </method>
<!-- Set an URI for an endpoint -->
<method name="SetEndpointUri">
PROP_ID = 1,
PROP_BACKEND,
PROP_SOURCES,
- PROP_SINKS
+ PROP_SINKS,
+ PROP_PIPELINE_DESC
};
enum
GHashTable *endpoints;
gchar **sources;
gchar **sinks;
+ gchar *pipeline_desc;
};
static void
g_param_spec_pointer("sinks", "Sinks", "Sink endpoints used for this route",
G_PARAM_READABLE));
+ g_object_class_install_property(gobject_class, PROP_PIPELINE_DESC,
+ g_param_spec_string("pipeline-description", "PipelineDescription", "Forced pipeline description (backend specific)", NULL,
+ G_PARAM_READABLE));
+
signals[SIGNAL_MAPPING_CHANGED] =
g_signal_new ("mapping-changed",
G_TYPE_FROM_CLASS(gobject_class),
case PROP_SINKS:
g_value_set_pointer(value, route->priv->sinks);
break;
+ case PROP_PIPELINE_DESC:
+ if(route->priv->pipeline_desc)
+ g_value_set_string(value, route->priv->pipeline_desc);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
}
return TRUE;
}
+gboolean
+octopus_route_set_pipeline_description(OctopusRoute *route,
+ const gchar *desc)
+{
+ OctopusRoutePrivate *priv = route->priv;
+
+ g_free(priv->pipeline_desc);
+ priv->pipeline_desc = g_strdup(desc);
+
+ g_signal_emit(route, signals[SIGNAL_MAPPING_CHANGED], 0);
+
+ return TRUE;
+}
+
gboolean
octopus_route_set_endpoint_uri(OctopusRoute *route,
const gchar *ep_name,
const gchar *const *sources,
const gchar *const *sinks);
gboolean
+octopus_route_set_pipeline_description (OctopusRoute *route,
+ const gchar *desc);
+gboolean
octopus_route_set_endpoint_uri (OctopusRoute *route,
const gchar *ep_name,
const gchar *uri);
return TRUE;
}
+gboolean
+octopus_server_force_pipeline (OctopusServer *server,
+ gulong id,
+ const gchar *desc,
+ GError **error)
+{
+ OctopusRoute *route;
+
+ g_assert(OCTOPUS_IS_SERVER (server));
+
+ if(!(route = get_route_by_id(server, id, error)))
+ return FALSE;
+
+ if(!octopus_route_set_pipeline_description(route, desc))
+ {
+ g_set_error(error, OCTOPUS_SERVER_ERROR, OCTOPUS_SERVER_ERROR_FAILED, "Could not set pipeline description");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
gboolean
octopus_server_set_endpoint_uri(OctopusServer *server,
guint32 id,
const gchar ***dsts,
GError **error);
gboolean
+octopus_server_force_pipeline (OctopusServer *server,
+ gulong id,
+ const gchar *desc,
+ GError **error);
+gboolean
octopus_server_set_endpoint_uri(OctopusServer *server,
guint32 id,
const gchar *ep_name,