Всем привет!
Необходимо проигрывать видео, которое получаю по udp. Когда на порту нет данных (сервер недоступен прим.) необходимо показать заставку.
Server:
gst-launch-1.0 -v filesrc location=/video/0001.mp4 ! decodebin ! vpuenc_h264 bitrate=8192 ! rtph264pay ! udpsink host=192.168.5.255 port=5555
Client:
#define GST_PLAYER_UDP "udpsrc port=5555 caps=\"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96\"\
! rtph264depay ! decodebin ! videoconvert ! autovideosink"
....
static gboolean bus_call (GstBus *bus, GstMessage *msg, gpointer data)
{
printf("msg=%s (from %s)\n",gst_message_type_get_name(GST_MESSAGE_TYPE(msg)), GST_MESSAGE_SRC_NAME(msg));
return TRUE;
}
...
GstElement* gstLaunch()
{
GstElement *pipeline;
GError *error = NULL;
pipeline = gst_parse_launch (GST_PLAYER_UDP, &error);
if (!pipeline){
g_print ("\tParse error: %s\n", error->message);
return 0;
}
gst_element_set_state (pipeline, GST_STATE_PLAYING);
GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
guint watch_id = gst_bus_add_watch (bus, bus_call, NULL);
gst_object_unref (bus);
return pipeline;
}
Когда вещание начинается, все отлично и я могу увидеть событие начала потока:
display(/dev/fb0) resolution is (1280x800).
====== OVERLAYSINK: 4.0.9 build on May 12 2017 10:36:47. ======
display(/dev/fb0) resolution is (1280x800).
display(/dev/fb0) resolution is (1280x800).
msg=state-changed (from autovideosink0)
msg=state-changed (from videoconvert0)
msg=state-changed (from typefind)
msg=state-changed (from decodebin0)
msg=state-changed (from rtph264depay0)
msg=state-changed (from udpsrc0)
msg=state-changed (from pipeline0)
msg=state-changed (from videoconvert0)
msg=state-changed (from typefind)
msg=state-changed (from rtph264depay0)
msg=stream-status (from src)
msg=state-changed (from udpsrc0)
msg=state-changed (from pipeline0)
msg=stream-status (from src)
msg=new-clock (from pipeline0)
msg=state-changed (from videoconvert0)
msg=state-changed (from rtph264depay0)
msg=state-changed (from udpsrc0)
msg=state-changed (from h264parse0)
msg=state-changed (from h264parse0)
[INFO] Product Info: i.MX6Q/D/S
msg=state-changed (from vpudec0)
[INFO] Product Info: i.MX6Q/D/S
====== VPUDEC: 4.0.9 build on May 12 2017 10:36:53. ======
wrapper: 1.0.65 (VPUWRAPPER_ARM_LINUX Build on May 12 2017 10:30:05)
vpulib: 5.4.33
firmware: 3.1.1.46072
msg=state-changed (from vpudec0)
[INFO] bitstreamMode 1, chromaInterleave 1, mapType 0, tiled2LinearEnable 0
msg=state-changed (from decodebin0)
msg=stream-start (from pipeline0)<-------------------------start
msg=state-changed (from autovideosink0-actual-sink-overlay)
msg=state-changed (from autovideosink0)
msg=async-done (from pipeline0)
msg=state-changed (from autovideosink0-actual-sink-overlay)
msg=state-changed (from autovideosink0)
msg=state-changed (from vpudec0)
msg=state-changed (from capsfilter0)
msg=state-changed (from h264parse0)
msg=state-changed (from typefind)
msg=state-changed (from decodebin0)
msg=state-changed (from pipeline0)
msg=qos (from autovideosink0-actual-sink-overlay)
msg=tag (from autovideosink0-actual-sink-overlay)