找回密码
 立即注册

使用微信账号登录

只需一步,快速开始

csr8675 adk4.1 source工程codec指示

2021-7-8 22:21| 发布者: 522315697| 查看: 2013| 评论: 1

摘要: csr867x发射器,使用adk4.1 source工程,教程太过入门,高手绕道。针对有些对游戏延时要求较高的产品,需要切换发射器codec,教程说明再哪里添加codec指示,方便查看当前codec类型。这里只是debug输出,大家可以根据 ...
csr867x发射器,使用adk4.1 source工程,教程太过入门,高手绕道。
针对有些对游戏延时要求较高的产品,需要切换发射器codec,教程说明再哪里添加codec指示,方便查看当前codec类型。
这里只是debug输出,大家可以根据自己需求做IO输出或者LED口输出指示。
1. 找到codec状态输出的文件,source_a2dp_msg_handler.c,图片所示位置会连接蓝牙音箱后codec状态输出

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;
    }      
}

2. 编译完成以后,连接蓝牙音箱测试codec类型,这里只是查看debug输出,实际可以添加LED指示,为了方便直观延时,通过切换了aptx和aptx-LL codec。


codec切换方法参考这篇教程:http://www.52bluetooth.com/portal.php?mod=view&aid=268


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]

3. 根据debug输出的数字判断codec类型


路过

雷人
1

握手

鲜花

鸡蛋

刚表态过的朋友 (1 人)

相关阅读

发表评论

最新评论

引用 想~nl 2021-7-27 21:48
这是好的文章啊,学习了

查看全部评论(1)

小黑屋|手机版|我爱蓝牙网 - 52Bluetooth

GMT+8, 2024-4-25 00:17 , Processed in 0.205690 second(s), 19 queries , Gzip On, MemCached On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

返回顶部