Unable to get the sample from Appsink using C++
RK29
giri_2984 at yahoo.co.in
Fri Aug 21 17:41:57 UTC 2020
Still Failing:
GStreamer-CRITICAL **: 10:39:39.301: gst_bin_add: assertion 'GST_IS_ELEMENT
(element)' failed
GStreamer-CRITICAL **: 10:39:39.307: gst_element_link_pads_full: assertion
'GST_IS_ELEMENT (dest)' failed
on_incoming_decodebin_stream (GstElement * decodebin, GstPad * pad,
GstElement * pipe)
{
GstCaps *caps;
const gchar *name;
if (!gst_pad_has_current_caps (pad)) {
g_printerr ("Pad '%s' has no caps, can't do anything, ignoring\n",
GST_PAD_NAME (pad));
return;
}
caps = gst_pad_get_current_caps (pad);
name = gst_structure_get_name (gst_caps_get_structure (caps, 0));
if (g_str_has_prefix (name, "video")) {
// handle_media_stream (pad, pipe, "videoconvert", "autovideosink");
// Create our user data
UserData* user_data = new UserData();
user_data->pipeline = pipe;
GstElement* queue = gst_element_factory_make("queue", NULL);
GstElement* videoconvert = gst_element_factory_make("videoconvert",
NULL);
GstElement* videoscale = gst_element_factory_make("videoscale",
NULL);
GstCaps* caps = gst_caps_from_string("video/x-raw,format=BGR, width=
1280, height=720");
GstElement* appSink = gst_element_factory_make("appsink", NULL);
// GstElement* videosink = gst_element_factory_make("autovideosink",
"dasautovideosink");
gst_element_sync_state_with_parent(queue);
gst_element_sync_state_with_parent(videoconvert);
gst_element_sync_state_with_parent(videoscale);
gst_element_sync_state_with_parent(appSink);
// gst_element_sync_state_with_parent(videosink);
// gst_element_sync_state_with_parent(queue);
// Set all the callbacks
gst_app_sink_set_emit_signals((GstAppSink*)appSink, true);
gst_app_sink_set_drop((GstAppSink*)appSink, true);
gst_app_sink_set_max_buffers((GstAppSink*)appSink, 3); // Limit
the number of buffers the appsink can store if we don't take anything from
it
GstAppSinkCallbacks callbacks = { NULL, NULL, new_sample1 }; //
These are the functions called when we get a new preroll (new_preroll) and a
new buffer/image (new_sample)
gst_app_sink_set_callbacks(GST_APP_SINK(appSink), &callbacks,
user_data, NULL); // 'data' is just some user data sent to the callback so
you can update your own data, if needed
// Add everything to the pipeline
gst_bin_add_many(GST_BIN(user_data->pipeline), queue, videoconvert,
videoscale,caps, appSink,NULL);
gst_element_link_many(queue, videoconvert, videoscale, caps,
appSink, NULL);
GstPad* qpad = gst_element_get_static_pad(queue, "sink");
GstPadLinkReturn ret = gst_pad_link(pad, qpad);
g_assert_cmphex(ret, == , GST_PAD_LINK_OK);
// handle_media_stream(pad, pipe, "videoconvert", "appsink");
} else if (g_str_has_prefix (name, "audio")) {
// handle_media_stream (pad, pipe, "audioconvert", "autoaudiosink");
} else {
g_printerr ("Unknown pad %s, ignoring", GST_PAD_NAME (pad));
}
}
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list