mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	gst: Check for video/ caps before parsing for info
The gst_video_info_from_caps() API isn't really intended to be used as a check-for-videoness function (it generates an error-level GStreamer debug message when used this way). We check the caps for a video/ name for this reason, which is functionally equivalent.
This commit is contained in:
		
							parent
							
								
									7eeb657d37
								
							
						
					
					
						commit
						f400ff2050
					
				
					 2 changed files with 16 additions and 5 deletions
				
			
		| 
						 | 
					@ -224,7 +224,14 @@ set_config (GstBufferPool * pool, GstStructure * config)
 | 
				
			||||||
    return FALSE;
 | 
					    return FALSE;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  has_video = gst_video_info_from_caps (&p->video_info, caps);
 | 
					  if (g_str_has_prefix (gst_structure_get_name (
 | 
				
			||||||
 | 
					          gst_caps_get_structure (caps, 0)),
 | 
				
			||||||
 | 
					        "video/")) {
 | 
				
			||||||
 | 
					    has_video = TRUE;
 | 
				
			||||||
 | 
					    gst_video_info_from_caps (&p->video_info, caps);
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    has_video = FALSE;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  p->add_metavideo = has_video && gst_buffer_pool_config_has_option (config,
 | 
					  p->add_metavideo = has_video && gst_buffer_pool_config_has_option (config,
 | 
				
			||||||
      GST_BUFFER_POOL_OPTION_VIDEO_META);
 | 
					      GST_BUFFER_POOL_OPTION_VIDEO_META);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1028,6 +1028,11 @@ handle_format_change (GstPipeWireSrc *pwsrc,
 | 
				
			||||||
  if (pwsrc->caps && gst_caps_is_fixed (pwsrc->caps)) {
 | 
					  if (pwsrc->caps && gst_caps_is_fixed (pwsrc->caps)) {
 | 
				
			||||||
    pwsrc->negotiated = TRUE;
 | 
					    pwsrc->negotiated = TRUE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (g_str_has_prefix (gst_structure_get_name (
 | 
				
			||||||
 | 
					            gst_caps_get_structure (pwsrc->caps, 0)),
 | 
				
			||||||
 | 
					          "video/")) {
 | 
				
			||||||
 | 
					      pwsrc->is_video = TRUE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_GSTREAMER_DMA_DRM
 | 
					#ifdef HAVE_GSTREAMER_DMA_DRM
 | 
				
			||||||
    if (gst_video_is_dma_drm_caps (pwsrc->caps)) {
 | 
					    if (gst_video_is_dma_drm_caps (pwsrc->caps)) {
 | 
				
			||||||
      if (!gst_video_info_dma_drm_from_caps (&pwsrc->drm_info, pwsrc->caps)) {
 | 
					      if (!gst_video_info_dma_drm_from_caps (&pwsrc->drm_info, pwsrc->caps)) {
 | 
				
			||||||
| 
						 | 
					@ -1042,13 +1047,12 @@ handle_format_change (GstPipeWireSrc *pwsrc,
 | 
				
			||||||
        pw_stream_set_error (pwsrc->stream, -EINVAL, "internal error");
 | 
					        pw_stream_set_error (pwsrc->stream, -EINVAL, "internal error");
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					 | 
				
			||||||
      pwsrc->is_video = TRUE;
 | 
					 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      gst_video_info_dma_drm_init (&pwsrc->drm_info);
 | 
					      gst_video_info_dma_drm_init (&pwsrc->drm_info);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
      pwsrc->is_video = gst_video_info_from_caps (&pwsrc->video_info,
 | 
					      gst_video_info_from_caps (&pwsrc->video_info,
 | 
				
			||||||
                                                  pwsrc->caps);
 | 
					          pwsrc->caps);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
#ifdef HAVE_GSTREAMER_DMA_DRM
 | 
					#ifdef HAVE_GSTREAMER_DMA_DRM
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue