mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	gst: Accept MP3 and FLAC for compressed sink
This commit is contained in:
		
							parent
							
								
									6a034cc398
								
							
						
					
					
						commit
						92344bf8ac
					
				
					 2 changed files with 16 additions and 0 deletions
				
			
		| 
						 | 
					@ -59,6 +59,8 @@ static const struct media_type media_type_map[] = {
 | 
				
			||||||
  { "video/x-h264", SPA_MEDIA_TYPE_video, SPA_MEDIA_SUBTYPE_h264 },
 | 
					  { "video/x-h264", SPA_MEDIA_TYPE_video, SPA_MEDIA_SUBTYPE_h264 },
 | 
				
			||||||
  { "audio/x-mulaw", SPA_MEDIA_TYPE_audio, SPA_MEDIA_SUBTYPE_raw },
 | 
					  { "audio/x-mulaw", SPA_MEDIA_TYPE_audio, SPA_MEDIA_SUBTYPE_raw },
 | 
				
			||||||
  { "audio/x-alaw", SPA_MEDIA_TYPE_audio, SPA_MEDIA_SUBTYPE_raw },
 | 
					  { "audio/x-alaw", SPA_MEDIA_TYPE_audio, SPA_MEDIA_SUBTYPE_raw },
 | 
				
			||||||
 | 
					  { "audio/mpeg", SPA_MEDIA_TYPE_audio, SPA_MEDIA_SUBTYPE_mp3 },
 | 
				
			||||||
 | 
					  { "audio/x-flac", SPA_MEDIA_TYPE_audio, SPA_MEDIA_SUBTYPE_flac },
 | 
				
			||||||
  { NULL, }
 | 
					  { NULL, }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -532,6 +534,12 @@ handle_audio_fields (ConvertData *d)
 | 
				
			||||||
  } else if (strcmp(d->type->name, "audio/x-alaw") == 0) {
 | 
					  } else if (strcmp(d->type->name, "audio/x-alaw") == 0) {
 | 
				
			||||||
        spa_pod_builder_prop (&d->b, SPA_FORMAT_AUDIO_format, 0);
 | 
					        spa_pod_builder_prop (&d->b, SPA_FORMAT_AUDIO_format, 0);
 | 
				
			||||||
        spa_pod_builder_id (&d->b, SPA_AUDIO_FORMAT_ALAW);
 | 
					        spa_pod_builder_id (&d->b, SPA_AUDIO_FORMAT_ALAW);
 | 
				
			||||||
 | 
					  } else if (strcmp(d->type->name, "audio/mpeg") == 0) {
 | 
				
			||||||
 | 
					        spa_pod_builder_prop (&d->b, SPA_FORMAT_AUDIO_format, 0);
 | 
				
			||||||
 | 
					        spa_pod_builder_id (&d->b, SPA_AUDIO_FORMAT_ENCODED);
 | 
				
			||||||
 | 
					  } else if (strcmp(d->type->name, "audio/x-flac") == 0) {
 | 
				
			||||||
 | 
					        spa_pod_builder_prop (&d->b, SPA_FORMAT_AUDIO_format, 0);
 | 
				
			||||||
 | 
					        spa_pod_builder_id (&d->b, SPA_AUDIO_FORMAT_ENCODED);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if 0
 | 
					#if 0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -346,6 +346,14 @@ gst_pipewire_sink_sink_fixate (GstBaseSink * bsink, GstCaps * caps)
 | 
				
			||||||
    gst_structure_fixate_field_string (structure, "format", "S16LE");
 | 
					    gst_structure_fixate_field_string (structure, "format", "S16LE");
 | 
				
			||||||
    gst_structure_fixate_field_nearest_int (structure, "channels", 2);
 | 
					    gst_structure_fixate_field_nearest_int (structure, "channels", 2);
 | 
				
			||||||
    gst_structure_fixate_field_nearest_int (structure, "rate", 44100);
 | 
					    gst_structure_fixate_field_nearest_int (structure, "rate", 44100);
 | 
				
			||||||
 | 
					  } else if (gst_structure_has_name (structure, "audio/mpeg")) {
 | 
				
			||||||
 | 
					    gst_structure_fixate_field_string (structure, "format", "Encoded");
 | 
				
			||||||
 | 
					    gst_structure_fixate_field_nearest_int (structure, "channels", 2);
 | 
				
			||||||
 | 
					    gst_structure_fixate_field_nearest_int (structure, "rate", 44100);
 | 
				
			||||||
 | 
					  } else if (gst_structure_has_name (structure, "audio/x-flac")) {
 | 
				
			||||||
 | 
					    gst_structure_fixate_field_string (structure, "format", "Encoded");
 | 
				
			||||||
 | 
					    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);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue