C++ API: UDP streaming receiver not working

classic Classic list List threaded Threaded
2 messages Options
HM
Reply | Threaded
Open this post in threaded view
|

C++ API: UDP streaming receiver not working

HM
Hi, I'm quite new to Gstreamer. I'm trying to play a UDP streaming usign gstreamer 1.0. The video is from a camera (full HD, 1920x1080, 25 fps), is encoded into the h.264 compression. It is transmitted via UDP as mpeg-ts packets. Receiving port is 49152.

My code is:

 GstElement* pipeline = gst_pipeline_new("my_pipeline");

 GstElement* src = gst_element_factory_make("udpsrc", NULL);
 g_object_set(src, "port", 49152, NULL);

 GstElement* mpegtsdemux = gst_element_factory_make("tsdemux", NULL);

 GstElement* queue = gst_element_factory_make("queue", NULL);
 
 GstElement* ffdec = gst_element_factory_make("avdec_h264", NULL);
 g_object_set(ffdec, "max_threads", 0, NULL);

 GstElement* ffmpeg = gst_element_factory_make("videoconvert", NULL);

 GstElement* xvimagesink = gst_element_factory_make("xvimagesink", "video");
 if (!pipeline | !src | !mpegtsdemux | !queue | !ffdec | !xvimagesink )
 {
        std::cout << "Error creating components." << std::endl;
        return;
 }

 gst_bin_add_many(GST_BIN(pipeline), src, mpegtsdemux, queue, ffdec, ffmpeg, xvimagesink, NULL);
 if (gst_element_link_many(src, mpegtsdemux, queue, ffdec, ffmpeg, xvimagesink, NULL) != true)
 {
       std::cout << "Error linking gstreamer elements." << std::endl;
       return;
 }

 gst_element_set_state(pipeline, GST_STATE_PLAYING);

The program executes but nothing is shown. Any help is welcome.
H
Reply | Threaded
Open this post in threaded view
|

Re: C++ API: UDP streaming receiver not working

saepia
You have to start GLib MainLoop.

Remeber also to call gst_init

m.

2016-05-27 15:43 GMT+02:00 HM <[hidden email]>:
Hi, I'm quite new to Gstreamer. I'm trying to play a UDP streaming usign
gstreamer 1.0. The video is from a camera (full HD, 1920x1080, 25 fps), is
encoded into the h.264 compression. It is transmitted via UDP as mpeg-ts
packets. Receiving port is 49152.

My code is:

 GstElement* pipeline = gst_pipeline_new("my_pipeline");

 GstElement* src = gst_element_factory_make("udpsrc", NULL);
 g_object_set(src, "port", 49152, NULL);

 GstElement* mpegtsdemux = gst_element_factory_make("tsdemux", NULL);

 GstElement* queue = gst_element_factory_make("queue", NULL);

 GstElement* ffdec = gst_element_factory_make("avdec_h264", NULL);
 g_object_set(ffdec, "max_threads", 0, NULL);

 GstElement* ffmpeg = gst_element_factory_make("videoconvert", NULL);

 GstElement* xvimagesink = gst_element_factory_make("xvimagesink", "video");
 if (!pipeline | !src | !mpegtsdemux | !queue | !ffdec | !xvimagesink )
 {
        std::cout << "Error creating components." << std::endl;
        return;
 }

 gst_bin_add_many(GST_BIN(pipeline), src, mpegtsdemux, queue, ffdec, ffmpeg,
xvimagesink, NULL);
 if (gst_element_link_many(src, mpegtsdemux, queue, ffdec, ffmpeg,
xvimagesink, NULL) != true)
 {
       std::cout << "Error linking gstreamer elements." << std::endl;
       return;
 }

 gst_element_set_state(pipeline, GST_STATE_PLAYING);

The program executes but nothing is shown. Any help is welcome.
H




--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/C-API-UDP-streaming-receiver-not-working-tp4677784.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel