mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	avb: add some more descriptors
PipeWire Streams now show up in Hive.
This commit is contained in:
		
							parent
							
								
									4613c7822f
								
							
						
					
					
						commit
						b6b8471540
					
				
					 2 changed files with 131 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -147,9 +147,16 @@ struct avbtp_aem_desc_audio_unit {
 | 
			
		|||
	struct avbtp_aem_desc_sampling_rate sampling_rates[0];
 | 
			
		||||
} __attribute__ ((__packed__));
 | 
			
		||||
 | 
			
		||||
#define AVBTP_AEM_DESC_STREAM_FLAG_SYNC_SOURCE	(1<<0)
 | 
			
		||||
#define AVBTP_AEM_DESC_STREAM_FLAG_CLASS_A	(1<<1)
 | 
			
		||||
#define AVBTP_AEM_DESC_STREAM_FLAG_CLASS_B	(1<<2)
 | 
			
		||||
#define AVBTP_AEM_DESC_STREAM_FLAG_SYNC_SOURCE			(1u<<0)
 | 
			
		||||
#define AVBTP_AEM_DESC_STREAM_FLAG_CLASS_A			(1u<<1)
 | 
			
		||||
#define AVBTP_AEM_DESC_STREAM_FLAG_CLASS_B			(1u<<2)
 | 
			
		||||
#define AVBTP_AEM_DESC_STREAM_FLAG_SUPPORTS_ENCRYPTED		(1u<<3)
 | 
			
		||||
#define AVBTP_AEM_DESC_STREAM_FLAG_PRIMARY_BACKUP_SUPPORTED	(1u<<4)
 | 
			
		||||
#define AVBTP_AEM_DESC_STREAM_FLAG_PRIMARY_BACKUP_VALID		(1u<<5)
 | 
			
		||||
#define AVBTP_AEM_DESC_STREAM_FLAG_SECONDARY_BACKUP_SUPPORTED	(1u<<6)
 | 
			
		||||
#define AVBTP_AEM_DESC_STREAM_FLAG_SECONDARY_BACKUP_VALID	(1u<<7)
 | 
			
		||||
#define AVBTP_AEM_DESC_STREAM_FLAG_TERTIARY_BACKUP_SUPPORTED	(1u<<8)
 | 
			
		||||
#define AVBTP_AEM_DESC_STREAM_FLAG_TERTIARY_BACKUP_VALID	(1u<<9)
 | 
			
		||||
 | 
			
		||||
struct avbtp_aem_desc_stream {
 | 
			
		||||
	char object_name[64];
 | 
			
		||||
| 
						 | 
				
			
			@ -172,6 +179,44 @@ struct avbtp_aem_desc_stream {
 | 
			
		|||
	uint64_t stream_formats[0];
 | 
			
		||||
} __attribute__ ((__packed__));
 | 
			
		||||
 | 
			
		||||
#define AVBTP_AEM_DESC_AVB_INTERFACE_FLAG_GPTP_GRANDMASTER_SUPPORTED	(1<<0)
 | 
			
		||||
#define AVBTP_AEM_DESC_AVB_INTERFACE_FLAG_GPTP_SUPPORTED		(1<<1)
 | 
			
		||||
#define AVBTP_AEM_DESC_AVB_INTERFACE_FLAG_SRP_SUPPORTED			(1<<2)
 | 
			
		||||
 | 
			
		||||
struct avbtp_aem_desc_avb_interface {
 | 
			
		||||
	char object_name[64];
 | 
			
		||||
	uint16_t localized_description;
 | 
			
		||||
	uint8_t mac_address[6];
 | 
			
		||||
	uint16_t interface_flags;
 | 
			
		||||
	uint64_t clock_identity;
 | 
			
		||||
	uint8_t priority1;
 | 
			
		||||
	uint8_t clock_class;
 | 
			
		||||
	uint16_t offset_scaled_log_variance;
 | 
			
		||||
	uint8_t clock_accuracy;
 | 
			
		||||
	uint8_t priority2;
 | 
			
		||||
	uint8_t domain_number;
 | 
			
		||||
	int8_t log_sync_interval;
 | 
			
		||||
	int8_t log_announce_interval;
 | 
			
		||||
	int8_t log_pdelay_interval;
 | 
			
		||||
	uint16_t port_number;
 | 
			
		||||
} __attribute__ ((__packed__));
 | 
			
		||||
 | 
			
		||||
#define AVBTP_AEM_DESC_CLOCK_SOURCE_TYPE_INTERNAL		0x0000
 | 
			
		||||
#define AVBTP_AEM_DESC_CLOCK_SOURCE_TYPE_EXTERNAL		0x0001
 | 
			
		||||
#define AVBTP_AEM_DESC_CLOCK_SOURCE_TYPE_INPUT_STREAM		0x0002
 | 
			
		||||
#define AVBTP_AEM_DESC_CLOCK_SOURCE_TYPE_MEDIA_CLOCK_STREAM	0x0003
 | 
			
		||||
#define AVBTP_AEM_DESC_CLOCK_SOURCE_TYPE_EXPANSION		0xffff
 | 
			
		||||
 | 
			
		||||
struct avbtp_aem_desc_clock_source {
 | 
			
		||||
	char object_name[64];
 | 
			
		||||
	uint16_t localized_description;
 | 
			
		||||
	uint16_t clock_source_flags;
 | 
			
		||||
	uint16_t clock_source_type;
 | 
			
		||||
	uint64_t clock_source_identifier;
 | 
			
		||||
	uint16_t clock_source_location_type;
 | 
			
		||||
	uint16_t clock_source_location_index;
 | 
			
		||||
} __attribute__ ((__packed__));
 | 
			
		||||
 | 
			
		||||
struct avbtp_aem_desc_locale {
 | 
			
		||||
	char locale_identifier[64];
 | 
			
		||||
	uint16_t number_of_strings;
 | 
			
		||||
| 
						 | 
				
			
			@ -188,4 +233,14 @@ struct avbtp_aem_desc_strings {
 | 
			
		|||
	char string_6[64];
 | 
			
		||||
} __attribute__ ((__packed__));
 | 
			
		||||
 | 
			
		||||
struct avbtp_aem_desc_stream_port {
 | 
			
		||||
	uint16_t clock_domain_index;
 | 
			
		||||
	uint16_t port_flags;
 | 
			
		||||
	uint16_t number_of_controls;
 | 
			
		||||
	uint16_t base_control;
 | 
			
		||||
	uint16_t number_of_clusters;
 | 
			
		||||
	uint16_t base_cluster;
 | 
			
		||||
	uint16_t number_of_maps;
 | 
			
		||||
	uint16_t base_map;
 | 
			
		||||
} __attribute__ ((__packed__));
 | 
			
		||||
#endif /* AVBTP_AECP_AEM_DESCRIPTORS_H */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -102,16 +102,14 @@ void init_descriptors(struct server *server)
 | 
			
		|||
		.localized_description = htons(1),
 | 
			
		||||
		.descriptor_counts_count = htons(8),
 | 
			
		||||
		.descriptor_counts_offset = htons(
 | 
			
		||||
			sizeof(struct avbtp_packet_aecp_aem) +
 | 
			
		||||
			sizeof(struct avbtp_packet_aecp_aem_read_descriptor) +
 | 
			
		||||
			sizeof(struct avbtp_aem_desc_configuration)),
 | 
			
		||||
			4 + sizeof(struct avbtp_aem_desc_configuration)),
 | 
			
		||||
		},
 | 
			
		||||
		.descriptor_counts = {
 | 
			
		||||
			{ htons(AVBTP_AEM_DESC_AUDIO_UNIT), htons(1) },
 | 
			
		||||
			{ htons(AVBTP_AEM_DESC_STREAM_INPUT), htons(1) },
 | 
			
		||||
			{ htons(AVBTP_AEM_DESC_STREAM_OUTPUT), htons(1) },
 | 
			
		||||
			{ htons(AVBTP_AEM_DESC_AVB_INTERFACE), htons(1) },
 | 
			
		||||
			{ htons(AVBTP_AEM_DESC_CLOCK_SOURCE), htons(13) },
 | 
			
		||||
			{ htons(AVBTP_AEM_DESC_CLOCK_SOURCE), htons(1) },
 | 
			
		||||
			{ htons(AVBTP_AEM_DESC_CONTROL), htons(2) },
 | 
			
		||||
			{ htons(AVBTP_AEM_DESC_LOCALE), htons(1) },
 | 
			
		||||
			{ htons(AVBTP_AEM_DESC_CLOCK_DOMAIN), htons(1) }
 | 
			
		||||
| 
						 | 
				
			
			@ -217,4 +215,75 @@ void init_descriptors(struct server *server)
 | 
			
		|||
	add_descriptor(server, AVBTP_AEM_DESC_STREAM_INPUT, 0,
 | 
			
		||||
			sizeof(stream_input_0), &stream_input_0);
 | 
			
		||||
 | 
			
		||||
	struct {
 | 
			
		||||
		struct avbtp_aem_desc_stream desc;
 | 
			
		||||
		uint64_t stream_formats[6];
 | 
			
		||||
	} __attribute__ ((__packed__)) stream_output_0 =
 | 
			
		||||
	{
 | 
			
		||||
		{
 | 
			
		||||
		.object_name = "Stream Output 1",
 | 
			
		||||
		.localized_description = htons(0xffff),
 | 
			
		||||
		.clock_domain_index = htons(0),
 | 
			
		||||
		.stream_flags = htons(
 | 
			
		||||
				AVBTP_AEM_DESC_STREAM_FLAG_CLASS_A),
 | 
			
		||||
		.current_format = htobe64(0x00a0020840000800ULL),
 | 
			
		||||
		.formats_offset = htons(
 | 
			
		||||
			4 + sizeof(struct avbtp_aem_desc_stream)),
 | 
			
		||||
		.number_of_formats = htons(6),
 | 
			
		||||
		.backup_talker_entity_id_0 = htobe64(0),
 | 
			
		||||
		.backup_talker_unique_id_0 = htons(0),
 | 
			
		||||
		.backup_talker_entity_id_1 = htobe64(0),
 | 
			
		||||
		.backup_talker_unique_id_1 = htons(0),
 | 
			
		||||
		.backup_talker_entity_id_2 = htobe64(0),
 | 
			
		||||
		.backup_talker_unique_id_2 = htons(0),
 | 
			
		||||
		.backedup_talker_entity_id = htobe64(0),
 | 
			
		||||
		.backedup_talker_unique = htons(0),
 | 
			
		||||
		.avb_interface_index = htons(0),
 | 
			
		||||
		.buffer_length = htons(8)
 | 
			
		||||
		},
 | 
			
		||||
		.stream_formats = {
 | 
			
		||||
			htobe64(0x00a0010860000800ULL),
 | 
			
		||||
			htobe64(0x00a0020860000800ULL),
 | 
			
		||||
			htobe64(0x00a0030860000800ULL),
 | 
			
		||||
			htobe64(0x00a0040860000800ULL),
 | 
			
		||||
			htobe64(0x00a0050860000800ULL),
 | 
			
		||||
			htobe64(0x00a0060860000800ULL),
 | 
			
		||||
		},
 | 
			
		||||
	};
 | 
			
		||||
	add_descriptor(server, AVBTP_AEM_DESC_STREAM_OUTPUT, 0,
 | 
			
		||||
			sizeof(stream_output_0), &stream_output_0);
 | 
			
		||||
 | 
			
		||||
	struct avbtp_aem_desc_avb_interface avb_interface = {
 | 
			
		||||
		.localized_description = htons(0xffff),
 | 
			
		||||
		.interface_flags = htons(
 | 
			
		||||
				AVBTP_AEM_DESC_AVB_INTERFACE_FLAG_GPTP_GRANDMASTER_SUPPORTED),
 | 
			
		||||
		.clock_identity = htobe64(0),
 | 
			
		||||
		.priority1 = 0,
 | 
			
		||||
		.clock_class = 0,
 | 
			
		||||
		.offset_scaled_log_variance = htons(0),
 | 
			
		||||
		.clock_accuracy = 0,
 | 
			
		||||
		.priority2 = 0,
 | 
			
		||||
		.domain_number = 0,
 | 
			
		||||
		.log_sync_interval = 0,
 | 
			
		||||
		.log_announce_interval = 0,
 | 
			
		||||
		.log_pdelay_interval = 0,
 | 
			
		||||
		.port_number = 0,
 | 
			
		||||
	};
 | 
			
		||||
	strncpy(avb_interface.object_name, server->ifname, 63);
 | 
			
		||||
	memcpy(avb_interface.mac_address, server->mac_addr, 6);
 | 
			
		||||
	add_descriptor(server, AVBTP_AEM_DESC_AVB_INTERFACE, 0,
 | 
			
		||||
			sizeof(avb_interface), &avb_interface);
 | 
			
		||||
 | 
			
		||||
	struct avbtp_aem_desc_clock_source clock_source = {
 | 
			
		||||
		.object_name = "Stream Clock",
 | 
			
		||||
		.localized_description = htons(0xffff),
 | 
			
		||||
		.clock_source_flags = htons(0),
 | 
			
		||||
		.clock_source_type = htons(
 | 
			
		||||
				AVBTP_AEM_DESC_CLOCK_SOURCE_TYPE_INPUT_STREAM),
 | 
			
		||||
		.clock_source_identifier = htobe64(0),
 | 
			
		||||
		.clock_source_location_type = htons(AVBTP_AEM_DESC_STREAM_INPUT),
 | 
			
		||||
		.clock_source_location_index = htons(0),
 | 
			
		||||
	};
 | 
			
		||||
	add_descriptor(server, AVBTP_AEM_DESC_CLOCK_SOURCE, 0,
 | 
			
		||||
			sizeof(clock_source), &clock_source);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue