===代码请参考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.运行之前,处于断开状态