gst: fix JPEG format

Since commit f400ff2050 ("gst: Check for video/ caps before parsing
for info") JPEG support in the GStreamer elements is broken as JPEG is
not recognized as a video format anymore.

gst_video_info_from_caps is able to handle "video/" and "image/"
formats. Therefore, the check needs to allow "image/" too.

While at it, cleanup the formatting to make the check more readable.
This commit is contained in:
Michael Tretter 2024-06-11 15:09:28 +02:00 committed by Wim Taymans
parent 3b68b5088b
commit a9bf5fa24a
2 changed files with 9 additions and 8 deletions

View file

@ -1019,6 +1019,7 @@ static void
handle_format_change (GstPipeWireSrc *pwsrc,
const struct spa_pod *param)
{
GstStructure *structure;
g_autoptr (GstCaps) pw_peer_caps = NULL;
g_clear_pointer (&pwsrc->caps, gst_caps_unref);
@ -1040,9 +1041,9 @@ handle_format_change (GstPipeWireSrc *pwsrc,
if (pwsrc->caps && gst_caps_is_fixed (pwsrc->caps)) {
pwsrc->negotiated = TRUE;
if (g_str_has_prefix (gst_structure_get_name (
gst_caps_get_structure (pwsrc->caps, 0)),
"video/")) {
structure = gst_caps_get_structure (pwsrc->caps, 0);
if (g_str_has_prefix (gst_structure_get_name (structure), "video/") ||
g_str_has_prefix (gst_structure_get_name (structure), "image/")) {
pwsrc->is_video = TRUE;
#ifdef HAVE_GSTREAMER_DMA_DRM
@ -1062,8 +1063,7 @@ handle_format_change (GstPipeWireSrc *pwsrc,
} else {
gst_video_info_dma_drm_init (&pwsrc->drm_info);
#endif
gst_video_info_from_caps (&pwsrc->video_info,
pwsrc->caps);
gst_video_info_from_caps (&pwsrc->video_info, pwsrc->caps);
#ifdef HAVE_GSTREAMER_DMA_DRM
}
#endif