clean pulseaudio recipes
[scm/bb/meta-tizen.git] / recipes-multimedia / pulseaudio / pulseaudio_5.0 / 0048-Add-bt_profile_set-patch-which-fixed-bt-a2dp-hsp-pro.patch
1 From: "vivian,zhang" <vivian.zhang@intel.com>
2 Date: Wed, 17 Jul 2013 11:17:40 +0800
3 Subject: Add bt_profile_set patch which fixed bt a2dp&hsp profile setting
4  issues in mobile
5
6 Change-Id: I9bc3649b02ab7ac56584211789a3ea18ff17fbb7
7 Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
8 ---
9  configure.ac                                   | 13 +++++++++++++
10  src/Makefile.am                                |  3 +++
11  src/modules/bluetooth/module-bluez4-discover.c | 18 ++++++++++++++++++
12  3 files changed, 34 insertions(+)
13
14 diff --git a/configure.ac b/configure.ac
15 index 870375f..6a6bc83 100644
16 --- a/configure.ac
17 +++ b/configure.ac
18 @@ -679,6 +679,19 @@ fi
19  AM_CONDITIONAL(USE_DLOG, test "x$USE_DLOG" = "xyes")
20  dnl end --------------------------------------------------------------------
21  
22 +dnl use bt-profile-set --------------------------------------------------------------------------
23 +AC_ARG_ENABLE(bt-profile-set, AC_HELP_STRING([--enable-bt-profile-set], [enable bt profile param]),
24 +[
25 + case "${enableval}" in
26 +        yes) USE_BT_PROFILE_SET=yes ;;
27 +        no)  USE_BT_PROFILE_SET=no ;;
28 +        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-bt-profile-set) ;;
29 + esac
30 + ],[USE_BT_PROFILE_SET=no])
31 +
32 +AM_CONDITIONAL(USE_BT_PROFILE_SET, test "x$USE_BT_PROFILE_SET" = "xyes")
33 +dnl end --------------------------------------------------------------------
34 +
35  #### atomic-ops ####
36  
37  AC_MSG_CHECKING([whether we need libatomic_ops])
38 diff --git a/src/Makefile.am b/src/Makefile.am
39 index a60b5bf..b09903f 100644
40 --- a/src/Makefile.am
41 +++ b/src/Makefile.am
42 @@ -2082,6 +2082,9 @@ module_bluetooth_discover_la_CFLAGS = $(AM_CFLAGS)
43  if HAVE_BT_A2DP_APTX
44  module_bluetooth_discover_la_CFLAGS += -DBLUETOOTH_APTX_SUPPORT
45  endif
46 +if USE_BT_PROFILE_SET
47 +module_bluetooth_discover_la_CFLAGS += -DBLUETOOTH_PROFILE_SET
48 +endif
49  
50  # Bluetooth BlueZ 4 sink / source
51  module_bluez4_discover_la_SOURCES = modules/bluetooth/module-bluez4-discover.c
52 diff --git a/src/modules/bluetooth/module-bluez4-discover.c b/src/modules/bluetooth/module-bluez4-discover.c
53 index 7673ba7..aaaa095 100644
54 --- a/src/modules/bluetooth/module-bluez4-discover.c
55 +++ b/src/modules/bluetooth/module-bluez4-discover.c
56 @@ -79,9 +79,27 @@ static pa_hook_result_t load_module_for_device(pa_bluez4_discovery *y, const pa_
57              pa_module *m = NULL;
58              char *args;
59  
60 +#ifdef BLUETOOTH_PROFILE_SET
61 +            const char *profile = NULL;
62 +
63 +            if ((d->transports[PROFILE_A2DP] && d->transports[PROFILE_A2DP]->state != PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)) {
64 +                profile = "a2dp";
65 +            } if ((d->transports[PROFILE_A2DP_SOURCE] && d->transports[PROFILE_A2DP_SOURCE]->state != PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)) {
66 +                profile = "a2dp_source";
67 +            } else if ((d->transports[PROFILE_HFGW] && d->transports[PROFILE_HFGW]->state != PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)) {
68 +                profile = "hfgw";
69 +            }
70 +            if (!profile)
71 +                return PA_HOOK_OK;
72 +#endif
73 +
74              /* Oh, awesome, a new device has shown up and been connected! */
75  
76 +#ifdef BLUETOOTH_PROFILE_SET
77 +            args = pa_sprintf_malloc("address=\"%s\" path=\"%s\" profile=\"%s\"", d->address, d->path, profile);
78 +#else
79              args = pa_sprintf_malloc("address=\"%s\" path=\"%s\"", d->address, d->path);
80 +#endif
81  
82              if (pa_modargs_get_value(u->modargs, "sco_sink", NULL) &&
83                  pa_modargs_get_value(u->modargs, "sco_source", NULL)) {