mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-29 06:46:38 -04:00
module-vban: create streams per stream_name
Always listen on the receive socket. Find the stream with the given stream_name of the packet and create it if it doesn't exist. Also take the sample-rate, channels and format from the packet parameters instead of the config. Fixes #4400
This commit is contained in:
parent
567b484386
commit
1a5514e5cf
6 changed files with 284 additions and 153 deletions
|
|
@ -17,21 +17,30 @@ extern "C" {
|
|||
#define VBAN_SAMPLES_MAX_NB 256
|
||||
|
||||
struct vban_header {
|
||||
char vban[4]; /* contains 'V' 'B', 'A', 'N' */
|
||||
uint8_t format_SR; /* SR index */
|
||||
uint8_t format_nbs; /* nb sample per frame (1 to 256) */
|
||||
uint8_t format_nbc; /* nb channel (1 to 256) */
|
||||
uint8_t format_bit; /* bit format */
|
||||
char vban[4]; /* contains 'V' 'B', 'A', 'N' */
|
||||
uint8_t format_SR; /* SR index */
|
||||
uint8_t format_nbs; /* nb sample per frame (1 to 256) */
|
||||
uint8_t format_nbc; /* nb channel (1 to 256) */
|
||||
uint8_t format_bit; /* bit format */
|
||||
char stream_name[VBAN_STREAM_NAME_SIZE]; /* stream name */
|
||||
uint32_t n_frames; /* growing frame number. */
|
||||
uint32_t n_frames; /* growing frame number. */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define VBAN_PROTOCOL_AUDIO 0x00
|
||||
#define VBAN_PROTOCOL_SERIAL 0x20
|
||||
#define VBAN_PROTOCOL_TXT 0x40
|
||||
#define VBAN_PROTOCOL_SERVICE 0x60
|
||||
#define VBAN_PROTOCOL_UNDEFINED_1 0x80
|
||||
#define VBAN_PROTOCOL_UNDEFINED_2 0xA0
|
||||
#define VBAN_PROTOCOL_UNDEFINED_3 0xC0
|
||||
#define VBAN_PROTOCOL_USER 0xE0
|
||||
|
||||
#define VBAN_SR_MAXNUMBER 21
|
||||
|
||||
static uint32_t const vban_SR[VBAN_SR_MAXNUMBER] = {
|
||||
6000, 12000, 24000, 48000, 96000, 192000, 384000,
|
||||
8000, 16000, 32000, 64000, 128000, 256000, 512000,
|
||||
11025, 22050, 44100, 88200, 176400, 352800, 705600
|
||||
static uint32_t const vban_SR[32] = {
|
||||
6000, 12000, 24000, 48000, 96000, 192000, 384000,
|
||||
8000, 16000, 32000, 64000, 128000, 256000, 512000,
|
||||
11025, 22050, 44100, 88200, 176400, 352800, 705600
|
||||
};
|
||||
|
||||
static inline uint8_t vban_sr_index(uint32_t rate)
|
||||
|
|
@ -44,7 +53,37 @@ static inline uint8_t vban_sr_index(uint32_t rate)
|
|||
return VBAN_SR_MAXNUMBER;
|
||||
}
|
||||
|
||||
#define VBAN_DATATYPE_U8 0x00
|
||||
#define VBAN_CODEC_PCM 0x00
|
||||
#define VBAN_CODEC_VBCA 0x10 //VB-AUDIO AOIP CODEC
|
||||
#define VBAN_CODEC_VBCV 0x20 //VB-AUDIO VOIP CODEC
|
||||
#define VBAN_CODEC_UNDEFINED_1 0x30
|
||||
#define VBAN_CODEC_UNDEFINED_2 0x40
|
||||
#define VBAN_CODEC_UNDEFINED_3 0x50
|
||||
#define VBAN_CODEC_UNDEFINED_4 0x60
|
||||
#define VBAN_CODEC_UNDEFINED_5 0x70
|
||||
#define VBAN_CODEC_UNDEFINED_6 0x80
|
||||
#define VBAN_CODEC_UNDEFINED_7 0x90
|
||||
#define VBAN_CODEC_UNDEFINED_8 0xA0
|
||||
#define VBAN_CODEC_UNDEFINED_9 0xB0
|
||||
#define VBAN_CODEC_UNDEFINED_10 0xC0
|
||||
#define VBAN_CODEC_UNDEFINED_11 0xD0
|
||||
#define VBAN_CODEC_UNDEFINED_12 0xE0
|
||||
#define VBAN_CODEC_USER 0xF0
|
||||
|
||||
#define VBAN_BPS_MAXNUMBER 25
|
||||
|
||||
static const long vban_BPSList[32] = {
|
||||
0, 110, 150, 300, 600, 1200, 2400, 4800, 9600,
|
||||
14400, 19200, 31250, 38400, 57600, 115200, 128000,
|
||||
230400, 250000, 256000, 460800, 921600, 1000000,
|
||||
1500000, 2000000, 3000000
|
||||
};
|
||||
|
||||
#define VBAN_SERIAL_GENERIC 0x00
|
||||
#define VBAN_SERIAL_MIDI 0x10
|
||||
#define VBAN_SERIAL_USER 0xf0
|
||||
|
||||
#define VBAN_DATATYPE_BYTE8 0x00
|
||||
#define VBAN_DATATYPE_INT16 0x01
|
||||
#define VBAN_DATATYPE_INT24 0x02
|
||||
#define VBAN_DATATYPE_INT32 0x03
|
||||
|
|
@ -53,10 +92,6 @@ static inline uint8_t vban_sr_index(uint32_t rate)
|
|||
#define VBAN_DATATYPE_12BITS 0x06
|
||||
#define VBAN_DATATYPE_10BITS 0x07
|
||||
|
||||
#define VBAN_SERIAL_GENERIC 0x00
|
||||
#define VBAN_SERIAL_MIDI 0x10
|
||||
#define VBAN_SERIAL_USER 0xf0
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue