Сервер Windows:
gst-launch-1.0.exe videotestsrc ! rtpvraewpay ! udpsink host=192.168.101.111 port=8001
Клиент Linux:
Я использую следующий конвейер и могу показать видео testvideosrc:
gst-launch-1.0 udpsrc caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)RAW,width=(string)480,height=(string)360,payload=(int)96" port=8001 ! rtpvrawdepay ! videoconvert ! glimagesink
Но я не могу отобразить тестовое видео на QWidget со следующим кодом C ++:
ScreenWidgets.append(new CamWidget(this));
ui->gridLayout_screens->addWidget(ScreenWidgets.last());
WId windowId= ScreenWidgets.last()->winId();
GtElement *pipeline = gst_pipeline_new("udp_pipeline");
GstElement *source = gst_element_factory_make("udpsrc","source");
GstElement *depayloader = gst_element_factory_make("rtpvrawdepay","depayl");
GstElement *q1 = gst_element_factory_make("queue", "qone1");
GstElement *convert1 = gst_element_factory_make("videoconvert","conv");
GstElement *q2 = gst_element_factory_make("queue", "q2");
GstElement *sink = gst_element_factory_make("glimagesink","sink");
GstCaps *caps = gst_caps_new_simple("application/x-rtp",
"media", G_TYPE_STRING, "video",
"clock-rate",G_TYPE_INT,90000,
"encoding-name", G_TYPE_STRING,"RAW",
"width",G_TYPE_STRING,"640",
"height",G_TYPE_STRING,"480",
"payload",G_TYPE_INT,96,
NULL);
if(source != NULL && depayloader != NULL
&& convert1 != NULL && q1 && q2
&& sink!= NULL && caps != NULL)
{
g_object_set(GST_OBJECT(sink),"sync",FALSE,NULL);
g_object_set(GST_OBJECT(sink),"enable-last-sample",TRUE,NULL);
g_object_set(G_OBJECT(source),"port",8001,NULL);
//g_object_set(G_OBJECT(source),"buffer-size",640000,NULL);
gst_bin_add_many (GST_BIN (pipeline), source, depayloader, NULL);
gst_bin_add_many (GST_BIN (pipeline), convert1 ,q2, q1, sink, NULL);
if(gst_element_link_many(depayloader,
q1,
convert1,
q2,
sink,
NULL))
{
if(gst_element_link_filtered(source,depayloader,caps))
{
gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sink),windowId);
GThread *thread = g_thread_new(NULL,(GThreadFunc)func,loop);
}
}
}
Может кто-нибудь помочь мне, где я неправ?
Спасибо