fallbacksrc with custom source element throwing error
Hello,
Attempting to use a simple pipeline with fallbacksrc. I'm using a shmsrc as my primary source so desiring to set the source
property. (i've attempted with other src types though and have gotten the same error). The error message is: Failed to add the element using the parent function
and seems to point here.
the pipeline looks similar to:
pipeline = gst_pipeline_new ("pipeline");
fallback = gst_element_factory_make ("fallbacksrc", "fallback");
if (fallback == NULL)
g_error ("Could not create 'fallbacksrc' element");
shmsrc = gst_element_factory_make ("shmsrc", NULL);
g_object_set (shmsrc, "socket-path", "/tmp/shm", NULL);
g_object_set (shmsrc, "is-live", TRUE, NULL);
g_object_set (shmsrc, "do-timestamp", TRUE, NULL);
g_object_set (fallback, "source", shmsrc, NULL);
GstElement *filter = gst_element_factory_make ("capsfilter", "filter");
g_assert (filter != NULL); /* should always exist */
g_object_set (filter, "caps", pVideoCaps, NULL);
prequeue = gst_element_factory_make ("queue", "pre-encode-queue");
if (prequeue == NULL)
g_error ("Could not create 'prequeue' element");
encoder = gst_element_factory_make ("x264enc", "encoder");
g_assert (encoder != NULL); /* should always exist */
queue = gst_element_factory_make ("queue", "rtc-queue");
if (queue == NULL)
g_error ("Could not create 'prequeue' element");
appsinkVideo = gst_element_factory_make ("appsink", "appsink-video");
if (appsinkVideo == NULL)
g_error ("Could not create 'appsinkVideo' element");
g_object_set (appsinkVideo, "sync", TRUE, NULL);
g_object_set (appsinkVideo, "emit-signals", TRUE, NULL);
if (appsinkVideo != NULL) {
g_signal_connect(appsinkVideo, "new-sample", G_CALLBACK(on_new_sample_video), (gpointer) pSampleConfiguration);
}
gst_bin_add_many (GST_BIN (pipeline), fallback, shmsrc, filter, prequeue, encoder, queue, appsinkVideo, NULL);
gst_element_link_many (fallback, filter, prequeue, encoder, queue, appsinkVideo, NULL);
gst_element_set_state(pipeline, GST_STATE_PLAYING);
let me know if i can provide anything else! thanks