Skip to content

Media API

Luiz Augusto von Dentz linux-bluetooth 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest10 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10Add media API documentationdoc/media-api.txt+169 -00 replies
2/10Add rule to enabling talking to org.bluez.MediaEndpointsrc/bluetooth.conf+1 -00 replies
3/10Add option to enable/disable unix ipc via audio.confaudio/main.c audio/manager.c audio/manager.h+13 -90 replies
4/10Add support for media transport in gstreamer pluginMakefile.am audio/a2dp-codecs.h audio/gsta2dpsink.c +3 more+757 -120 replies
5/10Add simple-endpoint test scripttest/simple-endpoint+126 -00 replies
6/10Add initial implementation of org.bluez.Media specMakefile.am audio/a2dp.c audio/a2dp.h +11 more+2198 -4870 replies
7/10Introduce headset_get_inbandaudio/headset.c audio/headset.h+11 -00 replies
8/10Update a2dp transport delay when it changesaudio/a2dp.c audio/media.c audio/media.h +2 more+51 -40 replies
9/10Remove local cache for nrec and inbandaudio/transport.c+6 -50 replies
10/10Add proper checks for MediaTransport.SetPropertyaudio/transport.c+94 -220 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/10] Media API

From: Luiz Augusto von Dentz <[email protected]>

Hi,

Now that DBus 1.4 has finally been released I guess it is time to integrate the Media API that I've been working since the beginning of the year. For those not aware of what it is about the discussion can be found here:

http://thread.gmane.org/gmane.linux.bluez.kernel/4125

For now it is disabled by default to avoid a build dependency on DBus 1.4 and to buy some time while Im working to getting it working reliably with PulseAudio. To enable it just add the following to /etc/bluetooth/audio.conf (won't work if DBus is < 1.3 but better use 1.3.1 or latter):

Enable=<...,>Media

It can be used together with old unix socket, but I also add the possibility to complete disable it by doing (highly suggested if the system is running PA):

Disable=<...,>Socket

To register endpoint test/simple-endpoint can be used, note that it will not stream anything, it basically configure a transport object which can be used by e.g. gstreamer plugin:

$./simple-endpoint
dbus.Dictionary({'Codec': dbus.Byte(0), 'UUID': '0000110A-0000-1000-8000-00805F9B34FB', 'DelayReporting': True, 'Capabilities': dbus.Array([dbus.Byte(255), dbus.Byte(255), dbus.Byte(2), dbus.Byte(64)], signature=None)}, signature=None) SelectConfiguration (dbus.Array([dbus.Byte(255), dbus.Byte(255), dbus.Byte(2), dbus.Byte(32)], signature=dbus.Signature('y')))
SetConfiguration (/org/bluez/16530/hci0/dev_00_0D_3C_B1_DD_56/fd0, dbus.Array([dbus.Byte(33), dbus.Byte(21), dbus.Byte(2), dbus.Byte(32)], signature=dbus.Signature('y')))

$gst-launch-0.10 filesrc location=<file to stream> ! decodebin ! audioconvert ! sbcenc ! a2dpsink transport=/org/bluez/16530/hci0/dev_00_0D_3C_B1_DD_56/fd0

Or for mp3:

$./simple-endpoint hci0 mp3source
dbus.Dictionary({'Codec': dbus.Byte(1), 'UUID': '0000110A-0000-1000-8000-00805F9B34FB', 'Capabilities': dbus.Array([dbus.Byte(63), dbus.Byte(7), dbus.Byte(255), dbus.Byte(254)], signature=None)}, signature=None) SelectConfiguration (dbus.Array([dbus.Byte(63), dbus.Byte(7), dbus.Byte(255), dbus.Byte(254)], signature=dbus.Signature('y')))
SetConfiguration (/org/bluez/15317/hci0/dev_00_0D_3C_B1_DD_56/fd2, dbus.Array([dbus.Byte(33), dbus.Byte(2), dbus.Byte(0), dbus.Byte(128)], signature=dbus.Signature('y')))

$gst-launch-0.10 filesrc location=<file to stream> ! mp3parse ! a2dpsink transport=/org/bluez/15317/hci0/dev_00_0D_3C_B1_DD_56/fd2

Endpoints can be used with old unix socket so it should not break anything if Media API got enabled but Socket doesn't got disabled, but note that PA will probably try to use/lock if one register a sbcsource.

There are things that doesn't work though:

- Simple-endpoint uses fixed configuration for sbc and mp3, also it should probably support streaming and more codecs via gstreamer to make it easier to test.
- A2dp setconf callback need to be change since right now it expect a return from the endpoint but in case of MediaEndpoit this has to be async. For now it will block while waiting for SetConfiguration reply of the endpoint. Also to support BlueZ x BlueZ streams this has to take less than 4 sec. otherwise it will timeout on the requestor side, so timeout for SetConfiguration is set to 3 sec.
- Properties such as Delay, NREC and InbandRingtone are not really writeable right now.

Luiz Augusto von Dentz (10):
Add media API documentation
Add rule to enabling talking to org.bluez.MediaEndpoint Add option to enable/disable unix ipc via audio.conf Add support for media transport in gstreamer plugin Add simple-endpoint test script
Add initial implementation of org.bluez.Media spec Introduce headset_get_inband
Update a2dp transport delay when it changes Remove local cache for nrec and inband
Add proper checks for MediaTransport.SetProperty

 Makefile.am          |    6 +-
 audio/a2dp-codecs.h  |  116 ++++++++
 audio/a2dp.c         |  749 +++++++++++++++++++++++++++++++++++++++++--------
 audio/a2dp.h         |   15 +
 audio/avdtp.c        |   88 +++----
 audio/avdtp.h        |    5 +-
 audio/gsta2dpsink.c  |   33 ++-
 audio/gsta2dpsink.h  |    1 +
 audio/gstavdtpsink.c |  609 +++++++++++++++++++++++++++++++++++++++-
 audio/gstavdtpsink.h |    6 +
 audio/headset.c      |   10 +
 audio/headset.h      |    1 +
 audio/main.c         |    9 -
 audio/manager.c      |   66 +++++
 audio/manager.h      |    2 +
 audio/media.c        |  689 +++++++++++++++++++++++++++++++++++++++++++++
 audio/media.h        |   54 ++++
 audio/sink.c         |  179 ++-----------
 audio/source.c       |  174 ++----------
 audio/transport.c    |  758 ++++++++++++++++++++++++++++++++++++++++++++++++++
 audio/transport.h    |   36 +++
 audio/unix.c         |    1 +
 doc/media-api.txt    |  169 +++++++++++
 src/bluetooth.conf   |    1 +
 test/simple-endpoint |  126 +++++++++
 25 files changed, 3395 insertions(+), 508 deletions(-)
 create mode 100644 audio/a2dp-codecs.h
 create mode 100644 audio/media.c
 create mode 100644 audio/media.h
 create mode 100644 audio/transport.c
 create mode 100644 audio/transport.h
 create mode 100644 doc/media-api.txt
 create mode 100755 test/simple-endpoint