Thanks for your response. I’ve tested this out and decided to update, in case anyone else faces the same issue.
I followed official Gstreamer docs to make a probe and ended up with the following code:
// Registering probe
GstPad *source_srcpad = gst_element_get_static_pad (source_bin, "src");
gst_pad_add_probe( source_srcpad,
GST_PAD_PROBE_TYPE_BUFFER,
(GstPadProbeCallback)test_probe,
(gpointer)nvvidconv_crop,
NULL);
// Probe callback
GstPadProbeReturn CounterPipeline::test_probe(GstPad *pad, GstPadProbeInfo *info, gpointer user_data)
{
/**
* Callback for source pad buffer probe.
*/
GstCaps *current_caps = gst_pad_get_current_caps(pad);
GstStructure *caps_structure = gst_caps_get_structure(current_caps, 0);
gint height, width;
GstElement *nvvidconv_crop = (GstElement *)user_data;
if (gst_structure_get_int(caps_structure, "width", &width) && gst_structure_get_int(caps_structure, "height", &height))
{
if (width != 1920 || height != 1080)
{
g_print("Resolution changed from %dx%d to %dx%d\n", 1920, 1080, width, height);
std::string scr_crop = "100:100:200:200";
g_object_set(G_OBJECT(nvvidconv_crop), "src-crop", scr_crop.c_str(), NULL);
}
}
Probing resolution worked as expected. Surprisingly, dynamically setting nvvideoconvert’s property worked as well!
Hope it helps someone in the future.