[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-jb2q.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-jb2q.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -6,7 +6,7 @@
<service name="tar_git">
<param name="url">https://github.com/mer-hybris/pulseaudio-modules-droid-jb2q.git</param>
<param name="branch">master</param>
- <param name="revision">aff7c90071064a72f58357487329d1b4d359b03b</param>
+ <param name="revision">6f3132dac04cc77800754b884096fca338969562</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-jb2q-14.2.100.tar.bz2/src/common/config-parser-xml.c
^
|
@@ -218,6 +218,12 @@
&element_parse_item
};
+/* Entries like
+ * <modules>
+ * <module name="primary"> <xi:include href="other.xml"/> </module>
+ * </modules>
+ * Where other.xml contains module elements
+ */
static const struct element_parser element_parse_module_include = {
ELEMENT_include,
parse_module_include,
@@ -226,11 +232,25 @@
NULL
};
+/* Entries like
+ * <modules>
+ * <xi:include href="other.xml"/>
+ * </modules>
+ * Where other.xml contains <module name="primary">...
+ */
+static const struct element_parser element_parse_modules_include = {
+ ELEMENT_include,
+ parse_module_include,
+ NULL,
+ NULL,
+ NULL
+};
+
static const struct element_parser element_parse_module = {
ELEMENT_module,
parse_module,
NULL,
- NULL,
+ &element_parse_modules_include,
&element_parse_module_include
};
@@ -1128,9 +1148,6 @@
SLLIST_FOREACH(data.current_include, data.conf->includes) {
char *fn = NULL;
- if (!data.current_include->module)
- continue;
-
if (data.current_include->href[0] != '/')
fn = build_path(filename, data.current_include->href);
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-jb2q-14.2.100.tar.bz2/src/common/droid-util.c
^
|
@@ -77,19 +77,21 @@
};
struct droid_quirk valid_quirks[] = {
- { "input_atoi", QUIRK_INPUT_ATOI },
- { "set_parameters", QUIRK_SET_PARAMETERS },
- { "close_input", QUIRK_CLOSE_INPUT },
- { "unload_no_close", QUIRK_UNLOAD_NO_CLOSE },
- { "no_hw_volume", QUIRK_NO_HW_VOLUME },
- { "output_make_writable", QUIRK_OUTPUT_MAKE_WRITABLE },
- { "realcall", QUIRK_REALCALL },
- { "unload_call_exit", QUIRK_UNLOAD_CALL_EXIT },
- { "output_fast", QUIRK_OUTPUT_FAST },
- { "output_deep_buffer", QUIRK_OUTPUT_DEEP_BUFFER },
- { "audio_cal_wait", QUIRK_AUDIO_CAL_WAIT },
- { "standby_set_route", QUIRK_STANDBY_SET_ROUTE },
- { "speaker_before_voice", QUIRK_SPEAKER_BEFORE_VOICE },
+ { "input_atoi", QUIRK_INPUT_ATOI },
+ { "set_parameters", QUIRK_SET_PARAMETERS },
+ { "close_input", QUIRK_CLOSE_INPUT },
+ { "unload_no_close", QUIRK_UNLOAD_NO_CLOSE },
+ { "no_hw_volume", QUIRK_NO_HW_VOLUME },
+ { "output_make_writable", QUIRK_OUTPUT_MAKE_WRITABLE },
+ { "realcall", QUIRK_REALCALL },
+ { "unload_call_exit", QUIRK_UNLOAD_CALL_EXIT },
+ { "output_fast", QUIRK_OUTPUT_FAST },
+ { "output_deep_buffer", QUIRK_OUTPUT_DEEP_BUFFER },
+ { "audio_cal_wait", QUIRK_AUDIO_CAL_WAIT },
+ { "standby_set_route", QUIRK_STANDBY_SET_ROUTE },
+ { "speaker_before_voice", QUIRK_SPEAKER_BEFORE_VOICE },
+ { "swap_headphone_speaker", QUIRK_SWAP_HEADPHONE_SPEAKER },
+ { "output_remix_to_mono", QUIRK_OUTPUT_REMIX_TO_MONO },
};
#define QUIRK_AUDIO_CAL_WAIT_S (10)
@@ -122,6 +124,8 @@
static int droid_set_parameters(pa_droid_hw_module *hw, const char *parameters);
static bool droid_set_audio_source(pa_droid_hw_module *hw_module, audio_source_t audio_source);
+static pa_droid_hw_module *hw_primary = NULL;
+
static pa_droid_profile *profile_new(pa_droid_profile_set *ps,
const pa_droid_config_hw_module *module,
const char *name,
@@ -445,15 +449,23 @@
devices = am->output->devices;
- /* IHF combo devices, these devices are combined with IHF */
- combo_devices = AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_WIRED_HEADPHONE;
+ /* IHF combo devices, these devices are combined with IHF, only if swap quirk is disabled. */
+ if (!pa_droid_quirk(hw_primary, QUIRK_SWAP_HEADPHONE_SPEAKER))
+ combo_devices = AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_WIRED_HEADPHONE;
while (devices) {
uint32_t cur_device = (1 << i++);
if (devices & cur_device) {
- pa_assert_se(pa_droid_output_port_name(cur_device, &name));
+ if (pa_droid_quirk(hw_primary, QUIRK_SWAP_HEADPHONE_SPEAKER) &&
+ cur_device & (AUDIO_DEVICE_OUT_WIRED_HEADPHONE | AUDIO_DEVICE_OUT_SPEAKER)) {
+ if (cur_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE)
+ pa_assert_se(pa_droid_output_port_name(AUDIO_DEVICE_OUT_SPEAKER, &name));
+ else /* cur_device & AUDIO_DEVICE_OUT_SPEAKER */
+ pa_assert_se(pa_droid_output_port_name(AUDIO_DEVICE_OUT_WIRED_HEADPHONE, &name));
+ } else
+ pa_assert_se(pa_droid_output_port_name(cur_device, &name));
if (!(p = pa_hashmap_get(am->profile_set->all_ports, name))) {
@@ -1056,9 +1068,10 @@
pa_assert_se(pa_shared_set(core, hw->shared_name, hw) >= 0);
- /* API for calling HAL functions from other modules. */
-
if (pa_streq(hw->module_id, PA_DROID_PRIMARY_DEVICE)) {
+ hw_primary = hw;
+
+ /* API for calling HAL functions from other modules. */
pa_shared_set(core, DROID_HW_HANDLE_V1, hw);
pa_shared_set(core, DROID_SET_PARAMETERS_V1, droid_set_parameters_v1_cb);
pa_shared_set(core, DROID_GET_PARAMETERS_V1, droid_get_parameters_v1_cb);
@@ -1188,6 +1201,9 @@
pa_idxset_free(hw->inputs, NULL);
}
+ if (hw_primary == hw)
+ hw_primary = NULL;
+
pa_xfree(hw);
}
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-jb2q-14.2.100.tar.bz2/src/common/include/droid/droid-util.h
^
|
@@ -84,6 +84,8 @@
QUIRK_AUDIO_CAL_WAIT,
QUIRK_STANDBY_SET_ROUTE,
QUIRK_SPEAKER_BEFORE_VOICE,
+ QUIRK_SWAP_HEADPHONE_SPEAKER,
+ QUIRK_OUTPUT_REMIX_TO_MONO,
QUIRK_COUNT
};
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-jb2q-14.2.100.tar.bz2/src/droid/droid-sink.c
^
|
@@ -86,6 +86,7 @@
pa_hook_slot *sink_unlink_hook_slot;
pa_hook_slot *sink_port_changed_hook_slot;
pa_sink *primary_stream_sink;
+ pa_time_event *refresh_time_event;
audio_devices_t primary_devices;
audio_devices_t extra_devices;
@@ -127,6 +128,8 @@
#define DEFAULT_VOICE_CONTROL_PROPERTY_KEY "media.role"
#define DEFAULT_VOICE_CONTROL_PROPERTY_VALUE "phone"
+#define REFRESH_TIME_US ((pa_usec_t) (10 * PA_USEC_PER_SEC))
+
static void parameter_free(droid_parameter_mapping *m);
static void userdata_free(struct userdata *u);
static void set_voice_volume(struct userdata *u, pa_sink_input *i);
@@ -281,9 +284,35 @@
u->write_time = pa_rtclock_now();
for (;;) {
- if (pa_droid_quirk(u->hw_module, QUIRK_OUTPUT_MAKE_WRITABLE))
+ if (pa_droid_quirk(u->hw_module, QUIRK_OUTPUT_MAKE_WRITABLE) ||
+ pa_droid_quirk(u->hw_module, QUIRK_OUTPUT_REMIX_TO_MONO)) {
pa_memchunk_make_writable(&c, c.length);
+ /* Naive implementation, only works for little-endian 16 bit samples
+ * and causes volume to drop by 6dB.
+ * Do mixing for speaker, headset and headphone only. */
+ if (pa_droid_quirk(u->hw_module, QUIRK_OUTPUT_REMIX_TO_MONO) &&
+ u->primary_devices & (AUDIO_DEVICE_OUT_SPEAKER |
+ AUDIO_DEVICE_OUT_WIRED_HEADSET |
+ AUDIO_DEVICE_OUT_WIRED_HEADPHONE)) {
+ size_t i;
+ void *dst;
+
+ dst = pa_memblock_acquire_chunk(&c);
+
+ for (i = 0; i < c.length; i += 4) {
+ int16_t *left = dst;
+ int16_t *right = dst + 2;
+
+ *left = *left / 2 + *right / 2;
+ *right = *left;
+ dst += 4;
+ }
+
+ pa_memblock_release(c.memblock);
+ }
+ }
+
p = pa_memblock_acquire_chunk(&c);
wrote = pa_droid_stream_write(u->stream, p, c.length);
pa_memblock_release(c.memblock);
@@ -1043,6 +1072,19 @@
return false;
}
+static void refresh_time_cb(pa_mainloop_api *a, pa_time_event *e, const struct timeval *t, void *userdata) {
+ struct userdata *u = userdata;
+
+ pa_assert(u->refresh_time_event);
+ pa_assert(u->refresh_time_event == e);
+
+ u->core->mainloop->time_free(u->refresh_time_event);
+ u->refresh_time_event = NULL;
+
+ /* Re-apply whatever route currently is active to HAL. */
+ do_routing(u);
+}
+
pa_sink *pa_droid_sink_new(pa_module *m,
pa_modargs *ma,
const char *driver,
@@ -1324,6 +1366,9 @@
pa_droid_stream_set_data(u->stream, u->sink);
pa_sink_put(u->sink);
+ if (pa_droid_quirk(u->hw_module, QUIRK_SWAP_HEADPHONE_SPEAKER) && pa_droid_stream_is_primary(u->stream))
+ u->refresh_time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + REFRESH_TIME_US, refresh_time_cb, u);
+
return u->sink;
fail:
@@ -1354,6 +1399,9 @@
static void userdata_free(struct userdata *u) {
+ if (u->refresh_time_event)
+ u->core->mainloop->time_free(u->refresh_time_event);
+
if (u->primary_stream_sink)
unset_primary_stream_sink(u);
|