csr867x发射器,使用adk4.1 source工程,教程太过入门,高手绕道。 针对有些对游戏延时要求较高的产品,需要切换发射器codec,教程说明再哪里添加codec指示,方便查看当前codec类型。 这里只是debug输出,大家可以根据自己需求做IO输出或者LED口输出指示。 1. 找到codec状态输出的文件,source_a2dp_msg_handler.c,图片所示位置会连接蓝牙音箱后codec状态输出 [code]static void a2dp_msg_media_open_cfm(const A2DP_MEDIA_OPEN_CFM_T *message)
{
a2dpInstance *inst = a2dp_get_instance_from_device_id(message->device_id);
if (inst == NULL)
{
A2DP_MSG_DEBUG((" inst not found\n"));
return;
}
A2DP_MSG_DEBUG_INST(inst);
switch (a2dp_get_state(inst))
{
case A2DP_STATE_CONNECTING_MEDIA_LOCAL:
case A2DP_STATE_CONNECTING_MEDIA_REMOTE:
{
if (message->status == a2dp_success)
{
a2dp_codec_settings *settings = NULL;
/* store the device_id for this signalling connection */
inst->a2dp_stream_id = message->stream_id;
A2DP_MSG_DEBUG((" device ID:[0x%x]\n", message->device_id));
A2DP_MSG_DEBUG((" stream ID [0x%x]\n", message->stream_id));
settings = A2dpCodecGetSettings(message->device_id, message->stream_id);
if (settings)
{
A2DP_MSG_DEBUG((" stream end point ID [0x%x]\n", settings->seid));/*位置在这里*/
/* update the audio plugin in use */
audio_a2dp_set_plugin(settings->seid);
/* free the settings memory that the A2DP library allocated */
memory_free(settings);
}
/* update the state to reflect the media channel is connected */
a2dp_set_state(inst, A2DP_STATE_CONNECTED_MEDIA);
}
else
{
/* if media can't be connected then disconnect signalling channel */
a2dp_set_state(inst, A2DP_STATE_DISCONNECTING);
}
}
break;
default:
{
a2dp_msg_unhandled_state(inst);
}
break;
}
}[/code]2. 编译完成以后,连接蓝牙音箱测试codec类型,这里只是查看debug输出,实际可以添加LED指示,为了方便直观延时,通过切换了aptx和aptx-LL codec。 codec切换方法参考这篇教程:http://www.52bluetooth.com/portal.php?mod=view&aid=268 [code]A2DP_INTERNAL_MEDIA_CLOSE_REQ:
inst[0xe00]
A2DP_MEDIA_CLOSE_IND:
inst[0xe00]
A2DP_INTERNAL_MEDIA_OPEN_REQ:
inst[0xe00]
A2DP_MEDIA_OPEN_CFM 0:
inst[0xe00]
device ID:[0x0]
stream ID [0x0]
stream end point ID [0x3]
A2DP_INTERNAL_MEDIA_START_REQ:
inst[0xe00]
A2DP_MEDIA_START_CFM 0:
inst[0xe00]
A2DP_INTERNAL_MEDIA_CLOSE_REQ:
inst[0xe00]
A2DP_MEDIA_CLOSE_IND:
inst[0xe00]
A2DP_INTERNAL_MEDIA_OPEN_REQ:
inst[0xe00]
A2DP_MEDIA_OPEN_CFM 0:
inst[0xe00]
device ID:[0x0]
stream ID [0x0]
stream end point ID [0x4]
A2DP_INTERNAL_MEDIA_START_REQ:
inst[0xe00]
A2DP_MEDIA_START_CFM 0:
inst[0xe00][/code]3. 根据debug输出的数字判断codec类型 |
GMT+8, 2025-12-14 23:19 , Processed in 0.691023 second(s), 28 queries , Gzip On, MemCached On.
Powered by Discuz! X3.5
© 2001-2025 Discuz! Team.