summaryrefslogtreecommitdiffstats
path: root/stack/include/a2d_m24.h
blob: 0417a57a37190f6e64dfd7fb3ac3c77ef9cb983d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*****************************************************************************
**
**  Name:       a2d_m24.h
**
**  Description:Interface to MPEG-2, 4 Aac
**
**  Copyright (c) 2000-2004, WIDCOMM Inc., All Rights Reserved.
**  WIDCOMM Bluetooth Core. Proprietary and confidential.
**
*****************************************************************************/
#ifndef A2D_M24_H
#define A2D_M24_H

/*****************************************************************************
**  Constants
*****************************************************************************/

/* the LOSC of MPEG_2, 4 AAC media codec capabilitiy */
#define A2D_M24_INFO_LEN            8

/* for Codec Specific Information Element */
#define A2D_M24_IE_OBJ_MSK          0xF0    /* b7-b4 object type. b3-b0 is RFA,not used */
#define A2D_M24_IE_OBJ_2LC          0x80    /* b7: MPEG-2 AAC LC */
#define A2D_M24_IE_OBJ_4LC          0x40    /* b6: MPEG-4 AAC LC */
#define A2D_M24_IE_OBJ_4LTP         0x20    /* b5: MPEG-4 AAC LTP */
#define A2D_M24_IE_OBJ_4S           0x10    /* b4: MPEG-4 AAC scalable */

#define A2D_M24_IE_SAMP_FREQ_MSK    0xFFF0    /* sampling frequency */
#define A2D_M24_IE_SAMP_FREQ_8      0x8000    /* b7:8  kHz */
#define A2D_M24_IE_SAMP_FREQ_11     0x4000    /* b6:11  kHz */
#define A2D_M24_IE_SAMP_FREQ_12     0x2000    /* b5:12  kHz */
#define A2D_M24_IE_SAMP_FREQ_16     0x1000    /* b4:16  kHz */
#define A2D_M24_IE_SAMP_FREQ_22     0x0800    /* b3:22.05kHz */
#define A2D_M24_IE_SAMP_FREQ_24     0x0400    /* b2:24  kHz */
#define A2D_M24_IE_SAMP_FREQ_32     0x0200    /* b1:32  kHz */
#define A2D_M24_IE_SAMP_FREQ_44     0x0100    /* b0:44.1kHz */
#define A2D_M24_IE_SAMP_FREQ_48     0x0080    /* b7:48  kHz */
#define A2D_M24_IE_SAMP_FREQ_64     0x0040    /* b6:64  kHz */
#define A2D_M24_IE_SAMP_FREQ_88     0x0020    /* b5:88  kHz */
#define A2D_M24_IE_SAMP_FREQ_96     0x0010    /* b4:96  kHz */

#define A2D_M24_IE_CHNL_MSK         0x0C    /* b3-b2 channels */
#define A2D_M24_IE_CHNL_1           0x08    /* b3: 1 channel */
#define A2D_M24_IE_CHNL_2           0x04    /* b2: 2 channels */

#define A2D_M24_IE_VBR_MSK          0x80    /* b7: VBR */

#define A2D_M24_IE_BITRATE3_MSK     0x7F0000    /* octect3*/
#define A2D_M24_IE_BITRATE45_MSK    0x00FFFF    /* octect4, 5*/
#define A2D_M24_IE_BITRATE_MSK      0x7FFFFF    /* b7-b0 of octect 3, all of octect4, 5*/


/*****************************************************************************
**  Type Definitions
*****************************************************************************/

/* data type for the MPEG-2, 4 AAC Codec Information Element*/
typedef struct
{
    UINT8   obj_type;   /* Object type */
    UINT16  samp_freq;  /* Sampling frequency */
    UINT8   chnl;       /* Channel mode */
    BOOLEAN vbr;        /* Variable Bit Rate */
    UINT32  bitrate;    /* Bit rate index */
} tA2D_M24_CIE;

/*****************************************************************************
**  External Function Declarations
*****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/******************************************************************************
**
** Function         A2D_BldM24Info
**
** Description      This function is called by an application to build  
**                  the MPEG-2, 4 AAC Media Codec Capabilities byte sequence
**                  beginning from the LOSC octet.
**                  Input Parameters:
**                      media_type:  Indicates Audio, or Multimedia.
**
**                      p_ie:  MPEG-2, 4 AAC Codec Information Element information.
**
**                  Output Parameters:
**                      p_result:  the resulting codec info byte sequence.
**
** Returns          A2D_SUCCESS if function execution succeeded.
**                  Error status code, otherwise.
******************************************************************************/
A2D_API extern tA2D_STATUS A2D_BldM24Info(UINT8 media_type, tA2D_M24_CIE *p_ie,
                                          UINT8 *p_result);

/******************************************************************************
**
** Function         A2D_ParsM24Info
**
** Description      This function is called by an application to parse 
**                  the MPEG-2, 4 AAC Media Codec Capabilities byte sequence
**                  beginning from the LOSC octet.
**                  Input Parameters:
**                      p_info:  the byte sequence to parse.
**
**                      for_caps:  TRUE, if the byte sequence is for get
**                                 capabilities response.
**
**                  Output Parameters:
**                      p_ie:  MPEG-2, 4 AAC Codec Information Element information.
**
** Returns          A2D_SUCCESS if function execution succeeded.
**                  Error status code, otherwise.
******************************************************************************/
A2D_API extern tA2D_STATUS A2D_ParsM24Info(tA2D_M24_CIE *p_ie, UINT8 *p_info,
                                           BOOLEAN for_caps);

#ifdef __cplusplus
}
#endif

#endif /* A2D_M24_H */