doc/media-api: Add RegisterApplication method
Luiz Augusto von Dentz
maintainerPATCH 1/4 doc/media-api: Add RegisterApplication method
From: Luiz Augusto von Dentz <[email protected]>
This uses application ObjectManager to discover the MediaEndpoint and MediaPlayer object of an application and deprecates the use of RegisterEndpoint and RegisterPlayer.
--- doc/media-api.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
doc/media-api.txt +20 -0
@@ -66,7 +66,27 @@ Methods void RegisterEndpoint(object endpoint, dict properties) Unregister sender media player. + void RegisterApplication(object root, dict options) + Register endpoints an player objects within root + object which must implement ObjectManager. + + The application object path together with the D-Bus + system bus connection ID define the identification of + the application. + + Possible errors: org.bluez.Error.InvalidArguments + org.bluez.Error.AlreadyExists + + void UnregisterApplication(object application) + + This unregisters the services that has been + previously registered. The object path parameter + must match the same value that has been used + on registration. + + Possible errors: org.bluez.Error.InvalidArguments + org.bluez.Error.DoesNotExist Media Control hierarchy =======================
Signature · 1 line
2.21.0
Luiz Augusto von Dentz
maintainerPATCH 2/4 media: Add implementation of RegisterApplication
From: Luiz Augusto von Dentz <[email protected]>
This implements RegisterApplication registering any proxy which does implement either MediaEndpoint or MediaPlayer.
--- profiles/audio/media.c | 485 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 482 insertions(+), 3 deletions(-)
profiles/audio/media.c +482 -3
@@ -48,6 +48,7 @@#include "src/uuid-helper.h" #include "src/log.h" #include "src/error.h" +#include "src/shared/util.h" #include "src/shared/queue.h" #include "avdtp.h"
@@ -62,8 +63,21 @@#define REQUEST_TIMEOUT (3 * 1000)/* 3 seconds */ +struct media_app { +struct media_adapter *adapter; +GDBusClient *client; +DBusMessage *reg; +char *sender;/* Application bus id */ +char *path;/* Application object path */ +struct queue *proxies;/* Application proxies */ +struct queue *endpoints;/* Application endpoints */ +struct queue *players;/* Application players */ +int err; +}; +struct media_adapter {struct btd_adapter *btd_adapter; +struct queue *apps;/* Application list */ GSList *endpoints;/* Endpoints list */ GSList *players;/* Players list */ };
@@ -194,8 +208,9 @@ static struct media_endpoint *media_adapter_find_endpoint(return NULL ; } -static void media_endpoint_remove (struct media_endpoint *endpoint) +static void media_endpoint_remove (void *data) { +struct media_endpoint *endpoint = data;struct media_adapter *adapter = endpoint->adapter;if (endpoint->sep) {
@@ -996,8 +1011,10 @@ static void media_player_destroy(struct media_player *mp)media_player_free (mp); } -static void media_player_remove (struct media_player *mp) +static void media_player_remove (void *data) { +struct media_player *mp = data; +info ("Player unregistered: sender=%s path=%s" , mp->sender, mp->path);media_player_destroy (mp);
@@ -1341,7 +1358,7 @@ static gboolean set_position(struct media_player *mp, DBusMessageIter *iter)const char *status;if (dbus_message_iter_get_arg_type (iter) !=DBUS_TYPE_INT64 ) -return FALSE; +return FALSE;dbus_message_iter_get_basic (iter, &value);
@@ -1870,6 +1887,461 @@ static DBusMessage *unregister_player(DBusConnection *conn, DBusMessage *msg,return g_dbus_create_reply (msg,DBUS_TYPE_INVALID ); } +static void app_free (void *data) +{ +struct media_app *app = data; + +queue_destroy (app->endpoints, media_endpoint_remove); +queue_destroy (app->players, media_player_remove); + +if (app->client) { +g_dbus_client_set_disconnect_watch (app->client,NULL ,NULL ); +g_dbus_client_set_proxy_handlers (app->client,NULL ,NULL , +NULL ,NULL ); +g_dbus_client_set_ready_watch (app->client,NULL ,NULL ); +g_dbus_client_unref (app->client); + } + +if (app->reg) +dbus_message_unref (app->reg); + +g_free (app->sender); +g_free (app->path); + +free (app); +} + +static void client_disconnect_cb (DBusConnection *conn,void *user_data) +{ +struct media_app *app = user_data; +struct media_adapter *adapter = app->adapter; + +DBG ("Client disconnected" ); + +if (queue_remove (adapter->apps, app)) +app_free (app); +} + +static void app_register_endpoint (void *data,void *user_data) +{ +struct media_app *app = user_data; +GDBusProxy *proxy = data; +const char *iface =g_dbus_proxy_get_interface (proxy); +const char *path =g_dbus_proxy_get_path (proxy); +const char *uuid; +gboolean delay_reporting = FALSE; +uint8_t codec; +uint8_t *capabilities =NULL ; +int size =0 ; +DBusMessageIter iter, array; +struct media_endpoint *endpoint; + +if (app->err) +return ; + +if (strcmp (iface,MEDIA_ENDPOINT_INTERFACE )) +return ; + +/* Parse properties */ +if (!g_dbus_proxy_get_property (proxy,"UUID" , &iter)) + goto fail; + +if (dbus_message_iter_get_arg_type (&iter) !=DBUS_TYPE_STRING ) + goto fail; + +dbus_message_iter_get_basic (&iter, &uuid); + +if (!g_dbus_proxy_get_property (proxy,"Codec" , &iter)) + goto fail; + +if (dbus_message_iter_get_arg_type (&iter) !=DBUS_TYPE_BYTE ) + goto fail; + +dbus_message_iter_get_basic (&iter, &codec); + +/* DelayReporting and Capabilities are considered optional */ +if (g_dbus_proxy_get_property (proxy,"DelayReporting" , &iter)) { +if (dbus_message_iter_get_arg_type (&iter) !=DBUS_TYPE_BOOLEAN ) + goto fail; + +dbus_message_iter_get_basic (&iter, &delay_reporting); + } + +if (g_dbus_proxy_get_property (proxy,"Capabilities" , &iter)) { +if (dbus_message_iter_get_arg_type (&iter) !=DBUS_TYPE_ARRAY ) + goto fail; + +dbus_message_iter_recurse (&iter, &array); +dbus_message_iter_get_fixed_array (&array, &capabilities, &size); + } + + endpoint =media_endpoint_create (app->adapter, app->sender, path, uuid, + delay_reporting, codec, capabilities, + size, &app->err); +if (!endpoint) { +error ("Unable to register endpoint %s:%s: %s" , app->sender, + path,strerror (-app->err)); +return ; + } + +queue_push_tail (app->endpoints, endpoint); + +return ; + +fail: + app->err = -EINVAL ; +} + +static void app_register_player (void *data,void *user_data) +{ +struct media_app *app = user_data; +GDBusProxy *proxy = data; +const char *iface =g_dbus_proxy_get_interface (proxy); +const char *path =g_dbus_proxy_get_path (proxy); +struct media_player *player; +DBusMessageIter iter; + +if (app->err) +return ; + +if (strcmp (iface,MEDIA_PLAYER_INTERFACE )) +return ; + + player =media_player_create (app->adapter, app->sender, path, + &app->err); +if (!player) +return ; + +if (g_dbus_proxy_get_property (proxy,"PlaybackStatus" , &iter)) { +if (!set_status (player, &iter)) + goto fail; + } + +if (g_dbus_proxy_get_property (proxy,"Position" , &iter)) { +if (!set_position (player, &iter)) + goto fail; + } + +if (g_dbus_proxy_get_property (proxy,"Metadata" , &iter)) { +if (!parse_player_metadata (player, &iter)) + goto fail; + } + +if (g_dbus_proxy_get_property (proxy,"Shuffle" , &iter)) { +if (!set_shuffle (player, &iter)) + goto fail; + } + +if (g_dbus_proxy_get_property (proxy,"LoopStatus" , &iter)) { +if (!set_repeat (player, &iter)) + goto fail; + } + +if (g_dbus_proxy_get_property (proxy,"CanPlay" , &iter)) { +if (!set_flag (player, &iter, &player->play)) + goto fail; + } + +if (g_dbus_proxy_get_property (proxy,"CanPause" , &iter)) { +if (!set_flag (player, &iter, &player->pause)) + goto fail; + } + +if (g_dbus_proxy_get_property (proxy,"CanGoNext" , &iter)) { +if (!set_flag (player, &iter, &player->next)) + goto fail; + } + +if (g_dbus_proxy_get_property (proxy,"CanGoPrevious" , &iter)) { +if (!set_flag (player, &iter, &player->previous)) + goto fail; + } + +if (g_dbus_proxy_get_property (proxy,"CanControl" , &iter)) { +if (!set_flag (player, &iter, &player->control)) + goto fail; + } + +if (g_dbus_proxy_get_property (proxy,"Identity" , &iter)) { +if (!set_name (player, &iter)) + goto fail; + } + +queue_push_tail (app->players, player); + +return ; +fail: + app->err = -EINVAL ; +error ("Unable to register player %s:%s: %s" , app->sender, path, +strerror (-app->err)); +media_player_destroy (player); +} + +static void remove_app (void *data) +{ +struct media_app *app = data; + +/* +* Set callback to NULL to avoid potential race condition +* when calling remove_app and GDBusClient unref. +*/ +g_dbus_client_set_disconnect_watch (app->client,NULL ,NULL ); + +/* +* Set proxy handlers to NULL, so that this gets called only once when +* the first proxy that belongs to this service gets removed. +*/ +g_dbus_client_set_proxy_handlers (app->client,NULL ,NULL ,NULL ,NULL ); + + +queue_remove (app->adapter->apps, app); + +app_free (app); +} + +static void client_ready_cb (GDBusClient *client,void *user_data) +{ +struct media_app *app = user_data; +DBusMessage *reply; +bool fail = false; + +/* +* Process received objects +*/ +if (queue_isempty (app->proxies)) { +error ("No object received" ); + fail = true; + reply =btd_error_failed (app->reg,"No object received" ); + goto reply; + } + +queue_foreach (app->proxies, app_register_endpoint, app); +queue_foreach (app->proxies, app_register_player, app); + +if (app->err) { +if (app->err == -EPROTONOSUPPORT ) + reply =btd_error_not_supported (app->reg); +else + reply =btd_error_invalid_args (app->reg); + goto reply; + } + +if ((queue_isempty (app->endpoints) &&queue_isempty (app->players))) { +error ("No valid external Media objects found" ); + fail = true; + reply =btd_error_failed (app->reg, +"No valid media object found" ); + goto reply; + } + +DBG ("Media application registered: %s:%s" , app->sender, app->path); + + reply =dbus_message_new_method_return (app->reg); + +reply: +g_dbus_send_message (btd_get_dbus_connection (), reply); +dbus_message_unref (app->reg); + app->reg =NULL ; + +if (fail) +remove_app (app); +} + +static void proxy_added_cb (GDBusProxy *proxy,void *user_data) +{ +struct media_app *app = user_data; +const char *iface, *path; + +if (app->err) +return ; + +queue_push_tail (app->proxies, proxy); + + iface =g_dbus_proxy_get_interface (proxy); + path =g_dbus_proxy_get_path (proxy); + +DBG ("Proxy added: %s, iface: %s" , path, iface); +} + +static bool match_endpoint_by_path (const void *a,const void *b) +{ +const struct media_endpoint *endpoint = a; +const char *path = b; + +return !strcmp (endpoint->path, path); +} + +static bool match_player_by_path (const void *a,const void *b) +{ +const struct media_player *player = a; +const char *path = b; + +return !strcmp (player->path, path); +} + +static void proxy_removed_cb (GDBusProxy *proxy,void *user_data) +{ +struct media_app *app = user_data; +struct media_endpoint *endpoint; +struct media_player *player; +const char *iface, *path; + + iface =g_dbus_proxy_get_interface (proxy); + path =g_dbus_proxy_get_path (proxy); + +if (!strcmp (iface,MEDIA_ENDPOINT_INTERFACE )) { + endpoint =queue_remove_if (app->endpoints, + match_endpoint_by_path, + (void *) path); +if (!endpoint) +return ; + +if (!g_slist_find (app->adapter->endpoints, endpoint)) +return ; + +DBG ("Proxy removed - removing endpoint: %s" , endpoint->path); + +media_endpoint_remove (endpoint); + }else if (!strcmp (iface,MEDIA_PLAYER_INTERFACE )) { + player =queue_remove_if (app->players, match_player_by_path, + (void *) path); +if (!player) +return ; + +if (!g_slist_find (app->adapter->players, player)) +return ; + +DBG ("Proxy removed - removing player: %s" , player->path); + +media_player_remove (player); + } +} + +static struct media_app *create_app (DBusConnection *conn,DBusMessage *msg, +const char *path) +{ +struct media_app *app; +const char *sender =dbus_message_get_sender (msg); + +if (!path || !g_str_has_prefix (path,"/" )) +return NULL ; + + app = new0(struct media_app, 1); + + app->client =g_dbus_client_new_full (conn, sender, path, path); +if (!app->client) + goto fail; + + app->sender =g_strdup (sender); +if (!app->sender) + goto fail; + + app->path =g_strdup (path); +if (!app->path) + goto fail; + + app->proxies =queue_new (); + app->endpoints =queue_new (); + app->players =queue_new (); + app->reg =dbus_message_ref (msg); + +g_dbus_client_set_disconnect_watch (app->client, client_disconnect_cb, + app); +g_dbus_client_set_proxy_handlers (app->client, proxy_added_cb, + proxy_removed_cb,NULL , app); +g_dbus_client_set_ready_watch (app->client, client_ready_cb, app); + +return app; + +fail: +app_free (app); +return NULL ; +} + +struct match_data { +const char *path; +const char *sender; +}; + +static bool match_app (const void *a,const void *b) +{ +const struct media_app *app = a; +const struct match_data *data = b; + +return g_strcmp0 (app->path, data->path) ==0 && +g_strcmp0 (app->sender, data->sender) ==0 ; +} + +static DBusMessage *register_app (DBusConnection *conn,DBusMessage *msg, +void *user_data) +{ +struct media_adapter *adapter = user_data; +const char *sender =dbus_message_get_sender (msg); +DBusMessageIter args; +const char *path; +struct media_app *app; +struct match_data match_data; + +if (!dbus_message_iter_init (msg, &args)) +return btd_error_invalid_args (msg); + +if (dbus_message_iter_get_arg_type (&args) !=DBUS_TYPE_OBJECT_PATH ) +return btd_error_invalid_args (msg); + +dbus_message_iter_get_basic (&args, &path); + + match_data.path = path; + match_data.sender = sender; + +if (queue_find (adapter->apps, match_app, &match_data)) +return btd_error_already_exists (msg); + +dbus_message_iter_next (&args); +if (dbus_message_iter_get_arg_type (&args) !=DBUS_TYPE_ARRAY ) +return btd_error_invalid_args (msg); + + app =create_app (conn, msg, path); +if (!app) +return btd_error_failed (msg,"Failed to register application" ); + +DBG ("Registering application: %s:%s" , sender, path); + + app->adapter = adapter; +queue_push_tail (adapter->apps, app); + +return NULL ; +} + +static DBusMessage *unregister_app (DBusConnection *conn,DBusMessage *msg, +void *user_data) +{ +struct media_adapter *adapter = user_data; +const char *sender =dbus_message_get_sender (msg); +const char *path; +DBusMessageIter args; +struct media_app *app; +struct match_data match_data; + +if (!dbus_message_iter_init (msg, &args)) +return btd_error_invalid_args (msg); + +if (dbus_message_iter_get_arg_type (&args) !=DBUS_TYPE_OBJECT_PATH ) +return btd_error_invalid_args (msg); + +dbus_message_iter_get_basic (&args, &path); + + match_data.path = path; + match_data.sender = sender; + + app =queue_remove_if (adapter->apps, match_app, &match_data); +if (!app) +return btd_error_does_not_exist (msg); + +app_free (app); + +return dbus_message_new_method_return (msg); +} +static const GDBusMethodTable media_methods[] = { { GDBUS_METHOD("RegisterEndpoint", GDBUS_ARGS({ "endpoint", "o" }, { "properties", "a{sv}" }),
@@ -1881,6 +2353,13 @@ static const GDBusMethodTable media_methods[] = { NULL, register_player) }, {GDBUS_METHOD ("UnregisterPlayer" , GDBUS_ARGS({ "player", "o" }), NULL, unregister_player) }, + { GDBUS_ASYNC_METHOD("RegisterApplication", + GDBUS_ARGS({ "application", "o" }, + { "options", "a{sv}" }), + NULL, register_app) }, + { GDBUS_ASYNC_METHOD("UnregisterApplication", + GDBUS_ARGS({ "application", "o" }), + NULL, unregister_app) }, { }, };
Signature · 1 line
2.21.0
Luiz Augusto von Dentz
maintainerPATCH 3/4 test: Add example-endpoint
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This adds an example of registering an endpoint with use of RegisterApplication.
--- test/example-endpoint | 186 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 test/example-endpoint
test/example-endpoint new file +186 -0
@@ -0,0 +1,186 @@ +#!/usr/bin/python + +from __future__ import absolute_import, print_function, unicode_literals + +import sys +import dbus +import dbus.exceptions +import dbus.service +import dbus.mainloop.glib + +import array +try: + from gi.repository import GObject +except ImportError: + import gobject as GObject +import bluezutils + +ENDPOINT_IFACE = 'org.bluez.MediaEndpoint1' +DBUS_OM_IFACE = 'org.freedesktop.DBus.ObjectManager' +DBUS_PROP_IFACE = 'org.freedesktop.DBus.Properties' + +A2DP_SOURCE_UUID = '0000110A-0000-1000-8000-00805F9B34FB' +A2DP_SINK_UUID = '0000110B-0000-1000-8000-00805F9B34FB' + +SBC_CODEC = dbus.Byte(0x00) +#Channel Modes: Mono DualChannel Stereo JointStereo +#Frequencies: 16Khz 32Khz 44.1Khz 48Khz +#Subbands: 4 8 +#Blocks: 4 8 12 16 +#Bitpool Range: 2-64 +SBC_CAPABILITIES = dbus.Array([dbus.Byte(0xff), dbus.Byte(0xff), dbus.Byte(2), dbus.Byte(64)]) +# JointStereo 44.1Khz Subbands: Blocks: 16 Bitpool Range: 2-32 +SBC_CONFIGURATION = dbus.Array([dbus.Byte(0x21), dbus.Byte(0x15), dbus.Byte(2), dbus.Byte(32)]) + +MP3_CODEC = dbus.Byte(0x01) +#Channel Modes: Mono DualChannel Stereo JointStereo +#Frequencies: 32Khz 44.1Khz 48Khz +#CRC: YES +#Layer: 3 +#Bit Rate: All except Free format +#VBR: Yes +#Payload Format: RFC-2250 +MP3_CAPABILITIES = dbus.Array([dbus.Byte(0x3f), dbus.Byte(0x07), dbus.Byte(0xff), dbus.Byte(0xfe)]) +# JointStereo 44.1Khz Layer: 3 Bit Rate: VBR Format: RFC-2250 +MP3_CONFIGURATION = dbus.Array([dbus.Byte(0x21), dbus.Byte(0x02), dbus.Byte(0x00), dbus.Byte(0x80)]) + +PCM_CODEC = dbus.Byte(0x00) +PCM_CONFIGURATION = dbus.Array([], signature="ay") + +CVSD_CODEC = dbus.Byte(0x01) + +class Rejected(dbus.DBusException): + _dbus_error_name = "org.bluez.Error.Rejected" + +class InvalidArgsException(dbus.exceptions.DBusException): + _dbus_error_name = 'org.freedesktop.DBus.Error.InvalidArgs' + +class Endpoint(dbus.service.Object): + def __init__(self, bus, path, properties, configuration): + self.path = path + self.bus = bus + self.properties = properties + self.configuration = configuration + self.exit_on_release = True + dbus.service.Object.__init__(self, bus, self.path) + + def get_properties(self): + return self.properties + + def get_path(self): + return dbus.ObjectPath(self.path) + + @dbus.service.method(DBUS_PROP_IFACE, in_signature='s', + out_signature='a{sv}') + def GetAll(self, interface): + if interface != ENDPOINT_IFACE: + raise InvalidArgsException() + + return self.get_properties() + + def set_exit_on_release(self, exit_on_release): + self.exit_on_release = exit_on_release + + def default_configuration(self, configuration): + self.configuration = configuration + + @dbus.service.method(ENDPOINT_IFACE, in_signature="", out_signature="") + def Release(self): + print("Release") + if self.exit_on_release: + mainloop.quit() + + @dbus.service.method(ENDPOINT_IFACE, in_signature="o", out_signature="") + def ClearConfiguration(self, transport): + print("ClearConfiguration (%s)" % (transport)) + + @dbus.service.method(ENDPOINT_IFACE, in_signature="oay", out_signature="") + def SetConfiguration(self, transport, config): + print("SetConfiguration (%s, %s)" % (transport, config)) + return + + @dbus.service.method(ENDPOINT_IFACE, in_signature="ay", out_signature="ay") + def SelectConfiguration(self, caps): + print("SelectConfiguration (%s)" % (caps)) + return self.configuration + +class Application(dbus.service.Object): + def __init__(self, bus, path, properties, configuration): + self.path = '/' + self.endpoints = [] + dbus.service.Object.__init__(self, bus, self.path) + self.add_endpoint(Endpoint(bus, path, properties, configuration)) + + def get_path(self): + return dbus.ObjectPath(self.path) + + def add_endpoint(self, endpoint): + self.endpoints.append(endpoint) + + @dbus.service.method(DBUS_OM_IFACE, out_signature='a{oa{sa{sv}}}') + def GetManagedObjects(self): + response = {} + print('GetManagedObjects') + + for endpoint in self.endpoints: + response[endpoint.get_path()] = { ENDPOINT_IFACE: + endpoint.get_properties() } + + return response + +def register_app_cb(): + print('Media application registered') + + +def register_app_error_cb(error): + print('Failed to register application: ' + str(error)) + mainloop.quit() + +if __name__ == '__main__': + dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) + + bus = dbus.SystemBus() + + if len(sys.argv) > 1: + path = bluezutils.find_adapter(sys.argv[1]).object_path + else: + path = bluezutils.find_adapter().object_path + + media = dbus.Interface(bus.get_object("org.bluez", path), + "org.bluez.Media1") + + + properties = dbus.Dictionary({ "UUID" : A2DP_SOURCE_UUID, + "Codec" : SBC_CODEC, + "DelayReporting" : True, + "Capabilities" : SBC_CAPABILITIES }) + + configuration = SBC_CONFIGURATION + + if len(sys.argv) > 2: + if sys.argv[2] == "sbcsink": + properties = dbus.Dictionary({ "UUID" : A2DP_SINK_UUID, + "Codec" : SBC_CODEC, + "DelayReporting" : True, + "Capabilities" : SBC_CAPABILITIES }) + if sys.argv[2] == "mp3source": + properties = dbus.Dictionary({ "UUID" : A2DP_SOURCE_UUID, + "Codec" : MP3_CODEC, + "Capabilities" : MP3_CAPABILITIES }) + configuration = MP3_CONFIGURATION + if sys.argv[2] == "mp3sink": + properties = dbus.Dictionary({ "UUID" : A2DP_SINK_UUID, + "Codec" : MP3_CODEC, + "Capabilities" : MP3_CAPABILITIES }) + configuration = MP3_CONFIGURATION + + print(properties) + + path = "/test/endpoint" + app = Application(bus, path, properties, configuration) + mainloop = GObject.MainLoop() + + media.RegisterApplication(app.get_path(), {}, + reply_handler=register_app_cb, + error_handler=register_app_error_cb) + mainloop.run()
Signature · 1 line
2.21.0
Luiz Augusto von Dentz
maintainerPATCH 4/4 test: Add example-player
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This adds an example of registering a player with use of RegisterApplication.
--- test/example-player | 203 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 test/example-player
test/example-player new file +203 -0
@@ -0,0 +1,203 @@ +#!/usr/bin/python + +from __future__ import print_function + +import os +import sys +import dbus +import dbus.service +import dbus.mainloop.glib +try: + from gi.repository import GObject +except ImportError: + import gobject as GObject +import bluezutils + +PLAYER_IFACE = 'org.mpris.MediaPlayer2.Player' +DBUS_OM_IFACE = 'org.freedesktop.DBus.ObjectManager' +DBUS_PROP_IFACE = 'org.freedesktop.DBus.Properties' + +class InvalidArgsException(dbus.exceptions.DBusException): + _dbus_error_name = 'org.freedesktop.DBus.Error.InvalidArgs' + +class Player(dbus.service.Object): + def __init__(self, bus, path, obj): + self.path = path + dbus.service.Object.__init__(self, bus, self.path) + + if obj != None: + mp = dbus.Interface(bus.get_object("org.bluez", obj), + "org.bluez.MediaPlayer1") + prop = dbus.Interface(bus.get_object("org.bluez", obj), + "org.freedesktop.DBus.Properties") + + self.properties = prop.GetAll("org.bluez.MediaPlayer1") + + bus.add_signal_receiver(self.properties_changed, path = obj, + dbus_interface = "org.freedesktop.DBus.Properties", + signal_name = "PropertiesChanged") + else: + self.track = dbus.Dictionary({"xesam:title" : "Title", + "xesam:artist" : ["Artist"], + "xesam:album" : "Album", + "xesam:genre" : ["Genre"], + "xesam:trackNumber" : dbus.Int32(1), + "mpris:length" : dbus.Int64(10000) }, + signature="sv") + + self.properties = dbus.Dictionary({"PlaybackStatus" : "playing", + "Identity" : "SimplePlayer", + "LoopStatus" : "None", + "Rate" : dbus.Double(1.0), + "Shuffle" : dbus.Boolean(False), + "Metadata" : self.track, + "Volume" : dbus.Double(1.0), + "Position" : dbus.Int64(0), + "MinimumRate" : dbus.Double(1.0), + "MaximumRate" : dbus.Double(1.0), + "CanGoNext" : dbus.Boolean(False), + "CanGoPrevious" : dbus.Boolean(False), + "CanPlay" : dbus.Boolean(False), + "CanSeek" : dbus.Boolean(False), + "CanControl" : dbus.Boolean(False), + }, + signature="sv") + + print('Register media player with:\n\tProperties: %s' \ + % (self.properties)) + handler = InputHandler(self) + GObject.io_add_watch(sys.stdin, GObject.IO_IN, handler.handle) + + @dbus.service.method("org.freedesktop.DBus.Properties", + in_signature="ssv", out_signature="") + def Set(self, interface, key, value): + print("Set (%s, %s)" % (key, value), file=sys.stderr) + return + + def get_properties(self): + return self.properties + + def get_path(self): + return dbus.ObjectPath(self.path) + + @dbus.service.method("org.freedesktop.DBus.Properties", + in_signature='s', out_signature='a{sv}') + def GetAll(self, interface): + if interface != PLAYER_IFACE: + raise InvalidArgsException() + + return self.get_properties() + + @dbus.service.signal("org.freedesktop.DBus.Properties", + signature="sa{sv}as") + def PropertiesChanged(self, interface, properties, + invalidated = dbus.Array()): + """PropertiesChanged(interface, properties, invalidated) + + Send a PropertiesChanged signal. 'properties' is a dictionary + containing string parameters as specified in doc/media-api.txt. + """ + pass + + def help(self, func): + help(self.__class__.__dict__[func]) + + def properties_changed(self, interface, properties, invalidated): + print("properties_changed(%s, %s)" % (properties, invalidated)) + + self.PropertiesChanged(interface, properties, invalidated) + +class InputHandler: + commands = { 'PropertiesChanged': '(interface, properties)', + 'help': '(cmd)' } + def __init__(self, player): + self.player = player + print('\n\nAvailable commands:') + for cmd in self.commands: + print('\t', cmd, self.commands[cmd], sep='') + + print("\nUse python syntax to pass arguments to available methods.\n" \ + "E.g.: PropertiesChanged({'Metadata' : {'Title': 'My title', \ + 'Album': 'my album' }})") + self.prompt() + + def prompt(self): + print('\n>>> ', end='') + sys.stdout.flush() + + def handle(self, fd, condition): + s = os.read(fd.fileno(), 1024).strip() + try: + cmd = s[:s.find('(')] + if not cmd in self.commands: + print("Unknown command ", cmd) + except ValueError: + print("Malformed command") + return True + try: + exec "self.player.%s" % s + except Exception as e: + print(e) + pass + self.prompt() + return True + +class Application(dbus.service.Object): + def __init__(self, bus, path, obj): + self.path = '/' + self.players = [] + dbus.service.Object.__init__(self, bus, self.path) + self.add_player(Player(bus, path, obj)) + + def get_path(self): + return dbus.ObjectPath(self.path) + + def add_player(self, player): + self.players.append(player) + + @dbus.service.method(DBUS_OM_IFACE, out_signature='a{oa{sa{sv}}}') + def GetManagedObjects(self): + response = {} + print('GetManagedObjects') + + for player in self.players: + response[player.get_path()] = { PLAYER_IFACE: + player.get_properties() } + + return response + +def register_app_cb(): + print('Media application registered') + + +def register_app_error_cb(error): + print('Failed to register application: ' + str(error)) + mainloop.quit() + +if __name__ == '__main__': + dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) + + bus = dbus.SystemBus() + + if len(sys.argv) > 1: + path = bluezutils.find_adapter(sys.argv[1]).object_path + else: + path = bluezutils.find_adapter().object_path + + media = dbus.Interface(bus.get_object("org.bluez", path), + "org.bluez.Media1") + + path = "/test/player" + + if len(sys.argv) > 2: + app = Application(bus, path, sys.argv[2]) + else: + app = Application(bus, path, None) + + mainloop = GObject.MainLoop() + + media.RegisterApplication(app.get_path(), {}, + reply_handler=register_app_cb, + error_handler=register_app_error_cb) + + mainloop.run()
Signature · 1 line
2.21.0
Luiz Augusto von Dentz
maintainerHi Pali,
Quoted 43 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
This uses application ObjectManager to discover the MediaEndpoint and MediaPlayer object of an application and deprecates the use of RegisterEndpoint and RegisterPlayer.
--- doc/media-api.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)doc/media-api.txt +20
-1@@ -66,7 +66,27 @@ Methods void RegisterEndpoint(object endpoint, dict properties) Unregister sender media player. + void RegisterApplication(object root, dict options) + Register endpoints an player objects within root + object which must implement ObjectManager. + + The application object path together with the D-Bus + system bus connection ID define the identification of + the application. + + Possible errors: org.bluez.Error.InvalidArguments + org.bluez.Error.AlreadyExists + + void UnregisterApplication(object application) + + This unregisters the services that has been + previously registered. The object path parameter + must match the same value that has been used + on registration. + + Possible errors: org.bluez.Error.InvalidArguments + org.bluez.Error.DoesNotExist Media Control hierarchy ======================= --
Quoted 1 line
2.21.0
Can you try this set?
Signature · 1 line
Luiz Augusto von Dentz
Quoted 46 lines · On Saturday 13 July 2019 17:52:46 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 42 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
This uses application ObjectManager to discover the MediaEndpoint and MediaPlayer object of an application and deprecates the use of RegisterEndpoint and RegisterPlayer.
--- doc/media-api.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)doc/media-api.txt +20
-0@@ -66,7 +66,27 @@ Methods void RegisterEndpoint(object endpoint, dict properties) Unregister sender media player. + void RegisterApplication(object root, dict options) + Register endpoints an player objects within root + object which must implement ObjectManager. + + The application object path together with the D-Bus + system bus connection ID define the identification of + the application. + + Possible errors: org.bluez.Error.InvalidArguments + org.bluez.Error.AlreadyExists + + void UnregisterApplication(object application) + + This unregisters the services that has been + previously registered. The object path parameter + must match the same value that has been used + on registration. + + Possible errors: org.bluez.Error.InvalidArguments + org.bluez.Error.DoesNotExist Media Control hierarchy =======================
Quoted 4 lines
Quoted 2 lines
--
2.21.0Can you try this set?
Hello, I will try it later in next week. To test it would mean to rewrite pulseaudio bluetooth modules to use this new API, so it would take me longer time.
Signature · 2 lines
Pali Rohár [email protected]
Quoted 47 lines · On Thursday 18 July 2019 12:00:24 Pali Rohár wrote:
Quoted 46 lines · On Saturday 13 July 2019 17:52:46 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 42 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
This uses application ObjectManager to discover the MediaEndpoint and MediaPlayer object of an application and deprecates the use of RegisterEndpoint and RegisterPlayer.
--- doc/media-api.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)doc/media-api.txt +20
-0@@ -66,7 +66,27 @@ Methods void RegisterEndpoint(object endpoint, dict properties) Unregister sender media player. + void RegisterApplication(object root, dict options) + Register endpoints an player objects within root + object which must implement ObjectManager. + + The application object path together with the D-Bus + system bus connection ID define the identification of + the application. + + Possible errors: org.bluez.Error.InvalidArguments + org.bluez.Error.AlreadyExists + + void UnregisterApplication(object application) + + This unregisters the services that has been + previously registered. The object path parameter + must match the same value that has been used + on registration. + + Possible errors: org.bluez.Error.InvalidArguments + org.bluez.Error.DoesNotExist Media Control hierarchy =======================
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
--
2.21.0Can you try this set?
Hello, I will try it later in next week. To test it would mean to rewrite pulseaudio bluetooth modules to use this new API, so it would take me longer time.
Hi! I looked at it. But I do not know how to implement GetManagedObjects() method via libdbus properly. Any idea?
Signature · 2 lines
Pali Rohár [email protected]
Luiz Augusto von Dentz
maintainerHi,
Quoted 54 lines · Pali Rohár
Quoted 52 lines · On Thursday 18 July 2019 12:00:24 Pali Rohár wrote:
Quoted 50 lines · On Saturday 13 July 2019 17:52:46 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 43 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
This uses application ObjectManager to discover the MediaEndpoint and MediaPlayer object of an application and deprecates the use of RegisterEndpoint and RegisterPlayer.
--- doc/media-api.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)doc/media-api.txt +20
-1@@ -66,7 +66,27 @@ Methods void RegisterEndpoint(object endpoint, dict properties) Unregister sender media player. + void RegisterApplication(object root, dict options) + Register endpoints an player objects within root + object which must implement ObjectManager. + + The application object path together with the D-Bus + system bus connection ID define the identification of + the application. + + Possible errors: org.bluez.Error.InvalidArguments + org.bluez.Error.AlreadyExists + + void UnregisterApplication(object application) + + This unregisters the services that has been + previously registered. The object path parameter + must match the same value that has been used + on registration. + + Possible errors: org.bluez.Error.InvalidArguments + org.bluez.Error.DoesNotExist Media Control hierarchy ======================= --Quoted 1 line
2.21.0
Can you try this set?
Quoted 6 lines
Quoted 3 lines
Hello, I will try it later in next week. To test it would mean to rewrite pulseaudio bluetooth modules to use this new API, so it would take me longer time.
Hi! I looked at it. But I do not know how to implement
GetManagedObjects()method via libdbus properly. Any idea?
I went ahead and applied this set, you can find some examples of how to implement ObjectManager interface in gdbus but I guess what you really need to do is make PA aware of the objects being exposed since it does make it simpler to to enumerate objects by the clients.
Signature · 1 line
Luiz Augusto von Dentz
Hi,
Quoted 61 lines · Luiz Augusto von Dentz
Hi,
Quoted 58 lines · Pali Rohár
Quoted 55 lines · On Thursday 18 July 2019 12:00:24 Pali Rohár wrote:
Quoted 46 lines · On Saturday 13 July 2019 17:52:46 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 42 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
This uses application ObjectManager to discover the MediaEndpoint and MediaPlayer object of an application and deprecates the use of RegisterEndpoint and RegisterPlayer.
--- doc/media-api.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)doc/media-api.txt +20
-0@@ -66,7 +66,27 @@ Methods void RegisterEndpoint(object endpoint, dict properties) Unregister sender media player. + void RegisterApplication(object root, dict options) + Register endpoints an player objects within root + object which must implement ObjectManager. + + The application object path together with the D-Bus + system bus connection ID define the identification of + the application. + + Possible errors: org.bluez.Error.InvalidArguments + org.bluez.Error.AlreadyExists + + void UnregisterApplication(object application) + + This unregisters the services that has been + previously registered. The object path parameter + must match the same value that has been used + on registration. + + Possible errors: org.bluez.Error.InvalidArguments + org.bluez.Error.DoesNotExist Media Control hierarchy =======================Quoted 4 lines
Quoted 2 lines
--
2.21.0Can you try this set?
Hello, I will try it later in next week. To test it would mean to rewrite pulseaudio bluetooth modules to use this new API, so it would take me longer time.
Quoted 8 lines
Quoted 2 lines
Hi! I looked at it. But I do not know how to implement
GetManagedObjects()method via libdbus properly. Any idea?I went ahead and applied this set, you can find some examples of how to implement ObjectManager interface in gdbus but I guess what you really need to do is make PA aware of the objects being exposed since it does make it simpler to to enumerate objects by the clients.
Pali: How does it look with porting the PA patches to use the new interfaces?
Thanks,
-- Pasi
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
Signature · 2 lines
Pali Rohár [email protected]
Hi,
Quoted 7 lines · Pali Rohár
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.
-- Pasi
Quoted 3 lines
Signature · 2 lines
Pali Rohár [email protected]
Quoted 6 lines · On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
Hi,
Quoted 3 lines · Pali Rohár
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Quoted 7 lines
Quoted 4 lines
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.
Ok! Today I have looked at this new Bluez API, but seems that there is not only missing some examples or usages with libdbus-1, but also documentation. I have tried to find something how to register endpoints throw GetManagedObjects() via libdbus-1, but seems that there is no usage of it and also unusable documentation for it in libdbus-1. So currently I'm stuck how to use this exotic API in pulseaudio...
Signature · 2 lines
Pali Rohár [email protected]
Luiz Augusto von Dentz
maintainerHi Pali,
Quoted 16 lines · Pali Rohár
Quoted 6 lines · On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
Hi,
Quoted 3 lines · Pali Rohár
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Quoted 7 lines
Quoted 4 lines
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.
Quoted 6 lines
Ok! Today I have looked at this new Bluez API, but seems that there is not only missing some examples or usages with libdbus-1, but also documentation. I have tried to find something how to register endpoints throw
GetManagedObjects()via libdbus-1, but seems that there is no usage of it and also unusable documentation for it in libdbus-1. So currently I'm stuck how to use this exotic API in pulseaudio...
It is just another D-Bus method, the only difference is that it carries the entire object tree, btw I did add an example of how to register Endpoints in python:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
You can also have a look at how our gdbus internal library (uses libdbus) utilize it:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
Signature · 1 line
Luiz Augusto von Dentz
Quoted 26 lines · On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 16 lines · Pali Rohár
Quoted 6 lines · On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
Hi,
Quoted 3 lines · Pali Rohár
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Quoted 7 lines
Quoted 4 lines
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.Quoted 6 lines
Ok! Today I have looked at this new Bluez API, but seems that there is not only missing some examples or usages with libdbus-1, but also documentation. I have tried to find something how to register endpoints throw
GetManagedObjects()via libdbus-1, but seems that there is no usage of it and also unusable documentation for it in libdbus-1. So currently I'm stuck how to use this exotic API in pulseaudio...
Quoted 5 lines
It is just another D-Bus method, the only difference is that it carries the entire object tree, btw I did add an example of how to register Endpoints in python:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
Now I found this python example and currently I'm doing observations and "reverse-engineering" how it is working and how this example behaves on D-Bus. I think I understood it now.
Quoted 5 lines
You can also have a look at how our gdbus internal library (uses libdbus) utilize it:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
Signature · 2 lines
Pali Rohár [email protected]
Luiz Augusto von Dentz
maintainerHi Pali,
Quoted 32 lines · Pali Rohár
Quoted 30 lines · On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 16 lines · Pali Rohár
Quoted 6 lines · On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
Hi,
Quoted 3 lines · Pali Rohár
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Quoted 7 lines
Quoted 4 lines
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.Quoted 6 lines
Ok! Today I have looked at this new Bluez API, but seems that there is not only missing some examples or usages with libdbus-1, but also documentation. I have tried to find something how to register endpoints throw
GetManagedObjects()via libdbus-1, but seems that there is no usage of it and also unusable documentation for it in libdbus-1. So currently I'm stuck how to use this exotic API in pulseaudio...It is just another D-Bus method, the only difference is that it carries the entire object tree, btw I did add an example of how to register Endpoints in python:
Quoted 5 lines
Now I found this python example and currently I'm doing observations and "reverse-engineering" how it is working and how this example behaves on D-Bus. I think I understood it now.
One important detail is that RegisterApplication shall not block since the daemon will call GetManagedObjects the D-Bus mainloop must be able to process messages.
Quoted 9 lines
Quoted 5 lines
You can also have a look at how our gdbus internal library (uses libdbus) utilize it:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
--
Pali Rohár
[email protected]
Signature · 1 line
Luiz Augusto von Dentz
Quoted 37 lines · On Sunday 06 October 2019 14:14:18 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 34 lines · Pali Rohár
Quoted 31 lines · On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 16 lines · Pali Rohár
Quoted 6 lines · On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
Hi,
Quoted 3 lines · Pali Rohár
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Quoted 7 lines
Quoted 4 lines
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.Quoted 6 lines
Ok! Today I have looked at this new Bluez API, but seems that there is not only missing some examples or usages with libdbus-1, but also documentation. I have tried to find something how to register endpoints throw
GetManagedObjects()via libdbus-1, but seems that there is no usage of it and also unusable documentation for it in libdbus-1. So currently I'm stuck how to use this exotic API in pulseaudio...It is just another D-Bus method, the only difference is that it carries the entire object tree, btw I did add an example of how to register Endpoints in python:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
Quoted 7 lines
Quoted 3 lines
Now I found this python example and currently I'm doing observations and "reverse-engineering" how it is working and how this example behaves on D-Bus. I think I understood it now.
One important detail is that RegisterApplication shall not block since the daemon will call GetManagedObjects the D-Bus mainloop must be able to process messages.
Ok. I'm already using non-blocking / async processing as blocking variants can cause more problems in event-orientated applications.
Quoted 12 lines
Quoted 9 lines
Quoted 5 lines
You can also have a look at how our gdbus internal library (uses libdbus) utilize it:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
--
Pali Rohár
[email protected]
Signature · 2 lines
Pali Rohár [email protected]
Quoted 26 lines · On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 16 lines · Pali Rohár
Quoted 6 lines · On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
Hi,
Quoted 3 lines · Pali Rohár
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Quoted 7 lines
Quoted 4 lines
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.Quoted 6 lines
Ok! Today I have looked at this new Bluez API, but seems that there is not only missing some examples or usages with libdbus-1, but also documentation. I have tried to find something how to register endpoints throw
GetManagedObjects()via libdbus-1, but seems that there is no usage of it and also unusable documentation for it in libdbus-1. So currently I'm stuck how to use this exotic API in pulseaudio...
Quoted 5 lines
It is just another D-Bus method, the only difference is that it carries the entire object tree, btw I did add an example of how to register Endpoints in python:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
This example uses undocumented property "DelayReporting". What it is doing?
Quoted 5 lines
You can also have a look at how our gdbus internal library (uses libdbus) utilize it:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
Signature · 2 lines
Pali Rohár [email protected]
Quoted 42 lines · On Sunday 06 October 2019 13:17:00 Pali Rohár wrote:
Quoted 41 lines · On Sunday 06 October 2019 14:14:18 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 37 lines · Pali Rohár
Quoted 26 lines · On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 16 lines · Pali Rohár
Quoted 6 lines · On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
Hi,
Quoted 3 lines · Pali Rohár
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Quoted 7 lines
Quoted 4 lines
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.Quoted 6 lines
Ok! Today I have looked at this new Bluez API, but seems that there is not only missing some examples or usages with libdbus-1, but also documentation. I have tried to find something how to register endpoints throw
GetManagedObjects()via libdbus-1, but seems that there is no usage of it and also unusable documentation for it in libdbus-1. So currently I'm stuck how to use this exotic API in pulseaudio...Quoted 5 lines
It is just another D-Bus method, the only difference is that it carries the entire object tree, btw I did add an example of how to register Endpoints in python:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
Now I found this python example and currently I'm doing observations and "reverse-engineering" how it is working and how this example behaves on D-Bus. I think I understood it now.
Quoted 6 lines
Quoted 3 lines
One important detail is that RegisterApplication shall not block since the daemon will call GetManagedObjects the D-Bus mainloop must be able to process messages.
Ok. I'm already using non-blocking / async processing as blocking variants can cause more problems in event-orientated applications.
Now I implemented it in pulseaudio. New patches are now available in [email protected] mailing list.
Quoted 13 lines
Quoted 12 lines
Quoted 9 lines
Quoted 5 lines
You can also have a look at how our gdbus internal library (uses libdbus) utilize it:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
--
Pali Rohár
[email protected]
Signature · 2 lines
Pali Rohár [email protected]
Quoted 27 lines · On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
Quoted 26 lines · On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 22 lines · Pali Rohár
Quoted 6 lines · On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
Hi,
Quoted 3 lines · Pali Rohár
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Quoted 7 lines
Quoted 4 lines
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.Ok! Today I have looked at this new Bluez API, but seems that there is not only missing some examples or usages with libdbus-1, but also documentation. I have tried to find something how to register endpoints throw
GetManagedObjects()via libdbus-1, but seems that there is no usage of it and also unusable documentation for it in libdbus-1. So currently I'm stuck how to use this exotic API in pulseaudio...
Quoted 7 lines
Quoted 5 lines
It is just another D-Bus method, the only difference is that it carries the entire object tree, btw I did add an example of how to register Endpoints in python:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
This example uses undocumented property "DelayReporting". What it is doing?
Also this new Managed Objects API bring some inconsistency. Codec switching API is available only when bluetoothd was started with --experimental flag, but this new Object API is available also without it. So it just complicated implementation.
How could application (e.g. pulseaudio) check if A2DP codec switching is available and based on this decide if via Managed Objects API export more codecs or just only default SBC?
Quoted 6 lines
Quoted 5 lines
You can also have a look at how our gdbus internal library (uses libdbus) utilize it:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
Signature · 2 lines
Pali Rohár [email protected]
Luiz Augusto von Dentz
maintainerHi Pali,
Quoted 37 lines · Pali Rohár
Quoted 27 lines · On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
Quoted 26 lines · On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 22 lines · Pali Rohár
Quoted 6 lines · On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
Hi,
Quoted 3 lines · Pali Rohár
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Quoted 7 lines
Quoted 4 lines
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.Ok! Today I have looked at this new Bluez API, but seems that there is not only missing some examples or usages with libdbus-1, but also documentation. I have tried to find something how to register endpoints throw
GetManagedObjects()via libdbus-1, but seems that there is no usage of it and also unusable documentation for it in libdbus-1. So currently I'm stuck how to use this exotic API in pulseaudio...Quoted 7 lines
Quoted 5 lines
It is just another D-Bus method, the only difference is that it carries the entire object tree, btw I did add an example of how to register Endpoints in python:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
This example uses undocumented property "DelayReporting". What it is doing?
Quoted 8 lines
Also this new Managed Objects API bring some inconsistency. Codec switching API is available only when bluetoothd was started with --experimental flag, but this new Object API is available also without it. So it just complicated implementation.
How could application (e.g. pulseaudio) check if A2DP codec switching is available and based on this decide if via Managed Objects API export more codecs or just only default SBC?
The idea was that this API would be experimental as well but it seems it is not, they should go hand in hand with Endpoint objects to ensure they will be available as well so we might have to fix this in 5.52, too bad we didn't see this before 5.51 went out.
Quoted 10 lines
Quoted 6 lines
Quoted 5 lines
You can also have a look at how our gdbus internal library (uses libdbus) utilize it:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
--
Pali Rohár
[email protected]
Signature · 1 line
Luiz Augusto von Dentz
Quoted 45 lines · On Tuesday 08 October 2019 13:28:53 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 42 lines · Pali Rohár
Quoted 27 lines · On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
Quoted 26 lines · On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 22 lines · Pali Rohár
Quoted 6 lines · On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
Hi,
Quoted 3 lines · Pali Rohár
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Quoted 7 lines
Quoted 4 lines
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.Ok! Today I have looked at this new Bluez API, but seems that there is not only missing some examples or usages with libdbus-1, but also documentation. I have tried to find something how to register endpoints throw
GetManagedObjects()via libdbus-1, but seems that there is no usage of it and also unusable documentation for it in libdbus-1. So currently I'm stuck how to use this exotic API in pulseaudio...Quoted 7 lines
Quoted 5 lines
It is just another D-Bus method, the only difference is that it carries the entire object tree, btw I did add an example of how to register Endpoints in python:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
This example uses undocumented property "DelayReporting". What it is doing?
Also this new Managed Objects API bring some inconsistency. Codec switching API is available only when bluetoothd was started with --experimental flag, but this new Object API is available also without it. So it just complicated implementation.
Quoted 6 lines
Quoted 3 lines
How could application (e.g. pulseaudio) check if A2DP codec switching is available and based on this decide if via Managed Objects API export more codecs or just only default SBC?
The idea was that this API would be experimental as well but it seems it is not,
No, it is not experimental. Managed Objects API is available also when bluetoothd is started without --experimental argument.
Quoted 3 lines
they should go hand in hand with Endpoint objects to ensure they will be available as well so we might have to fix this in 5.52, too bad we didn't see this before 5.51 went out.
So... what should applications expects and how they should implement above decision?
Quoted 13 lines
Quoted 10 lines
Quoted 6 lines
Quoted 5 lines
You can also have a look at how our gdbus internal library (uses libdbus) utilize it:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
--
Pali Rohár
[email protected]
Signature · 2 lines
Pali Rohár [email protected]
Luiz Augusto von Dentz
maintainerHi Pali,
Quoted 57 lines · Pali Rohár
Quoted 45 lines · On Tuesday 08 October 2019 13:28:53 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 42 lines · Pali Rohár
Quoted 27 lines · On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
Quoted 26 lines · On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 22 lines · Pali Rohár
Quoted 6 lines · On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
Hi,
Quoted 3 lines · Pali Rohár
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Quoted 7 lines
Quoted 4 lines
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.Ok! Today I have looked at this new Bluez API, but seems that there is not only missing some examples or usages with libdbus-1, but also documentation. I have tried to find something how to register endpoints throw
GetManagedObjects()via libdbus-1, but seems that there is no usage of it and also unusable documentation for it in libdbus-1. So currently I'm stuck how to use this exotic API in pulseaudio...Quoted 7 lines
Quoted 5 lines
It is just another D-Bus method, the only difference is that it carries the entire object tree, btw I did add an example of how to register Endpoints in python:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
This example uses undocumented property "DelayReporting". What it is doing?
Also this new Managed Objects API bring some inconsistency. Codec switching API is available only when bluetoothd was started with --experimental flag, but this new Object API is available also without it. So it just complicated implementation.
Quoted 6 lines
Quoted 3 lines
How could application (e.g. pulseaudio) check if A2DP codec switching is available and based on this decide if via Managed Objects API export more codecs or just only default SBC?
The idea was that this API would be experimental as well but it seems it is not,
No, it is not experimental. Managed Objects API is available also when bluetoothd is started without --experimental argument.
Quoted 6 lines
Quoted 3 lines
they should go hand in hand with Endpoint objects to ensure they will be available as well so we might have to fix this in 5.52, too bad we didn't see this before 5.51 went out.
So... what should applications expects and how they should implement above decision?
Actually the decision should be based on the presence of RegisterApplication method, if that exists then endpoint switching should be supported as well, so has nothing to do the GetManagedObjects API of the bluetoothd. That said RegisterApplication was not made experimental which kind makes 5.51 broken because it would appear that it endpoint objects would be exposed but when in fact there are not, anyway lets finally have the code to use this interface and then we can remove the experimental flag from MediaEndpoint.
Quoted 17 lines
Quoted 13 lines
Quoted 10 lines
Quoted 6 lines
Quoted 5 lines
You can also have a look at how our gdbus internal library (uses libdbus) utilize it:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
--
Pali Rohár
[email protected]--
Pali Rohár
[email protected]
Signature · 1 line
Luiz Augusto von Dentz
Quoted 67 lines · On Wednesday 09 October 2019 16:15:59 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 57 lines · Pali Rohár
Quoted 45 lines · On Tuesday 08 October 2019 13:28:53 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 42 lines · Pali Rohár
Quoted 27 lines · On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
Quoted 26 lines · On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 22 lines · Pali Rohár
Quoted 6 lines · On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
Hi,
Quoted 3 lines · Pali Rohár
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Quoted 7 lines
Quoted 4 lines
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.Ok! Today I have looked at this new Bluez API, but seems that there is not only missing some examples or usages with libdbus-1, but also documentation. I have tried to find something how to register endpoints throw
GetManagedObjects()via libdbus-1, but seems that there is no usage of it and also unusable documentation for it in libdbus-1. So currently I'm stuck how to use this exotic API in pulseaudio...Quoted 7 lines
Quoted 5 lines
It is just another D-Bus method, the only difference is that it carries the entire object tree, btw I did add an example of how to register Endpoints in python:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
This example uses undocumented property "DelayReporting". What it is doing?
Also this new Managed Objects API bring some inconsistency. Codec switching API is available only when bluetoothd was started with --experimental flag, but this new Object API is available also without it. So it just complicated implementation.
Quoted 6 lines
Quoted 3 lines
How could application (e.g. pulseaudio) check if A2DP codec switching is available and based on this decide if via Managed Objects API export more codecs or just only default SBC?
The idea was that this API would be experimental as well but it seems it is not,
No, it is not experimental. Managed Objects API is available also when bluetoothd is started without --experimental argument.
Quoted 6 lines
Quoted 3 lines
they should go hand in hand with Endpoint objects to ensure they will be available as well so we might have to fix this in 5.52, too bad we didn't see this before 5.51 went out.
So... what should applications expects and how they should implement above decision?
Quoted 9 lines
Actually the decision should be based on the presence of RegisterApplication method, if that exists then endpoint switching should be supported as well, so has nothing to do the GetManagedObjects API of the bluetoothd. That said RegisterApplication was not made experimental which kind makes 5.51 broken because it would appear that it endpoint objects would be exposed but when in fact there are not, anyway lets finally have the code to use this interface and then we can remove the experimental flag from MediaEndpoint.
Ok, so can pulseaudio do following?
Call RegisterApplication. If success then expects that codec switching is possible and via GetManagedObjects exports all available codecs. If RegisterApplication fails then fallback to RegisterEndpoint, expects that codec switching is not possible and so register only one SBC codec.
Quoted 20 lines
Quoted 17 lines
Quoted 13 lines
Quoted 10 lines
Quoted 6 lines
Quoted 5 lines
You can also have a look at how our gdbus internal library (uses libdbus) utilize it:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
--
Pali Rohár
[email protected]--
Pali Rohár
[email protected]
Signature · 2 lines
Pali Rohár [email protected]
Quoted 27 lines · On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
Quoted 26 lines · On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 22 lines · Pali Rohár
Quoted 6 lines · On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
Hi,
Quoted 3 lines · Pali Rohár
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Quoted 7 lines
Quoted 4 lines
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.Ok! Today I have looked at this new Bluez API, but seems that there is not only missing some examples or usages with libdbus-1, but also documentation. I have tried to find something how to register endpoints throw
GetManagedObjects()via libdbus-1, but seems that there is no usage of it and also unusable documentation for it in libdbus-1. So currently I'm stuck how to use this exotic API in pulseaudio...
Quoted 7 lines
Quoted 5 lines
It is just another D-Bus method, the only difference is that it carries the entire object tree, btw I did add an example of how to register Endpoints in python:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
This example uses undocumented property "DelayReporting". What it is doing?
And I would like to know what is that undocumented DelayReporting is doing? And to which value should I initialize it in pulseaudio?
Quoted 6 lines
Quoted 5 lines
You can also have a look at how our gdbus internal library (uses libdbus) utilize it:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
Signature · 2 lines
Pali Rohár [email protected]
Quoted 78 lines · On Wednesday 09 October 2019 15:19:21 Pali Rohár wrote:
Quoted 67 lines · On Wednesday 09 October 2019 16:15:59 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 57 lines · Pali Rohár
Quoted 45 lines · On Tuesday 08 October 2019 13:28:53 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 42 lines · Pali Rohár
Quoted 27 lines · On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
Quoted 26 lines · On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
Hi Pali,
Quoted 22 lines · Pali Rohár
Quoted 6 lines · On Thursday 03 October 2019 21:18:55 Pasi Kärkkäinen wrote:
Hi,
Quoted 3 lines · Pali Rohár
Quoted 1 line · On Thursday 29 August 2019 15:57:34 Pasi Kärkkäinen wrote:
Pali: How does it look with porting the PA patches to use the new interfaces?
Quoted 7 lines
Quoted 4 lines
Hello, I have not had a time yet to play with these pulseaudio patches and porting to the new interface. I guess that I could have more free time in the last week of next month.
It seems BlueZ 5.51 has been released meanwhile (http://www.bluez.org/release-of-bluez-5-51/)
So now at least the new interfaces are in a released bluez version.Ok! Today I have looked at this new Bluez API, but seems that there is not only missing some examples or usages with libdbus-1, but also documentation. I have tried to find something how to register endpoints throw
GetManagedObjects()via libdbus-1, but seems that there is no usage of it and also unusable documentation for it in libdbus-1. So currently I'm stuck how to use this exotic API in pulseaudio...Quoted 7 lines
Quoted 5 lines
It is just another D-Bus method, the only difference is that it carries the entire object tree, btw I did add an example of how to register Endpoints in python:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-endpoint
This example uses undocumented property "DelayReporting". What it is doing?
Also this new Managed Objects API bring some inconsistency. Codec switching API is available only when bluetoothd was started with --experimental flag, but this new Object API is available also without it. So it just complicated implementation.
Quoted 6 lines
Quoted 3 lines
How could application (e.g. pulseaudio) check if A2DP codec switching is available and based on this decide if via Managed Objects API export more codecs or just only default SBC?
The idea was that this API would be experimental as well but it seems it is not,
No, it is not experimental. Managed Objects API is available also when bluetoothd is started without --experimental argument.
Quoted 6 lines
Quoted 3 lines
they should go hand in hand with Endpoint objects to ensure they will be available as well so we might have to fix this in 5.52, too bad we didn't see this before 5.51 went out.
So... what should applications expects and how they should implement above decision?
Quoted 9 lines
Actually the decision should be based on the presence of RegisterApplication method, if that exists then endpoint switching should be supported as well, so has nothing to do the GetManagedObjects API of the bluetoothd. That said RegisterApplication was not made experimental which kind makes 5.51 broken because it would appear that it endpoint objects would be exposed but when in fact there are not, anyway lets finally have the code to use this interface and then we can remove the experimental flag from MediaEndpoint.
Quoted 6 lines
Ok, so can pulseaudio do following?
Call RegisterApplication. If success then expects that codec switching is possible and via GetManagedObjects exports all available codecs. If RegisterApplication fails then fallback to RegisterEndpoint, expects that codec switching is not possible and so register only one SBC codec.
Also can we solve this problem in bluez ASAP? Last released bluez version is due to that non-experimental API broken and once applications (e.g. pulseaudio) starts using this new API then A2DP without bluetoothd -E would be broken.
I would propose to remove experimental mark for codec switching API and release a new bugfix version of bluez, so people would not use released 5.51 broken version... which could prevent breakage of A2DP in future.
Quoted 21 lines
Quoted 20 lines
Quoted 17 lines
Quoted 13 lines
Quoted 10 lines
Quoted 6 lines
Quoted 5 lines
You can also have a look at how our gdbus internal library (uses libdbus) utilize it:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/gdbus/client.c#n1269
--
Pali Rohár
[email protected]--
Pali Rohár
[email protected]
Signature · 2 lines
Pali Rohár [email protected]
Quoted 21 lines · Pali Rohár
Quoted 14 lines
Quoted 4 lines
Quoted 3 lines
So... what should applications expects and how they should implement above decision?
Quoted 9 lines
Actually the decision should be based on the presence of RegisterApplication method, if that exists then endpoint switching should be supported as well, so has nothing to do the GetManagedObjects API of the bluetoothd. That said RegisterApplication was not made experimental which kind makes 5.51 broken because it would appear that it endpoint objects would be exposed but when in fact there are not, anyway lets finally have the code to use this interface and then we can remove the experimental flag from MediaEndpoint.
Quoted 6 lines
Ok, so can pulseaudio do following?
Call RegisterApplication. If success then expects that codec switching is possible and via GetManagedObjects exports all available codecs. If RegisterApplication fails then fallback to RegisterEndpoint, expects that codec switching is not possible and so register only one SBC codec.
Quoted 9 lines
Also can we solve this problem in bluez ASAP? Last released bluez version is due to that non-experimental API broken and once applications (e.g. pulseaudio) starts using this new API then A2DP without bluetoothd -E would be broken.
I would propose to remove experimental mark for codec switching API and release a new bugfix version of bluez, so people would not use released 5.51 broken version... which could prevent breakage of A2DP in future.
+1
It would be nice to get bluez 5.52 released before 5.51 gets released by distros..
-- Pasi
Luiz Augusto von Dentz
maintainerHi,
Quoted 28 lines · Pasi Kärkkäinen
Quoted 26 lines · Pali Rohár
Quoted 14 lines
Quoted 4 lines
Quoted 3 lines
So... what should applications expects and how they should implement above decision?
Quoted 9 lines
Actually the decision should be based on the presence of RegisterApplication method, if that exists then endpoint switching should be supported as well, so has nothing to do the GetManagedObjects API of the bluetoothd. That said RegisterApplication was not made experimental which kind makes 5.51 broken because it would appear that it endpoint objects would be exposed but when in fact there are not, anyway lets finally have the code to use this interface and then we can remove the experimental flag from MediaEndpoint.
Quoted 6 lines
Ok, so can pulseaudio do following?
Call RegisterApplication. If success then expects that codec switching is possible and via GetManagedObjects exports all available codecs. If RegisterApplication fails then fallback to RegisterEndpoint, expects that codec switching is not possible and so register only one SBC codec.
Also can we solve this problem in bluez ASAP? Last released bluez version is due to that non-experimental API broken and once applications (e.g. pulseaudio) starts using this new API then A2DP without bluetoothd -E would be broken.
Quoted 8 lines
Quoted 4 lines
I would propose to remove experimental mark for codec switching API and release a new bugfix version of bluez, so people would not use released 5.51 broken version... which could prevent breakage of A2DP in future.
+1
It would be nice to get bluez 5.52 released before 5.51 gets released by distros..
Just sent a patch marking these APIs as stable, when are we expecting a new PA release btw?
Signature · 1 line
Luiz Augusto von Dentz
Quoted 36 lines · On Friday 18 October 2019 13:55:10 Luiz Augusto von Dentz wrote:
Hi,
Quoted 33 lines · Pasi Kärkkäinen
Quoted 30 lines · Pali Rohár
Quoted 14 lines
Quoted 4 lines
Quoted 3 lines
So... what should applications expects and how they should implement above decision?
Quoted 9 lines
Actually the decision should be based on the presence of RegisterApplication method, if that exists then endpoint switching should be supported as well, so has nothing to do the GetManagedObjects API of the bluetoothd. That said RegisterApplication was not made experimental which kind makes 5.51 broken because it would appear that it endpoint objects would be exposed but when in fact there are not, anyway lets finally have the code to use this interface and then we can remove the experimental flag from MediaEndpoint.
Quoted 6 lines
Ok, so can pulseaudio do following?
Call RegisterApplication. If success then expects that codec switching is possible and via GetManagedObjects exports all available codecs. If RegisterApplication fails then fallback to RegisterEndpoint, expects that codec switching is not possible and so register only one SBC codec.
Also can we solve this problem in bluez ASAP? Last released bluez version is due to that non-experimental API broken and once applications (e.g. pulseaudio) starts using this new API then A2DP without bluetoothd -E would be broken.
I would propose to remove experimental mark for codec switching API and release a new bugfix version of bluez, so people would not use released 5.51 broken version... which could prevent breakage of A2DP in future.
Quoted 5 lines
Quoted 3 lines
+1
It would be nice to get bluez 5.52 released before 5.51 gets released by distros..
Just sent a patch marking these APIs as stable
Great! Thank you!
Now there is only my question about undocumented DelayReporting. Can you look at that email?
Quoted 1 line
when are we expecting a new PA release btw?
I do not know. I even do not know if release date was announced.
Signature · 2 lines
Pali Rohár [email protected]
Quoted 8 lines · On Wednesday 09 October 2019 15:20:40 Pali Rohár wrote:
Quoted 7 lines · On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
Quoted 6 lines · On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
Hi Pali,
It is just another D-Bus method, the only difference is that it carries the entire object tree, btw I did add an example of how to register Endpoints in python:
Quoted 6 lines
Quoted 3 lines
This example uses undocumented property "DelayReporting". What it is doing?
And I would like to know what is that undocumented DelayReporting is doing? And to which value should I initialize it in pulseaudio?
Luiz, any comments on this?
Signature · 2 lines
Pali Rohár [email protected]
Undocumented property "DelayReporting" (Was: Re: [PATCH BlueZ 1/4] doc/media-api: Add RegisterApplication method)
Quoted 9 lines · On Thursday 14 November 2019 12:27:53 Pali Rohár wrote:
Quoted 8 lines · On Wednesday 09 October 2019 15:20:40 Pali Rohár wrote:
Quoted 7 lines · On Sunday 06 October 2019 14:02:45 Pali Rohár wrote:
Quoted 6 lines · On Sunday 06 October 2019 13:53:37 Luiz Augusto von Dentz wrote:
Hi Pali,
It is just another D-Bus method, the only difference is that it carries the entire object tree, btw I did add an example of how to register Endpoints in python:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
This example uses undocumented property "DelayReporting". What it is doing?
And I would like to know what is that undocumented DelayReporting is doing? And to which value should I initialize it in pulseaudio?
Luiz, any comments on this?
Luiz, could you please tell me some information about this undocumented property to which value should I set it? I really need it for proper implementation of endpoints in pulseaudio.
I was not able to decode its meaning from source code nor found any other information about it.