From f1ba395bf88fdd63d8253add63425c10c84883c1 Mon Sep 17 00:00:00 2001 From: IanBrace2 Date: Tue, 26 Mar 2024 11:33:19 +1100 Subject: [PATCH] Using GST structure to confirm video decoding stream format. --- src/VideoReceiver/GstVideoReceiver.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/VideoReceiver/GstVideoReceiver.cc b/src/VideoReceiver/GstVideoReceiver.cc index 620706c..35837dd 100644 --- a/src/VideoReceiver/GstVideoReceiver.cc +++ b/src/VideoReceiver/GstVideoReceiver.cc @@ -717,18 +717,21 @@ GstVideoReceiver::_filterParserCaps(GstElement* bin, GstPad* pad, GstElement* el GstCaps* filter; - if ((filter = gst_caps_from_string("video/x-h264")) != nullptr) { + GstStructure* structure; + + structure = gst_caps_get_structure(srcCaps, 0); + if(gst_structure_has_name(structure, "video/x-h265")){ + filter = gst_caps_from_string("video/x-h265"); if (gst_caps_can_intersect(srcCaps, filter)) { - sinkCaps = gst_caps_from_string("video/x-h264,stream-format=avc"); + sinkCaps = gst_caps_from_string("video/x-h265,stream-format=hvc1"); } - gst_caps_unref(filter); filter = nullptr; - } else if ((filter = gst_caps_from_string("video/x-h265")) != nullptr) { + } else if(gst_structure_has_name(structure, "video/x-h264")){ + filter = gst_caps_from_string("video/x-h264"); if (gst_caps_can_intersect(srcCaps, filter)) { - sinkCaps = gst_caps_from_string("video/x-h265,stream-format=hvc1"); + sinkCaps = gst_caps_from_string("video/x-h264,stream-format=avc"); } - gst_caps_unref(filter); filter = nullptr; }