The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/sound/pcm/feeder.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2005-2009 Ariff Abdullah <ariff@FreeBSD.org>
    3  * Copyright (c) 1999 Cameron Grant <cg@FreeBSD.org>
    4  * All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   25  * SUCH DAMAGE.
   26  *
   27  * $FreeBSD: releng/10.4/sys/dev/sound/pcm/feeder.h 193640 2009-06-07 19:12:08Z ariff $
   28  */
   29 
   30 struct pcm_feederdesc {
   31         u_int32_t type;
   32         u_int32_t in, out;
   33         u_int32_t flags;
   34         int idx;
   35 };
   36 
   37 struct feeder_class {
   38         KOBJ_CLASS_FIELDS;
   39         struct pcm_feederdesc *desc;
   40         void *data;
   41 };
   42 
   43 struct pcm_feeder {
   44         KOBJ_FIELDS;
   45         int align;
   46         struct pcm_feederdesc *desc, desc_static;
   47         void *data;
   48         struct feeder_class *class;
   49         struct pcm_feeder *source, *parent;
   50 
   51 };
   52 
   53 void feeder_register(void *p);
   54 struct feeder_class *feeder_getclass(struct pcm_feederdesc *desc);
   55 
   56 u_int32_t snd_fmtscore(u_int32_t fmt);
   57 u_int32_t snd_fmtbestbit(u_int32_t fmt, u_int32_t *fmts);
   58 u_int32_t snd_fmtbestchannel(u_int32_t fmt, u_int32_t *fmts);
   59 u_int32_t snd_fmtbest(u_int32_t fmt, u_int32_t *fmts);
   60 
   61 int chn_addfeeder(struct pcm_channel *c, struct feeder_class *fc,
   62     struct pcm_feederdesc *desc);
   63 int chn_removefeeder(struct pcm_channel *c);
   64 struct pcm_feeder *chn_findfeeder(struct pcm_channel *c, u_int32_t type);
   65 void feeder_printchain(struct pcm_feeder *head);
   66 int feeder_chain(struct pcm_channel *);
   67 
   68 #define FEEDER_DECLARE(feeder, pdata)                                   \
   69 static struct feeder_class feeder ## _class = {                         \
   70         .name =         #feeder,                                        \
   71         .methods =      feeder ## _methods,                             \
   72         .size =         sizeof(struct pcm_feeder),                      \
   73         .desc =         feeder ## _desc,                                \
   74         .data =         pdata,                                          \
   75 };                                                                      \
   76 SYSINIT(feeder, SI_SUB_DRIVERS, SI_ORDER_ANY, feeder_register,          \
   77     &feeder ## _class)
   78 
   79 enum {
   80         FEEDER_ROOT,
   81         FEEDER_FORMAT,
   82         FEEDER_MIXER,
   83         FEEDER_RATE,
   84         FEEDER_EQ,
   85         FEEDER_VOLUME,
   86         FEEDER_MATRIX,
   87         FEEDER_LAST,
   88 };
   89 
   90 /* feeder_format */
   91 enum {
   92         FEEDFORMAT_CHANNELS
   93 };
   94 
   95 /* feeder_mixer */
   96 enum {
   97         FEEDMIXER_CHANNELS
   98 };
   99 
  100 /* feeder_rate */
  101 enum {
  102         FEEDRATE_SRC,
  103         FEEDRATE_DST,
  104         FEEDRATE_QUALITY,
  105         FEEDRATE_CHANNELS
  106 };
  107 
  108 #define FEEDRATE_RATEMIN        1
  109 #define FEEDRATE_RATEMAX        2016000         /* 48000 * 42 */
  110 #define FEEDRATE_MIN            1
  111 #define FEEDRATE_MAX            0x7fffff        /* sign 24bit ~ 8ghz ! */
  112 #define FEEDRATE_ROUNDHZ        25
  113 #define FEEDRATE_ROUNDHZ_MIN    0
  114 #define FEEDRATE_ROUNDHZ_MAX    500
  115 
  116 extern int feeder_rate_min;
  117 extern int feeder_rate_max;
  118 extern int feeder_rate_round;
  119 extern int feeder_rate_quality;
  120 
  121 /* feeder_eq */
  122 enum {
  123         FEEDEQ_CHANNELS,
  124         FEEDEQ_RATE,
  125         FEEDEQ_TREBLE,
  126         FEEDEQ_BASS,
  127         FEEDEQ_PREAMP,
  128         FEEDEQ_STATE,
  129         FEEDEQ_DISABLE,
  130         FEEDEQ_ENABLE,
  131         FEEDEQ_BYPASS,
  132         FEEDEQ_UNKNOWN
  133 };
  134 
  135 int feeder_eq_validrate(uint32_t);
  136 void feeder_eq_initsys(device_t);
  137 
  138 /* feeder_volume */
  139 enum {
  140         FEEDVOLUME_CLASS,
  141         FEEDVOLUME_CHANNELS,
  142         FEEDVOLUME_STATE,
  143         FEEDVOLUME_ENABLE,
  144         FEEDVOLUME_BYPASS
  145 };
  146 
  147 int feeder_volume_apply_matrix(struct pcm_feeder *, struct pcmchan_matrix *);
  148 
  149 /* feeder_matrix */
  150 int feeder_matrix_default_id(uint32_t);
  151 struct pcmchan_matrix *feeder_matrix_default_channel_map(uint32_t);
  152 
  153 uint32_t feeder_matrix_default_format(uint32_t);
  154 
  155 int feeder_matrix_format_id(uint32_t);
  156 struct pcmchan_matrix *feeder_matrix_format_map(uint32_t);
  157 
  158 struct pcmchan_matrix *feeder_matrix_id_map(int);
  159 
  160 int feeder_matrix_setup(struct pcm_feeder *, struct pcmchan_matrix *,
  161     struct pcmchan_matrix *);
  162 int feeder_matrix_compare(struct pcmchan_matrix *, struct pcmchan_matrix *);
  163 
  164 /* 4Front OSS stuffs */
  165 int feeder_matrix_oss_get_channel_order(struct pcmchan_matrix *,
  166     unsigned long long *);
  167 int feeder_matrix_oss_set_channel_order(struct pcmchan_matrix *,
  168     unsigned long long *);
  169 
  170 #if 0
  171 /* feeder_matrix */
  172 enum {
  173         FEEDMATRIX_TYPE,
  174         FEEDMATRIX_RESET,
  175         FEEDMATRIX_CHANNELS_IN,
  176         FEEDMATRIX_CHANNELS_OUT,
  177         FEEDMATRIX_SET_MAP
  178 };
  179 
  180 enum {
  181         FEEDMATRIX_TYPE_NONE,
  182         FEEDMATRIX_TYPE_AUTO,
  183         FEEDMATRIX_TYPE_2X1,
  184         FEEDMATRIX_TYPE_1X2,
  185         FEEDMATRIX_TYPE_2X2
  186 };
  187 
  188 #define FEEDMATRIX_TYPE_STEREO_TO_MONO  FEEDMATRIX_TYPE_2X1
  189 #define FEEDMATRIX_TYPE_MONO_TO_STEREO  FEEDMATRIX_TYPE_1X2
  190 #define FEEDMATRIX_TYPE_SWAP_STEREO     FEEDMATRIX_TYPE_2X2
  191 #define FEEDMATRIX_MAP(x, y)            ((((x) & 0x3f) << 6) | ((y) & 0x3f))
  192 #define FEEDMATRIX_MAP_SRC(x)           ((x) & 0x3f)
  193 #define FEEDMATRIX_MAP_DST(x)           (((x) >> 6) & 0x3f)
  194 #endif
  195 
  196 /*
  197  * By default, various feeders only deal with sign 16/32 bit native-endian
  198  * since it should provide the fastest processing path. Processing 8bit samples
  199  * is too noisy due to limited dynamic range, while 24bit is quite slow due to
  200  * unnatural per-byte read/write. However, for debugging purposes, ensuring
  201  * implementation correctness and torture test, the following can be defined:
  202  *
  203  *      SND_FEEDER_MULTIFORMAT - Compile all type of converters, but force
  204  *                               8bit samples to be converted to 16bit
  205  *                               native-endian for better dynamic range.
  206  *                               Process 24bit samples natively.
  207  * SND_FEEDER_FULL_MULTIFORMAT - Ditto, but process 8bit samples natively.
  208  */
  209 #ifdef SND_FEEDER_FULL_MULTIFORMAT
  210 #undef SND_FEEDER_MULTIFORMAT
  211 #define SND_FEEDER_MULTIFORMAT  1
  212 #endif

Cache object: a9440821a066193fbd1c858af3d93a32


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.