我正在尝试更改rtspsrc中的视频格式。我一直伪造直到我在我的程序C中进行封顶过滤。它说内部数据流错误。有谁知道怎么做这个工作?
pipel.source = gst_element_factory_make ("rtspsrc","source");
g_object_set(GST_OBJECT(pipel.source),"location",url,NULL);
pipel.rtppay = gst_element_factory_make( "rtph264depay", "depayl");
pipel.decodebin = gst_element_factory_make ("openh264dec","decode");
pipel.parse = gst_element_factory_make("h264parse","parse");
pipel.videoscale = gst_element_factory_make("videoscale","scale");
filtercaps = gst_caps_from_string("video/x-raw,width=320,height=240");
g_object_set (G_OBJECT (pipel.filter1), "caps",filtercaps,NULL);
gst_caps_unref(filtercaps);
gst_bin_add_many (GST_BIN (pipel.pipeline),pipel.source,pipel.rtppay,pipel.parse,pipel.decodebin,pipel.videoscale,pipel.filter1,pipel.sink
,NULL);
if(!gst_element_link_many(pipel.rtppay,pipel.parse,pipel.decodebin,pipel.videoscale,pipel.filter1,pipel.sink))
printf("\nFailed Linking\n");
g_signal_connect(pipel.source, "pad-added", G_CALLBACK(cb_new_rtspsrc_pad),pipel.rtppay);
g_signal_connect(pipel.rtppay, "pad-added", G_CALLBACK(on_pad_added), pipel.parse);
答案 0 :(得分:0)
filtercaps = gst_caps_from_string("video/x-raw,width=320,height=240");
gst_bin_add_many (GST_BIN (pipel.pipeline),pipel.source,pipel.rtppay,pipel.parse,pipel.decodebin,pipel.videoscale,pipel.sink
,NULL);
if(!gst_element_link_many(pipel.rtppay,pipel.parse,pipel.decodebin,pipel.videoscale,pipel.sink))
printf("\nFailed Linking\n");
添加此行将使其正常工作。你不会在视频和视频链接之间使用封顶过滤器和链接。
gst_element_link_filtered(pipel.videoscale, pipel.sink, filtercaps);
gst_caps_unref(filtercaps);