mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	raop: Add fp_sap25 encryption type
				
					
				
			Add support for FairPlay SAP v2.5 (encryption type 5) type devices such as Apple Home Pod Minis. Apparently only these devices require the `POST /feedback` heartbeat, so fix that.
This commit is contained in:
		
							parent
							
								
									1c542e9a0c
								
							
						
					
					
						commit
						30df4e70d0
					
				
					 2 changed files with 13 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -71,7 +71,7 @@
 | 
			
		|||
 *                          #raop.domain = ""
 | 
			
		||||
 *                          #raop.device = ""
 | 
			
		||||
 *                          #raop.transport = "udp" | "tcp"
 | 
			
		||||
 *                          #raop.encryption.type = "RSA" | "auth_setup" | "none"
 | 
			
		||||
 *                          #raop.encryption.type = "none" | "RSA" | "auth_setup" | "fp_sap25"
 | 
			
		||||
 *                          #raop.audio.codec = "PCM" | "ALAC" | "AAC" | "AAC-ELD"
 | 
			
		||||
 *                          #audio.channels = 2
 | 
			
		||||
 *                          #audio.format = "S16" | "S24" | "S32"
 | 
			
		||||
| 
						 | 
				
			
			@ -244,10 +244,12 @@ static void pw_properties_from_avahi_string(const char *key, const char *value,
 | 
			
		|||
		 *  3 = FairPlay,
 | 
			
		||||
		 *  4 = MFiSAP (/auth-setup),
 | 
			
		||||
		 *  5 = FairPlay SAPv2.5 */
 | 
			
		||||
		if (str_in_list(value, ",", "1"))
 | 
			
		||||
			value = "RSA";
 | 
			
		||||
		if (str_in_list(value, ",", "5"))
 | 
			
		||||
			value = "fp_sap25";
 | 
			
		||||
		else if (str_in_list(value, ",", "4"))
 | 
			
		||||
			value = "auth_setup";
 | 
			
		||||
		else if (str_in_list(value, ",", "1"))
 | 
			
		||||
			value = "RSA";
 | 
			
		||||
		else
 | 
			
		||||
			value = "none";
 | 
			
		||||
		pw_properties_set(props, "raop.encryption.type", value);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -197,6 +197,7 @@ enum {
 | 
			
		|||
	CRYPTO_NONE,
 | 
			
		||||
	CRYPTO_RSA,
 | 
			
		||||
	CRYPTO_AUTH_SETUP,
 | 
			
		||||
	CRYPTO_FP_SAP25,
 | 
			
		||||
};
 | 
			
		||||
enum {
 | 
			
		||||
	CODEC_PCM,
 | 
			
		||||
| 
						 | 
				
			
			@ -892,8 +893,8 @@ static int rtsp_record_reply(void *data, int status, const struct spa_dict *head
 | 
			
		|||
	interval.tv_nsec = 0;
 | 
			
		||||
 | 
			
		||||
	// feedback timer is only needed for auth_setup	encryption
 | 
			
		||||
	if (impl->encryption == CRYPTO_AUTH_SETUP && !impl->feedback_timer) {
 | 
			
		||||
 | 
			
		||||
	if (impl->encryption == CRYPTO_FP_SAP25) {
 | 
			
		||||
		if (!impl->feedback_timer)
 | 
			
		||||
			impl->feedback_timer = pw_loop_add_timer(impl->loop, rtsp_do_post_feedback, impl);
 | 
			
		||||
		pw_loop_update_timer(impl->loop, impl->feedback_timer, &timeout, &interval, false);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -1239,6 +1240,7 @@ static int rtsp_do_announce(struct impl *impl)
 | 
			
		|||
 | 
			
		||||
	switch (impl->encryption) {
 | 
			
		||||
	case CRYPTO_NONE:
 | 
			
		||||
	case CRYPTO_FP_SAP25:
 | 
			
		||||
		sdp = spa_aprintf("v=0\r\n"
 | 
			
		||||
				"o=iTunes %s 0 IN IP%d %s\r\n"
 | 
			
		||||
				"s=iTunes\r\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -1252,6 +1254,7 @@ static int rtsp_do_announce(struct impl *impl)
 | 
			
		|||
		if (!sdp)
 | 
			
		||||
			return -errno;
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	case CRYPTO_AUTH_SETUP:
 | 
			
		||||
		sdp = spa_aprintf("v=0\r\n"
 | 
			
		||||
				"o=iTunes %s 0 IN IP%d %s\r\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -1877,6 +1880,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
			
		|||
		impl->encryption = CRYPTO_RSA;
 | 
			
		||||
	else if (spa_streq(str, "auth_setup"))
 | 
			
		||||
		impl->encryption = CRYPTO_AUTH_SETUP;
 | 
			
		||||
	else if (spa_streq(str, "fp_sap25"))
 | 
			
		||||
		impl->encryption = CRYPTO_FP_SAP25;
 | 
			
		||||
	else {
 | 
			
		||||
		pw_log_error( "can't handle encryption type %s", str);
 | 
			
		||||
		res = -EINVAL;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue