avb: implement streams

Add in input/output stream, setup the talker/listeners.
Implement IEC61883 audio packets, send and receive data.
Implement talker encoding.

With this, audio can be sent and received from MOTU M64.
This commit is contained in:
Wim Taymans 2022-04-05 18:10:27 +02:00
parent 460cedbc86
commit e0d6b2bb4f
15 changed files with 1083 additions and 94 deletions

View file

@ -31,6 +31,9 @@ extern "C" {
#include <pipewire/pipewire.h>
struct server;
struct avb_mrp;
#define AVB_TSN_ETH 0x22f0
#define AVB_BROADCAST_MAC { 0x91, 0xe0, 0xf0, 0x01, 0x00, 0x00 };
@ -38,6 +41,8 @@ struct impl {
struct pw_loop *loop;
struct pw_context *context;
struct spa_hook context_listener;
struct pw_core *core;
unsigned do_disconnect:1;
struct pw_properties *props;
struct pw_work_queue *work_queue;
@ -67,7 +72,6 @@ struct descriptor {
void *ptr;
};
struct server {
struct spa_list link;
struct impl *impl;
@ -83,6 +87,7 @@ struct server {
struct spa_hook_list listener_list;
struct spa_list descriptors;
struct spa_list streams;
unsigned debug_messages:1;
@ -92,9 +97,10 @@ struct server {
struct avb_msrp *msrp;
struct avb_msrp_attribute *domain_attr;
struct avb_msrp_attribute *listener_attr;
};
#include "stream.h"
static inline const struct descriptor *server_find_descriptor(struct server *server,
uint16_t type, uint16_t index)
{
@ -124,6 +130,18 @@ static inline void *server_add_descriptor(struct server *server,
return d->ptr;
}
static inline struct stream *server_find_stream(struct server *server,
enum spa_direction direction, uint16_t index)
{
struct stream *s;
spa_list_for_each(s, &server->streams, link) {
if (s->direction == direction &&
s->index == index)
return s;
}
return NULL;
}
struct server *avdecc_server_new(struct impl *impl, const char *ifname, struct spa_dict *props);
void avdecc_server_free(struct server *server);