Do you know how to get element 'glimagesink' with name vsink?


On android , I get stream from camera like this and then rtsp streaming.

server = gst_rtsp_server_new ();
g_object_set (server, “service”, port, NULL);
mounts = gst_rtsp_server_get_mount_points (server);
str1= "(ahcsrc ! tee name=t "
"t. ! queue ! capsfilter ! glimagesink name=vsink "
“t. ! queue ! timeoverlay ! x264enc tune=zerolatency ! rtph264pay pt=96 name=pay0 "
" )”;
factory = gst_rtsp_media_factory_new ();
gst_rtsp_media_factory_set_launch (factory, str);
gst_rtsp_mount_points_add_factory (mounts, “/test”, factory);
gst_rtsp_server_attach (server, NULL);

Do you know how to get element ‘glimagesink’ with name vsink ?

I want to use glimagesink as native_window.
But I cannot get ‘glimagesink’ from above.
I know gst_bin_get_by_name, but how to use?


This (the pipeline string) just sets things up for later. At this point the pipeline has not been constructed yet, so you need to wait until a client connects and the pipeline gets constructed before you can access the elements.

I think you have to do something like:

/* Called when a new media pipeline is constructed. We can query the
 * pipeline and configure our elements now */
static void
media_configure (GstRTSPMediaFactory * factory,
    GstRTSPMedia * media,
    gpointer user_data)
  GstElement *element, *sink;

  // Get the element used for providing the streams of the media
  element = gst_rtsp_media_get_element (media);

  // Get the element we care about by name
  vsink = gst_bin_get_by_name_recurse_up (GST_BIN (element), "vsink");


int main (argc, char **) {
  // Notify when our media is ready, This is called whenever someone
  // asks for  the media and a new pipeline with our elements is created
  g_signal_connect (factory,
      (GCallback) media_configure,

(Not sure if you need the recurse_up variant or if a plain get_by_name() will do as well)

Thank you for your reply. I will try your suggestion.