Since gst-plugins-base 0.10.33, the playbin2 element has a "source-setup" signal.
Either way, you can connect a "notify::source" signal to the playbin2 element and find out when the source element was created. In this callback you can then do checking if it is in fact an rtspsrc, and you can set its properties.
import java.net.URI;
import org.gstreamer.Bin;
import org.gstreamer.Element;
import org.gstreamer.ElementFactory;
import org.gstreamer.Gst;
import org.gstreamer.Bin.ELEMENT_ADDED;
import org.gstreamer.elements.PlayBin2;
import org.gstreamer.lowlevel.GObjectAPI.GParamSpec;
import org.gstreamer.lowlevel.GstAPI;
import com.sun.jna.Pointer;
public class GstPlayBin2Test {
public static void main(String [] args) throws Exception {
Gst.init("GstPlayBin2Test", args);
PlayBin2 playbin2 = new PlayBin2("GstPlayBin2Test", uri);
Element videoSink = ElementFactory.make("autovideosink", "videosink");
playbin2.setVideoSink(videoSink);
playbin2.connect("notify::source", Object.class, null, new NotifySourceCallback());
Gst.main();
playbin2.stop();
}
static class NotifySourceCallback implements GstAPI.GstCallback {
public void callback(Element element, GParamSpec spec, Pointer user_data) {
Element source = (Element) element.get("source");
String sourceFactory = source.getFactory().getName();
if ("rtspsrc".equals(sourceFactory)) {
source.set("latency", 10000);
}
}
}
}