Unable to get the sample from Appsink using C++
RK29
giri_2984 at yahoo.co.in
Mon Aug 24 16:52:35 UTC 2020
Hey Guys, I was able to get callback working but the moment I add the
capsfilter the call back does not work. Please help me to find the problem:
GstCaps* videosinkcaps =gst_caps_from_string("video/x-raw,format=BGR, width=
1280, height=720,framerate=10/1");
GstElement* capsf = gst_element_factory_make("capsfilter", NULL);
GstElement* appSink = gst_element_factory_make("appsink", NULL);
g_object_set(G_OBJECT(capsf), "caps", videosinkcaps, NULL);
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, 30000); //
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, pipe,
NULL); // 'data' is just some user data sent to the callback so you can
update your own data, if needed
//gst_element_sync_state_with_parent(appSink);
gst_bin_add_many(GST_BIN(pipe), q, conv, scale, capsf, appSink,
NULL);
gst_element_sync_state_with_parent(q);
gst_element_sync_state_with_parent(conv);
gst_element_sync_state_with_parent(scale);
gst_element_sync_state_with_parent(capsf);
gst_element_sync_state_with_parent(appSink);
// gst_element_link_filtered(conv, scale, videosinkcaps);
if (!gst_element_link_many(q, conv, scale,capsf, appSink, NULL))
{
g_critical("Failed to link elements with automatic caps!
Aborting!");
}
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list