• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2013 - 2016 Sony Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _LDACBT_H_
18 #define _LDACBT_H_
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 #ifndef LDACBT_API
23 #define LDACBT_API
24 #endif /* LDACBT_API  */
25 
26 /* This file contains the definitions, declarations and macros for an implimentation of
27  * LDAC encode processing.
28  *
29  * The basic flow of the encode processing is as follows:
30  * - The program creates an handle of an LDAC api using ldacBT_get_handle().
31  * - The program initialize the handle for encode using ldacBT_init_handle_encode().
32  * - The program calls ldacBT_encode() to encode data.
33  * - If the program demands to control the Encode Quality Mode Index, then one of the following
34  *   should be called:
35  *     - ldacBT_set_eqmid()
36  *     - ldacBT_alter_eqmid()
37  * - The program finishes the encoding with passing NULL to input pcm buffer for ldacBT_encode(),
38  *   which enables the encoder to encode remaining data in its input buffers.
39  * - The handle may be closed using ldacBT_close_handle() then used again, or released with
40  *   ldacBT_free_handle().
41  * - The rest of the set functions should be called only if it is needed by the client.
42  *
43  *
44  * Note for an implimentation
45  * - Error processing
46  *     When continuous processing for next frame is performed after error detection, following
47  *     processing must be carried out using C function provided in the library.
48  *      - Release of internal variables in encode processing using ldacBT_close_handle().
49  *      - Allocation and initialization of internal variables in encode processing using
50  *        ldacBT_init_handle_encode().
51  *     Note that the encoded output for a few frames will not be present just after error recovery.
52  *
53  * - Resuming of the encode processing from an interruption
54  *     In case of resuming of the encode processing from interruption (such as changing
55  *     configuration, seeking and playback), initialization of internal variables in encode
56  *     processing must be carried out as error processing described above.
57  *     Note that the encoded output for a few frames will not be present just after initialization
58  *     as above.
59  *
60  *
61  * Glossary
62  *  channel_config_index (cci)
63  *    The channel setting information for ldaclib.
64  *    See ldacBT_cm_to_cci() to get value from channel_mode.
65  *
66  *  channel_mode (cm)
67  *    The channel setting information for LDAC specification of Bluetooth A2DP.
68  *    See ldacBT_cci_to_cm() to get value from channel_config_index.
69  *
70  *  ldac_transport_frame
71  *    See LDAC specification of bluetooth A2DP.
72  *
73  *  Maximum Transmission Unit (MTU)
74  *    The minimum MTU that a L2CAP implementation for LDAC shall support is 679 bytes, because LDAC
75  *    is optimized with 2-DH5 packet as its target.
76  *
77  *  frame
78  *    An audio signal sequence representing a certain number of PCM audio signals.
79  *    Encoding and decoding are processed frame by frame in LDAC. Number of samples in a frame is
80  *    determined by sampling frequency as described below.
81  *
82  *  Sampling frequency and frame sample.
83  *    Supported sampling frequencies are 44.1, 48, 88.2 and 96 kHz.
84  *    The relationship between sampling frequency and frame sample in LDAC are shown below.
85  *       --------------------------------------------------------
86  *      | sampling frequency       [kHz] | 44.1 | 48 | 88.2 | 96 |
87  *      | frame sample [samples/channel] |     128   |     256   |
88  *       --------------------------------------------------------
89  *    Though the frame size varies in LDAC core as described in the table, the number of samples in
90  *    input PCM signal for encoding is fixed to 128 sample/channel, and it is not affected by
91  *    sampling frequency.
92  */
93 #define LDACBT_ENC_LSU 128
94 #define LDACBT_MAX_LSU 512
95 
96 /* channel_config_index.
97  * Supported value are below.
98  */
99 #define LDAC_CCI_MONO         0 /* MONO */
100 #define LDAC_CCI_DUAL_CHANNEL 1 /* DUAL CHANNEL */
101 #define LDAC_CCI_STEREO       2 /* STEREO */
102 
103 /* PCM format.
104  * Supported PCM format are shown below.
105  *   - LDACBT_SMPL_FMT_S16 : signed 16bits little endian.
106  *   - LDACBT_SMPL_FMT_S24 : signed 24bits little endian.
107  *   - LDACBT_SMPL_FMT_S32 : signed 32bits little endian.
108  *   - LDACBT_SMPL_FMT_F32 : single-precision floating point.
109  * The data sequency must be interleaved format by 1 sample.
110  * Ex) 2 channel audio, the data sequences are aligned as below.
111  *       seq : |L[0]|R[0]|L[1]|R[1]|...
112  */
113 typedef enum {
114     LDACBT_SMPL_FMT_S16 = 0x2,
115     LDACBT_SMPL_FMT_S24 = 0x3,
116     LDACBT_SMPL_FMT_S32 = 0x4,
117     LDACBT_SMPL_FMT_F32 = 0x5,
118 } LDACBT_SMPL_FMT_T;
119 
120 /* Encode Quality Mode Index. (EQMID)
121  *  The configuration of encoding in LDAC will be coordinated by "Encode Quality Mode Index"
122  *  parameter. Configurable values are shown below.
123  *   - LDACBT_EQMID_HQ : Encode setting for High Quality.
124  *   - LDACBT_EQMID_SQ : Encode setting for Standard Quality.
125  *   - LDACBT_EQMID_MQ : Encode setting for Mobile use Quality.
126  *   - LDACBT_EQMID_ABR: Reserved EQMID for ABR. The value shall be 0x7F.
127  */
128 enum {
129     LDACBT_EQMID_HQ = 0,
130     LDACBT_EQMID_SQ,
131     LDACBT_EQMID_MQ,
132     LDACBT_EQMID_NUM,     /* terminator */
133     LDACBT_EQMID_ABR = 0x7F,
134 };
135 
136 /* Bit rates
137  *  Bit rates in each EQMID are depend on sampling frequency.
138  *  In this API specification, these relations are shown below.
139  *     ___________________________________________
140  *    |                 | Sampling Frequency[kHz] |
141  *    |      EQMID      | 44.1, 88.2 |   48, 96   |
142  *    +-----------------+------------+------------+
143  *    | LDACBT_EQMID_HQ |   909kbps  |   990kbps  |
144  *    | LDACBT_EQMID_SQ |   606kbps  |   660kbps  |
145  *    | LDACBT_EQMID_MQ |   303kbps  |   330kbps  |
146  *     -------------------------------------------
147  */
148 
149 /* Maximum size of the "ldac_transport_frame" sequence at transportation. */
150 #define LDACBT_MAX_NBYTES 1024 /* byte */
151 
152 /* Maximum number of channel for LDAC */
153 #define LDAC_PRCNCH 2
154 
155 /* LDAC handle type */
156 typedef struct _st_ldacbt_handle * HANDLE_LDAC_BT;
157 
158 /* Allocation of LDAC handle.
159  *  Format
160  *      HANDLE_LDAC_BT ldacBT_get_handle( void );
161  *  Arguments
162  *      None.
163  *  Return value
164  *      HANDLE_LDAC_BT for success, NULL for failure.
165  */
166 LDACBT_API HANDLE_LDAC_BT ldacBT_get_handle( void );
167 
168 /* Release of LDAC handle.
169  *  Format
170  *      void ldacBT_free_handle( HANDLE_LDAC_BT hLdacBt );
171  *  Arguments
172  *      hLdacBt    HANDLE_LDAC_BT    LDAC handle.
173  *  Return value
174  *      None.
175  */
176 LDACBT_API void ldacBT_free_handle( HANDLE_LDAC_BT hLdacBt );
177 
178 /* Closing of initialized LDAC handle.
179  * Closed handle can be initialized and used again.
180  *  Format
181  *      void ldacBT_close_handle( HANDLE_LDAC_BT hLdacBt );
182  *  Arguments
183  *      hLdacBt    HANDLE_LDAC_BT    LDAC handle.
184  *  Return value
185  *      None.
186  */
187 LDACBT_API void ldacBT_close_handle( HANDLE_LDAC_BT hLdacBt );
188 
189 /* Acquisition of the library version.
190  *  Format
191  *      int  ldacBT_get_version( void );
192  *  Arguments
193  *      None.
194  *  Return value
195  *      int : version number.
196  *              23-16 bit : major version
197  *              15- 8 bit : minor version
198  *               7- 0 bit : branch version
199  *              Ex) 0x00010203 -> version 1.02.03
200  */
201 LDACBT_API int  ldacBT_get_version( void );
202 
203 /* Acquisition of the sampling frequency in current configuration.
204  * The LDAC handle must be initialized by API function ldacBT_init_handle_encode() prior to
205  * calling this function.
206  *  Format
207  *      int  ldacBT_get_sampling_freq( HANDLE_LDAC_BT hLdacBt );
208  *  Arguments
209  *      hLdacBt    HANDLE_LDAC_BT    LDAC handle.
210  *  Return value
211  *      int : sampling frequency in current configuration. -1 for failure.
212  */
213 LDACBT_API int  ldacBT_get_sampling_freq( HANDLE_LDAC_BT hLdacBt );
214 
215 /* Acquisition of the Bit-rate.
216  * The LDAC handle must be initialized by API function ldacBT_init_handle_encode() prior to
217  * calling this function.
218  *  Format
219  *      int  ldacBT_get_bitrate( HANDLE_LDAC_BT hLdacBt );
220  *  Arguments
221  *      hLdacBt    HANDLE_LDAC_BT    LDAC handle.
222  *  Return value
223  *      int : Bit-rate for previously processed ldac_transport_frame for success. -1 for failure.
224  */
225 LDACBT_API int  ldacBT_get_bitrate( HANDLE_LDAC_BT hLdacBt );
226 
227 /* Initialization of a LDAC handle for encode processing.
228  * The LDAC handle must be allocated by API function ldacBT_get_handle() prior to calling this API.
229  * "mtu" value should be configured to MTU size of AVDTP Transport Channel, which is determined by
230  * SRC and SNK devices in Bluetooth transmission.
231  * "eqmid" is configured to desired value of "Encode Quality Mode Index".
232  * "cm" is configured to channel_mode in LDAC, which is determined by SRC and SNK devices in
233  * Bluetooth transmission.
234  * "fmt" is configured to input pcm audio format.
235  * When the configuration of "mtu", "cm", or "sf" changed, the re-initialization is required.
236  *
237  *  Format
238  *      int  ldacBT_init_handle_encode( HANDLE_LDAC_BT hLdacBt, int mtu, int eqmid, int cm,
239  *                                      LDACBT_SMPL_FMT_T fmt, int sf );
240  *  Arguments
241  *      hLdacBt    HANDLE_LDAC_BT    LDAC handle.
242  *      mtu        int               MTU value. Unit:Byte.
243  *      eqmid      int               Encode Quality Mode Index.
244  *      cm         int               Information of the channel_mode.
245  *      fmt        LDACBT_SMPL_FMT_T Audio format type of input pcm.
246  *      sf         int               Sampling frequency of input pcm.
247  *  Return value
248  *      int : 0 for success, -1 for failure.
249  */
250 LDACBT_API int  ldacBT_init_handle_encode( HANDLE_LDAC_BT hLdacBt, int mtu, int eqmid, int cm,
251                                            LDACBT_SMPL_FMT_T fmt, int sf );
252 
253 /* Configuration of Encode Quality Mode Index.
254  * The LDAC handle must be initialized by API function ldacBT_init_handle_encode() prior to
255  * calling this function.
256  * The API function can be called at any time, after the completion of initializing.
257  *  Format
258  *      int  ldacBT_set_eqmid( HANDLE_LDAC_BT hLdacBt, int eqmid );
259  *  Arguments
260  *      hLdacBt    HANDLE_LDAC_BT    LDAC handle.
261  *      eqmid      int               Encode Quality Mode Index.
262  *  Return value
263  *      int : 0 for success, -1 for failure.
264  */
265 LDACBT_API int  ldacBT_set_eqmid( HANDLE_LDAC_BT hLdacBt, int eqmid );
266 
267 /* Acquisition of prescribed Encode Quality Mode Index in current configuration.
268  * The LDAC handle must be initialized by API function ldacBT_init_handle_encode() prior to
269  * calling this function.
270  *  Format
271  *      int  ldacBT_get_eqmid( HANDLE_LDAC_BT hLdacBt );
272  *  Arguments
273  *      hLdacBt    HANDLE_LDAC_BT    LDAC handle.
274  *  Return value
275  *      int : Encode Quality Mode Index for success, -1 for failure.
276  */
277 LDACBT_API int  ldacBT_get_eqmid( HANDLE_LDAC_BT hLdacBt );
278 
279 /* Changing of configuration for Encode Quality Mode Index by one step.
280  * The LDAC handle must be initialized by API function ldacBT_init_handle_encode() prior to
281  * calling this function.
282  * Configuralbe values for "priority" are shown below.
283  *   - LDACBT_EQMID_INC_QUALITY    : Adjustment for EQMID by one step for the direction of
284  *                                   getting close to LDACBT_EQMID_HQ.
285  *   - LDACBT_EQMID_INC_CONNECTION : Adjustment for EQMID by one step for the direction of
286  *                                   getting away from LDACBT_EQMID_HQ.
287  * For restoring prescribed value for "Encode Quality Mode Index", it must be configured again by
288  * API function ldacBT_init_handle_encode() or ldacBT_set_qmode().
289  * A transition to the state other than "Encode Quality Mode Index" mention before may be occurred
290  * caused by an adjustment using this API function.
291  * The API function can be called at any time, after the completion of initializing.
292  *  Format
293  *      int  ldacBT_alter_eqmid_priority( HANDLE_LDAC_BT hLdacBt, int priority );
294  *  Arguments
295  *      hLdacBt    HANDLE_LDAC_BT    LDAC handle.
296  *      priority   int               The direction of changing EQMID.
297  *  Return value
298  *      int : 0 for success, -1 for failure.
299  */
300 #define LDACBT_EQMID_INC_QUALITY     1
301 #define LDACBT_EQMID_INC_CONNECTION -1
302 LDACBT_API int  ldacBT_alter_eqmid_priority( HANDLE_LDAC_BT hLdacBt, int priority );
303 
304 
305 /* LDAC encode processing.
306  * The LDAC handle must be initialized by API function ldacBT_init_handle_encode() prior to calling
307  * this API function.
308  * <Regarding on a input PCM signal>
309  *  Number of samples in input PCM signal for encoding is fixed to 128 samples per channel, and it
310  *  is not affected by sampling frequency.
311  *
312  *  The region in input signal buffer without any PCM signal must be filled with zero, if the
313  *  number of samples is less than 128 samples.
314  *
315  *  The format of PCM signal is determined by "fmt" configured by API function
316  *  ldacBT_init_handle_encode().
317  *
318  *  Total size of referenced PCM signal (in byte) will be set in "pcm_used" on return. The value of
319  *  "Number of input samples * Number of channels * sizeof(PCM word length)" will be set in normal.
320  *
321  *  Finalize processing of encode will be carried out with setting "p_pcm" as zero.
322  *
323  * <Regarding on output encoded data>
324  *  An output data in "ldac_transport_frame" sequence will be set to "p_stream" after several frame
325  *  processing. So the output is not necessarily present at each calling of this API function.
326  *
327  *  The presence of the output can be verified by checking whether the value of "stream_wrote",
328  *  representing the number of written bytes for "p_stream", is positive or not.
329  *
330  *  In addition, encoded data size for output will be determined by the value of "mtu" configured
331  *  by API function ldacBT_init_handle_encode().
332  *
333  *  The number of "ldac_transport_frame" corresponding to "ldac_transport_frame" sequence as output
334  *  will be set to "frame_num".
335  *
336  *  Format
337  *      int  ldacBT_encode( HANDLE_LDAC_BT hLdacBt, void *p_pcm, int *pcm_used,
338  *                          unsigned char *p_stream, int *stream_sz, int *frame_num );
339  *  Arguments
340  *      hLdacBt    HANDLE_LDAC_BT    LDAC handle.
341  *      p_pcm      void *            Input PCM signal sequence
342  *      pcm_used   int *             Data size of referenced PCM singnal. Unit:Byte.
343  *      p_stream   unsigned char *   Output "ldac_transport_frame" sequence.
344  *      stream_sz  int *             Size of output data. Unit:Byte.
345  *      frame_num  int *             Number of output "ldac_transport_frame"
346  *  Return value
347  *      int : 0 for success, -1 for failure.
348  */
349 LDACBT_API int  ldacBT_encode( HANDLE_LDAC_BT hLdacBt, void *p_pcm, int *pcm_used,
350                                unsigned char *p_stream, int *stream_sz, int *frame_num );
351 
352 /* Acquisition of previously established error code.
353  * The LDAC handle must be allocated by API function ldacBT_get_handle() prior to calling this function.
354  * The details of error code are described below at the end of this header file.
355  * Tips for error code handling.
356  * The macro function LDACBT_FATAL() is useful to determine whether the error code is Fatal or not.
357  *      Ex.) if( LDACBT_FATAL(err) ) // Fatal Error occurred.
358  *
359  * The macro function LDACBT_ERROR() is useful to determine whether the error occurred or not.
360  *      Ex.) if( LDACBT_ERROR(err) ) // Error occurred.
361  *
362  * The macro function LDACBT_HANDLE_ERR() is useful to get the handle level error code.
363  *      Ex.) err_handle_lv = LDACBT_HANDLE_ERR(err);
364  *
365  * The macro function LDACBT_BLOCK_ERR() is useful to get the block level error code.
366  *      Ex.) err_block_lv = LDACBT_BLOCK_ERR(err);
367  *
368  *  Format
369  *      int  ldacBT_get_error_code( HANDLE_LDAC_BT hLdacBt );
370  *  Arguments
371  *      hLdacBt    HANDLE_LDAC_BT    LDAC handle.
372  *  Return value
373  *      int : Error code.
374  */
375 LDACBT_API int  ldacBT_get_error_code( HANDLE_LDAC_BT hLdacBt );
376 
377 /*******************************************************************************
378     Error Code
379 *******************************************************************************/
380 #define LDACBT_ERR_NONE                     0
381 
382 /*    Non Fatal Error ***********************************************************/
383 #define LDACBT_ERR_NON_FATAL                1
384 
385 /*    Non Fatal Error (Block Level) *********************************************/
386 #define LDACBT_ERR_BIT_ALLOCATION           5
387 
388 /*    Non Fatal Error (Handle Level) ********************************************/
389 #define LDACBT_ERR_NOT_IMPLEMENTED          128
390 #define LDACBT_ERR_NON_FATAL_ENCODE         132
391 
392 /*    Fatal Error ***************************************************************/
393 #define LDACBT_ERR_FATAL                    256
394 
395 /*    Fatal Error (Block Level) *************************************************/
396 #define LDACBT_ERR_SYNTAX_BAND              260
397 #define LDACBT_ERR_SYNTAX_GRAD_A            261
398 #define LDACBT_ERR_SYNTAX_GRAD_B            262
399 #define LDACBT_ERR_SYNTAX_GRAD_C            263
400 #define LDACBT_ERR_SYNTAX_GRAD_D            264
401 #define LDACBT_ERR_SYNTAX_GRAD_E            265
402 #define LDACBT_ERR_SYNTAX_IDSF              266
403 #define LDACBT_ERR_SYNTAX_SPEC              267
404 
405 #define LDACBT_ERR_BIT_PACKING              280
406 
407 #define LDACBT_ERR_ALLOC_MEMORY             300
408 
409 /*    Fatal Error (Handle Level) ************************************************/
410 #define LDACBT_ERR_FATAL_HANDLE             512
411 
412 #define LDACBT_ERR_ILL_SYNCWORD             516
413 #define LDACBT_ERR_ILL_SMPL_FORMAT          517
414 #define LDACBT_ERR_ILL_PARAM                518
415 
416 #define LDACBT_ERR_ASSERT_SAMPLING_FREQ     530
417 #define LDACBT_ERR_ASSERT_SUP_SAMPLING_FREQ 531
418 #define LDACBT_ERR_CHECK_SAMPLING_FREQ      532
419 #define LDACBT_ERR_ASSERT_CHANNEL_CONFIG    533
420 #define LDACBT_ERR_CHECK_CHANNEL_CONFIG     534
421 #define LDACBT_ERR_ASSERT_FRAME_LENGTH      535
422 #define LDACBT_ERR_ASSERT_SUP_FRAME_LENGTH  536
423 #define LDACBT_ERR_ASSERT_FRAME_STATUS      537
424 #define LDACBT_ERR_ASSERT_NSHIFT            538
425 #define LDACBT_ERR_ASSERT_CHANNEL_MODE      539
426 
427 #define LDACBT_ERR_ENC_INIT_ALLOC           550
428 #define LDACBT_ERR_ENC_ILL_GRADMODE         551
429 #define LDACBT_ERR_ENC_ILL_GRADPAR_A        552
430 #define LDACBT_ERR_ENC_ILL_GRADPAR_B        553
431 #define LDACBT_ERR_ENC_ILL_GRADPAR_C        554
432 #define LDACBT_ERR_ENC_ILL_GRADPAR_D        555
433 #define LDACBT_ERR_ENC_ILL_NBANDS           556
434 #define LDACBT_ERR_PACK_BLOCK_FAILED        557
435 
436 #define LDACBT_ERR_DEC_INIT_ALLOC           570
437 #define LDACBT_ERR_INPUT_BUFFER_SIZE        571
438 #define LDACBT_ERR_UNPACK_BLOCK_FAILED      572
439 #define LDACBT_ERR_UNPACK_BLOCK_ALIGN       573
440 #define LDACBT_ERR_UNPACK_FRAME_ALIGN       574
441 #define LDACBT_ERR_FRAME_LENGTH_OVER        575
442 #define LDACBT_ERR_FRAME_ALIGN_OVER         576
443 
444 
445 /* LDAC API for Encode */
446 #define LDACBT_ERR_ALTER_EQMID_LIMITED      21
447 #define LDACBT_ERR_HANDLE_NOT_INIT          1000
448 #define LDACBT_ERR_ILL_EQMID                1024
449 #define LDACBT_ERR_ILL_SAMPLING_FREQ        1025
450 #define LDACBT_ERR_ILL_NUM_CHANNEL          1026
451 #define LDACBT_ERR_ILL_MTU_SIZE             1027
452 /* LDAC API for Decode */
453 #define LDACBT_ERR_DEC_CONFIG_UPDATED       40
454 
455 
456 /* Macro Functions for Error Code ********************************************/
457 #define LDACBT_API_ERR(err)    ((err >> 20) & 0x0FFF)
458 #define LDACBT_HANDLE_ERR(err) ((err >> 10) & 0x03FF)
459 #define LDACBT_BLOCK_ERR(err)  ( err & 0x03FF)
460 #define LDACBT_ERROR(err)      ((LDACBT_ERR_NON_FATAL) <= LDACBT_API_ERR(err) ? 1 : 0)
461 #define LDACBT_FATAL(err)      ((LDACBT_ERR_FATAL) <= LDACBT_API_ERR(err) ? 1 : 0)
462 
463 
464 
465 /* Codec Specific Information Elements for LDAC
466  * (based on "LDAC Specification of Bluetooth A2DP Rev.2.0.1")
467  *                  |  7  |  6  |  5  |  4  |  3  |  2  |  1  |  0  |
468  *  service_caps[4] |   SONY ID                                     | Octet0
469  *  service_caps[5] |   SONY ID                                     | Octet1
470  *  service_caps[6] |   SONY ID                                     | Octet2
471  *  service_caps[7] |   SONY ID                                     | Octet3
472  *  service_caps[8] |   SONY Specific Codec ID                      | Octet4
473  *  service_caps[9] |   SONY Specific Codec ID                      | Octet5
474  *  service_caps[A] |   RFA     |   Sampling Frequency              | Octet6
475  *  service_caps[B] |   RFA                       | Channel Mode ID | Octet7
476  */
477 #define LDACBT_MEDIA_CODEC_SC_SZ         (10+2)
478 
479 /* [Octet 0-3] Vendor ID for SONY */
480 #define LDACBT_VENDOR_ID0 0x2D
481 #define LDACBT_VENDOR_ID1 0x01
482 #define LDACBT_VENDOR_ID2 0x0
483 #define LDACBT_VENDOR_ID3 0x0
484 
485 /* [Octet 4-5] Vendor Specific A2DP Codec ID for LDAC */
486 #define LDACBT_CODEC_ID0 0xAA
487 #define LDACBT_CODEC_ID1 0x00
488 
489 /* [Octet 6]
490  * [b7,b6] : RFA
491  *       Reserved for future additions.
492  *       Bits with this designation shall be set to zero.
493  *       Receivers shall ignore these bits.
494  * -----------------------------------------------------
495  * [b5-b0] : Sampling frequency and its associated bit field in LDAC are shown below.
496  *    |  5  |  4  |  3  |  2  |  1  |  0  |
497  *    |  o  |     |     |     |     |     |  44100
498  *    |     |  o  |     |     |     |     |  48000
499  *    |     |     |  o  |     |     |     |  88200
500  *    |     |     |     |  o  |     |     |  96000
501  *    |     |     |     |     |  o  |     | 176400
502  *    |     |     |     |     |     |  o  | 192000
503  *
504  */
505 /* Support for 44.1kHz sampling frequency */
506 #define LDACBT_SAMPLING_FREQ_044100        0x20
507 /* Support for 48kHz sampling frequency */
508 #define LDACBT_SAMPLING_FREQ_048000        0x10
509 /* Support for 88.2kHz sampling frequency */
510 #define LDACBT_SAMPLING_FREQ_088200        0x08
511 /* Support for 96kHz sampling frequency */
512 #define LDACBT_SAMPLING_FREQ_096000        0x04
513 /* Support for 176.4kHz sampling frequency */
514 #define LDACBT_SAMPLING_FREQ_176400        0x02
515 /* Support for 192kHz sampling frequency */
516 #define LDACBT_SAMPLING_FREQ_192000        0x01
517 
518 /* [Octet 7]
519  * [b7-b3] : RFA
520  *       Reserved for future additions.
521  *       Bits with this designation shall be set to zero.
522  *       Receivers shall ignore these bits.
523  * ------------------------------------------------------
524  * [b2-b0] : Channel mode and its associated bit field in LDAC are shown below.
525  *    |  2  |  1  |  0  |
526  *    |  o  |     |     | MONO
527  *    |     |  o  |     | DUAL CHANNEL
528  *    |     |     |  o  | STEREO
529  */
530 /* Support for MONO */
531 #define LDACBT_CHANNEL_MODE_MONO           0x04
532 /* Support for DUAL CHANNEL */
533 #define LDACBT_CHANNEL_MODE_DUAL_CHANNEL   0x02
534 /* Support for STEREO */
535 #define LDACBT_CHANNEL_MODE_STEREO         0x01
536 
537 #ifdef __cplusplus
538 }
539 #endif
540 #endif /* _LDACBT_H_ */
541