[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -3,6 +3,6 @@
<service name="tar_git">
<param name="url">https://github.com/mer-hybris/pulseaudio-modules-droid.git</param>
<param name="branch">master</param>
- <param name="revision">10ba85789eec4153ef78f3e6c23072629bd31e37</param>
+ <param name="revision">0130b2dd5b1ec4da2eea50a57289df089709f0a5</param>
</service>
</services>
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-5.0.19.tar.bz2/configure.ac
^
|
@@ -196,12 +196,9 @@
AS_HELP_STRING([--with-droid-device], [Droid device type for possible specific quirks (defaults to generic).]),
[droiddevice=$withval], [droiddevice="generic"]
)
-if test "x$droiddevice" = xmako ; then
- AC_DEFINE([DROID_DEVICE_MAKO], [1], [Using droid device mako.])
-elif test "x$droiddevice" = xi9305 ; then
- AC_DEFINE([DROID_DEVICE_I9305], [1], [Using droid device i9305.])
-else
- AC_DEFINE([DROID_DEVICE_GENERIC], [1], [Using droid device generic.])
+if test "x$droiddevice" != x ; then
+ DROID_DEVICE_CFLAGS="-DDROID_DEVICE_`echo $droiddevice | tr '[a-z]' '[A-Z]'`=1"
+ AC_SUBST([DROID_DEVICE_CFLAGS])
fi
AC_MSG_CHECKING([If we are using hardfp tool chain])
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-5.0.19.tar.bz2/src/droid/Makefile.am
^
|
@@ -2,6 +2,7 @@
$(PULSEAUDIO_LIBS) \
$(HYBRIS_LIBS)
AM_CFLAGS = \
+ $(DROID_DEVICE_CFLAGS) \
$(PULSEAUDIO_CFLAGS) \
$(DROIDHEADERS_CFLAGS) \
$(HYBRIS_CFLAGS) \
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-5.0.19.tar.bz2/src/droid/droid-source.c
^
|
@@ -377,6 +377,7 @@
pa_source *pa_droid_source_new(pa_module *m,
pa_modargs *ma,
const char *driver,
+ audio_devices_t device,
pa_droid_card_data *card_data,
pa_droid_mapping *am,
pa_card *card) {
@@ -394,6 +395,7 @@
bool namereg_fail = false;
pa_droid_config_audio *config = NULL; /* Only used when source is created without card */
uint32_t source_buffer = 0;
+ bool voicecall_source = false;
int ret;
audio_format_t hal_audio_format = 0;
@@ -404,7 +406,7 @@
pa_assert(driver);
/* When running under card use hw module name for source by default. */
- if (card && ma)
+ if (am)
module_id = am->input->module->name;
else
module_id = pa_modargs_get_value(ma, "module_id", DEFAULT_MODULE_ID);
@@ -412,6 +414,11 @@
sample_spec = m->core->default_sample_spec;
channel_map = m->core->default_channel_map;
+ if (device & AUDIO_DEVICE_IN_VOICE_CALL) {
+ pa_log_info("Enabling voice call record source. Most module arguments are overridden.");
+ voicecall_source = true;
+ }
+
if (pa_modargs_get_sample_spec_and_channel_map(ma, &sample_spec, &channel_map, PA_CHANNEL_MAP_AIFF) < 0) {
pa_log("Failed to parse sample specification and channel map.");
goto fail;
@@ -445,12 +452,14 @@
} else {
/* Stand-alone source */
- if (!(config = pa_droid_config_load(ma)))
- goto fail;
-
- /* Ownership of config transfers to hw_module if opening of hw module succeeds. */
- if (!(u->hw_module = pa_droid_hw_module_get(u->core, config, module_id)))
- goto fail;
+ if (!(u->hw_module = pa_droid_hw_module_get(u->core, NULL, module_id))) {
+ if (!(config = pa_droid_config_load(ma)))
+ goto fail;
+
+ /* Ownership of config transfers to hw_module if opening of hw module succeeds. */
+ if (!(u->hw_module = pa_droid_hw_module_get(u->core, config, module_id)))
+ goto fail;
+ }
}
if (!pa_convert_format(sample_spec.format, CONV_FROM_PA, &hal_audio_format)) {
@@ -467,6 +476,17 @@
hal_channel_mask |= c;
}
+ if (voicecall_source) {
+ pa_channel_map_init_mono(&channel_map);
+ sample_spec.channels = 1;
+ /* Only allow recording both downlink and uplink. */
+#ifdef QCOM_HARDWARE
+ hal_channel_mask = AUDIO_CHANNEL_IN_VOICE_CALL_MONO;
+#else
+ hal_channel_mask = AUDIO_CHANNEL_IN_VOICE_UPLINK | AUDIO_CHANNEL_IN_VOICE_DNLINK;
+#endif
+ }
+
struct audio_config config_in = {
.sample_rate = sample_spec.rate,
.channel_mask = hal_channel_mask,
@@ -474,24 +494,25 @@
};
/* Default routing */
- /* FIXME So while setting routing through stream with HALv2 API fails, creation of stream
- * requires HALv2 style device to work properly. So until that oddity is resolved we always
- * set AUDIO_DEVICE_IN_BUILTIN_MIC as initial device here. */
-#if 0
- pa_assert_se(pa_string_convert_input_device_str_to_num("AUDIO_DEVICE_IN_BUILTIN_MIC", &dev_in));
+ if (device)
+ dev_in = device;
+ else {
+ /* FIXME So while setting routing through stream with HALv2 API fails, creation of stream
+ * requires HALv2 style device to work properly. So until that oddity is resolved we always
+ * set AUDIO_DEVICE_IN_BUILTIN_MIC as initial device here. */
+ pa_log_info("FIXME: Setting AUDIO_DEVICE_IN_BUILTIN_MIC as initial device.");
+ pa_assert_se(pa_string_convert_input_device_str_to_num("AUDIO_DEVICE_IN_BUILTIN_MIC", &dev_in));
- if ((tmp = pa_modargs_get_value(ma, "input_devices", NULL))) {
- audio_devices_t tmp_dev;
+ if ((tmp = pa_modargs_get_value(ma, "input_devices", NULL))) {
+ audio_devices_t tmp_dev;
- if (parse_device_list(tmp, &tmp_dev) && tmp_dev)
- dev_in = tmp_dev;
+ if (parse_device_list(tmp, &tmp_dev) && tmp_dev)
+ dev_in = tmp_dev;
- pa_log_debug("Set initial devices %s", tmp);
+ pa_log_debug("Set initial devices %s", tmp);
+ }
}
-#else
- pa_log_info("FIXME: Setting AUDIO_DEVICE_IN_BUILTIN_MIC as initial device.");
- dev_in = AUDIO_DEVICE_IN_BUILTIN_MIC;
-#endif
+
pa_droid_hw_module_lock(u->hw_module);
ret = u->hw_module->device->open_input_stream(u->hw_module->device,
u->hw_module->stream_in_id++,
@@ -500,7 +521,7 @@
&u->stream);
pa_droid_hw_module_unlock(u->hw_module);
- if (ret < 0) {
+ if (ret < 0 || !u->stream) {
pa_log("Failed to open input stream.");
goto fail;
}
@@ -555,7 +576,7 @@
pa_source_new_data_set_channel_map(&data, &channel_map);
pa_source_new_data_set_alternate_sample_rate(&data, alternate_sample_rate);
- if (am)
+ if (am && card)
pa_droid_add_ports(data.ports, am, card);
u->source = pa_source_new(m->core, &data, PA_SOURCE_HARDWARE);
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-5.0.19.tar.bz2/src/droid/droid-source.h
^
|
@@ -43,9 +43,11 @@
#include "droid-util.h"
+/* If device is non-zero, it will override whatever is set in modargs for input device. */
pa_source *pa_droid_source_new(pa_module *m,
pa_modargs *ma,
const char *driver,
+ audio_devices_t device,
pa_droid_card_data *card_data,
pa_droid_mapping *am,
pa_card *card);
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-5.0.19.tar.bz2/src/droid/droid-util-41qc.h
^
|
@@ -22,9 +22,16 @@
#ifndef _ANDROID_UTIL_V412_H_
#define _ANDROID_UTIL_V412_H_
+#ifdef DROID_DEVICE_SBJ
+#define QCOM_HARDWARE
+#endif
+
+#include <hardware/audio.h>
+#include <hardware_legacy/audio_policy_conf.h>
+
// PulseAudio value - Android value
-static uint32_t conversion_table_output_channel[][2] = {
+uint32_t conversion_table_output_channel[][2] = {
{ PA_CHANNEL_POSITION_MONO, AUDIO_CHANNEL_OUT_MONO },
{ PA_CHANNEL_POSITION_FRONT_LEFT, AUDIO_CHANNEL_OUT_FRONT_LEFT },
{ PA_CHANNEL_POSITION_FRONT_RIGHT, AUDIO_CHANNEL_OUT_FRONT_RIGHT},
@@ -46,7 +53,7 @@
{ PA_CHANNEL_POSITION_TOP_REAR_RIGHT, AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT }
};
-static uint32_t conversion_table_input_channel[][2] = {
+uint32_t conversion_table_input_channel[][2] = {
{ PA_CHANNEL_POSITION_MONO, AUDIO_CHANNEL_IN_MONO },
{ PA_CHANNEL_POSITION_FRONT_LEFT, AUDIO_CHANNEL_IN_LEFT },
{ PA_CHANNEL_POSITION_FRONT_RIGHT, AUDIO_CHANNEL_IN_RIGHT},
@@ -65,7 +72,7 @@
{ AUDIO_CHANNEL_IN_VOICE_DNLINK, AUDIO_CHANNEL_IN_VOICE_DNLINK }
};
-static uint32_t conversion_table_format[][2] = {
+uint32_t conversion_table_format[][2] = {
{ PA_SAMPLE_U8, AUDIO_FORMAT_PCM_8_BIT },
{ PA_SAMPLE_S16LE, AUDIO_FORMAT_PCM_16_BIT },
{ PA_SAMPLE_S32LE, AUDIO_FORMAT_PCM_32_BIT },
@@ -82,7 +89,7 @@
#endif
#define STRING_ENTRY(str) { str, #str }
/* Output devices */
-static struct string_conversion string_conversion_table_output_device[] = {
+struct string_conversion string_conversion_table_output_device[] = {
STRING_ENTRY(AUDIO_DEVICE_OUT_EARPIECE),
STRING_ENTRY(AUDIO_DEVICE_OUT_SPEAKER),
STRING_ENTRY(AUDIO_DEVICE_OUT_WIRED_HEADSET),
@@ -110,7 +117,7 @@
{ 0, NULL }
};
-static struct string_conversion string_conversion_table_output_device_fancy[] = {
+struct string_conversion string_conversion_table_output_device_fancy[] = {
{ AUDIO_DEVICE_OUT_EARPIECE, "output-earpiece" },
{ AUDIO_DEVICE_OUT_SPEAKER, "output-speaker" },
{ AUDIO_DEVICE_OUT_SPEAKER
@@ -137,7 +144,7 @@
};
/* Input devices */
-static struct string_conversion string_conversion_table_input_device[] = {
+struct string_conversion string_conversion_table_input_device[] = {
STRING_ENTRY(AUDIO_DEVICE_IN_COMMUNICATION),
STRING_ENTRY(AUDIO_DEVICE_IN_AMBIENT),
STRING_ENTRY(AUDIO_DEVICE_IN_BUILTIN_MIC),
@@ -153,7 +160,7 @@
{ 0, NULL }
};
-static struct string_conversion string_conversion_table_input_device_fancy[] = {
+struct string_conversion string_conversion_table_input_device_fancy[] = {
{ AUDIO_DEVICE_IN_COMMUNICATION, "input-in_communication" },
{ AUDIO_DEVICE_IN_AMBIENT, "input-ambient" },
{ AUDIO_DEVICE_IN_BUILTIN_MIC, "input-builtin_mic" },
@@ -170,7 +177,7 @@
};
/* Flags */
-static struct string_conversion string_conversion_table_flag[] = {
+struct string_conversion string_conversion_table_flag[] = {
STRING_ENTRY(AUDIO_OUTPUT_FLAG_NONE),
STRING_ENTRY(AUDIO_OUTPUT_FLAG_DIRECT),
STRING_ENTRY(AUDIO_OUTPUT_FLAG_PRIMARY),
@@ -184,7 +191,7 @@
};
/* Channels */
-static struct string_conversion string_conversion_table_output_channels[] = {
+struct string_conversion string_conversion_table_output_channels[] = {
STRING_ENTRY(AUDIO_CHANNEL_OUT_FRONT_LEFT),
STRING_ENTRY(AUDIO_CHANNEL_OUT_FRONT_RIGHT),
STRING_ENTRY(AUDIO_CHANNEL_OUT_FRONT_CENTER),
@@ -212,7 +219,7 @@
STRING_ENTRY(AUDIO_CHANNEL_OUT_ALL),
{ 0, NULL }
};
-static struct string_conversion string_conversion_table_input_channels[] = {
+struct string_conversion string_conversion_table_input_channels[] = {
STRING_ENTRY(AUDIO_CHANNEL_IN_LEFT),
STRING_ENTRY(AUDIO_CHANNEL_IN_RIGHT),
STRING_ENTRY(AUDIO_CHANNEL_IN_FRONT),
@@ -238,7 +245,7 @@
};
/* Formats */
-static struct string_conversion string_conversion_table_format[] = {
+struct string_conversion string_conversion_table_format[] = {
STRING_ENTRY(AUDIO_FORMAT_DEFAULT),
STRING_ENTRY(AUDIO_FORMAT_PCM),
STRING_ENTRY(AUDIO_FORMAT_MP3),
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-5.0.19.tar.bz2/src/droid/droid-util-42.h
^
|
@@ -24,9 +24,12 @@
#define HAL_V2
+#include <hardware/audio.h>
+#include <hardware_legacy/audio_policy_conf.h>
+
// PulseAudio value - Android value
-static uint32_t conversion_table_output_channel[][2] = {
+uint32_t conversion_table_output_channel[][2] = {
{ PA_CHANNEL_POSITION_MONO, AUDIO_CHANNEL_OUT_MONO },
{ PA_CHANNEL_POSITION_FRONT_LEFT, AUDIO_CHANNEL_OUT_FRONT_LEFT },
{ PA_CHANNEL_POSITION_FRONT_RIGHT, AUDIO_CHANNEL_OUT_FRONT_RIGHT},
@@ -48,7 +51,7 @@
{ PA_CHANNEL_POSITION_TOP_REAR_RIGHT, AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT }
};
-static uint32_t conversion_table_input_channel[][2] = {
+uint32_t conversion_table_input_channel[][2] = {
{ PA_CHANNEL_POSITION_MONO, AUDIO_CHANNEL_IN_MONO },
{ PA_CHANNEL_POSITION_FRONT_LEFT, AUDIO_CHANNEL_IN_LEFT },
{ PA_CHANNEL_POSITION_FRONT_RIGHT, AUDIO_CHANNEL_IN_RIGHT},
@@ -67,7 +70,7 @@
{ AUDIO_CHANNEL_IN_VOICE_DNLINK, AUDIO_CHANNEL_IN_VOICE_DNLINK }
};
-static uint32_t conversion_table_format[][2] = {
+uint32_t conversion_table_format[][2] = {
{ PA_SAMPLE_U8, AUDIO_FORMAT_PCM_8_BIT },
{ PA_SAMPLE_S16LE, AUDIO_FORMAT_PCM_16_BIT },
{ PA_SAMPLE_S32LE, AUDIO_FORMAT_PCM_32_BIT },
@@ -84,7 +87,7 @@
#endif
#define STRING_ENTRY(str) { str, #str }
/* Output devices */
-static struct string_conversion string_conversion_table_output_device[] = {
+struct string_conversion string_conversion_table_output_device[] = {
STRING_ENTRY(AUDIO_DEVICE_OUT_EARPIECE),
STRING_ENTRY(AUDIO_DEVICE_OUT_SPEAKER),
STRING_ENTRY(AUDIO_DEVICE_OUT_WIRED_HEADSET),
@@ -109,7 +112,7 @@
{ 0, NULL }
};
-static struct string_conversion string_conversion_table_output_device_fancy[] = {
+struct string_conversion string_conversion_table_output_device_fancy[] = {
{ AUDIO_DEVICE_OUT_EARPIECE, "output-earpiece" },
{ AUDIO_DEVICE_OUT_SPEAKER, "output-speaker" },
{ AUDIO_DEVICE_OUT_SPEAKER
@@ -133,7 +136,7 @@
/* Input devices */
#ifdef DROID_DEVICE_MAKO
-static struct string_conversion string_conversion_table_input_device[] = {
+struct string_conversion string_conversion_table_input_device[] = {
{ 0x10000, "AUDIO_DEVICE_IN_COMMUNICATION" },
{ 0x20000, "AUDIO_DEVICE_IN_AMBIENT" },
{ 0x40000, "AUDIO_DEVICE_IN_BUILTIN_MIC" },
@@ -147,7 +150,7 @@
{ 0, NULL }
};
-static struct string_conversion string_conversion_table_input_device_fancy[] = {
+struct string_conversion string_conversion_table_input_device_fancy[] = {
{ 0x10000, "input-communication" },
{ 0x20000, "input-ambient" },
{ 0x40000, "input-builtin_mic" },
@@ -160,7 +163,7 @@
{ 0, NULL }
};
#else
-static struct string_conversion string_conversion_table_input_device[] = {
+struct string_conversion string_conversion_table_input_device[] = {
STRING_ENTRY(AUDIO_DEVICE_IN_COMMUNICATION),
STRING_ENTRY(AUDIO_DEVICE_IN_AMBIENT),
STRING_ENTRY(AUDIO_DEVICE_IN_BUILTIN_MIC),
@@ -177,7 +180,7 @@
{ 0, NULL }
};
-static struct string_conversion string_conversion_table_input_device_fancy[] = {
+struct string_conversion string_conversion_table_input_device_fancy[] = {
{ AUDIO_DEVICE_IN_COMMUNICATION, "input-communication" },
{ AUDIO_DEVICE_IN_AMBIENT, "input-ambient" },
{ AUDIO_DEVICE_IN_BUILTIN_MIC, "input-builtin_mic" },
@@ -192,7 +195,7 @@
#endif
/* Flags */
-static struct string_conversion string_conversion_table_flag[] = {
+struct string_conversion string_conversion_table_flag[] = {
STRING_ENTRY(AUDIO_OUTPUT_FLAG_NONE),
STRING_ENTRY(AUDIO_OUTPUT_FLAG_DIRECT),
STRING_ENTRY(AUDIO_OUTPUT_FLAG_PRIMARY),
@@ -202,7 +205,7 @@
};
/* Channels */
-static struct string_conversion string_conversion_table_output_channels[] = {
+struct string_conversion string_conversion_table_output_channels[] = {
STRING_ENTRY(AUDIO_CHANNEL_OUT_FRONT_LEFT),
STRING_ENTRY(AUDIO_CHANNEL_OUT_FRONT_RIGHT),
STRING_ENTRY(AUDIO_CHANNEL_OUT_FRONT_CENTER),
@@ -230,7 +233,7 @@
STRING_ENTRY(AUDIO_CHANNEL_OUT_ALL),
{ 0, NULL }
};
-static struct string_conversion string_conversion_table_input_channels[] = {
+struct string_conversion string_conversion_table_input_channels[] = {
STRING_ENTRY(AUDIO_CHANNEL_IN_LEFT),
STRING_ENTRY(AUDIO_CHANNEL_IN_RIGHT),
STRING_ENTRY(AUDIO_CHANNEL_IN_FRONT),
@@ -252,7 +255,7 @@
};
/* Formats */
-static struct string_conversion string_conversion_table_format[] = {
+struct string_conversion string_conversion_table_format[] = {
STRING_ENTRY(AUDIO_FORMAT_DEFAULT),
STRING_ENTRY(AUDIO_FORMAT_PCM),
STRING_ENTRY(AUDIO_FORMAT_MP3),
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-5.0.19.tar.bz2/src/droid/droid-util-44.h
^
|
@@ -24,9 +24,16 @@
#define HAL_V2
+#ifdef DROID_DEVICE_HAMMERHEAD
+#define QCOM_HARDWARE
+#endif
+
+#include <hardware/audio.h>
+#include <hardware_legacy/audio_policy_conf.h>
+
// PulseAudio value - Android value
-static uint32_t conversion_table_output_channel[][2] = {
+uint32_t conversion_table_output_channel[][2] = {
{ PA_CHANNEL_POSITION_MONO, AUDIO_CHANNEL_OUT_MONO },
{ PA_CHANNEL_POSITION_FRONT_LEFT, AUDIO_CHANNEL_OUT_FRONT_LEFT },
{ PA_CHANNEL_POSITION_FRONT_RIGHT, AUDIO_CHANNEL_OUT_FRONT_RIGHT},
@@ -48,7 +55,7 @@
{ PA_CHANNEL_POSITION_TOP_REAR_RIGHT, AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT }
};
-static uint32_t conversion_table_input_channel[][2] = {
+uint32_t conversion_table_input_channel[][2] = {
{ PA_CHANNEL_POSITION_MONO, AUDIO_CHANNEL_IN_MONO },
{ PA_CHANNEL_POSITION_FRONT_LEFT, AUDIO_CHANNEL_IN_LEFT },
{ PA_CHANNEL_POSITION_FRONT_RIGHT, AUDIO_CHANNEL_IN_RIGHT},
@@ -67,7 +74,7 @@
{ AUDIO_CHANNEL_IN_VOICE_DNLINK, AUDIO_CHANNEL_IN_VOICE_DNLINK }
};
-static uint32_t conversion_table_format[][2] = {
+uint32_t conversion_table_format[][2] = {
{ PA_SAMPLE_U8, AUDIO_FORMAT_PCM_8_BIT },
{ PA_SAMPLE_S16LE, AUDIO_FORMAT_PCM_16_BIT },
{ PA_SAMPLE_S32LE, AUDIO_FORMAT_PCM_32_BIT },
@@ -84,7 +91,7 @@
#endif
#define STRING_ENTRY(str) { str, #str }
/* Output devices */
-static struct string_conversion string_conversion_table_output_device[] = {
+struct string_conversion string_conversion_table_output_device[] = {
STRING_ENTRY(AUDIO_DEVICE_OUT_EARPIECE),
STRING_ENTRY(AUDIO_DEVICE_OUT_SPEAKER),
STRING_ENTRY(AUDIO_DEVICE_OUT_WIRED_HEADSET),
@@ -110,7 +117,7 @@
{ 0, NULL }
};
-static struct string_conversion string_conversion_table_output_device_fancy[] = {
+struct string_conversion string_conversion_table_output_device_fancy[] = {
{ AUDIO_DEVICE_OUT_EARPIECE, "output-earpiece" },
{ AUDIO_DEVICE_OUT_SPEAKER, "output-speaker" },
{ AUDIO_DEVICE_OUT_SPEAKER
@@ -135,7 +142,7 @@
/* Input devices */
#ifdef DROID_DEVICE_HAMMERHEAD
-static struct string_conversion string_conversion_table_input_device[] = {
+struct string_conversion string_conversion_table_input_device[] = {
{ 0x10000, "AUDIO_DEVICE_IN_COMMUNICATION" },
{ 0x20000, "AUDIO_DEVICE_IN_AMBIENT" },
{ 0x40000, "AUDIO_DEVICE_IN_BUILTIN_MIC" },
@@ -149,7 +156,7 @@
{ 0, NULL }
};
-static struct string_conversion string_conversion_table_input_device_fancy[] = {
+struct string_conversion string_conversion_table_input_device_fancy[] = {
{ 0x10000, "input-communication" },
{ 0x20000, "input-ambient" },
{ 0x40000, "input-builtin_mic" },
@@ -162,7 +169,7 @@
{ 0, NULL }
};
#else
-static struct string_conversion string_conversion_table_input_device[] = {
+struct string_conversion string_conversion_table_input_device[] = {
STRING_ENTRY(AUDIO_DEVICE_IN_COMMUNICATION),
STRING_ENTRY(AUDIO_DEVICE_IN_AMBIENT),
STRING_ENTRY(AUDIO_DEVICE_IN_BUILTIN_MIC),
@@ -179,7 +186,7 @@
{ 0, NULL }
};
-static struct string_conversion string_conversion_table_input_device_fancy[] = {
+struct string_conversion string_conversion_table_input_device_fancy[] = {
{ AUDIO_DEVICE_IN_COMMUNICATION, "input-communication" },
{ AUDIO_DEVICE_IN_AMBIENT, "input-ambient" },
{ AUDIO_DEVICE_IN_BUILTIN_MIC, "input-builtin_mic" },
@@ -194,7 +201,7 @@
#endif
/* Flags */
-static struct string_conversion string_conversion_table_flag[] = {
+struct string_conversion string_conversion_table_flag[] = {
STRING_ENTRY(AUDIO_OUTPUT_FLAG_NONE),
STRING_ENTRY(AUDIO_OUTPUT_FLAG_DIRECT),
STRING_ENTRY(AUDIO_OUTPUT_FLAG_PRIMARY),
@@ -206,7 +213,7 @@
};
/* Channels */
-static struct string_conversion string_conversion_table_output_channels[] = {
+struct string_conversion string_conversion_table_output_channels[] = {
STRING_ENTRY(AUDIO_CHANNEL_OUT_FRONT_LEFT),
STRING_ENTRY(AUDIO_CHANNEL_OUT_FRONT_RIGHT),
STRING_ENTRY(AUDIO_CHANNEL_OUT_FRONT_CENTER),
@@ -234,7 +241,7 @@
STRING_ENTRY(AUDIO_CHANNEL_OUT_ALL),
{ 0, NULL }
};
-static struct string_conversion string_conversion_table_input_channels[] = {
+struct string_conversion string_conversion_table_input_channels[] = {
STRING_ENTRY(AUDIO_CHANNEL_IN_LEFT),
STRING_ENTRY(AUDIO_CHANNEL_IN_RIGHT),
STRING_ENTRY(AUDIO_CHANNEL_IN_FRONT),
@@ -257,7 +264,7 @@
};
/* Formats */
-static struct string_conversion string_conversion_table_format[] = {
+struct string_conversion string_conversion_table_format[] = {
STRING_ENTRY(AUDIO_FORMAT_DEFAULT),
STRING_ENTRY(AUDIO_FORMAT_PCM),
STRING_ENTRY(AUDIO_FORMAT_MP3),
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-5.0.19.tar.bz2/src/droid/droid-util.c
^
|
@@ -55,27 +55,8 @@
#include <pulsecore/shared.h>
#include <pulsecore/mutex.h>
-#include <hardware/audio.h>
-#include <hardware_legacy/audio_policy_conf.h>
-
#include "droid-util.h"
-#include <android-version.h>
-
-#ifndef ANDROID_VERSION_MAJOR
-#error "ANDROID_VERSION_* not defined."
-#endif
-
-#if ANDROID_VERSION_MAJOR == 4 && ANDROID_VERSION_MINOR == 1
-#include "droid-util-41qc.h"
-#elif ANDROID_VERSION_MAJOR == 4 && ANDROID_VERSION_MINOR == 2
-#include "droid-util-42.h"
-#elif ANDROID_VERSION_MAJOR == 4 && ANDROID_VERSION_MINOR == 4
-#include "droid-util-44.h"
-#else
-#error "No valid ANDROID_VERSION found."
-#endif
-
#define CONVERT_FUNC(TABL) \
bool pa_convert_ ## TABL (uint32_t value, pa_conversion_field_t field, uint32_t *to_value) { \
for (unsigned int i = 0; i < sizeof( conversion_table_ ## TABL )/(sizeof(uint32_t)*2); i++) { \
@@ -749,7 +730,6 @@
static void add_o_ports(pa_droid_mapping *am) {
pa_droid_port *p;
const char *name;
- char *desc;
uint32_t devices;
uint32_t combo_devices;
uint32_t i = 0;
@@ -999,7 +979,6 @@
pa_droid_hw_module *hw = NULL;
struct hw_module_t *hwmod = NULL;
audio_hw_device_t *device = NULL;
- char *shared_name;
int ret;
pa_assert(core);
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-5.0.19.tar.bz2/src/droid/droid-util.h
^
|
@@ -29,8 +29,21 @@
#include <pulsecore/macro.h>
#include <pulsecore/mutex.h>
-#include <hardware/audio.h>
-#include <hardware_legacy/audio_policy_conf.h>
+#include <android-version.h>
+
+#ifndef ANDROID_VERSION_MAJOR
+#error "ANDROID_VERSION_* not defined. Did you get your headers via extract-headers.sh?"
+#endif
+
+#if ANDROID_VERSION_MAJOR == 4 && ANDROID_VERSION_MINOR == 1
+#include "droid-util-41qc.h"
+#elif ANDROID_VERSION_MAJOR == 4 && ANDROID_VERSION_MINOR == 2
+#include "droid-util-42.h"
+#elif ANDROID_VERSION_MAJOR == 4 && ANDROID_VERSION_MINOR == 4
+#include "droid-util-44.h"
+#else
+#error "No valid ANDROID_VERSION found."
+#endif
#define PROP_DROID_DEVICES "droid.devices"
#define PROP_DROID_FLAGS "droid.flags"
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-5.0.19.tar.bz2/src/droid/module-droid-card.c
^
|
@@ -110,14 +110,21 @@
#define DEFAULT_AUDIO_POLICY_CONF "/system/etc/audio_policy.conf"
#define VOICE_CALL_PROFILE_NAME "voicecall"
#define VOICE_CALL_PROFILE_DESC "Call mode"
+#define VOICE_RECORD_PROFILE_NAME "voicecall-record"
+#define VOICE_RECORD_PROFILE_DESC "Call mode record"
#define RINGTONE_PROFILE_NAME "ringtone"
#define RINGTONE_PROFILE_DESC "Ringtone mode"
#define COMMUNICATION_PROFILE_NAME "communication"
#define COMMUNICATION_PROFILE_DESC "Communication mode"
+struct userdata;
+
+typedef bool (*virtual_profile_event_cb)(struct userdata *u, pa_droid_profile *p, bool enabling);
+
struct virtual_profile {
- pa_droid_profile *profile;
- audio_mode_t mode;
+ pa_card_profile *parent;
+ pa_card_profile *extension;
+ virtual_profile_event_cb event_cb;
};
struct userdata {
@@ -133,10 +140,8 @@
pa_droid_hw_module *hw_module;
pa_droid_card_data card_data;
- struct virtual_profile call_profile;
- struct virtual_profile comm_profile;
- struct virtual_profile ring_profile;
pa_droid_profile *old_profile;
+ pa_source *voicecall_source;
bool voice_source_routing;
@@ -146,6 +151,10 @@
struct profile_data {
pa_droid_profile *profile;
+ audio_mode_t mode;
+ bool virtual_profile;
+ /* Variables for virtual profiles: */
+ struct virtual_profile virtual;
};
static void add_disabled_profile(pa_hashmap *profiles) {
@@ -161,10 +170,13 @@
}
/* Special profile for calls */
-static pa_droid_profile* add_virtual_profile(struct userdata *u, const char *name, const char *description, pa_hashmap *profiles) {
+static pa_card_profile* add_virtual_profile(struct userdata *u, const char *name, const char *description,
+ audio_mode_t audio_mode, virtual_profile_event_cb event_cb,
+ pa_available_t available, pa_card_profile *extension_to,
+ pa_hashmap *profiles) {
pa_droid_profile *ap;
pa_card_profile *cp;
- struct profile_data *d;
+ struct profile_data *d, *ext;
pa_assert(u);
pa_assert(u->profile_set);
@@ -180,12 +192,23 @@
pa_hashmap_put(u->profile_set->profiles, ap->name, ap);
cp = pa_card_profile_new(ap->name, ap->description, sizeof(struct profile_data));
+ cp->available = available;
d = PA_CARD_PROFILE_DATA(cp);
d->profile = ap;
+ d->virtual_profile = true;
+ d->mode = audio_mode;
+ d->virtual.event_cb = event_cb;
+ d->virtual.extension = NULL;
+ if (extension_to) {
+ ext = PA_CARD_PROFILE_DATA(extension_to);
+ ext->virtual.extension = cp;
+ d->virtual.parent = extension_to;
+ } else
+ d->virtual.parent = NULL;
pa_hashmap_put(profiles, cp->name, cp);
- return ap;
+ return cp;
}
static void set_parameters_cb(pa_droid_card_data *card_data, const char *str) {
@@ -235,6 +258,7 @@
pa_log_debug("Card profile %s", ap->name);
cp = pa_card_profile_new(ap->name, ap->description, sizeof(struct profile_data));
+ cp->available = PA_AVAILABLE_YES;
cp->priority = ap->priority;
cp->n_sinks = 1;
@@ -248,6 +272,8 @@
d = PA_CARD_PROFILE_DATA(cp);
d->profile = ap;
+ d->virtual_profile = false;
+ d->mode = AUDIO_MODE_NORMAL;
pa_hashmap_put(h, cp->name, cp);
}
@@ -282,7 +308,7 @@
if (d->profile && d->profile->input) {
am = d->profile->input;
- am->source = pa_droid_source_new(u->module, u->modargs, __FILE__, &u->card_data, am, u->card);
+ am->source = pa_droid_source_new(u->module, u->modargs, __FILE__, (audio_devices_t) 0, &u->card_data, am, u->card);
}
}
@@ -328,11 +354,141 @@
pa_source_set_port(dp->input->source, PA_DROID_INPUT_PARKING, false);
}
+static bool voicecall_profile_event_cb(struct userdata *u, pa_droid_profile *p, bool enabling) {
+ pa_card_profile *cp;
+
+ pa_assert(u);
+ pa_assert(p);
+ pa_assert(u->old_profile);
+
+ /* call mode specialities */
+ if (enabling) {
+ pa_droid_sink_set_voice_control(u->old_profile->output->sink, true);
+ if (!u->voice_source_routing)
+ pa_droid_source_set_routing(u->old_profile->input->source, false);
+ if (u->old_profile->input->input->devices & AUDIO_DEVICE_IN_VOICE_CALL &&
+ (cp = pa_hashmap_get(u->card->profiles, VOICE_RECORD_PROFILE_NAME))) {
+ if (cp->available == PA_AVAILABLE_NO) {
+ pa_log_debug("Enable %s profile.", VOICE_RECORD_PROFILE_NAME);
+ pa_card_profile_set_available(cp, PA_AVAILABLE_YES);
+ }
+ }
+ } else {
+ pa_droid_sink_set_voice_control(u->old_profile->output->sink, false);
+ if (!u->voice_source_routing)
+ pa_droid_source_set_routing(u->old_profile->input->source, true);
+ if (u->old_profile->input->input->devices & AUDIO_DEVICE_IN_VOICE_CALL &&
+ (cp = pa_hashmap_get(u->card->profiles, VOICE_RECORD_PROFILE_NAME))) {
+ if (cp->available == PA_AVAILABLE_YES) {
+ pa_log_debug("Disable %s profile.", VOICE_RECORD_PROFILE_NAME);
+ pa_card_profile_set_available(cp, PA_AVAILABLE_NO);
+ }
+ }
+ }
+
+ return true;
+}
+
+static bool voicecall_record_profile_event_cb(struct userdata *u, pa_droid_profile *p, bool enabling) {
+ pa_queue *source_outputs = NULL;
+ pa_droid_mapping *am;
+
+ pa_assert(u);
+ pa_assert(p);
+ pa_assert(u->old_profile);
+
+ am = u->old_profile->input;
+
+ if (enabling) {
+ /* don't do anything if voicecall source has already been created. */
+ if (u->voicecall_source)
+ return true;
+
+ pa_log_info("Enabling voice call record.");
+
+ if (u->old_profile->input) {
+ am = u->old_profile->input;
+
+ if (am->source) {
+ source_outputs = pa_source_move_all_start(am->source, source_outputs);
+ pa_droid_source_free(am->source);
+ am->source = NULL;
+ }
+ }
+
+ u->voicecall_source = pa_droid_source_new(u->module, u->modargs, __FILE__, AUDIO_DEVICE_IN_VOICE_CALL, &u->card_data, am, u->card);
+ if (!u->voicecall_source)
+ pa_log("Failed to enable voice call recording.");
+
+ if (u->voicecall_source && source_outputs) {
+ pa_source_move_all_finish(u->voicecall_source, source_outputs, false);
+ source_outputs = NULL;
+ }
+
+ } else {
+ /* don't do anything if voicecall source has already been destroyed. */
+ if (!u->voicecall_source)
+ return true;
+
+ pa_log_info("Disabling voice call record.");
+
+ source_outputs = pa_source_move_all_start(u->voicecall_source, source_outputs);
+ pa_droid_source_free(u->voicecall_source);
+ u->voicecall_source = NULL;
+
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-5.0.19.tar.bz2/src/droid/module-droid-source.c
^
|
@@ -78,7 +78,7 @@
goto fail;
}
- if (!(m->userdata = pa_droid_source_new(m, ma, __FILE__, NULL, NULL, NULL)))
+ if (!(m->userdata = pa_droid_source_new(m, ma, __FILE__, (audio_devices_t) 0, NULL, NULL, NULL)))
goto fail;
pa_modargs_free(ma);
|