无法连接打击垫

时间:2014-09-07 10:53:37

标签: gstreamer

我正在使用gstreamer 1.0为Android编写应用程序。我需要显示视频流,并根据需要,有时将相同的流写入文件。现在,我正在实际使用手动连接垫。 我有这个代码:

 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

所有打击垫都已初始化,但gst_pad_link不会返回GST_PAD_LINK_OK。你知道为什么吗?可能是我不能直接链接tee和autovideosink,可能我需要一些队列?但是队列会有更多延迟。

1 个答案:

答案 0 :(得分:1)

没关系。我只是没有添加autovideosink到管道。