<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I need to display video stream and some times, as required, to write
the same stream to file. Now i'm in practic with manualy linking
pads. I've got this code:
<pre><code> gst_bin_add_many(GST_BIN(data->video_pipeline),udpsrc,rtph264depay,avdec_h264,/*videorate,*/clockoverlay,tee,queue_video_sink,queue_file_sink,NULL);
if (!gst_element_link_filtered (udpsrc,rtph264depay,udpsrc_caps))
GST_ERROR ("Can't link udpsrc and rtph264depay with caps");
}
if (!gst_element_link_many (rtph264depay,avdec_h264,/*videorate,*/clockoverlay,tee,NULL)){
GST_ERROR ("Can't link many to tee");
}
gst_object_unref (G_OBJECT(videorate_src_pad));//Возможно получится ошибка с пямятью
gst_caps_unref(videorate_caps);///Освобождаем caps
#if 1
if(!gst_element_add_pad(tee,pad_surface_src))
GST_ERROR("Cant add pad to tee");
tee_src_pad_template = gst_element_class_get_pad_template(GST_ELEMENT_GET_CLASS(tee),"src_%u");
pad_surface_src = gst_element_request_pad(tee,tee_src_pad_template,NULL,NULL);
if(!pad_surface_src){
g_printerr ("Can't obtain request pad src for tee.\n");
}
pad_surface_sink = gst_element_get_static_pad(autovideosink,"sink");
if(!pad_surface_sink){
g_printerr ("Can't obtain request pad sink for autovideosink.\n");
}
if (gst_pad_link (pad_surface_src,pad_surface_sink)!=GST_PAD_LINK_OK){
g_printerr ("Tee could not be linked.\n");
gst_object_unref (data->video_pipeline);
return -1;
}
gst_object_unref(pad_surface_sink);
#endif
</code></pre>
<p>all pads are initialized, but gst_pad_link does not returns
GST_PAD_LINK_OK. Do you know why? May be i can't to link tee and
autovideosink directly, may be i need some queue? but queue do
more latency. </p>
</body>
</html>