/* the call out functions for audio stream */
-const tBTA_AV_CO_FUNCTS bta_av_a2d_cos =
+/* const tBTA_AV_CO_FUNCTS bta_av_a2d_cos =
{
bta_av_co_audio_init,
bta_av_co_audio_disc_res,
bta_av_co_audio_src_data_path,
bta_av_co_audio_delay
};
+*/
+tBTA_AV_CO_FUNCTS *p_bta_av_a2d_cos = NULL;
+
+
/* ssm action functions for audio stream */
const tBTA_AV_SACT bta_av_a2d_action[] =
** Returns void
**
*******************************************************************************/
-void BTA_AvRegister(tBTA_AV_CHNL chnl, const char *p_service_name, UINT8 app_id, tBTA_AV_DATA_CBACK *p_data_cback)
+void BTA_AvRegister(tBTA_AV_CHNL chnl, const char *p_service_name, UINT8 app_id, tBTA_AV_DATA_CBACK *p_data_cback, tBTA_AV_CO_FUNCTS *bta_av_cos)
{
tBTA_AV_API_REG *p_buf;
}
p_buf->app_id = app_id;
p_buf->p_app_data_cback = p_data_cback;
+ p_buf->bta_av_cos = bta_av_cos;
bta_sys_sendmsg(p_buf);
}
}
/*****************************************************************************
** Data types
*****************************************************************************/
-
+#if 0
/* function types for call-out functions */
typedef BOOLEAN (*tBTA_AV_CO_INIT) (UINT8 *p_codec_type, UINT8 *p_codec_info,
UINT8 *p_num_protect, UINT8 *p_protect_info, UINT8 index);
tBTA_AV_CO_DATAPATH data;
tBTA_AV_CO_DELAY delay;
} tBTA_AV_CO_FUNCTS;
+#endif
/* data type for BTA_AV_API_ENABLE_EVT */
typedef struct
char p_service_name[BTA_SERVICE_NAME_LEN+1];
UINT8 app_id;
tBTA_AV_DATA_CBACK *p_app_data_cback;
+ tBTA_AV_CO_FUNCTS *bta_av_cos;
} tBTA_AV_API_REG;
extern UINT16 *p_bta_av_rc_id_ac;
extern const tBTA_AV_SACT bta_av_a2d_action[];
-extern const tBTA_AV_CO_FUNCTS bta_av_a2d_cos;
+// extern const tBTA_AV_CO_FUNCTS bta_av_a2d_cos;
extern const tBTA_AV_SACT bta_av_vdp_action[];
extern tAVDT_CTRL_CBACK * const bta_av_dt_cback[];
extern void bta_av_stream_data_cback(UINT8 handle, BT_HDR *p_pkt, UINT32 time_stamp, UINT8 m_pt);
registr.status = BTA_AV_FAIL_RESOURCES;
registr.app_id = p_data->api_reg.app_id;
registr.chnl = (tBTA_AV_CHNL)p_data->hdr.layer_specific;
+ registr.p_bta_av_cos = p_data->api_reg.bta_av_cos;
do
{
p_scb = bta_av_alloc_scb(registr.chnl);
{
/* set up the audio stream control block */
p_scb->p_act_tbl = (const tBTA_AV_ACT *)bta_av_a2d_action;
- p_scb->p_cos = &bta_av_a2d_cos;
+ // p_scb->p_cos = &bta_av_a2d_cos;
+ p_scb->p_cos = registr.p_bta_av_cos;
p_scb->media_type= AVDT_MEDIA_AUDIO;
cs.cfg.psc_mask = AVDT_PSC_TRANS;
cs.media_type = AVDT_MEDIA_AUDIO;
/* keep the configuration in the stream control block */
memcpy(&p_scb->cfg, &cs.cfg, sizeof(tAVDT_CFG));
while(index < BTA_AV_MAX_SEPS &&
- (*bta_av_a2d_cos.init)(&codec_type, cs.cfg.codec_info,
+ (p_scb->p_cos->init)(&codec_type, cs.cfg.codec_info,
&cs.cfg.num_protect, cs.cfg.protect_info, index) == TRUE)
{
#define BTA_AV_MAX_EVT 22
+/* function types for call-out functions */
+typedef BOOLEAN (*tBTA_AV_CO_INIT) (UINT8 *p_codec_type, UINT8 *p_codec_info,
+ UINT8 *p_num_protect, UINT8 *p_protect_info, UINT8 index);
+typedef void (*tBTA_AV_CO_DISC_RES) (tBTA_AV_HNDL hndl, UINT8 num_seps,
+ UINT8 num_snk, UINT8 num_src, BD_ADDR addr, UINT16 uuid_local);
+typedef UINT8 (*tBTA_AV_CO_GETCFG) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
+ UINT8 *p_codec_info, UINT8 *p_sep_info_idx, UINT8 seid,
+ UINT8 *p_num_protect, UINT8 *p_protect_info);
+typedef void (*tBTA_AV_CO_SETCFG) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
+ UINT8 *p_codec_info, UINT8 seid, BD_ADDR addr,
+ UINT8 num_protect, UINT8 *p_protect_info,
+ UINT8 t_local_sep, UINT8 avdt_handle);
+typedef void (*tBTA_AV_CO_OPEN) (tBTA_AV_HNDL hndl,
+ tBTA_AV_CODEC codec_type, UINT8 *p_codec_info,
+ UINT16 mtu);
+typedef void (*tBTA_AV_CO_CLOSE) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type, UINT16 mtu);
+typedef void (*tBTA_AV_CO_START) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,UINT8 *p_codec_info, BOOLEAN *p_no_rtp_hdr);
+typedef void (*tBTA_AV_CO_STOP) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
+typedef void * (*tBTA_AV_CO_DATAPATH) (tBTA_AV_CODEC codec_type,
+ UINT32 *p_len, UINT32 *p_timestamp);
+typedef void (*tBTA_AV_CO_DELAY) (tBTA_AV_HNDL hndl, UINT16 delay);
+
+/* the call-out functions for one stream */
+typedef struct
+{
+ tBTA_AV_CO_INIT init;
+ tBTA_AV_CO_DISC_RES disc_res;
+ tBTA_AV_CO_GETCFG getcfg;
+ tBTA_AV_CO_SETCFG setcfg;
+ tBTA_AV_CO_OPEN open;
+ tBTA_AV_CO_CLOSE close;
+ tBTA_AV_CO_START start;
+ tBTA_AV_CO_STOP stop;
+ tBTA_AV_CO_DATAPATH data;
+ tBTA_AV_CO_DELAY delay;
+} tBTA_AV_CO_FUNCTS;
+
typedef UINT8 tBTA_AV_EVT;
/* Event associated with BTA_AV_ENABLE_EVT */
tBTA_AV_HNDL hndl; /* Handle associated with the stream. */
UINT8 app_id; /* ID associated with call to BTA_AvRegister() */
tBTA_AV_STATUS status;
+ tBTA_AV_CO_FUNCTS *p_bta_av_cos;
} tBTA_AV_REGISTER;
/* data associated with BTA_AV_OPEN_EVT */
**
*******************************************************************************/
void BTA_AvRegister(tBTA_AV_CHNL chnl, const char *p_service_name,
- UINT8 app_id, tBTA_AV_DATA_CBACK *p_data_cback);
+ UINT8 app_id, tBTA_AV_DATA_CBACK *p_data_cback, tBTA_AV_CO_FUNCTS * bta_av_cos);
/*******************************************************************************
**
extern BOOLEAN btif_rc_get_connected_peer(BD_ADDR peer_addr);
extern void btif_rc_check_handle_pending_play (BD_ADDR peer_addr, BOOLEAN bSendToApp);
+
+extern tBTA_AV_CO_FUNCTS bta_av_a2d_cos;
/*****************************************************************************
** Local helper functions
******************************************************************************/
BTA_AvEnable(BTA_SEC_AUTHENTICATE, (BTA_AV_FEAT_RCTG | BTA_AV_FEAT_NO_SCO_SSPD),
bte_av_callback);
#endif
- BTA_AvRegister(BTA_AV_CHNL_AUDIO, BTIF_AV_SERVICE_NAME, 0, bte_av_media_callback);
+ BTA_AvRegister(BTA_AV_CHNL_AUDIO, BTIF_AV_SERVICE_NAME, 0, bte_av_media_callback, &bta_av_a2d_cos);
}
else {
BTA_AvDeregister(btif_av_cb.bta_handle);
#include "bta_av_co.h"
#include "bta_av_ci.h"
#include "bta_av_sbc.h"
-#if 0 // todo : port the call out functions
#include "btif_media.h"
#include "sbc_encoder.h"
#include "btif_av_co.h"
return TRUE;
}
-
-#else /* #if 0 */
-
-extern BOOLEAN bta_av_co_audio_init(UINT8 *p_codec_type, UINT8 *p_codec_info,
- UINT8 *p_num_protect, UINT8 *p_protect_info, UINT8 index)
-{
- return FALSE;
-}
-
-extern void bta_av_co_audio_disc_res(tBTA_AV_HNDL hndl, UINT8 num_seps,
- UINT8 num_snk, UINT8 num_src, BD_ADDR addr, UINT16 uuid_local)
-{
- return;
-}
-
-extern void bta_av_co_video_disc_res(tBTA_AV_HNDL hndl, UINT8 num_seps,
- UINT8 num_snk, BD_ADDR addr)
-{
- return;
-}
-
-extern UINT8 bta_av_co_audio_getconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
- UINT8 *p_codec_info, UINT8 *p_sep_info_idx, UINT8 seid,
- UINT8 *p_num_protect, UINT8 *p_protect_info)
-{
- return 0;
-}
-
-extern UINT8 bta_av_co_video_getconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
- UINT8 *p_codec_info, UINT8 *p_sep_info_idx, UINT8 seid,
- UINT8 *p_num_protect, UINT8 *p_protect_info)
-{
- return 0;
-}
-
-extern void bta_av_co_audio_setconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
- UINT8 *p_codec_info, UINT8 seid, BD_ADDR addr,
- UINT8 num_protect, UINT8 *p_protect_info,UINT8 t_local_sep, UINT8 avdt_handle)
-{
- return;
-}
-
-extern void bta_av_co_video_setconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
- UINT8 *p_codec_info, UINT8 seid, BD_ADDR addr,
- UINT8 num_protect, UINT8 *p_protect_info)
-{
- return;
-}
-
-extern void bta_av_co_audio_open(tBTA_AV_HNDL hndl,
- tBTA_AV_CODEC codec_type, UINT8 *p_codec_info,
- UINT16 mtu)
-{
- return;
-}
-
-extern void bta_av_co_video_open(tBTA_AV_HNDL hndl,
- tBTA_AV_CODEC codec_type, UINT8 *p_codec_info,
- UINT16 mtu)
-{
- return;
-}
-
-extern void bta_av_co_audio_close(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
- UINT16 mtu)
-{
- return;
-}
-
-extern void bta_av_co_video_close(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
- UINT16 mtu)
-{
- return;
-}
-
-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)
-{
- return;
-}
-
-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)
-{
- return;
-}
-
-extern void bta_av_co_audio_stop(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type)
-{
- return;
-}
-
-extern void bta_av_co_video_stop(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type)
-{
- return;
-}
-
-extern void * bta_av_co_audio_src_data_path(tBTA_AV_CODEC codec_type,
- UINT32 *p_len, UINT32 *p_timestamp)
-{
- return NULL;
-}
-
-extern void * bta_av_co_video_src_data_path(tBTA_AV_CODEC codec_type,
- UINT32 *p_len, UINT32 *p_timestamp)
-{
- return NULL;
-}
-
-extern void bta_av_co_audio_drop(tBTA_AV_HNDL hndl)
-{
- return;
-}
-
-extern void bta_av_co_video_report_conn (BOOLEAN open, UINT8 avdt_handle)
-{
- return;
-}
-
-extern void bta_av_co_video_report_rr (UINT32 packet_lost)
-{
- return;
-}
-
-extern void bta_av_co_audio_delay(tBTA_AV_HNDL hndl, UINT16 delay)
-{
- return;
-}
-
-extern void bta_av_co_video_delay(tBTA_AV_HNDL hndl, UINT16 delay)
-{
- return;
-}
-
-#endif
+/* the call out functions for audio stream */
+tBTA_AV_CO_FUNCTS bta_av_a2d_cos =
+{
+ bta_av_co_audio_init,
+ bta_av_co_audio_disc_res,
+ bta_av_co_audio_getconfig,
+ bta_av_co_audio_setconfig,
+ bta_av_co_audio_open,
+ bta_av_co_audio_close,
+ bta_av_co_audio_start,
+ bta_av_co_audio_stop,
+ bta_av_co_audio_src_data_path,
+ bta_av_co_audio_delay
+};
udrv/ulinux \
embdrv/sbc/encoder \
embdrv/sbc/decoder \
+ btif/co \
btif
CFLAGS += -Wno-error=unused-label -Wno-error=return-type -Wno-error=missing-braces -Wno-error=pointer-sign -Wno-error=parentheses -I./include