1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 16 /***************************************************************************** 17 ** 18 ** Name: btc_av_api.h 19 ** 20 ** Description: This is the public interface file for the advanced 21 ** audio/video streaming (AV) subsystem of BTC. 22 ** 23 *****************************************************************************/ 24 25 #ifndef __BTC_AV_API_H__ 26 #define __BTC_AV_API_H__ 27 28 #include "common/bt_target.h" 29 #include "bta/bta_av_api.h" 30 #include "stack/a2d_api.h" 31 #include "stack/a2d_sbc.h" 32 33 #if (BTC_AV_INCLUDED == TRUE) 34 /***************************************************************************** 35 ** Constants and data types 36 *****************************************************************************/ 37 38 /* Codec type */ 39 #define BTC_AV_CODEC_NONE 0xFF 40 #define BTC_AV_CODEC_SBC A2D_MEDIA_CT_SBC /* SBC media codec type */ 41 42 #define BTC_AV_CODEC_PCM 0x5 /* Raw PCM */ 43 44 typedef UINT8 tBTC_AV_CODEC_ID; 45 46 /* AV features masks */ 47 #define BTC_AV_FEAT_RCTG BTA_AV_FEAT_RCTG /* remote control target */ 48 #define BTC_AV_FEAT_RCCT BTA_AV_FEAT_RCCT /* remote control controller */ 49 #define BTC_AV_FEAT_METADATA BTA_AV_FEAT_METADATA /* remote control Metadata Transfer command/response */ 50 51 typedef UINT16 tBTC_AV_FEAT; 52 53 /* AV channel values */ 54 #define BTC_AV_CHNL_MSK BTA_AV_CHNL_MSK 55 #define BTC_AV_CHNL_AUDIO BTA_AV_CHNL_AUDIO /* audio channel */ 56 #define BTC_AV_CHNL_VIDEO BTA_AV_CHNL_VIDEO /* video channel */ 57 typedef UINT8 tBTC_AV_CHNL; 58 59 typedef UINT8 tBTC_AV_HNDL; 60 61 /* Operation id list for BTC_AvRemoteCmd */ 62 #define BTC_AV_ID_SELECT 0x00 /* select */ 63 #define BTC_AV_ID_UP 0x01 /* up */ 64 #define BTC_AV_ID_DOWN 0x02 /* down */ 65 #define BTC_AV_ID_LEFT 0x03 /* left */ 66 #define BTC_AV_ID_RIGHT 0x04 /* right */ 67 #define BTC_AV_ID_RIGHT_UP 0x05 /* right-up */ 68 #define BTC_AV_ID_RIGHT_DOWN 0x06 /* right-down */ 69 #define BTC_AV_ID_LEFT_UP 0x07 /* left-up */ 70 #define BTC_AV_ID_LEFT_DOWN 0x08 /* left-down */ 71 #define BTC_AV_ID_ROOT_MENU 0x09 /* root menu */ 72 #define BTC_AV_ID_SETUP_MENU 0x0A /* setup menu */ 73 #define BTC_AV_ID_CONT_MENU 0x0B /* contents menu */ 74 #define BTC_AV_ID_FAV_MENU 0x0C /* favorite menu */ 75 #define BTC_AV_ID_EXIT 0x0D /* exit */ 76 #define BTC_AV_ID_0 0x20 /* 0 */ 77 #define BTC_AV_ID_1 0x21 /* 1 */ 78 #define BTC_AV_ID_2 0x22 /* 2 */ 79 #define BTC_AV_ID_3 0x23 /* 3 */ 80 #define BTC_AV_ID_4 0x24 /* 4 */ 81 #define BTC_AV_ID_5 0x25 /* 5 */ 82 #define BTC_AV_ID_6 0x26 /* 6 */ 83 #define BTC_AV_ID_7 0x27 /* 7 */ 84 #define BTC_AV_ID_8 0x28 /* 8 */ 85 #define BTC_AV_ID_9 0x29 /* 9 */ 86 #define BTC_AV_ID_DOT 0x2A /* dot */ 87 #define BTC_AV_ID_ENTER 0x2B /* enter */ 88 #define BTC_AV_ID_CLEAR 0x2C /* clear */ 89 #define BTC_AV_ID_CHAN_UP 0x30 /* channel up */ 90 #define BTC_AV_ID_CHAN_DOWN 0x31 /* channel down */ 91 #define BTC_AV_ID_PREV_CHAN 0x32 /* previous channel */ 92 #define BTC_AV_ID_SOUND_SEL 0x33 /* sound select */ 93 #define BTC_AV_ID_INPUT_SEL 0x34 /* input select */ 94 #define BTC_AV_ID_DISP_INFO 0x35 /* display information */ 95 #define BTC_AV_ID_HELP 0x36 /* help */ 96 #define BTC_AV_ID_PAGE_UP 0x37 /* page up */ 97 #define BTC_AV_ID_PAGE_DOWN 0x38 /* page down */ 98 #define BTC_AV_ID_POWER 0x40 /* power */ 99 #define BTC_AV_ID_VOL_UP 0x41 /* volume up */ 100 #define BTC_AV_ID_VOL_DOWN 0x42 /* volume down */ 101 #define BTC_AV_ID_MUTE 0x43 /* mute */ 102 #define BTC_AV_ID_PLAY 0x44 /* play */ 103 #define BTC_AV_ID_STOP 0x45 /* stop */ 104 #define BTC_AV_ID_PAUSE 0x46 /* pause */ 105 #define BTC_AV_ID_RECORD 0x47 /* record */ 106 #define BTC_AV_ID_REWIND 0x48 /* rewind */ 107 #define BTC_AV_ID_FAST_FOR 0x49 /* fast forward */ 108 #define BTC_AV_ID_EJECT 0x4A /* eject */ 109 #define BTC_AV_ID_FORWARD 0x4B /* forward */ 110 #define BTC_AV_ID_BACKWARD 0x4C /* backward */ 111 #define BTC_AV_ID_ANGLE 0x50 /* angle */ 112 #define BTC_AV_ID_SUBPICT 0x51 /* subpicture */ 113 #define BTC_AV_ID_F1 0x71 /* F1 */ 114 #define BTC_AV_ID_F2 0x72 /* F2 */ 115 #define BTC_AV_ID_F3 0x73 /* F3 */ 116 #define BTC_AV_ID_F4 0x74 /* F4 */ 117 #define BTC_AV_ID_F5 0x75 /* F5 */ 118 #define BTC_AV_ID_VENDOR 0x7E /* vendor unique */ 119 #define BTC_AV_KEYPRESSED_RELEASE 0x80 120 121 typedef UINT8 tBTC_AV_RC; 122 123 /* State flag for pass through command */ 124 #define BTC_AV_STATE_PRESS 0 /* key pressed */ 125 #define BTC_AV_STATE_RELEASE 1 /* key released */ 126 127 typedef UINT8 tBTC_AV_STATE; 128 129 typedef UINT8 tBTC_AV_RC_HNDL; 130 131 /* Command codes for BTC_AvVendorCmd */ 132 #define BTC_AV_CMD_CTRL 0 133 #define BTC_AV_CMD_STATUS 1 134 #define BTC_AV_CMD_SPEC_INQ 2 135 #define BTC_AV_CMD_NOTIF 3 136 #define BTC_AV_CMD_GEN_INQ 4 137 138 typedef UINT8 tBTC_AV_CMD; 139 140 /* AV callback events */ 141 #define BTC_AV_OPEN_EVT 0 /* connection opened */ 142 #define BTC_AV_CLOSE_EVT 1 /* connection closed */ 143 #define BTC_AV_START_EVT 2 /* stream data transfer started */ 144 #define BTC_AV_STOP_EVT 3 /* stream data transfer stopped */ 145 #define BTC_AV_RC_OPEN_EVT 4 /* remote control channel open */ 146 #define BTC_AV_RC_CLOSE_EVT 5 /* remote control channel closed */ 147 #define BTC_AV_REMOTE_CMD_EVT 6 /* remote control command */ 148 #define BTC_AV_REMOTE_RSP_EVT 7 /* remote control response */ 149 #define BTC_AV_META_MSG_EVT 8 /* metadata messages */ 150 151 typedef UINT8 tBTC_AV_EVT; 152 153 #define BTC_AV_FEEDING_ASYNCHRONOUS 0 /* asynchronous feeding, use tx av timer */ 154 #define BTC_AV_FEEDING_SYNCHRONOUS 1 /* synchronous feeding, no av tx timer */ 155 156 #define BTC_AV_MAX_SYNCHRONOUS_LATENCY 80 /* max latency in ms for BTC_AV_FEEDING_SYNCHRONOUS */ 157 #define BTC_AV_MIN_SYNCHRONOUS_LATENCY 4 /* min latency in ms for BTC_AV_FEEDING_SYNCHRONOUS */ 158 159 typedef UINT8 tBTC_AV_FEEDING_MODE; 160 161 #define BTC_AV_CHANNEL_MODE_MONO A2D_SBC_IE_CH_MD_MONO 162 #define BTC_AV_CHANNEL_MODE_STEREO A2D_SBC_IE_CH_MD_STEREO 163 #define BTC_AV_CHANNEL_MODE_JOINT A2D_SBC_IE_CH_MD_JOINT 164 #define BTC_AV_CHANNEL_MODE_DUAL A2D_SBC_IE_CH_MD_DUAL 165 166 typedef UINT8 tBTC_AV_CHANNEL_MODE; 167 168 /** 169 * Structure used to configure the AV codec capabilities/config 170 */ 171 typedef struct { 172 tBTC_AV_CODEC_ID id; /* Codec ID (in terms of BTC) */ 173 UINT8 info[AVDT_CODEC_SIZE]; /* Codec info (can be config or capabilities) */ 174 } tBTC_AV_CODEC_INFO; 175 176 /** 177 * Structure used to configure the AV media feeding 178 */ 179 typedef struct { 180 UINT16 sampling_freq; /* 44100, 48000 etc */ 181 UINT16 num_channel; /* 1 for mono or 2 stereo */ 182 UINT8 bit_per_sample; /* Number of bits per sample (8, 16) */ 183 } tBTC_AV_MEDIA_FEED_CFG_PCM; 184 185 typedef union { 186 tBTC_AV_MEDIA_FEED_CFG_PCM pcm; /* Raw PCM feeding format */ 187 } tBTC_AV_MEDIA_FEED_CFG; 188 189 typedef struct { 190 tBTC_AV_CODEC_ID format; /* Media codec identifier */ 191 tBTC_AV_MEDIA_FEED_CFG cfg; /* Media codec configuration */ 192 } tBTC_AV_MEDIA_FEEDINGS; 193 194 195 #ifdef __cplusplus 196 } 197 #endif 198 199 #endif ///BTC_AV_INCLUDED == TRUE 200 201 #endif /* __BTC_AV_API_H__ */ 202