mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	gst: fix fixation
Implement fixate for video and audio caps
This commit is contained in:
		
							parent
							
								
									4b72848a1a
								
							
						
					
					
						commit
						0dd41f5e40
					
				
					 2 changed files with 50 additions and 38 deletions
				
			
		| 
						 | 
					@ -136,6 +136,7 @@ gst_pinos_sink_sink_fixate (GstBaseSink * bsink, GstCaps * caps)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  structure = gst_caps_get_structure (caps, 0);
 | 
					  structure = gst_caps_get_structure (caps, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (gst_structure_has_name (structure, "video/x-raw")) {
 | 
				
			||||||
    gst_structure_fixate_field_nearest_int (structure, "width", 320);
 | 
					    gst_structure_fixate_field_nearest_int (structure, "width", 320);
 | 
				
			||||||
    gst_structure_fixate_field_nearest_int (structure, "height", 240);
 | 
					    gst_structure_fixate_field_nearest_int (structure, "height", 240);
 | 
				
			||||||
    gst_structure_fixate_field_nearest_fraction (structure, "framerate", 30, 1);
 | 
					    gst_structure_fixate_field_nearest_fraction (structure, "framerate", 30, 1);
 | 
				
			||||||
| 
						 | 
					@ -158,6 +159,11 @@ gst_pinos_sink_sink_fixate (GstBaseSink * bsink, GstCaps * caps)
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      gst_structure_set (structure, "interlace-mode", G_TYPE_STRING,
 | 
					      gst_structure_set (structure, "interlace-mode", G_TYPE_STRING,
 | 
				
			||||||
          "progressive", NULL);
 | 
					          "progressive", NULL);
 | 
				
			||||||
 | 
					  } else if (gst_structure_has_name (structure, "audio/x-raw")) {
 | 
				
			||||||
 | 
					    gst_structure_fixate_field_string (structure, "format", "S16LE");
 | 
				
			||||||
 | 
					    gst_structure_fixate_field_nearest_int (structure, "channels", 2);
 | 
				
			||||||
 | 
					    gst_structure_fixate_field_nearest_int (structure, "rate", 44100);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  caps = GST_BASE_SINK_CLASS (parent_class)->fixate (bsink, caps);
 | 
					  caps = GST_BASE_SINK_CLASS (parent_class)->fixate (bsink, caps);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -199,6 +199,7 @@ gst_pinos_src_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  structure = gst_caps_get_structure (caps, 0);
 | 
					  structure = gst_caps_get_structure (caps, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (gst_structure_has_name (structure, "video/x-raw")) {
 | 
				
			||||||
    gst_structure_fixate_field_nearest_int (structure, "width", 320);
 | 
					    gst_structure_fixate_field_nearest_int (structure, "width", 320);
 | 
				
			||||||
    gst_structure_fixate_field_nearest_int (structure, "height", 240);
 | 
					    gst_structure_fixate_field_nearest_int (structure, "height", 240);
 | 
				
			||||||
    gst_structure_fixate_field_nearest_fraction (structure, "framerate", 30, 1);
 | 
					    gst_structure_fixate_field_nearest_fraction (structure, "framerate", 30, 1);
 | 
				
			||||||
| 
						 | 
					@ -221,6 +222,11 @@ gst_pinos_src_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      gst_structure_set (structure, "interlace-mode", G_TYPE_STRING,
 | 
					      gst_structure_set (structure, "interlace-mode", G_TYPE_STRING,
 | 
				
			||||||
          "progressive", NULL);
 | 
					          "progressive", NULL);
 | 
				
			||||||
 | 
					  } else if (gst_structure_has_name (structure, "audio/x-raw")) {
 | 
				
			||||||
 | 
					    gst_structure_fixate_field_string (structure, "format", "S16LE");
 | 
				
			||||||
 | 
					    gst_structure_fixate_field_nearest_int (structure, "channels", 2);
 | 
				
			||||||
 | 
					    gst_structure_fixate_field_nearest_int (structure, "rate", 44100);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  caps = GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps);
 | 
					  caps = GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue