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