summaryrefslogtreecommitdiffstats
path: root/bta/include
diff options
context:
space:
mode:
authorKausik Sinnaswamy <kausik@broadcom.com>2012-03-07 19:30:20 -0800
committerMatthew Xie <mattx@google.com>2012-07-14 11:19:12 -0700
commit95fa11b3b2f19a382c7e3a744a6afb452fad86df (patch)
tree1019e123db4596f2b8bd1259da04b51f3c44d7b2 /bta/include
parente2197423bcf1a93c620be13d458a9da6693fa94d (diff)
downloadexternal_bluetooth_bluedroid-95fa11b3b2f19a382c7e3a744a6afb452fad86df.zip
external_bluetooth_bluedroid-95fa11b3b2f19a382c7e3a744a6afb452fad86df.tar.gz
external_bluetooth_bluedroid-95fa11b3b2f19a382c7e3a744a6afb452fad86df.tar.bz2
AV control and data path added
Change-Id: I88ec6084c140fa257154a98e23e075900e84cc8c
Diffstat (limited to 'bta/include')
-rwxr-xr-xbta/include/bta_api.h2
-rw-r--r--bta/include/bta_ar_api.h127
-rw-r--r--bta/include/bta_av_api.h5
-rw-r--r--bta/include/bta_av_co.h28
-rw-r--r--bta/include/bta_av_sbc.h194
5 files changed, 328 insertions, 28 deletions
diff --git a/bta/include/bta_api.h b/bta/include/bta_api.h
index e8f5892..57baa4d 100755
--- a/bta/include/bta_api.h
+++ b/bta/include/bta_api.h
@@ -1456,7 +1456,7 @@ BTA_API extern void BTA_SysFeatures (UINT16 sys_features);
**
** Description This function will request BTA to execute a call back in the context of BTU task
** This API was named in lower case because it is only intended
-** for the internal customers(like BSA).
+** for the internal customers(like BTIF).
**
** Returns void
**
diff --git a/bta/include/bta_ar_api.h b/bta/include/bta_ar_api.h
new file mode 100644
index 0000000..bf66dca
--- /dev/null
+++ b/bta/include/bta_ar_api.h
@@ -0,0 +1,127 @@
+/*****************************************************************************
+**
+** Name: bta_ar_api.h
+**
+** Description: This is the public interface file for the simulatenous
+** advanced audio/video streaming (AV) source and sink of BTA,
+** Widcomm's Bluetooth application layer for mobile phones.
+**
+** Copyright (c) 2004-2008, Widcomm Inc., All Rights Reserved.
+** Widcomm Bluetooth Core. Proprietary and confidential.
+**
+*****************************************************************************/
+#ifndef BTA_AR_API_H
+#define BTA_AR_API_H
+
+#include "avdt_api.h"
+#include "avct_api.h"
+#include "avrc_api.h"
+#include "sdp_api.h"
+#include "bta_av_api.h"
+#include "bta_sys.h"
+
+/*****************************************************************************
+** Constants and data types
+*****************************************************************************/
+/* This event signal to AR user that other profile is connected */
+#define BTA_AR_AVDT_CONN_EVT (AVDT_MAX_EVT + 1)
+
+/*******************************************************************************
+**
+** Function bta_ar_init
+**
+** Description This function is called from bta_sys_init().
+** to initialize the control block
+**
+** Returns void
+**
+*******************************************************************************/
+extern void bta_ar_init(void);
+
+/*******************************************************************************
+**
+** Function bta_ar_reg_avdt
+**
+** Description This function is called to register to AVDTP.
+**
+** Returns void
+**
+*******************************************************************************/
+extern void bta_ar_reg_avdt(tAVDT_REG *p_reg, tAVDT_CTRL_CBACK *p_cback, tBTA_SYS_ID sys_id);
+
+/*******************************************************************************
+**
+** Function bta_ar_dereg_avdt
+**
+** Description This function is called to de-register from AVDTP.
+**
+** Returns void
+**
+*******************************************************************************/
+extern void bta_ar_dereg_avdt(tBTA_SYS_ID sys_id);
+
+/*******************************************************************************
+**
+** Function bta_ar_avdt_conn
+**
+** Description This function is called to let ar know that some AVDTP profile
+** is connected for this sys_id.
+** If the other sys modules started a timer for PENDING_EVT,
+** the timer can be stopped now.
+**
+** Returns void
+**
+*******************************************************************************/
+extern void bta_ar_avdt_conn(tBTA_SYS_ID sys_id, BD_ADDR bd_addr);
+
+/*******************************************************************************
+**
+** Function bta_ar_reg_avct
+**
+** Description This function is called to register to AVCTP.
+**
+** Returns void
+**
+*******************************************************************************/
+extern void bta_ar_reg_avct(UINT16 mtu, UINT16 mtu_br, UINT8 sec_mask, tBTA_SYS_ID sys_id);
+
+/*******************************************************************************
+**
+** Function bta_ar_dereg_avct
+**
+** Description This function is called to deregister from AVCTP.
+**
+** Returns void
+**
+*******************************************************************************/
+extern void bta_ar_dereg_avct(tBTA_SYS_ID sys_id);
+
+/******************************************************************************
+**
+** Function bta_ar_reg_avrc
+**
+** Description This function is called to register an SDP record for AVRCP.
+**
+** Returns void
+**
+******************************************************************************/
+extern void bta_ar_reg_avrc(UINT16 service_uuid, char *p_service_name,
+ char *p_provider_name, UINT16 categories, tBTA_SYS_ID sys_id);
+
+/******************************************************************************
+**
+** Function bta_ar_dereg_avrc
+**
+** Description This function is called to de-register/delete an SDP record for AVRCP.
+**
+** Returns void
+**
+******************************************************************************/
+extern void bta_ar_dereg_avrc(UINT16 service_uuid, tBTA_SYS_ID sys_id);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BTA_AR_API_H */
diff --git a/bta/include/bta_av_api.h b/bta/include/bta_av_api.h
index f639d22..02bc30c 100644
--- a/bta/include/bta_av_api.h
+++ b/bta/include/bta_av_api.h
@@ -17,9 +17,6 @@
#include "avdt_api.h"
#include "a2d_api.h"
#include "bta_api.h"
-#if( defined VDP_INCLUDED) && (VDP_INCLUDED == TRUE)
-#include "vdp_api.h"
-#endif
/*****************************************************************************
** Constants and data types
@@ -238,6 +235,8 @@ typedef UINT8 tBTA_AV_ERR;
#define BTA_AV_META_MSG_EVT 17 /* metadata messages */
#define BTA_AV_REJECT_EVT 18 /* incoming connection rejected */
#define BTA_AV_RC_FEAT_EVT 19 /* remote control channel peer supported features update */
+/* Max BTA event */
+#define BTA_AV_MAX_EVT 20
typedef UINT8 tBTA_AV_EVT;
diff --git a/bta/include/bta_av_co.h b/bta/include/bta_av_co.h
index 2f41180..f2fa83b 100644
--- a/bta/include/bta_av_co.h
+++ b/bta/include/bta_av_co.h
@@ -47,12 +47,6 @@ enum
BTA_AV_CO_ST_STREAM
};
-/* data type for the Video Codec Information Element*/
-typedef struct
-{
- UINT8 codec_type; /* Codec type */
- UINT8 levels; /* level mask */
-} tBTA_AV_VIDEO_CFG;
/* data type for the Audio Codec Information*/
typedef struct
@@ -83,22 +77,6 @@ BTA_API extern BOOLEAN bta_av_co_audio_init(UINT8 *p_codec_type, UINT8 *p_codec_
/*******************************************************************************
**
-** Function bta_av_co_video_init
-**
-** Description This callout function is executed by AV when it is
-** started by calling BTA_AvEnable(). This function can be
-** used by the phone to initialize video paths or for other
-** initialization purposes.
-**
-**
-** Returns Stream codec and content protection capabilities info.
-**
-*******************************************************************************/
-BTA_API extern BOOLEAN bta_av_co_video_init(UINT8 *p_codec_type, UINT8 *p_codec_info,
- UINT8 *p_num_protect, UINT8 *p_protect_info, UINT8 index);
-
-/*******************************************************************************
-**
** Function bta_av_co_audio_disc_res
**
** Description This callout function is executed by AV to report the
@@ -263,7 +241,8 @@ BTA_API extern void bta_av_co_video_close(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec
** Returns void
**
*******************************************************************************/
-BTA_API extern void bta_av_co_audio_start(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
+BTA_API extern void bta_av_co_audio_start(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
+ UINT8 *p_codec_info, BOOLEAN *p_no_rtp_hdr);
/*******************************************************************************
**
@@ -276,7 +255,8 @@ BTA_API extern void bta_av_co_audio_start(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec
** Returns void
**
*******************************************************************************/
-BTA_API extern void bta_av_co_video_start(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
+BTA_API extern void bta_av_co_video_start(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
+ UINT8 *p_codec_info, BOOLEAN *p_no_rtp_hdr);
/*******************************************************************************
**
diff --git a/bta/include/bta_av_sbc.h b/bta/include/bta_av_sbc.h
new file mode 100644
index 0000000..157ba08
--- /dev/null
+++ b/bta/include/bta_av_sbc.h
@@ -0,0 +1,194 @@
+/*****************************************************************************
+**
+** Name: bta_av_sbc.h
+**
+** Description: This is the interface to utility functions for dealing
+** with SBC data frames and codec capabilities.
+**
+** Copyright (c) 2004, Widcomm Inc., All Rights Reserved.
+** Widcomm Bluetooth Core. Proprietary and confidential.
+**
+*****************************************************************************/
+#ifndef BTA_AV_SBC_H
+#define BTA_AV_SBC_H
+
+/*****************************************************************************
+** constants
+*****************************************************************************/
+
+/* SBC packet header size */
+#define BTA_AV_SBC_HDR_SIZE A2D_SBC_MPL_HDR_LEN
+
+/*******************************************************************************
+**
+** Function bta_av_sbc_init_up_sample
+**
+** Description initialize the up sample
+**
+** src_sps: samples per second (source audio data)
+** dst_sps: samples per second (converted audio data)
+** bits: number of bits per pcm sample
+** n_channels: number of channels (i.e. mono(1), stereo(2)...)
+**
+** Returns none
+**
+*******************************************************************************/
+extern void bta_av_sbc_init_up_sample (UINT32 src_sps, UINT32 dst_sps,
+ UINT16 bits, UINT16 n_channels);
+
+/*******************************************************************************
+**
+** Function bta_av_sbc_up_sample
+**
+** Description Given the source (p_src) audio data and
+** source speed (src_sps, samples per second),
+** This function converts it to audio data in the desired format
+**
+** p_src: the data buffer that holds the source audio data
+** p_dst: the data buffer to hold the converted audio data
+** src_samples: The number of source samples (number of bytes)
+** dst_samples: The size of p_dst (number of bytes)
+**
+** Note: An AE reported an issue with this function.
+** When called with bta_av_sbc_up_sample(src, uint8_array_dst..)
+** the byte before uint8_array_dst may get overwritten.
+** Using uint16_array_dst avoids the problem.
+** This issue is related to endian-ness and is hard to resolve
+** in a generic manner.
+** **************** Please use uint16 array as dst.
+**
+** Returns The number of bytes used in p_dst
+** The number of bytes used in p_src (in *p_ret)
+**
+*******************************************************************************/
+extern int bta_av_sbc_up_sample (void *p_src, void *p_dst,
+ UINT32 src_samples, UINT32 dst_samples,
+ UINT32 *p_ret);
+
+/*******************************************************************************
+**
+** Function bta_av_sbc_up_sample_16s (16bits-stereo)
+**
+** Description Given the source (p_src) audio data and
+** source speed (src_sps, samples per second),
+** This function converts it to audio data in the desired format
+**
+** p_src: the data buffer that holds the source audio data
+** p_dst: the data buffer to hold the converted audio data
+** src_samples: The number of source samples (in uint of 4 bytes)
+** dst_samples: The size of p_dst (in uint of 4 bytes)
+**
+** Returns The number of bytes used in p_dst
+** The number of bytes used in p_src (in *p_ret)
+**
+*******************************************************************************/
+extern int bta_av_sbc_up_sample_16s (void *p_src, void *p_dst,
+ UINT32 src_samples, UINT32 dst_samples,
+ UINT32 *p_ret);
+
+/*******************************************************************************
+**
+** Function bta_av_sbc_up_sample_16m (16bits-mono)
+**
+** Description Given the source (p_src) audio data and
+** source speed (src_sps, samples per second),
+** This function converts it to audio data in the desired format
+**
+** p_src: the data buffer that holds the source audio data
+** p_dst: the data buffer to hold the converted audio data
+** src_samples: The number of source samples (in uint of 2 bytes)
+** dst_samples: The size of p_dst (in uint of 2 bytes)
+**
+** Returns The number of bytes used in p_dst
+** The number of bytes used in p_src (in *p_ret)
+**
+*******************************************************************************/
+extern int bta_av_sbc_up_sample_16m (void *p_src, void *p_dst,
+ UINT32 src_samples, UINT32 dst_samples,
+ UINT32 *p_ret);
+
+/*******************************************************************************
+**
+** Function bta_av_sbc_up_sample_8s (8bits-stereo)
+**
+** Description Given the source (p_src) audio data and
+** source speed (src_sps, samples per second),
+** This function converts it to audio data in the desired format
+**
+** p_src: the data buffer that holds the source audio data
+** p_dst: the data buffer to hold the converted audio data
+** src_samples: The number of source samples (in uint of 2 bytes)
+** dst_samples: The size of p_dst (in uint of 2 bytes)
+**
+** Returns The number of bytes used in p_dst
+** The number of bytes used in p_src (in *p_ret)
+**
+*******************************************************************************/
+extern int bta_av_sbc_up_sample_8s (void *p_src, void *p_dst,
+ UINT32 src_samples, UINT32 dst_samples,
+ UINT32 *p_ret);
+
+/*******************************************************************************
+**
+** Function bta_av_sbc_up_sample_8m (8bits-mono)
+**
+** Description Given the source (p_src) audio data and
+** source speed (src_sps, samples per second),
+** This function converts it to audio data in the desired format
+**
+** p_src: the data buffer that holds the source audio data
+** p_dst: the data buffer to hold the converted audio data
+** src_samples: The number of source samples (number of bytes)
+** dst_samples: The size of p_dst (number of bytes)
+**
+** Returns The number of bytes used in p_dst
+** The number of bytes used in p_src (in *p_ret)
+**
+*******************************************************************************/
+extern int bta_av_sbc_up_sample_8m (void *p_src, void *p_dst,
+ UINT32 src_samples, UINT32 dst_samples,
+ UINT32 *p_ret);
+
+/*******************************************************************************
+**
+** Function bta_av_sbc_cfg_for_cap
+**
+** Description Determine the preferred SBC codec configuration for the
+** given codec capabilities. The function is passed the
+** preferred codec configuration and the peer codec
+** capabilities for the stream. The function attempts to
+** match the preferred capabilities with the configuration
+** as best it can. The resulting codec configuration is
+** returned in the same memory used for the capabilities.
+**
+** Returns 0 if ok, nonzero if error.
+** Codec configuration in p_cap.
+**
+*******************************************************************************/
+extern UINT8 bta_av_sbc_cfg_for_cap(UINT8 *p_peer, tA2D_SBC_CIE *p_cap, tA2D_SBC_CIE *p_pref);
+
+/*******************************************************************************
+**
+** Function bta_av_sbc_cfg_in_cap
+**
+** Description This function checks whether an SBC codec configuration
+** is allowable for the given codec capabilities.
+**
+** Returns 0 if ok, nonzero if error.
+**
+*******************************************************************************/
+extern UINT8 bta_av_sbc_cfg_in_cap(UINT8 *p_cfg, tA2D_SBC_CIE *p_cap);
+
+/*******************************************************************************
+**
+** Function bta_av_sbc_bld_hdr
+**
+** Description This function builds the packet header for MPF1.
+**
+** Returns void
+**
+*******************************************************************************/
+extern void bta_av_sbc_bld_hdr(BT_HDR *p_buf, UINT16 fr_per_pkt);
+
+#endif /* BTA_AV_SBC_H */
+