Skip to contentSkip to conversation

audio: Move AVRCP related code to its own plugin

PATCH In review Luiz Augusto von Dentz 2 participants 5 messages Jul 24, 2013

Subsystems (2)
lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH v2 1/4 audio: Move AVRCP related code to its own plugin

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

This moves AVRCP related code to avrcp plugin and making it possible to disable by passing -P avrcp and increasing the modularity of the code.
---
v2: Make media driver part of a2dp plugin as they dependend on one another

 Makefile.plugins         |  10 +-
 profiles/audio/avrcp.c   | 345 ++++++++++++++++++++++++++++-------------------
 profiles/audio/avrcp.h   |   7 -
 profiles/audio/manager.c | 113 +---------------
 4 files changed, 214 insertions(+), 261 deletions(-)
Makefile.plugins +6 -4
index 7fd9e2d..0f07b11 100644
@@ -33,18 +33,20 @@ endif
 builtin_modules += audio
 builtin_sources += profiles/audio/main.c \
 			profiles/audio/manager.h profiles/audio/manager.c \
-			profiles/audio/control.h profiles/audio/control.c \
-			profiles/audio/avctp.h profiles/audio/avctp.c \
-			profiles/audio/avrcp.h profiles/audio/avrcp.c \
 			profiles/audio/source.h profiles/audio/source.c \
 			profiles/audio/sink.h profiles/audio/sink.c \
 			profiles/audio/a2dp.h profiles/audio/a2dp.c \
 			profiles/audio/avdtp.h profiles/audio/avdtp.c \
 			profiles/audio/media.h profiles/audio/media.c \
 			profiles/audio/transport.h profiles/audio/transport.c \
-			profiles/audio/player.h profiles/audio/player.c \
 			profiles/audio/a2dp-codecs.h
 
+builtin_modules += avrcp
+builtin_sources += profiles/audio/control.h profiles/audio/control.c \
+			profiles/audio/avctp.h profiles/audio/avctp.c \
+			profiles/audio/avrcp.h profiles/audio/avrcp.c \
+			profiles/audio/player.h profiles/audio/player.c
+
 builtin_modules += network
 builtin_sources += profiles/network/manager.c \
 			profiles/network/common.h profiles/network/common.c \
profiles/audio/avrcp.c +207 -138

386 lines not on this page · raw message

profiles/audio/avrcp.h +0 -7
index 2ec1664..4c520ca 100644
@@ -100,13 +100,6 @@ struct avrcp_player_cb {
 	bool (*previous) (void *user_data);
 };
 
-int avrcp_target_register(struct btd_adapter *adapter, GKeyFile *config);
-void avrcp_target_unregister(struct btd_adapter *adapter);
-int avrcp_remote_register(struct btd_adapter *adapter, GKeyFile *config);
-void avrcp_remote_unregister(struct btd_adapter *adapter);
-
-gboolean avrcp_connect(struct btd_device *dev);
-void avrcp_disconnect(struct btd_device *dev);
 int avrcp_set_volume(struct btd_device *dev, uint8_t volume);
 
 struct avrcp_player *avrcp_register_player(struct btd_adapter *adapter,
profiles/audio/manager.c +1 -112

149 lines not on this page · raw message

Signature · 1 line
1.8.3.1
author maintainer
#1 lore raw

PATCH v2 2/4 audio: Move A2DP code to its own plugin

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

This moves A2DP related code to a2dp plugin and making it possible to disable by passing -P a2dp and increasing the modularity of the code.

---
 Makefile.plugins         |   6 +-
 profiles/audio/a2dp.c    | 319 +++++++++++++++++++++++++++++++++++------------
 profiles/audio/a2dp.h    |   5 -
 profiles/audio/avdtp.c   |  18 +--
 profiles/audio/avdtp.h   |   2 +-
 profiles/audio/manager.c | 165 ------------------------
 profiles/audio/media.c   |   2 +-
 7 files changed, 245 insertions(+), 272 deletions(-)
Makefile.plugins +4 -2
index 0f07b11..b6743ba 100644
@@ -32,8 +32,10 @@ endif
 
 builtin_modules += audio
 builtin_sources += profiles/audio/main.c \
-			profiles/audio/manager.h profiles/audio/manager.c \
-			profiles/audio/source.h profiles/audio/source.c \
+			profiles/audio/manager.h profiles/audio/manager.c
+
+builtin_modules += a2dp
+builtin_sources += profiles/audio/source.h profiles/audio/source.c \
 			profiles/audio/sink.h profiles/audio/sink.c \
 			profiles/audio/a2dp.h profiles/audio/a2dp.c \
 			profiles/audio/avdtp.h profiles/audio/avdtp.c \
profiles/audio/a2dp.c +237 -82

360 lines not on this page · raw message

profiles/audio/a2dp.h +0 -5
index 2c06f74..ef3be5c 100644
@@ -63,11 +63,6 @@ typedef void (*a2dp_stream_cb_t) (struct avdtp *session,
 					struct avdtp_error *err,
 					void *user_data);
 
-int a2dp_source_register(struct btd_adapter *adapter, GKeyFile *config);
-void a2dp_source_unregister(struct btd_adapter *adapter);
-int a2dp_sink_register(struct btd_adapter *adapter, GKeyFile *config);
-void a2dp_sink_unregister(struct btd_adapter *adapter);
-
 struct a2dp_sep *a2dp_add_sep(struct btd_adapter *adapter, uint8_t type,
 				uint8_t codec, gboolean delay_reporting,
 				struct a2dp_endpoint *endpoint,
profiles/audio/avdtp.c +2 -16
index 07644e5..f6c9408 100644
@@ -3846,27 +3846,13 @@ struct btd_device *avdtp_get_device(struct avdtp *session)
 	return session->device;
 }
 
-int avdtp_init(struct btd_adapter *adapter, GKeyFile *config)
+int avdtp_init(struct btd_adapter *adapter)
 {
-	GError *err = NULL;
-	gboolean tmp, master = TRUE;
 	struct avdtp_server *server;
 
-	if (!config)
-		goto proceed;
-
-	tmp = g_key_file_get_boolean(config, "General",
-			"Master", &err);
-	if (err) {
-		DBG("audio.conf: %s", err->message);
-		g_clear_error(&err);
-	} else
-		master = tmp;
-
-proceed:
 	server = g_new0(struct avdtp_server, 1);
 
-	server->io = avdtp_server_socket(adapter_get_address(adapter), master);
+	server->io = avdtp_server_socket(adapter_get_address(adapter), TRUE);
 	if (!server->io) {
 		g_free(server);
 		return -1;
profiles/audio/avdtp.h +1 -1
index 4d3e6c8..b8aaf1d 100644
@@ -312,5 +312,5 @@ struct btd_device *avdtp_get_device(struct avdtp *session);
 gboolean avdtp_stream_setup_active(struct avdtp *session);
 void avdtp_set_device_disconnect(struct avdtp *session, gboolean dev_dc);
 
-int avdtp_init(struct btd_adapter *adapter, GKeyFile *config);
+int avdtp_init(struct btd_adapter *adapter);
 void avdtp_exit(struct btd_adapter *adapter);
profiles/audio/manager.c +0 -165

182 lines not on this page · raw message

profiles/audio/media.c +1 -1
index 715d49c..5a06b99 100644
@@ -34,6 +34,7 @@
 #include <gdbus/gdbus.h>
 
 #include "lib/uuid.h"
+#include "src/plugin.h"
 #include "src/adapter.h"
 #include "src/device.h"
 #include "src/dbus-common.h"
@@ -47,7 +48,6 @@
 #include "transport.h"
 #include "a2dp.h"
 #include "avrcp.h"
-#include "manager.h"
 
 #define MEDIA_INTERFACE "org.bluez.Media1"
 #define MEDIA_ENDPOINT_INTERFACE "org.bluez.MediaEndpoint1"
Signature · 1 line
1.8.3.1
author maintainer
#2 lore raw

PATCH v2 3/4 audio: Remove audio plugin

In reply to Luiz Augusto von Dentz

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

Audio plugin is now splitted in multiple plugins so it is no longer necessary to have a manager to deal with many different drivers.

---
 Makefile.plugins         |   4 --
 profiles/audio/a2dp.c    |   1 -
 profiles/audio/avctp.c   |   1 -
 profiles/audio/avdtp.c   |   1 -
 profiles/audio/control.c |   1 -
 profiles/audio/main.c    |  86 ----------------------------------------
 profiles/audio/manager.c | 101 -----------------------------------------------
 profiles/audio/manager.h |  30 --------------
 profiles/audio/sink.c    |   1 -
 profiles/audio/source.c  |   1 -
 10 files changed, 227 deletions(-)
 delete mode 100644 profiles/audio/main.c
 delete mode 100644 profiles/audio/manager.c
 delete mode 100644 profiles/audio/manager.h
Makefile.plugins +0 -4
index b6743ba..7c5f71d 100644
@@ -30,10 +30,6 @@ noinst_LIBRARIES += profiles/sap/libsap.a
 profiles_sap_libsap_a_SOURCES = profiles/sap/sap.h profiles/sap/sap-u8500.c
 endif
 
-builtin_modules += audio
-builtin_sources += profiles/audio/main.c \
-			profiles/audio/manager.h profiles/audio/manager.c
-
 builtin_modules += a2dp
 builtin_sources += profiles/audio/source.h profiles/audio/source.c \
 			profiles/audio/sink.h profiles/audio/sink.c \
profiles/audio/a2dp.c +0 -1
index 40c68af..3f3cc1b 100644
@@ -45,7 +45,6 @@
 #include "src/service.h"
 
 #include "log.h"
-#include "manager.h"
 #include "avdtp.h"
 #include "sink.h"
 #include "source.h"
profiles/audio/avctp.c +0 -1
index 627252a..11e9365 100644
@@ -53,7 +53,6 @@
 #include "log.h"
 #include "error.h"
 #include "uinput.h"
-#include "manager.h"
 #include "avctp.h"
 #include "avrcp.h"
 
profiles/audio/avdtp.c +0 -1
index f6c9408..818dbdd 100644
@@ -50,7 +50,6 @@
 #include "src/adapter.h"
 #include "src/device.h"
 
-#include "manager.h"
 #include "control.h"
 #include "avdtp.h"
 #include "sink.h"
profiles/audio/control.c +0 -1
index 912ca73..5f88a94 100644
@@ -53,7 +53,6 @@
 
 #include "log.h"
 #include "error.h"
-#include "manager.h"
 #include "avctp.h"
 #include "control.h"
 #include "sdpd.h"
profiles/audio/main.c deleted +0 -86

86 lines not on this page · raw message

profiles/audio/manager.c deleted +0 -101

101 lines not on this page · raw message

profiles/audio/manager.h deleted +0 -30
deleted file mode 100644
index de8d791..0000000
@@ -1,30 +0,0 @@
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2006-2010  Nokia Corporation
- *  Copyright (C) 2004-2010  Marcel Holtmann <[email protected]>
- *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-int audio_manager_init(GKeyFile *config);
-void audio_manager_exit(void);
-
-/* TRUE to enable fast connectable and FALSE to disable fast connectable for all
- * audio adapters. */
-void manager_set_fast_connectable(gboolean enable);
profiles/audio/sink.c +0 -1
index 7211e68..400af06 100644
@@ -47,7 +47,6 @@
 #include "media.h"
 #include "a2dp.h"
 #include "error.h"
-#include "manager.h"
 #include "sink.h"
 #include "dbus-common.h"
 
profiles/audio/source.c +0 -1
index 0793af3..24a4353 100644
@@ -48,7 +48,6 @@
 #include "media.h"
 #include "a2dp.h"
 #include "error.h"
-#include "manager.h"
 #include "source.h"
 #include "dbus-common.h"
 
Signature · 1 line
1.8.3.1
author maintainer
#3 lore raw

PATCH v2 4/4 audio: Remove audio.conf

In reply to Luiz Augusto von Dentz

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

With the audio plugin split there is no longer a need to have a .conf file and anyway any configuration should be put in main.conf under plugin name group.

---
 profiles/audio/audio.conf | 8 --------
 1 file changed, 8 deletions(-)
 delete mode 100644 profiles/audio/audio.conf
profiles/audio/audio.conf deleted +0 -8
deleted file mode 100644
index 067b3fc..0000000
@@ -1,8 +0,0 @@
-# Configuration file for the audio service
-
-# This section contains options which are not specific to any
-# particular interface
-[General]
-
-# Switch to master role for incoming connections (defaults to true)
-#Master=true
Signature · 1 line
1.8.3.1
#4 lore raw
In reply to Luiz Augusto von Dentz

Hi Luiz,

Quoted 10 lines · Luiz Augusto von Dentz

This moves AVRCP related code to avrcp plugin and making it possible to disable by passing -P avrcp and increasing the modularity of the code.
---
v2: Make media driver part of a2dp plugin as they dependend on one another

 Makefile.plugins         |  10 +-
 profiles/audio/avrcp.c   | 345 ++++++++++++++++++++++++++++-------------------
 profiles/audio/avrcp.h   |   7 -
 profiles/audio/manager.c | 113 +---------------
 4 files changed, 214 insertions(+), 261 deletions(-)

All patches in this set have been applied. Thanks.

Johan