播放歌曲到蓝牙耳机--A2DP
来源:互联网 发布:ubuntu虚拟机硬盘扩容 编辑:程序博客网 时间:2024/06/10 09:16
===代码请参考btsco中的a2play.c===
基本流程如下:
1.init sbc
2.open audio file
/dev/dsp
/dev/audio
snd format file
3.read[call read()] and encode to sbc[call sbc_encode()]
4.Detect whether support A2DP Sink by create and connect SDP Session[call detect_a2dp()]
5.create "cmd_socket"
(1)call socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP) to create "cmd_socket"
(2)call bind() to local
(3)call connect() to remote
(4)call getsockopt(SOL_L2CAP, L2CAP_OPTIONS) to get MTU
6.call write(cmd_socket, AVDTP_DISCOVER) to get SEIDs
7.do follow things to each SEID until success
(1)call write(cmd_socket, AVDTP_GET_CAPABILITIES) to get Capability of SEID
(2)call write(cmd_socket, AVDTP_SET_CONFIGURATION) to set Configure of SEID
(3)call write(cmd_socket, AVDTP_OPEN) to open stream
8.create "stream_socket"
(1)call socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP) to create "stream_socket"
(2)call bind() to local
(3)call connect() to remote
(4)call getsockopt(SOL_L2CAP, L2CAP_OPTIONS) to get MTU
9.call write(cmd_socket, AVDTP_START) to start stream
10.send AudioContent to stream_socket
(1)read[call read()] and encode to sbc[call sbc_encode()]
(2)call write(stream_socket) to sink
11.call close() to close audio file
12.call write(cmd_socket, AVDTP_CLOSE) to close stream
13.call close() to close stream_socket
14.call close() to close cmd_socket
意见反馈:
1.输入的声音文件是snd编码格式的
2.实现过程与ipctest.c基本相同
3.运行之前,处于断开状态
基本流程如下:
1.init sbc
2.open audio file
/dev/dsp
/dev/audio
snd format file
3.read[call read()] and encode to sbc[call sbc_encode()]
4.Detect whether support A2DP Sink by create and connect SDP Session[call detect_a2dp()]
5.create "cmd_socket"
(1)call socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP) to create "cmd_socket"
(2)call bind() to local
(3)call connect() to remote
(4)call getsockopt(SOL_L2CAP, L2CAP_OPTIONS) to get MTU
6.call write(cmd_socket, AVDTP_DISCOVER) to get SEIDs
7.do follow things to each SEID until success
(1)call write(cmd_socket, AVDTP_GET_CAPABILITIES) to get Capability of SEID
(2)call write(cmd_socket, AVDTP_SET_CONFIGURATION) to set Configure of SEID
(3)call write(cmd_socket, AVDTP_OPEN) to open stream
8.create "stream_socket"
(1)call socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP) to create "stream_socket"
(2)call bind() to local
(3)call connect() to remote
(4)call getsockopt(SOL_L2CAP, L2CAP_OPTIONS) to get MTU
9.call write(cmd_socket, AVDTP_START) to start stream
10.send AudioContent to stream_socket
(1)read[call read()] and encode to sbc[call sbc_encode()]
(2)call write(stream_socket) to sink
11.call close() to close audio file
12.call write(cmd_socket, AVDTP_CLOSE) to close stream
13.call close() to close stream_socket
14.call close() to close cmd_socket
意见反馈:
1.输入的声音文件是snd编码格式的
2.实现过程与ipctest.c基本相同
3.运行之前,处于断开状态
- 播放歌曲到蓝牙耳机--A2DP
- 播放歌曲到蓝牙耳机--HSP
- 播放歌曲到蓝牙耳机--ALSA
- Android蓝牙连接蓝牙音箱和耳机的 A2dp与Headset Profile
- 解决WP7手机使用蓝牙耳机播放视频时无法启动A2DP(没有声音)
- 蓝牙耳机现在主要有三大规格———HSP、HFP和A2DP
- 建立到蓝牙耳机的连接
- ubuntu 10.10 蓝牙 a2dp
- 蓝牙音乐 A2DP 剖析
- 蓝牙profile:A2DP,AVRCP
- Android蓝牙A2dp开发
- 蓝牙耳机
- 蓝牙耳机
- 蓝牙耳机
- 蓝牙耳机
- android下的蓝牙A2DP
- 蓝牙A2DP的初始化过程
- android 打开蓝牙A2dp通道
- IT常用术语--存储
- 用fmt:formatDate格式化日期字段的输出
- 播放歌曲到蓝牙耳机--HSP
- 对现今手机主流操作系统发展的浅析
- VS2008 开发环境设置
- 播放歌曲到蓝牙耳机--A2DP
- 使用PHP模拟 URL Rewrite
- SQL Server2005中的IAM链
- WebQQ协议分析(7)——获取群信息(2)
- eclipse我和你没完----- 开发问题汇总,各种内存不足,启动不了等问题。
- Example - how to implement INotifyDataErrorInfo
- 在Visual Studio 2005中安装Qt 4.3.2
- Centos
- linux多线程下打开串口发送和接收数据