我想要manualy链接tee和autovideosink但是 无法使用gst_element_class_get_pad_template获取pad模板:
data->video_pipeline = gst_pipeline_new ("videopipeline");
gst_bin_add_many(GST_BIN(data->video_pipeline),udpsrc,rtph264depay,avdec_h264,/*videorate,* /clockoverlay,tee,/*queue,*/autovideosink,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
tee_src_pad_template = gst_element_class_get_pad_template(GST_ELEMENT_GET_CLASS(tee),"src_1");
pad_surface_src = gst_element_request_pad(tee,tee_src_pad_template,"src_%d",NULL);
// pad_surface_src = gst_element_get_request_pad(tee,"src_%d");
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);
为什么会这样?
答案 0 :(得分:2)
tee上的pad模板被称为" src_%u" (或" src_%d"在0.10中)。您必须将其用作名称而不是" src_1"。
对于请求打击垫,您可以使用后者,但只有在您希望打击垫具有这些名称而不是通过T形自动选择名称时才能使用。让发球台选择名字更有效率。