FreeBSD kernel sound device code
feeder_matrix.c File Reference
#include <dev/sound/pcm/sound.h>
#include <dev/sound/pcm/pcm.h>
#include "feeder_if.h"
#include "snd_fxdiv_gen.h"
Include dependency graph for feeder_matrix.c:

Go to the source code of this file.

Data Structures

struct  feed_matrix_info
 

Macros

#define SND_USE_FXDIV
 
#define FEEDMATRIX_RESERVOIR   (SND_CHN_MAX * PCM_32_BPS)
 
#define SND_CHN_T_EOF   0x00e0fe0f
 
#define SND_CHN_T_NULL   0x0e0e0e0e
 
#define FEEDMATRIX_CLIP_CHECK(...)
 
#define FEEDMATRIX_DECLARE(SIGN, BIT, ENDIAN)
 
#define FEEDMATRIX_ENTRY(SIGN, BIT, ENDIAN)
 
#define FEEDMATRIX_ATTN_SHIFT   16
 
#define SND_CHN_OSS_VALIDMASK
 
#define SND_CHN_OSS_MAX   8
 
#define SND_CHN_OSS_BEGIN   CHID_L
 
#define SND_CHN_OSS_END   CHID_RR
 

Typedefs

typedef void(* feed_matrix_t) (struct feed_matrix_info *, uint8_t *, uint8_t *, uint32_t)
 

Functions

 SND_DECLARE_FILE ("$FreeBSD$")
 
static void feed_matrix_reset (struct feed_matrix_info *info)
 
static int feed_matrix_setup (struct feed_matrix_info *info, struct pcmchan_matrix *m_in, struct pcmchan_matrix *m_out)
 
static int feed_matrix_init (struct pcm_feeder *f)
 
static int feed_matrix_free (struct pcm_feeder *f)
 
static int feed_matrix_feed (struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b, uint32_t count, void *source)
 
 FEEDER_DECLARE (feeder_matrix, NULL)
 
int feeder_matrix_setup (struct pcm_feeder *f, struct pcmchan_matrix *m_in, struct pcmchan_matrix *m_out)
 
int feeder_matrix_default_id (uint32_t ch)
 
struct pcmchan_matrixfeeder_matrix_default_channel_map (uint32_t ch)
 
uint32_t feeder_matrix_default_format (uint32_t format)
 
int feeder_matrix_format_id (uint32_t format)
 
struct pcmchan_matrixfeeder_matrix_format_map (uint32_t format)
 
struct pcmchan_matrixfeeder_matrix_id_map (int id)
 
int feeder_matrix_compare (struct pcmchan_matrix *m_in, struct pcmchan_matrix *m_out)
 
int feeder_matrix_oss_get_channel_order (struct pcmchan_matrix *m, unsigned long long *map)
 
int feeder_matrix_oss_set_channel_order (struct pcmchan_matrix *m, unsigned long long *map)
 

Variables

static struct pcmchan_matrix feeder_matrix_maps [SND_CHN_MATRIX_MAX]
 
static int feeder_matrix_default_ids [9]
 
struct {
   uint32_t   format
 
   feed_matrix_t   apply
 
feed_matrix_tab []
 
static struct pcm_feederdesc feeder_matrix_desc []
 
static kobj_method_t feeder_matrix_methods []
 
static int snd_chn_to_oss [SND_CHN_T_MAX]
 
static int oss_to_snd_chn [SND_CHN_OSS_END+1]
 

Macro Definition Documentation

◆ FEEDMATRIX_ATTN_SHIFT

#define FEEDMATRIX_ATTN_SHIFT   16

◆ FEEDMATRIX_CLIP_CHECK

#define FEEDMATRIX_CLIP_CHECK (   ...)

Definition at line 115 of file feeder_matrix.c.

◆ FEEDMATRIX_DECLARE

#define FEEDMATRIX_DECLARE (   SIGN,
  BIT,
  ENDIAN 
)

Definition at line 124 of file feeder_matrix.c.

◆ FEEDMATRIX_ENTRY

#define FEEDMATRIX_ENTRY (   SIGN,
  BIT,
  ENDIAN 
)
Value:
{ \
AFMT_##SIGN##BIT##_##ENDIAN, \
feed_matrix_##SIGN##BIT##ENDIAN \
}

Definition at line 198 of file feeder_matrix.c.

◆ FEEDMATRIX_RESERVOIR

#define FEEDMATRIX_RESERVOIR   (SND_CHN_MAX * PCM_32_BPS)

Definition at line 60 of file feeder_matrix.c.

◆ SND_CHN_OSS_BEGIN

#define SND_CHN_OSS_BEGIN   CHID_L

Definition at line 724 of file feeder_matrix.c.

◆ SND_CHN_OSS_END

#define SND_CHN_OSS_END   CHID_RR

Definition at line 725 of file feeder_matrix.c.

◆ SND_CHN_OSS_MAX

#define SND_CHN_OSS_MAX   8

Definition at line 723 of file feeder_matrix.c.

◆ SND_CHN_OSS_VALIDMASK

#define SND_CHN_OSS_VALIDMASK
Value:
SND_CHN_T_MASK_FC | SND_CHN_T_MASK_LF | \
SND_CHN_T_MASK_SL | SND_CHN_T_MASK_SR | \
SND_CHN_T_MASK_BL | SND_CHN_T_MASK_BR)
#define SND_CHN_T_MASK_FL
Definition: matrix.h:82
#define SND_CHN_T_MASK_LF
Definition: matrix.h:85
#define SND_CHN_T_MASK_BR
Definition: matrix.h:87
#define SND_CHN_T_MASK_FR
Definition: matrix.h:83
#define SND_CHN_T_MASK_SR
Definition: matrix.h:92

Definition at line 717 of file feeder_matrix.c.

◆ SND_CHN_T_EOF

#define SND_CHN_T_EOF   0x00e0fe0f

Definition at line 62 of file feeder_matrix.c.

◆ SND_CHN_T_NULL

#define SND_CHN_T_NULL   0x0e0e0e0e

Definition at line 63 of file feeder_matrix.c.

◆ SND_USE_FXDIV

#define SND_USE_FXDIV

Definition at line 54 of file feeder_matrix.c.

Typedef Documentation

◆ feed_matrix_t

typedef void(* feed_matrix_t) (struct feed_matrix_info *, uint8_t *, uint8_t *, uint32_t)

Definition at line 67 of file feeder_matrix.c.

Function Documentation

◆ feed_matrix_feed()

static int feed_matrix_feed ( struct pcm_feeder f,
struct pcm_channel c,
uint8_t *  b,
uint32_t  count,
void *  source 
)
static

◆ feed_matrix_free()

static int feed_matrix_free ( struct pcm_feeder f)
static

Definition at line 454 of file feeder_matrix.c.

References pcm_feeder::data, and free.

◆ feed_matrix_init()

◆ feed_matrix_reset()

static void feed_matrix_reset ( struct feed_matrix_info info)
static

Definition at line 231 of file feeder_matrix.c.

References feed_matrix_info::chn, feed_matrix_info::matrix, feed_matrix_info::mul, feed_matrix_info::shift, and SND_CHN_T_EOF.

Referenced by feed_matrix_setup().

Here is the caller graph for this function:

◆ feed_matrix_setup()

◆ FEEDER_DECLARE()

FEEDER_DECLARE ( feeder_matrix  ,
NULL   
)

◆ feeder_matrix_compare()

int feeder_matrix_compare ( struct pcmchan_matrix m_in,
struct pcmchan_matrix m_out 
)

◆ feeder_matrix_default_channel_map()

struct pcmchan_matrix * feeder_matrix_default_channel_map ( uint32_t  ch)

◆ feeder_matrix_default_format()

uint32_t feeder_matrix_default_format ( uint32_t  format)

Definition at line 591 of file feeder_matrix.c.

References AFMT_CHANNEL, AFMT_EXTCHANNEL, pcmchan_matrix::channels, pcmchan_matrix::ext, feeder_matrix_default_channel_map(), feeder_matrix_maps, format, m, SND_CHN_MATRIX_BEGIN, SND_CHN_MATRIX_END, and SND_FORMAT.

Referenced by uaudio_chan_fill_info_sub().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ feeder_matrix_default_id()

int feeder_matrix_default_id ( uint32_t  ch)

◆ feeder_matrix_format_id()

◆ feeder_matrix_format_map()

struct pcmchan_matrix * feeder_matrix_format_map ( uint32_t  format)

◆ feeder_matrix_id_map()

struct pcmchan_matrix * feeder_matrix_id_map ( int  id)

Definition at line 660 of file feeder_matrix.c.

References feeder_matrix_maps, and SND_CHN_MATRIX_END.

Referenced by chn_init().

Here is the caller graph for this function:

◆ feeder_matrix_oss_get_channel_order()

int feeder_matrix_oss_get_channel_order ( struct pcmchan_matrix m,
unsigned long long *  map 
)

Definition at line 742 of file feeder_matrix.c.

References pcmchan_matrix::channels, m, pcmchan_matrix::map, pcmchan_matrix::mask, SND_CHN_OSS_MAX, SND_CHN_OSS_VALIDMASK, SND_CHN_T_MAX, snd_chn_to_oss, and pcmchan_matrix::type.

Referenced by chn_oss_getorder().

Here is the caller graph for this function:

◆ feeder_matrix_oss_set_channel_order()

int feeder_matrix_oss_set_channel_order ( struct pcmchan_matrix m,
unsigned long long *  map 
)

◆ feeder_matrix_setup()

int feeder_matrix_setup ( struct pcm_feeder f,
struct pcmchan_matrix m_in,
struct pcmchan_matrix m_out 
)

Definition at line 542 of file feeder_matrix.c.

References pcm_feeder::data, pcm_feeder::desc, feed_matrix_setup(), FEEDER_MATRIX, and pcm_feederdesc::type.

Referenced by feeder_build_matrix().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SND_DECLARE_FILE()

SND_DECLARE_FILE ( "$FreeBSD$"  )

Variable Documentation

◆ apply

Definition at line 206 of file feeder_matrix.c.

◆ 

const struct { ... } feed_matrix_tab[]
Initial value:
= {
FEEDMATRIX_ENTRY(S, 16, LE),
FEEDMATRIX_ENTRY(S, 32, LE),
FEEDMATRIX_ENTRY(S, 16, BE),
FEEDMATRIX_ENTRY(S, 32, BE),
}
#define FEEDMATRIX_ENTRY(SIGN, BIT, ENDIAN)

Referenced by feed_matrix_init().

◆ feeder_matrix_default_ids

int feeder_matrix_default_ids[9]
static
Initial value:
= {
}
#define SND_CHN_MATRIX_4
Definition: matrix.h:142
#define SND_CHN_MATRIX_8
Definition: matrix.h:161
#define SND_CHN_MATRIX_5
Definition: matrix.h:147
#define SND_CHN_MATRIX_3
Definition: matrix.h:137
#define SND_CHN_MATRIX_7
Definition: matrix.h:157
#define SND_CHN_MATRIX_2
Definition: matrix.h:132
#define SND_CHN_MATRIX_UNKNOWN
Definition: matrix.h:172
#define SND_CHN_MATRIX_1
Definition: matrix.h:128
#define SND_CHN_MATRIX_6
Definition: matrix.h:152

Definition at line 102 of file feeder_matrix.c.

Referenced by feeder_matrix_default_channel_map(), and feeder_matrix_default_id().

◆ feeder_matrix_desc

struct pcm_feederdesc feeder_matrix_desc[]
static
Initial value:
= {
{ FEEDER_MATRIX, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 }
}
@ FEEDER_MATRIX
Definition: feeder.h:88

Definition at line 526 of file feeder_matrix.c.

◆ feeder_matrix_maps

struct pcmchan_matrix feeder_matrix_maps[SND_CHN_MATRIX_MAX]
static
Initial value:
= {
}
#define SND_CHN_MATRIX_2_1
Definition: matrix.h:135
#define SND_CHN_MATRIX_6_1
Definition: matrix.h:155
#define SND_CHN_MATRIX_7_0
Definition: matrix.h:156
#define SND_CHN_MATRIX_4_1
Definition: matrix.h:145
#define SND_CHN_MATRIX_7_1
Definition: matrix.h:160
#define SND_CHN_MATRIX_5_0
Definition: matrix.h:146
#define SND_CHN_MATRIX_1_0
Definition: matrix.h:127
#define SND_CHN_MATRIX_3_0
Definition: matrix.h:136
#define SND_CHN_MATRIX_2_0
Definition: matrix.h:131
#define SND_CHN_MATRIX_4_0
Definition: matrix.h:141
#define SND_CHN_MATRIX_6_0
Definition: matrix.h:151
#define SND_CHN_MATRIX_3_1
Definition: matrix.h:140
#define SND_CHN_MATRIX_5_1
Definition: matrix.h:150
#define SND_CHN_MATRIX_MAP_4_1
Definition: matrix_map.h:287
#define SND_CHN_MATRIX_MAP_4_0
Definition: matrix_map.h:243
#define SND_CHN_MATRIX_MAP_7_1
Definition: matrix_map.h:614
#define SND_CHN_MATRIX_MAP_2_0
Definition: matrix_map.h:94
#define SND_CHN_MATRIX_MAP_3_0
Definition: matrix_map.h:162
#define SND_CHN_MATRIX_MAP_2_1
Definition: matrix_map.h:125
#define SND_CHN_MATRIX_MAP_1_0
Definition: matrix_map.h:68
#define SND_CHN_MATRIX_MAP_6_0
Definition: matrix_map.h:440
#define SND_CHN_MATRIX_MAP_6_1
Definition: matrix_map.h:495
#define SND_CHN_MATRIX_MAP_7_0
Definition: matrix_map.h:552
#define SND_CHN_MATRIX_MAP_3_1
Definition: matrix_map.h:200
#define SND_CHN_MATRIX_MAP_5_1
Definition: matrix_map.h:387
#define SND_CHN_MATRIX_MAP_5_0
Definition: matrix_map.h:337

Definition at line 86 of file feeder_matrix.c.

Referenced by feeder_matrix_default_channel_map(), feeder_matrix_default_format(), feeder_matrix_default_id(), feeder_matrix_format_id(), feeder_matrix_format_map(), and feeder_matrix_id_map().

◆ feeder_matrix_methods

kobj_method_t feeder_matrix_methods[]
static
Initial value:
= {
KOBJMETHOD(feeder_init, feed_matrix_init),
KOBJMETHOD(feeder_free, feed_matrix_free),
KOBJMETHOD(feeder_feed, feed_matrix_feed),
}
static int feed_matrix_init(struct pcm_feeder *f)
static int feed_matrix_free(struct pcm_feeder *f)
static int feed_matrix_feed(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b, uint32_t count, void *source)
#define KOBJMETHOD_END
Definition: midi.c:76

Definition at line 531 of file feeder_matrix.c.

◆ format

uint32_t format

◆ oss_to_snd_chn

int oss_to_snd_chn[SND_CHN_OSS_END+1]
static
Initial value:
= {
[CHID_L] = SND_CHN_T_FL,
[CHID_R] = SND_CHN_T_FR,
[CHID_C] = SND_CHN_T_FC,
[CHID_LFE] = SND_CHN_T_LF,
[CHID_LS] = SND_CHN_T_SL,
[CHID_RS] = SND_CHN_T_SR,
[CHID_LR] = SND_CHN_T_BL,
[CHID_RR] = SND_CHN_T_BR
}
#define SND_CHN_T_SL
Definition: matrix.h:51
#define SND_CHN_T_FL
Definition: matrix.h:42
#define SND_CHN_T_FR
Definition: matrix.h:43
#define SND_CHN_T_LF
Definition: matrix.h:45
#define SND_CHN_T_SR
Definition: matrix.h:52
#define SND_CHN_T_BL
Definition: matrix.h:46
#define SND_CHN_T_FC
Definition: matrix.h:44
#define SND_CHN_T_BR
Definition: matrix.h:47

Definition at line 727 of file feeder_matrix.c.

Referenced by feeder_matrix_oss_set_channel_order().

◆ snd_chn_to_oss

int snd_chn_to_oss[SND_CHN_T_MAX]
static
Initial value:
= {
[SND_CHN_T_FL] = CHID_L,
[SND_CHN_T_FR] = CHID_R,
[SND_CHN_T_FC] = CHID_C,
[SND_CHN_T_LF] = CHID_LFE,
[SND_CHN_T_SL] = CHID_LS,
[SND_CHN_T_SR] = CHID_RS,
[SND_CHN_T_BL] = CHID_LR,
[SND_CHN_T_BR] = CHID_RR
}

Definition at line 706 of file feeder_matrix.c.

Referenced by feeder_matrix_oss_get_channel_order().