1. 添加按键切换 修改source_buttons.button文件 2. 增加按键相关代码 修改source_button_handler.c和source_a2dp.c文件。 [code]a2dpInstance *a2dp_get_inst(void)
{
return A2DP_RUNDATA.inst;
}[/code][code] case BUTTON_MSG_SW_CODEC:
BUTTONS_DEBUG(("BUTTON_MSG_SW_CODEC\n"));
if(a2dp_any_media_connections())
{
if(codec_mode)
{
codec_mode=0;
}
else
{
codec_mode=1;
}
BUTTONS_DEBUG(("codec_mode = %d\n",codec_mode));
MessageSend(&a2dp_get_inst()->a2dpTask,A2DP_INTERNAL_MEDIA_CLOSE_REQ,0);
MessageSendLater(&a2dp_get_inst()->a2dpTask,A2DP_INTERNAL_MEDIA_OPEN_REQ,0,500);
}
break; [/code]代码如图所示 3. 修改source_a2dp.c文件 [code]static void a2dp_enter_state_connecting_media_local(a2dpInstance *inst, A2DP_STATE_T old_state)
{
uint8 a2dp_seid_list[A2DP_MAX_ENDPOINTS];
uint8 a2dp_seid_preference[A2DP_MAX_ENDPOINTS];
uint16 current_endpoint = 0;
uint16 i = 0;
uint16 j = 0;
uint16 k = 0;
uint16 temp_id;
uint16 temp_pref;
uint16 preference = 1;
a2dp_codecs_config_def_t a2dp_config_data;
memset(&a2dp_config_data,0,sizeof(a2dp_codecs_config_def_t));
memset(&a2dp_seid_list,0,sizeof(a2dp_seid_list));
memset(&a2dp_seid_preference,0,sizeof(a2dp_seid_preference));
/*Get the codec config values from the a2dp module config xml files.*/
a2dp_get_codec_enable_values(&a2dp_config_data);
if (inst && inst->a2dp_reconfiguring)
{
/* this is a reconfigure so chose CODECS based on what is set as a2dp_reconfigure_codec */
if (a2dp_seid_is_aptx(inst->a2dp_reconfigure_codec))
{
a2dp_seid_list[current_endpoint] = A2DP_SEID_APTX;
a2dp_seid_preference[current_endpoint++] = preference++;
}
a2dp_seid_list[current_endpoint] = A2DP_SEID_SBC;
a2dp_seid_preference[current_endpoint++] = preference++;
}
else
{
/* this is a standard A2DP Open so choose CODECS based on PS configuration */
if(a2dp_config_data.a2dpCodecsSBCEnable)
{
a2dp_seid_list[current_endpoint] = A2DP_SEID_SBC;
a2dp_seid_preference[current_endpoint++] =a2dp_config_data.a2dpCodecsSBCPref;
}
if(a2dp_config_data.a2dpCodecsFastStreamEnable)
{
a2dp_seid_list[current_endpoint] = A2DP_SEID_FASTSTREAM;
a2dp_seid_preference[current_endpoint++] = a2dp_config_data.a2dpFastStreamPref;
}
if(a2dp_config_data.a2dpCodecsAptXEnable)
{
a2dp_seid_list[current_endpoint] = A2DP_SEID_APTX;
a2dp_seid_preference[current_endpoint++] = a2dp_config_data.a2dpCodecsAptXPref;
}
if(codec_mode == 0) //切换部分代码,codec_mode=0屏蔽aptx-LL,codec_mode=1屏蔽aptx-HD |
GMT+8, 2025-12-14 23:13 , Processed in 0.235304 second(s), 15 queries , Gzip On, MemCached On.
Powered by Discuz! X3.5
© 2001-2025 Discuz! Team.