Unfortunately I cannot, I can however provide some code pertaining to adding the source bin and deleting.
Here is how I would add a source bin to a pipeline called muxer (which has the streammux), notice I am not linking the sourcebin by setting the pipeline to play, I only add it.
void add_sources(char uri[],int index)
{
GstElement *source_bin = create_uridecode_bin (index, uri);
if(!source_bin)
{
g_printerr ("Failed to create source bin. Exiting.\n");
return;
}
gst_bin_add (GST_BIN (muxer), source_bin);
}
GstElement *create_uridecode_bin (guint index, gchar * filename)
{
GstElement *bin = NULL;
gchar bin_name[16] = { };
g_print ("creating uridecodebin for [%s]\n", filename);
g_snprintf (bin_name, 15, "source-bin-%02d", index-1);
printf ("ADDING source-bin-%02d\n", index-1);
bin = gst_element_factory_make ("uridecodebin", bin_name);
g_object_set (G_OBJECT (bin), "uri", filename, NULL);
g_source_id_list[index] = index;
g_signal_connect (G_OBJECT (bin), "pad-added", G_CALLBACK (cb_newpad), &g_source_id_list[index]-1);
g_signal_connect (G_OBJECT (bin), "child-added", G_CALLBACK (decodebin_child_added), &g_source_id_list[index]-1);
return bin;
}
Here is how I am deleting it
void stop_release_source (int index)
{
char source_bin_string[1024];
memset(source_bin_string,0,sizeof(source_bin_string));
char str[100];
memset(str,0,sizeof(str));
sprintf(str,"%02d",index);
strncpy(source_bin_string,"source-bin-",1024-1);
strncat(source_bin_string,str,1024-strlen(source_bin_string)-1);
printf("REMOVING %s\n",source_bin_string);
GstElement *source_bin = gst_bin_get_by_name( GST_BIN(muxer),source_bin_string);
gst_element_set_state (source_bin, GST_STATE_NULL);
gst_element_get_state (source_bin, NULL, NULL, GST_CLOCK_TIME_NONE);
gst_bin_remove (GST_BIN (muxer), source_bin);
gst_object_unref (source_bin);
}
Once I remove source bins from the pipeline, do the source bin’s “g_signal_connect” attribute go away as well? That could explain why I have this problem.