xref: /netbsd-src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.h (revision b6121f8d46c6ed587503b30f2a1b37239a96a801)
1 /* $NetBSD: sbc_encode.h,v 1.1 2017/01/28 16:55:54 nat Exp $ */
2 
3 /*-
4  * Copyright (c) 2015 - 2016 Nathanial Sloss <nathanialsloss@yahoo.com.au>
5  * All rights reserved.
6  *
7  *		This software is dedicated to the memory of -
8  *	   Baron James Anlezark (Barry) - 1 Jan 1949 - 13 May 2012.
9  *
10  *		Barry was a man who loved his music.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #define SRC_SEP 1
35 #define SNK_SEP 2
36 
37 #define SBC_CODEC_ID	0x0
38 #define mediaTypeAudio	0x0
39 
40 #define CONFIG_ANY_FREQ	0xf7
41 #define CONFIG_ANY_ALLOC 0xff
42 #define MIN_BITPOOL	2
43 #define DEFAULT_MAXBPOOL 253
44 
45 #define MODE_STEREO	(1 << 1)
46 #define MODE_JOINT	(1 << 0)
47 #define MODE_DUAL	(1 << 2)
48 #define MODE_MONO	(1 << 3)
49 #define MODE_ANY	0xf
50 
51 #define ALLOC_LOUDNESS	(1 << 0)
52 #define ALLOC_SNR 	(1 << 1)
53 #define ALLOC_ANY 	3
54 
55 #define FREQ_16K	(1 << 3)
56 #define FREQ_32K	(1 << 2)
57 #define FREQ_44_1K	(1 << 1)
58 #define FREQ_48K	(1 << 0)
59 #define FREQ_ANY	0xf
60 
61 
62 #define BANDS_4		(1 << 1)
63 #define BANDS_8		(1 << 0)
64 #define BANDS_ANY	3
65 
66 #define BLOCKS_4	(1 << 3)
67 #define BLOCKS_8	(1 << 2)
68 #define BLOCKS_12	(1 << 1)
69 #define BLOCKS_16	(1 << 0)
70 #define BLOCKS_ANY	0xf
71 
72 u_int FLS(uint8_t);
73 ssize_t stream(int, int, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t,
74     size_t, int);
75 ssize_t recvstream(int, int);
76