Hello,
We have one problem about playing coordinate for nvoverlaysink. Please refer to the following sample code and I also highlight the symptom. We set the coordinates before playing and the coordinates are correct. But, the coordinates can not be changed after playing. The symptom happened both on R23.2 and R24.2. Can you kindly help to check this issue ?
static void playback_pad_added(GstElement* src, GstPad* new_pad, gpointer user_data)
{
PlaybackData* s = (PlaybackData*)user_data;
printf(“Received new pad ‘%s’ from ‘%s’:\n”, GST_PAD_NAME(new_pad), GST_ELEMENT_NAME(src));
AutoGstCaps caps = gst_pad_get_current_caps(new_pad);
GstStructure* structure = gst_caps_get_structure(caps, 0);
const gchar* pad_type = gst_structure_get_name(structure);
if(g_str_has_prefix(pad_type, "video/"))
{
if(!gst_element_link(src, s->overlay))
printf("overlay could not be linked.\n");
}
else if(g_str_has_prefix(pad_type, "audio/"))
{
}
}
static void playback_no_more_pads(GstElement* object, gpointer user_data)
{
PlaybackData* s = (PlaybackData*)user_data;
s->no_more_pads_event.set_event();
}
GstElement* pipeline = gst_pipeline_new("pipeline");
GstElement* source = gst_element_factory_make("uridecodebin", "source");
g_object_set(source, "uri", "file://test.mp4", NULL);
g_signal_connect(source, "pad-added", G_CALLBACK(playback_pad_added), s);
g_signal_connect(source, "no-more-pads", G_CALLBACK(playback_no_more_pads), s);
GstElement* sink = gst_element_factory_make("nvoverlaysink", NULL);
/* The coordinates are correct here. */
g_object_set(sink,
"overlay-x", x,
"overlay-y", y,
"overlay-w", cx,
"overlay-h", cy,
NULL);
if(!pipeline || !source || !sink)
{
printf("Not all elements could be created.\n");
return -1;
}
gst_bin_add_many(GST_BIN(pipeline), source, sink, NULL);
if(gst_element_set_state(pipeline, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE)
{
printf("Unable to set the pipeline to the playing state.\n");
return -1;
}
/* Waiting for play. */
usleep(5000 * 1000);
/* After playing, we changed the new coordinates but the original coordinates was not replaced by new one. */
g_object_set(sink,
"overlay-x", x,
"overlay-y", y,
"overlay-w", cx,
"overlay-h", cy,
NULL);