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,
"media-configure",
(GCallback) media_configure,
NULL);
...
}
(Not sure if you need the recurse_up variant or if a plain get_by_name() will do as well)