xref: /btstack/src/btstack_lc3plus_fraunhofer.h (revision d60a1028c7699fe210efeebd03e9fb2be1fe3e5e)
1*d60a1028SMatthias Ringwald /*
2*d60a1028SMatthias Ringwald  * Copyright (C) 2022 BlueKitchen GmbH
3*d60a1028SMatthias Ringwald  *
4*d60a1028SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5*d60a1028SMatthias Ringwald  * modification, are permitted provided that the following conditions
6*d60a1028SMatthias Ringwald  * are met:
7*d60a1028SMatthias Ringwald  *
8*d60a1028SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9*d60a1028SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10*d60a1028SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11*d60a1028SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12*d60a1028SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13*d60a1028SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14*d60a1028SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15*d60a1028SMatthias Ringwald  *    from this software without specific prior written permission.
16*d60a1028SMatthias Ringwald  *
17*d60a1028SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
18*d60a1028SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19*d60a1028SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20*d60a1028SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
21*d60a1028SMatthias Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22*d60a1028SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23*d60a1028SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24*d60a1028SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25*d60a1028SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26*d60a1028SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27*d60a1028SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28*d60a1028SMatthias Ringwald  * SUCH DAMAGE.
29*d60a1028SMatthias Ringwald  *
30*d60a1028SMatthias Ringwald  */
31*d60a1028SMatthias Ringwald 
32*d60a1028SMatthias Ringwald /**
33*d60a1028SMatthias Ringwald  * @title Adapter for Fraunhofer LC3plus Coddec
34*d60a1028SMatthias Ringwald  * only uses suitable subset for lc3 testing
35*d60a1028SMatthias Ringwald  */
36*d60a1028SMatthias Ringwald 
37*d60a1028SMatthias Ringwald #ifndef BTSTACK_LC3PLUS_FRAUNHOFER_H
38*d60a1028SMatthias Ringwald #define BTSTACK_LC3PLUS_FRAUNHOFER_H
39*d60a1028SMatthias Ringwald 
40*d60a1028SMatthias Ringwald #include <stdint.h>
41*d60a1028SMatthias Ringwald #include "btstack_lc3.h"
42*d60a1028SMatthias Ringwald 
43*d60a1028SMatthias Ringwald #if defined __cplusplus
44*d60a1028SMatthias Ringwald extern "C" {
45*d60a1028SMatthias Ringwald #endif
46*d60a1028SMatthias Ringwald 
47*d60a1028SMatthias Ringwald #ifdef HAVE_LC3PLUS
48*d60a1028SMatthias Ringwald 
49*d60a1028SMatthias Ringwald #include "LC3plus/lc3.h"
50*d60a1028SMatthias Ringwald 
51*d60a1028SMatthias Ringwald /* API_START */
52*d60a1028SMatthias Ringwald 
53*d60a1028SMatthias Ringwald typedef struct {
54*d60a1028SMatthias Ringwald     btstack_lc3_frame_duration_t    frame_duration;
55*d60a1028SMatthias Ringwald     uint16_t                        octets_per_frame;
56*d60a1028SMatthias Ringwald     uint16_t                        samples_per_frame;
57*d60a1028SMatthias Ringwald     uint32_t                        sample_rate;
58*d60a1028SMatthias Ringwald     // decoder must be 4-byte aligned
59*d60a1028SMatthias Ringwald     uint8_t                         decoder[LC3PLUS_DEC_MAX_SIZE];
60*d60a1028SMatthias Ringwald } btstack_lc3plus_fraunhofer_decoder_t;
61*d60a1028SMatthias Ringwald 
62*d60a1028SMatthias Ringwald typedef struct {
63*d60a1028SMatthias Ringwald     btstack_lc3_frame_duration_t    frame_duration;
64*d60a1028SMatthias Ringwald     uint16_t                        octets_per_frame;
65*d60a1028SMatthias Ringwald     uint32_t                        sample_rate;
66*d60a1028SMatthias Ringwald     // encoder must be 4-byte aligned
67*d60a1028SMatthias Ringwald     uint8_t                         encoder[LC3PLUS_ENC_MAX_SIZE];
68*d60a1028SMatthias Ringwald } btstack_lc3plus_fraunhofer_encoder_t;
69*d60a1028SMatthias Ringwald 
70*d60a1028SMatthias Ringwald /**
71*d60a1028SMatthias Ringwald  * Init LC3 Decoder Instance
72*d60a1028SMatthias Ringwald  * @param context for Fraunhofer LC3plus decoder
73*d60a1028SMatthias Ringwald  */
74*d60a1028SMatthias Ringwald const btstack_lc3_decoder_t * btstack_lc3plus_fraunhofer_decoder_init_instance(btstack_lc3plus_fraunhofer_decoder_t * context);
75*d60a1028SMatthias Ringwald 
76*d60a1028SMatthias Ringwald /**
77*d60a1028SMatthias Ringwald  * Init LC3 Encoder Instance
78*d60a1028SMatthias Ringwald  * @param context for Fraunhofer LC3plus encoder
79*d60a1028SMatthias Ringwald  */
80*d60a1028SMatthias Ringwald const btstack_lc3_encoder_t * btstack_lc3plus_fraunhofer_encoder_init_instance(btstack_lc3plus_fraunhofer_encoder_t * context);
81*d60a1028SMatthias Ringwald 
82*d60a1028SMatthias Ringwald /* API_END */
83*d60a1028SMatthias Ringwald 
84*d60a1028SMatthias Ringwald #endif /* HAVE_LC3PLUS */
85*d60a1028SMatthias Ringwald 
86*d60a1028SMatthias Ringwald #if defined __cplusplus
87*d60a1028SMatthias Ringwald }
88*d60a1028SMatthias Ringwald #endif
89*d60a1028SMatthias Ringwald #endif // BTSTACK_LC3_PLUS_FRAUNHOFER_H
90