mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	bluez5: add parameter to use A2DP source as input
This commit is contained in:
		
							parent
							
								
									149471631e
								
							
						
					
					
						commit
						e7f2f450ff
					
				
					 2 changed files with 17 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -129,6 +129,8 @@ struct impl {
 | 
			
		|||
	struct timespec now;
 | 
			
		||||
	uint64_t sample_count;
 | 
			
		||||
	uint64_t skip_count;
 | 
			
		||||
 | 
			
		||||
	bool is_input;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define NAME "a2dp-source"
 | 
			
		||||
| 
						 | 
				
			
			@ -746,12 +748,14 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
 | 
			
		|||
static void emit_node_info(struct impl *this, bool full)
 | 
			
		||||
{
 | 
			
		||||
	char latency[64] = SPA_STRINGIFY(MIN_LATENCY)"/48000";
 | 
			
		||||
 | 
			
		||||
	struct spa_dict_item node_info_items[] = {
 | 
			
		||||
		{ SPA_KEY_DEVICE_API, "bluez5" },
 | 
			
		||||
		{ SPA_KEY_MEDIA_CLASS, "Stream/Output/Audio" },
 | 
			
		||||
		{ SPA_KEY_MEDIA_CLASS, this->is_input ? "Audio/Source" : "Stream/Output/Audio" },
 | 
			
		||||
		{ SPA_KEY_NODE_LATENCY, latency },
 | 
			
		||||
		{ "media.name", ((this->transport && this->transport->device->name) ?
 | 
			
		||||
		                 this->transport->device->name : "A2DP") },
 | 
			
		||||
                { SPA_KEY_NODE_DRIVER, this->is_input ? "true" : "false" },
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	if (full)
 | 
			
		||||
| 
						 | 
				
			
			@ -1321,6 +1325,13 @@ impl_init(const struct spa_handle_factory *factory,
 | 
			
		|||
		this->codec_props = this->codec->init_props(this->codec,
 | 
			
		||||
					this->transport->device->settings);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	const char *a2dp_source_role = spa_dict_lookup(info, "bluez5.a2dp-source-role");
 | 
			
		||||
	if (a2dp_source_role != NULL && !strcmp("input", a2dp_source_role))
 | 
			
		||||
		this->is_input = true;
 | 
			
		||||
	else
 | 
			
		||||
		this->is_input = false;
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -84,6 +84,11 @@ rules = [
 | 
			
		|||
                #channelmix.normalize = false
 | 
			
		||||
                #channelmix.mix-lfe   = false
 | 
			
		||||
                #session.suspend-timeout-seconds = 5      # 0 disables suspend
 | 
			
		||||
 | 
			
		||||
                # A2DP source role, "input" or "playback"
 | 
			
		||||
                # Defaults to "playback", playing stream to speakers
 | 
			
		||||
                # Set to "input" to use as an input for apps
 | 
			
		||||
                #bluez5.a2dp-source-role = input
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue