[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<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">22be43a324fee369c488c7b6b12282b133b38b95</param>
+ <param name="revision">HEAD</param>
<param name="token"></param>
<param name="debian"></param>
<param name="dumb"></param>
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.86.tar.bz2/README
^
|
@@ -1,420 +0,0 @@
-PulseAudio Droid modules
-========================
-
-Building of droid modules is split to two packages
- * common (and common-devel) which contains shared library code for use in
- PulseAudio modules in this package and for inclusion in other projects
- * droid with actual PulseAudio modules
-
-Supported Android versions:
-
- * 4.1.x with Qualcomm extensions (tested with 4.1.2)
- * 4.2.x
- * 4.4.x
- * 5.x
- * 6.0.x
- * 7.x
- * 8.x
- * 9.x
-
-Headers for defining devices and strings for different droid versions are in
-src/common/droid-util-audio.h (legacy headers for Jolla 1 in droid-util-41qc.h).
-
-When new devices with relevant new enums appear, add enum check to configure.ac.
-CC_CHECK_DROID_ENUM macro will create macros HAVE_ENUM_FOO, STRING_ENTRY_IF_FOO
-and FANCY_ENTRY_IF_FOO if enum FOO exists in HAL audio.h.
-
-For example:
-
-# configure.ac:
- CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_IP])
- CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_OTHER_NEW])
-
-# and then in droid-util-audio.h add macros to proper tables:
- /* string_conversion_table_output_device[] */
- STRING_ENTRY_IF_OUT_IP
- STRING_ENTRY_IF_OUT_OTHER_NEW
-
- /* string_conversion_table_output_device_fancy[] */
- FANCY_ENTRY_IF_OUT_IP("output-ip")
- FANCY_ENTRY_IF_OUT_OTHER_NEW("output-other_new")
-
-In addition to the above macros there are also now defines
-HAVE_ENUM_AUDIO_DEVICE_OUT_IP and HAVE_ENUM_AUDIO_DEVICE_OUT_OTHER_NEW.
-
-The purpose of droid-modules is to "replace AudioFlinger". Many hardware
-adaptations use ALSA as the kernel interface, but there is no saying that
-someday vendor would create and use something proprietary or otherwise
-different from ALSA. Also the ALSA implementation in droid devices may contain
-funny ways to achieve things (notable example is voicecall) which might be
-difficult to do if interfacing directly with ALSA to replace AudioFlinger.
-Also using ALSA directly would mean that the whole HAL adaptation would need to
-be ported for each new device adaptation. With droid-modules this is much more
-simpler, with somewhat stable HAL (HALv3 as of now, also different vendors add
-their own incompatible extensions) API. In best scenarios using droid-modules
-with new device is just compiling against target.
-
-Components
-==========
-
-common
-------
-
-The common part of PulseAudio Droid modules contains library for handling
-most operations towards audio HAL.
-
-### Audio policy configuration parsing
-
-To populate our configuration structs there exists two parsers, legacy parser
-for old .conf format present in Android versions 7.0 and older and new xml
-format present from version 7.0 upwards. The legacy format is obsoleted in
-version 7.0 but by default still in use and most 7.0 adaptations probably
-contain the legacy format. But 8.0 adaptations and up start to include only
-the new style xml format configuration files.
-
-### Configuration files
-
-By default new style xml format is tried first and if it is not found old
-config is read next. If the configuration is in non-default location for
-some reason "config" module argument (available for all modules, card, sink,
-and source) can be used to point to the configuration file location.
-
-By default files are tried in following order,
-
- /odm/etc/audio_policy_configuration.xml (new xml format)
- /vendor/etc/audio/audio_policy_configuration.xml (new xml format)
- /vendor/etc/audio_policy_configuration.xml (new xml format)
- /vendor/etc/audio_policy.conf (legacy format)
- /system/etc/audio_policy_configuration.xml (new xml format)
- /system/etc/audio_policy.conf (legacy format)
-
-module-droid-card
------------------
-
-Ideally only module-droid-card is loaded and then droid-card loads
-configuration, creates profiles and loads sinks and sources based on the
-selected profile.
-
-default profile
----------------
-
-When module-droid-card is loaded with default arguments, droid-card will try
-to create a default profile (called surprisingly "default"). The default
-profile will try to merge useful output and input streams to one profile,
-to allow use of possible low latency or deep buffer outputs.
-
-For example configuration with
-
- audio_hw_modules {
- primary {
- outputs {
- primary {}
- deep_buffer {}
- }
- inputs {
- primary {}
- voice_rx {}
- }
- }
- other {
- ...
- }
- }
-
-The default profile would contain two sinks, sink.primary and sink.deep_buffer
-and one source, source.droid.
-
-Usually this default profile is everything that is needed in normal use, and
-additional profiles created should be needed only for testing things out etc.
-
-virtual profiles
-----------------
-
-In addition to aforementioned card profiles, droid-card creates some additional
-virtual profiles. These virtual profiles are used when enabling voicecall
-routings etc. When virtual profile is enabled, possible sinks and sources
-previously active profile had are not removed.
-
-As an illustration, following command line sequence enables voicecall mode and
-routes audio to internal handsfree (ihf - "handsfree speaker"):
-
-(Before starting, droid_card.primary is using profile primary-primary and
-sink.primary port output-speaker)
-
-pactl set-card-profile droid_card.primary voicecall
-pactl set-sink-port sink.primary output-parking
-pactl set-sink-port sink.primary output-speaker
-
-After this, when there is an active voicecall (created by ofono for example),
-voice audio starts to flow between modem and audio chip.
-
-To disable voicecall and return to media audio:
-
-pactl set-card-profile droid_card.primary primary-primary
-pactl set-sink-port sink.primary output-parking
-pactl set-sink-port sink.primary output-speaker
-
-With this example sequence sinks and sources are the ones from primary-primary
-card profile, and they are maintained for the whole duration of the voicecall
-and after.
-
-This sequence follows the droid HAL idea that when changing audio mode the mode
-change is done when next routing change happens. output-parking and
-input-parking ports are just convenience for PulseAudio, where setting already
-active port is a no-op (output/input-parking doesn't do any real routing
-changes).
-
-Current virtual profiles are:
- * voicecall
- * voicecall-record
- * communication
- * ringtone
-
-Communication profile is used for VoIP-like applications, to enable some
-voicecall related algorithms without being in voicecall. Ringtone profile
-should be used when ringtone is playing, to again enable possible loudness
-related optimizations etc. Voicecall-record profile can be enabled when
-voicecall profile is active.
-
-debugging profiles
-------------------
-
-If needed in favour of default profile one can opt to creating combinations
-of all output and input definitions in a module definition. This can be
-done by passing "default=false" to module-droid-card. Module argument
-module_id will then defines which module to load (by default "primary").
-Without default profile all input and output definitions are translated
-to PulseAudio card profiles. For example configuration with
-
- audio_hw_modules {
- primary {
- outputs {
- primary {}
- lpa {}
- }
- inputs {
- primary {}
- }
- }
- other {
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.86.tar.bz2/src/droid/module-droid-card-symdef.h
^
|
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2013-2018 Jolla Ltd.
- *
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
- *
- * These PulseAudio Modules are free software; you can redistribute
- * it and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation
- * version 2.1 of the License.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA.
- */
-#ifndef foomoduledroidcardsymdeffoo
-#define foomoduledroidcardsymdeffoo
-
-#include <pulsecore/core.h>
-#include <pulsecore/module.h>
-
-#define pa__init module_droid_card_LTX_pa__init
-#define pa__done module_droid_card_LTX_pa__done
-#define pa__get_author module_droid_card_LTX_pa__get_author
-#define pa__get_description module_droid_card_LTX_pa__get_description
-#define pa__get_usage module_droid_card_LTX_pa__get_usage
-#define pa__get_version module_droid_card_LTX_pa__get_version
-
-int pa__init(struct pa_module*m);
-void pa__done(struct pa_module*m);
-
-const char* pa__get_author(void);
-const char* pa__get_description(void);
-const char* pa__get_usage(void);
-const char* pa__get_version(void);
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.86.tar.bz2/src/droid/module-droid-sink-symdef.h
^
|
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2013-2018 Jolla Ltd.
- *
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
- *
- * These PulseAudio Modules are free software; you can redistribute
- * it and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation
- * version 2.1 of the License.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA.
- */
-#ifndef foomoduledroidsinksymdeffoo
-#define foomoduledroidsinksymdeffoo
-
-#include <pulsecore/core.h>
-#include <pulsecore/module.h>
-
-#define pa__init module_droid_sink_LTX_pa__init
-#define pa__done module_droid_sink_LTX_pa__done
-#define pa__get_author module_droid_sink_LTX_pa__get_author
-#define pa__get_description module_droid_sink_LTX_pa__get_description
-#define pa__get_usage module_droid_sink_LTX_pa__get_usage
-#define pa__get_version module_droid_sink_LTX_pa__get_version
-
-int pa__init(struct pa_module*m);
-void pa__done(struct pa_module*m);
-
-const char* pa__get_author(void);
-const char* pa__get_description(void);
-const char* pa__get_usage(void);
-const char* pa__get_version(void);
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.86.tar.bz2/src/droid/module-droid-source-symdef.h
^
|
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2013-2018 Jolla Ltd.
- *
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
- *
- * These PulseAudio Modules are free software; you can redistribute
- * it and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation
- * version 2.1 of the License.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA.
- */
-#ifndef foomoduledroidsourcesymdeffoo
-#define foomoduledroidsourcesymdeffoo
-
-#include <pulsecore/core.h>
-#include <pulsecore/module.h>
-
-#define pa__init module_droid_source_LTX_pa__init
-#define pa__done module_droid_source_LTX_pa__done
-#define pa__get_author module_droid_source_LTX_pa__get_author
-#define pa__get_description module_droid_source_LTX_pa__get_description
-#define pa__get_usage module_droid_source_LTX_pa__get_usage
-#define pa__get_version module_droid_source_LTX_pa__get_version
-
-int pa__init(struct pa_module*m);
-void pa__done(struct pa_module*m);
-
-const char* pa__get_author(void);
-const char* pa__get_description(void);
-const char* pa__get_usage(void);
-const char* pa__get_version(void);
-
-#endif
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.94.tar.bz2/README.md
^
|
@@ -0,0 +1,442 @@
+PulseAudio Droid modules
+========================
+
+Building of droid modules is split to two packages
+* **common** (and **common-devel**) which contains shared library code for use in
+ PulseAudio modules in this package and for inclusion in other projects
+* **droid** with actual PulseAudio modules
+
+Supported Android versions:
+
+* 4.1.x with Qualcomm extensions (tested with 4.1.2)
+* 4.2.x
+* 4.4.x
+* 5.x
+* 6.0.x
+* 7.x
+* 8.x
+* 9.x
+* 10.x
+
+Headers for defining devices and strings for different droid versions are in
+src/common/droid-util-audio.h (legacy headers for Jolla 1 in droid-util-41qc.h).
+
+When new devices with relevant new enums appear, add enum check to configure.ac.
+CC_CHECK_DROID_ENUM macro will create macros HAVE_ENUM_FOO, STRING_ENTRY_IF_FOO
+and FANCY_ENTRY_IF_FOO if enum FOO exists in HAL audio.h.
+
+For example:
+
+ # configure.ac:
+ CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_IP])
+ CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_OTHER_NEW])
+
+ # and then in droid-util-audio.h add macros to proper tables:
+ /* string_conversion_table_output_device[] */
+ STRING_ENTRY_IF_OUT_IP
+ STRING_ENTRY_IF_OUT_OTHER_NEW
+
+ /* string_conversion_table_output_device_fancy[] */
+ FANCY_ENTRY_IF_OUT_IP("output-ip")
+ FANCY_ENTRY_IF_OUT_OTHER_NEW("output-other_new")
+
+In addition to the above macros there are also now defines
+HAVE_ENUM_AUDIO_DEVICE_OUT_IP and HAVE_ENUM_AUDIO_DEVICE_OUT_OTHER_NEW.
+
+The purpose of droid-modules is to "replace AudioFlinger". Many hardware
+adaptations use ALSA as the kernel interface, but there is no saying that
+someday vendor would create and use something proprietary or otherwise
+different from ALSA. Also the ALSA implementation in droid devices may contain
+funny ways to achieve things (notable example is voicecall) which might be
+difficult to do if interfacing directly with ALSA to replace AudioFlinger.
+Also using ALSA directly would mean that the whole HAL adaptation would need to
+be ported for each new device adaptation. With droid-modules this is much more
+simpler, with somewhat stable HAL (HALv3 as of now, also different vendors add
+their own incompatible extensions) API. In best scenarios using droid-modules
+with new device is just compiling against target.
+
+Components
+==========
+
+common
+------
+
+The common part of PulseAudio Droid modules contains library for handling
+most operations towards audio HAL.
+
+### Audio policy configuration parsing
+
+To populate our configuration structs there exists two parsers, legacy parser
+for old .conf format present in Android versions 7.0 and older and new xml
+format present from version 7.0 upwards. The legacy format is obsoleted in
+version 7.0 but by default still in use and most 7.0 adaptations probably
+contain the legacy format. But 8.0 adaptations and up start to include only
+the new style xml format configuration files.
+
+### Configuration files
+
+By default new style xml format is tried first and if it is not found old
+config is read next. If the configuration is in non-default location for
+some reason "config" module argument (available for all modules, card, sink,
+and source) can be used to point to the configuration file location.
+
+By default files are tried in following order,
+
+ /odm/etc/audio_policy_configuration.xml (new xml format)
+ /vendor/etc/audio/audio_policy_configuration.xml (new xml format)
+ /vendor/etc/audio_policy_configuration.xml (new xml format)
+ /vendor/etc/audio_policy.conf (legacy format)
+ /system/etc/audio_policy_configuration.xml (new xml format)
+ /system/etc/audio_policy.conf (legacy format)
+
+module-droid-card
+-----------------
+
+Ideally only module-droid-card is loaded and then droid-card loads
+configuration, creates profiles and loads sinks and sources based on the
+selected profile.
+
+default profile
+---------------
+
+When module-droid-card is loaded with default arguments, droid-card will try
+to create a default profile (called surprisingly "default"). The default
+profile will try to merge useful output and input streams to one profile,
+to allow use of possible low latency or deep buffer outputs.
+
+For example configuration with
+
+ audio_hw_modules {
+ primary {
+ outputs {
+ primary {}
+ deep_buffer {}
+ }
+ inputs {
+ primary {}
+ voice_rx {}
+ }
+ }
+ other {
+ ...
+ }
+ }
+
+The default profile would contain two sinks, sink.primary and sink.deep_buffer
+and one source, source.droid.
+
+Usually this default profile is everything that is needed in normal use, and
+additional profiles created should be needed only for testing things out etc.
+
+virtual profiles
+----------------
+
+In addition to aforementioned card profiles, droid-card creates some additional
+virtual profiles. These virtual profiles are used when enabling voicecall
+routings etc. When virtual profile is enabled, possible sinks and sources
+previously active profile had are not removed.
+
+As an illustration, following command line sequence enables voicecall mode and
+routes audio to internal handsfree (ihf - "handsfree speaker"):
+
+(Before starting, droid_card.primary is using profile primary-primary and
+sink.primary port output-speaker)
+
+ pactl set-card-profile droid_card.primary voicecall
+ pactl set-sink-port sink.primary output-parking
+ pactl set-sink-port sink.primary output-speaker
+
+After this, when there is an active voicecall (created by ofono for example),
+voice audio starts to flow between modem and audio chip.
+
+To disable voicecall and return to media audio:
+
+ pactl set-card-profile droid_card.primary primary-primary
+ pactl set-sink-port sink.primary output-parking
+ pactl set-sink-port sink.primary output-speaker
+
+With this example sequence sinks and sources are the ones from primary-primary
+card profile, and they are maintained for the whole duration of the voicecall
+and after.
+
+This sequence follows the droid HAL idea that when changing audio mode the mode
+change is done when next routing change happens. output-parking and
+input-parking ports are just convenience for PulseAudio, where setting already
+active port is a no-op (output/input-parking doesn't do any real routing
+changes).
+
+Current virtual profiles are:
+* voicecall
+* voicecall-record
+* communication
+* ringtone
+
+Communication profile is used for VoIP-like applications, to enable some
+voicecall related algorithms without being in voicecall. Ringtone profile
+should be used when ringtone is playing, to again enable possible loudness
+related optimizations etc. Voicecall-record profile can be enabled when
+voicecall profile is active.
+
+debugging profiles
+------------------
+
+If needed in favour of default profile one can opt to creating combinations
+of all output and input definitions in a module definition. This can be
+done by passing "default=false" to module-droid-card. Module argument
+module_id will then defines which module to load (by default "primary").
+Without default profile all input and output definitions are translated
+to PulseAudio card profiles. For example configuration with
+
+ audio_hw_modules {
+ primary {
+ outputs {
+ primary {}
+ lpa {}
+ }
+ inputs {
+ primary {}
+ }
+ }
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.94.tar.bz2/src/common/conversion.c
^
|
@@ -140,6 +140,40 @@
case CONV_STRING_INPUT_FLAG:
return string_convert_num_to_str(string_conversion_table_input_flag, value, to_str);
+
+ case CONV_STRING_AUDIO_SOURCE_FANCY:
+ return string_convert_num_to_str(string_conversion_table_audio_source_fancy, value, to_str);
+ }
+
+ pa_assert_not_reached();
+ return false;
+}
+
+bool pa_string_convert_str_to_num(pa_conversion_string_t type, const char *str, uint32_t *to_value) {
+ switch (type) {
+ case CONV_STRING_FORMAT:
+ return string_convert_str_to_num(string_conversion_table_format, str, to_value);
+
+ case CONV_STRING_OUTPUT_CHANNELS:
+ return string_convert_str_to_num(string_conversion_table_output_channels, str, to_value);
+
+ case CONV_STRING_INPUT_CHANNELS:
+ return string_convert_str_to_num(string_conversion_table_input_channels, str, to_value);
+
+ case CONV_STRING_OUTPUT_DEVICE:
+ return string_convert_str_to_num(string_conversion_table_output_device, str, to_value);
+
+ case CONV_STRING_INPUT_DEVICE:
+ return string_convert_str_to_num(string_conversion_table_input_device, str, to_value);
+
+ case CONV_STRING_OUTPUT_FLAG:
+ return string_convert_str_to_num(string_conversion_table_output_flag, str, to_value);
+
+ case CONV_STRING_INPUT_FLAG:
+ return string_convert_str_to_num(string_conversion_table_input_flag, str, to_value);
+
+ case CONV_STRING_AUDIO_SOURCE_FANCY:
+ return string_convert_str_to_num(string_conversion_table_audio_source_fancy, str, to_value);
}
pa_assert_not_reached();
@@ -210,10 +244,6 @@
return string_convert_num_to_str(string_conversion_table_input_device_fancy, (uint32_t) value, to_str);
}
-bool pa_droid_audio_source_name(audio_source_t value, const char **to_str) {
- return string_convert_num_to_str(string_conversion_table_audio_source_fancy, (uint32_t) value, to_str);
-}
-
static int parse_list(const struct string_conversion *table,
const char *separator,
const char *str,
@@ -280,6 +310,10 @@
case CONV_STRING_INPUT_FLAG:
return parse_list(string_conversion_table_input_flag, separator, str, dst, unknown_entries);
+
+ /* Not handled in this context */
+ case CONV_STRING_AUDIO_SOURCE_FANCY:
+ return 0;
}
pa_assert_not_reached();
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.94.tar.bz2/src/common/droid-util.c
^
|
@@ -27,6 +27,10 @@
#include <signal.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <grp.h>
#ifdef HAVE_VALGRIND_MEMCHECK_H
#include <valgrind/memcheck.h>
@@ -37,6 +41,7 @@
#include <pulse/volume.h>
#include <pulse/xmalloc.h>
#include <pulse/direction.h>
+#include <pulse/util.h>
#include <pulsecore/core.h>
#include <pulsecore/core-error.h>
@@ -82,16 +87,36 @@
{ "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 },
};
+#define QUIRK_AUDIO_CAL_WAIT_S (10)
+#define QUIRK_AUDIO_CAL_FILE "/data/vendor/audio/cirrus_sony.cal"
+#define QUIRK_AUDIO_CAL_GROUP "audio"
+#define QUIRK_AUDIO_CAL_MODE (0664)
#define DEFAULT_PRIORITY (100)
#define DEFAULT_AUDIO_FORMAT (AUDIO_FORMAT_PCM_16_BIT)
+#ifndef AUDIO_PARAMETER_VALUE_ON
+#define AUDIO_PARAMETER_VALUE_ON "on"
+#endif
+
+#ifndef AUDIO_PARAMETER_VALUE_OFF
+#define AUDIO_PARAMETER_VALUE_OFF "off"
+#endif
+
+#define AUDIO_PARAMETER_BT_SCO_ON "BT_SCO=" AUDIO_PARAMETER_VALUE_ON
+#define AUDIO_PARAMETER_BT_SCO_OFF "BT_SCO=" AUDIO_PARAMETER_VALUE_OFF
+
static void droid_port_free(pa_droid_port *p);
static int input_stream_set_route(pa_droid_hw_module *hw_module, pa_droid_stream *s);
+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_profile *profile_new(pa_droid_profile_set *ps,
const pa_droid_config_hw_module *module,
@@ -685,30 +710,20 @@
pa_assert(hw);
- if (hw->quirks) {
- for (i = 0; i < sizeof(valid_quirks) / sizeof(struct droid_quirk); i++) {
- if (hw->quirks->enabled[i]) {
- pa_log_debug("Enabled quirks:");
- for (i = 0; i < sizeof(valid_quirks) / sizeof(struct droid_quirk); i++)
- if (hw->quirks->enabled[i])
- pa_log_debug(" %s", valid_quirks[i].name);
- return;
- }
+ for (i = 0; i < sizeof(valid_quirks) / sizeof(struct droid_quirk); i++) {
+ if (hw->quirks.enabled[i]) {
+ pa_log_debug("Enabled quirks:");
+ for (i = 0; i < sizeof(valid_quirks) / sizeof(struct droid_quirk); i++)
+ if (hw->quirks.enabled[i])
+ pa_log_debug(" %s", valid_quirks[i].name);
+ return;
}
}
}
-static pa_droid_quirks *get_quirks(pa_droid_quirks *q) {
- if (!q)
- q = pa_xnew0(pa_droid_quirks, 1);
-
- return q;
-}
-
static pa_droid_quirks *set_default_quirks(pa_droid_quirks *q) {
- q = NULL;
+ pa_assert(q);
- q = get_quirks(q);
q->enabled[QUIRK_CLOSE_INPUT] = true;
q->enabled[QUIRK_OUTPUT_FAST] = true;
q->enabled[QUIRK_OUTPUT_DEEP_BUFFER] = true;
@@ -729,19 +744,23 @@
return q;
}
-bool pa_droid_quirk_parse(pa_droid_hw_module *hw, const char *quirks) {
+bool pa_droid_quirk_parse(pa_droid_quirks *quirks, const char *quirks_def) {
char *quirk = NULL;
char *d;
const char *state = NULL;
- pa_assert(hw);
pa_assert(quirks);
- hw->quirks = get_quirks(hw->quirks);
+ memset(quirks, 0, sizeof(*quirks));
+ set_default_quirks(quirks);
+
+ if (!quirks_def)
+ return true;
- while ((quirk = pa_split(quirks, ",", &state))) {
+ while ((quirk = pa_split(quirks_def, ",", &state))) {
uint32_t i;
bool enable = false;
+ bool found = false;
if (strlen(quirk) < 2)
goto error;
@@ -756,17 +775,22 @@
goto error;
for (i = 0; i < sizeof(valid_quirks) / sizeof(struct droid_quirk); i++) {
- if (pa_streq(valid_quirks[i].name, d))
- hw->quirks->enabled[valid_quirks[i].value] = enable;
+ if (pa_streq(valid_quirks[i].name, d)) {
+ quirks->enabled[valid_quirks[i].value] = enable;
+ found = true;
+ }
}
+ if (!found)
+ goto error;
+
pa_xfree(quirk);
}
return true;
error:
- pa_log("Incorrect quirk definition \"%s\" (\"%s\")", quirk ? quirk : "<null>", quirks);
+ pa_log("Incorrect quirk definition \"%s\" (\"%s\")", quirk ? quirk : "<null>", quirks_def);
pa_xfree(quirk);
return false;
@@ -859,7 +883,68 @@
return pa_sprintf_malloc("droid-hardware-module-%s", module_id);
}
-static pa_droid_hw_module *droid_hw_module_open(pa_core *core, const pa_droid_config_audio *config, const char *module_id) {
+static void quirk_audio_cal(pa_droid_hw_module *hw, uint32_t flags) {
+ struct group *grp;
+
+ pa_assert(hw);
+
+ if (!pa_droid_quirk(hw, QUIRK_AUDIO_CAL_WAIT))
+ return;
+
+ if (access(QUIRK_AUDIO_CAL_FILE, F_OK) == 0) {
+ if (flags & AUDIO_OUTPUT_FLAG_PRIMARY) {
+ pa_log_info("Waiting for audio calibration to load.");
+ /* 1 second is enough, so let's double that. */
+ pa_msleep(2 * PA_MSEC_PER_SEC);
+ }
+ return;
+ }
+
+ pa_log_info("Waiting for audio calibration to finish... (%d seconds)", QUIRK_AUDIO_CAL_WAIT_S);
+
+ /* First wait until the calibration file appears on file system. */
+ for (int i = 0; i < QUIRK_AUDIO_CAL_WAIT_S; i++) {
+ pa_log_debug("%d...", QUIRK_AUDIO_CAL_WAIT_S - i);
+ pa_msleep(PA_MSEC_PER_SEC);
+ if (access(QUIRK_AUDIO_CAL_FILE, F_OK) == 0) {
+ pa_log_debug("Calibration file " QUIRK_AUDIO_CAL_FILE " appeared, wait one second more.");
+ /* Then wait for a bit more. */
+ pa_msleep(PA_MSEC_PER_SEC);
+ break;
+ }
+ }
+
+ if (access(QUIRK_AUDIO_CAL_FILE, F_OK) != 0)
+ goto fail;
+
+ if (!(grp = getgrnam(QUIRK_AUDIO_CAL_GROUP))) {
+ pa_log("couldn't get gid for " QUIRK_AUDIO_CAL_GROUP);
+ goto fail;
+ }
+
+ if (chown(QUIRK_AUDIO_CAL_FILE, getuid(), grp->gr_gid) < 0) {
+ pa_log("chown failed for " QUIRK_AUDIO_CAL_FILE);
+ goto fail;
+ }
+
+ if (chmod(QUIRK_AUDIO_CAL_FILE, QUIRK_AUDIO_CAL_MODE) < 0) {
+ pa_log("chmod failed for " QUIRK_AUDIO_CAL_FILE);
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.94.tar.bz2/src/common/include/droid/conversion.h
^
|
@@ -52,10 +52,12 @@
CONV_STRING_OUTPUT_DEVICE,
CONV_STRING_INPUT_DEVICE,
CONV_STRING_OUTPUT_FLAG,
- CONV_STRING_INPUT_FLAG
+ CONV_STRING_INPUT_FLAG,
+ CONV_STRING_AUDIO_SOURCE_FANCY,
} pa_conversion_string_t;
bool pa_string_convert_num_to_str(pa_conversion_string_t type, uint32_t value, const char **to_str);
+bool pa_string_convert_str_to_num(pa_conversion_string_t type, const char *str, uint32_t *to_value);
bool pa_convert_output_channel(uint32_t value, pa_conversion_field_t from, uint32_t *to_value);
bool pa_convert_input_channel(uint32_t value, pa_conversion_field_t from, uint32_t *to_value);
@@ -81,9 +83,6 @@
bool pa_droid_output_port_name(audio_devices_t value, const char **to_str);
bool pa_droid_input_port_name(audio_devices_t value, const char **to_str);
-/* Pretty audio source names */
-bool pa_droid_audio_source_name(audio_source_t value, const char **to_str);
-
int pa_conversion_parse_list(pa_conversion_string_t type, const char *separator,
const char *str, uint32_t *dst, char **unknown_entries);
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.94.tar.bz2/src/common/include/droid/droid-util.h
^
|
@@ -30,6 +30,7 @@
#include <pulsecore/mutex.h>
#include <pulsecore/strlist.h>
#include <pulsecore/atomic.h>
+#include <pulsecore/modargs.h>
#include <droid/version.h>
#include <droid/droid-config.h>
@@ -50,6 +51,8 @@
#define PROP_DROID_INPUT_BUILTIN "droid.input.builtin"
#define PROP_DROID_INPUT_EXTERNAL "droid.input.external"
+#define EXT_PROP_AUDIO_SOURCE "audio.source"
+
#define PA_DROID_PRIMARY_DEVICE "primary"
typedef struct pa_droid_hw_module pa_droid_hw_module;
@@ -67,6 +70,26 @@
PA_DROID_HOOK_MAX
} pa_droid_hook_t;
+enum pa_droid_quirk_type {
+ QUIRK_INPUT_ATOI,
+ QUIRK_SET_PARAMETERS,
+ QUIRK_CLOSE_INPUT,
+ QUIRK_UNLOAD_NO_CLOSE,
+ QUIRK_NO_HW_VOLUME,
+ QUIRK_OUTPUT_MAKE_WRITABLE,
+ QUIRK_REALCALL,
+ QUIRK_UNLOAD_CALL_EXIT,
+ QUIRK_OUTPUT_FAST,
+ QUIRK_OUTPUT_DEEP_BUFFER,
+ QUIRK_AUDIO_CAL_WAIT,
+ QUIRK_STANDBY_SET_ROUTE,
+ QUIRK_SPEAKER_BEFORE_VOICE,
+ QUIRK_COUNT
+};
+
+struct pa_droid_quirks {
+ bool enabled[QUIRK_COUNT];
+};
struct pa_droid_hw_module {
PA_REFCNT_DECLARE;
@@ -95,7 +118,7 @@
pa_atomic_t active_outputs;
- pa_droid_quirks *quirks;
+ pa_droid_quirks quirks;
/* Mode and input control */
struct _state {
@@ -217,27 +240,12 @@
#define PA_DROID_OUTPUT_PARKING "output-parking"
#define PA_DROID_INPUT_PARKING "input-parking"
-enum pa_droid_quirk_type {
- QUIRK_INPUT_ATOI,
- QUIRK_SET_PARAMETERS,
- QUIRK_CLOSE_INPUT,
- QUIRK_UNLOAD_NO_CLOSE,
- QUIRK_NO_HW_VOLUME,
- QUIRK_OUTPUT_MAKE_WRITABLE,
- QUIRK_REALCALL,
- QUIRK_UNLOAD_CALL_EXIT,
- QUIRK_OUTPUT_FAST,
- QUIRK_OUTPUT_DEEP_BUFFER,
- QUIRK_COUNT
-};
-
-struct pa_droid_quirks {
- bool enabled[QUIRK_COUNT];
-};
-
/* Open hardware module */
/* 'config' can be NULL if it is assumed that hw module with module_id already is open. */
pa_droid_hw_module *pa_droid_hw_module_get(pa_core *core, const pa_droid_config_audio *config, const char *module_id);
+/* First try to get already open hw module and if none found parse config and quirks from modargs
+ * and do initial open. */
+pa_droid_hw_module *pa_droid_hw_module_get2(pa_core *core, pa_modargs *ma, const char *module_id);
pa_droid_hw_module *pa_droid_hw_module_ref(pa_droid_hw_module *hw);
void pa_droid_hw_module_unref(pa_droid_hw_module *hw);
@@ -245,11 +253,11 @@
bool pa_droid_hw_module_try_lock(pa_droid_hw_module *hw);
void pa_droid_hw_module_unlock(pa_droid_hw_module *hw);
-bool pa_droid_quirk_parse(pa_droid_hw_module *hw, const char *quirks);
+bool pa_droid_quirk_parse(pa_droid_quirks *quirks, const char *quirks_def);
void pa_droid_quirk_log(pa_droid_hw_module *hw);
static inline bool pa_droid_quirk(pa_droid_hw_module *hw, enum pa_droid_quirk_type quirk) {
- return hw->quirks && hw->quirks->enabled[quirk];
+ return hw && hw->quirks.enabled[quirk];
}
bool pa_droid_hw_set_mode(pa_droid_hw_module *hw_module, audio_mode_t mode);
@@ -312,9 +320,15 @@
pa_droid_stream *pa_droid_open_input_stream(pa_droid_hw_module *hw_module,
const pa_sample_spec *default_sample_spec,
const pa_channel_map *default_channel_map);
+/* Test if reconfiguring of input stream is needed */
+bool pa_droid_stream_reconfigure_input_needed(pa_droid_stream *s,
+ const pa_sample_spec *requested_sample_spec,
+ const pa_channel_map *requested_channel_map,
+ const pa_proplist *proplist);
bool pa_droid_stream_reconfigure_input(pa_droid_stream *s,
const pa_sample_spec *requested_sample_spec,
- const pa_channel_map *requested_channel_map);
+ const pa_channel_map *requested_channel_map,
+ const pa_proplist *proplist);
bool pa_droid_hw_set_input_device(pa_droid_hw_module *hw_module,
audio_devices_t device);
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.94.tar.bz2/src/droid/Makefile.am
^
|
@@ -19,8 +19,6 @@
module-droid-source.la \
module-droid-card.la
-noinst_HEADERS = module-droid-sink-symdef.h module-droid-source-symdef.h module-droid-card-symdef.h
-
libdroid_sink_la_SOURCES = droid-sink.c droid-sink.h
libdroid_sink_la_LDFLAGS = -avoid-version -Wl,-z,noexecstack -lhybris-common
libdroid_sink_la_LIBADD = $(top_builddir)/src/common/libdroid-util.la $(AM_LIBADD)
@@ -34,14 +32,14 @@
module_droid_sink_la_SOURCES = module-droid-sink.c
module_droid_sink_la_LDFLAGS = -module -avoid-version -Wl,-z,noexecstack -lhybris-common
module_droid_sink_la_LIBADD = -lm libdroid-sink.la $(AM_LIBADD)
-module_droid_sink_la_CFLAGS = $(AM_CFLAGS)
+module_droid_sink_la_CFLAGS = $(AM_CFLAGS) -DPA_MODULE_NAME=module_droid_sink
module_droid_source_la_SOURCES = module-droid-source.c
module_droid_source_la_LDFLAGS = -module -avoid-version -Wl,-z,noexecstack -lhybris-common
module_droid_source_la_LIBADD = -lm libdroid-source.la $(AM_LIBADD)
-module_droid_source_la_CFLAGS = $(AM_CFLAGS)
+module_droid_source_la_CFLAGS = $(AM_CFLAGS) -DPA_MODULE_NAME=module_droid_source
module_droid_card_la_SOURCES = module-droid-card.c
module_droid_card_la_LDFLAGS = -module -avoid-version -Wl,-z,noexecstack -lhybris-common
module_droid_card_la_LIBADD = -lm libdroid-sink.la libdroid-source.la $(top_builddir)/src/common/libdroid-util.la $(AM_LIBADD)
-module_droid_card_la_CFLAGS = $(AM_CFLAGS)
+module_droid_card_la_CFLAGS = $(AM_CFLAGS) -DPA_MODULE_NAME=module_droid_card
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.94.tar.bz2/src/droid/droid-sink.c
^
|
@@ -54,6 +54,7 @@
#include <pulsecore/time-smoother.h>
#include <pulsecore/hashmap.h>
#include <pulsecore/core-subscribe.h>
+#include <pulse/util.h>
#include <pulse/version.h>
#include "droid-sink.h"
@@ -79,6 +80,7 @@
pa_usec_t write_time;
pa_usec_t write_threshold;
audio_devices_t prewrite_devices;
+ bool prewrite_always;
uint32_t prewrite_silence;
pa_hook_slot *sink_put_hook_slot;
pa_hook_slot *sink_unlink_hook_slot;
@@ -94,7 +96,6 @@
bool use_voice_volume;
char *voice_property_key;
char *voice_property_value;
- pa_sink_input *voice_control_sink_input;
pa_hook_slot *sink_input_volume_changed_hook_slot;
pa_hook_slot *sink_input_put_hook_slot;
@@ -129,6 +130,8 @@
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);
+static void apply_volume(pa_sink *s);
+static pa_sink_input *find_volume_control_sink_input(struct userdata *u);
static void set_primary_devices(struct userdata *u, audio_devices_t devices) {
pa_assert(u);
@@ -289,7 +292,7 @@
pa_memblockq_drop(u->memblockq, c.length);
pa_memblock_unref(c.memblock);
u->write_time = 0;
- pa_log("failed to write stream (%d)", wrote);
+ pa_log("failed to write stream (%zd)", wrote);
return -1;
}
@@ -391,6 +394,9 @@
if (pa_rtpoll_timer_elapsed(u->rtpoll)) {
pa_usec_t sleept = 0;
+ if (u->use_hw_volume)
+ pa_sink_volume_change_apply(u->sink, NULL);
+
thread_render(u);
thread_write(u);
@@ -398,6 +404,9 @@
sleept = u->buffer_time;
pa_rtpoll_set_timer_relative(u->rtpoll, sleept);
+
+ if (u->use_hw_volume)
+ pa_sink_volume_change_apply(u->sink, NULL);
}
} else
pa_rtpoll_set_timer_disabled(u->rtpoll);
@@ -455,9 +464,11 @@
pa_log_info("Resuming...");
+ apply_volume(u->sink);
+
if (u->prewrite_silence &&
(u->primary_devices | u->extra_devices) & u->prewrite_devices &&
- pa_droid_output_stream_any_active(u->stream) == 0) {
+ (u->prewrite_always || pa_droid_output_stream_any_active(u->stream) == 0)) {
for (i = 0; i < u->prewrite_silence; i++)
thread_write_silence(u);
}
@@ -523,14 +534,6 @@
*((pa_usec_t*) data) = pa_droid_stream_get_latency(u->stream);
return 0;
}
-
-#if PULSEAUDIO_VERSION < 12
- case PA_SINK_MESSAGE_SET_STATE: {
- int r;
- if ((r = sink_set_state_in_io_thread_cb(u->sink, PA_PTR_TO_UINT(data), 0)) < 0)
- return r;
- }
-#endif
}
return pa_sink_process_msg(o, code, data, offset, chunk);
@@ -561,30 +564,39 @@
return 0;
}
-static void sink_set_volume_cb(pa_sink *s) {
+static void apply_volume(pa_sink *s) {
struct userdata *u = s->userdata;
pa_cvolume r;
+ float val;
+
+ if (u->use_voice_volume)
+ return;
+
+ if (!u->use_hw_volume)
+ return;
/* Shift up by the base volume */
pa_sw_cvolume_divide_scalar(&r, &s->real_volume, s->base_volume);
- if (r.channels == 1) {
- float val = pa_sw_volume_to_linear(r.values[0]);
- pa_log_debug("Set %s hw volume %f", s->name, val);
- pa_droid_hw_module_lock(u->hw_module);
- if (u->stream->output->stream->set_volume(u->stream->output->stream, val, val) < 0)
- pa_log_warn("Failed to set hw volume.");
- pa_droid_hw_module_unlock(u->hw_module);
- } else if (r.channels == 2) {
- float val[2];
- for (unsigned i = 0; i < 2; i++)
- val[i] = pa_sw_volume_to_linear(r.values[i]);
- pa_log_debug("Set %s hw volume %f : %f", s->name, val[0], val[1]);
- pa_droid_hw_module_lock(u->hw_module);
- if (u->stream->output->stream->set_volume(u->stream->output->stream, val[0], val[1]) < 0)
- pa_log_warn("Failed to set hw volume.");
- pa_droid_hw_module_unlock(u->hw_module);
- }
+ /* So far every hal implementation doing volume control expects
+ * both channels to have equal value, so we can just average the value
+ * from all channels. */
+ val = pa_sw_volume_to_linear(pa_cvolume_avg(&r));
+
+ pa_log_debug("Set %s volume -> %f", s->name, val);
+ pa_droid_hw_module_lock(u->hw_module);
+ if (u->stream->output->stream->set_volume(u->stream->output->stream, val, val) < 0)
+ pa_log_warn("Failed to set volume.");
+ pa_droid_hw_module_unlock(u->hw_module);
+}
+
+static void sink_set_volume_cb(pa_sink *s) {
+ (void) s;
+ /* noop */
+}
+
+static void sink_write_volume_cb(pa_sink *s) {
+ apply_volume(s);
}
/* Called from main thread */
@@ -631,8 +643,10 @@
u->use_hw_volume ? "hardware" : "software", u->sink->name);
}
- if (u->use_hw_volume)
+ if (u->use_hw_volume) {
pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
+ pa_sink_set_write_volume_callback(u->sink, sink_write_volume_cb);
+ }
}
static void set_sink_name(pa_modargs *ma, pa_sink_new_data *data, const char *module_id) {
@@ -696,13 +710,8 @@
if (!u->use_voice_volume)
return PA_HOOK_OK;
- if (!u->voice_control_sink_input && sink_input_is_voice_control(u, sink_input))
- u->voice_control_sink_input = sink_input;
-
- if (u->voice_control_sink_input != sink_input)
- return PA_HOOK_OK;
-
- set_voice_volume(u, sink_input);
+ if (sink_input_is_voice_control(u, sink_input))
+ set_voice_volume(u, sink_input);
return PA_HOOK_OK;
}
@@ -734,29 +743,21 @@
pa_assert(!u->sink_input_volume_changed_hook_slot);
- if (u->use_hw_volume)
- pa_sink_set_set_volume_callback(u->sink, NULL);
-
u->sink_input_volume_changed_hook_slot = pa_hook_connect(&u->core->hooks[PA_CORE_HOOK_SINK_INPUT_VOLUME_CHANGED],
PA_HOOK_LATE+10, (pa_hook_cb_t) sink_input_volume_changed_hook_cb, u);
if ((i = find_volume_control_sink_input(u))) {
- u->voice_control_sink_input = i;
set_voice_volume(u, i);
}
} else {
pa_assert(u->sink_input_volume_changed_hook_slot);
- u->voice_control_sink_input = NULL;
pa_hook_slot_free(u->sink_input_volume_changed_hook_slot);
u->sink_input_volume_changed_hook_slot = NULL;
pa_log_debug("Using %s volume control with %s",
u->use_hw_volume ? "hardware" : "software", u->sink->name);
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.94.tar.bz2/src/droid/droid-source.c
^
|
@@ -51,6 +51,7 @@
#include <pulsecore/rtpoll.h>
#include <pulsecore/time-smoother.h>
#include <pulsecore/resampler.h>
+#include <pulse/util.h>
#include <pulse/version.h>
#include "droid-source.h"
@@ -93,6 +94,7 @@
static void source_reconfigure(struct userdata *u,
const pa_sample_spec *reconfigure_sample_spec,
const pa_channel_map *reconfigure_channel_map,
+ const pa_proplist *proplist,
audio_devices_t update_device);
/* Our droid source may be left in a state of not having an input stream
@@ -173,7 +175,7 @@
pa_memblock_release(chunk.memblock);
if (readd < 0) {
- pa_log("Failed to read from stream. (err %i)", readd);
+ pa_log("Failed to read from stream. (err %zd)", readd);
goto end;
}
@@ -324,23 +326,6 @@
return 0;
}
-/* Called from IO context */
-static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
-#if PULSEAUDIO_VERSION < 12
- struct userdata *u = PA_SOURCE(o)->userdata;
-
- switch (code) {
- case PA_SOURCE_MESSAGE_SET_STATE: {
- int r;
- if ((r = source_set_state_in_io_thread_cb(u->source, PA_PTR_TO_UINT(data), 0)) < 0)
- return r;
- }
- }
-#endif
-
- return pa_source_process_msg(o, code, data, offset, chunk);
-}
-
static int source_set_port_cb(pa_source *s, pa_device_port *p) {
struct userdata *u = s->userdata;
pa_droid_port_data *data;
@@ -363,7 +348,7 @@
if (!PA_SOURCE_IS_OPENED(u->source->state))
do_routing(u, data->device);
else
- source_reconfigure(u, NULL, NULL, data->device);
+ source_reconfigure(u, NULL, NULL, NULL, data->device);
return 0;
}
@@ -430,9 +415,9 @@
if (u->source_buffer_size) {
u->buffer_size = pa_droid_buffer_size_round_up(u->source_buffer_size, u->buffer_size);
- pa_log_info("Using buffer size %u (requested %u).", u->buffer_size, u->source_buffer_size);
+ pa_log_info("Using buffer size %zu (requested %zu).", u->buffer_size, u->source_buffer_size);
} else
- pa_log_info("Using buffer size %u.", u->buffer_size);
+ pa_log_info("Using buffer size %zu.", u->buffer_size);
if (pa_thread_mq_get())
pa_source_set_fixed_latency_within_thread(u->source, pa_bytes_to_usec(u->buffer_size, pa_droid_stream_sample_spec(u->stream)));
@@ -445,6 +430,7 @@
static void source_reconfigure(struct userdata *u,
const pa_sample_spec *reconfigure_sample_spec,
const pa_channel_map *reconfigure_channel_map,
+ const pa_proplist *proplist,
audio_devices_t update_device) {
pa_channel_map old_channel_map;
pa_sample_spec old_sample_spec;
@@ -469,7 +455,7 @@
if (update_device)
do_routing(u, update_device);
- if (pa_droid_stream_reconfigure_input(u->stream, &new_sample_spec, &new_channel_map))
+ if (pa_droid_stream_reconfigure_input(u->stream, &new_sample_spec, &new_channel_map, proplist))
pa_log_info("Source reconfigured.");
else
pa_log_info("Failed to reconfigure input stream, no worries, using defaults.");
@@ -503,8 +489,10 @@
if (new_data->source != u->source)
return PA_HOOK_OK;
- if (pa_sample_spec_equal(&new_data->sample_spec, pa_droid_stream_sample_spec(u->stream)) &&
- pa_channel_map_equal(&new_data->channel_map, pa_droid_stream_channel_map(u->stream)))
+ if (!pa_droid_stream_reconfigure_input_needed(u->stream,
+ &new_data->sample_spec,
+ &new_data->channel_map,
+ new_data->proplist))
return PA_HOOK_OK;
pa_log_info("New source-output connecting and our source needs to be reconfigured.");
@@ -516,10 +504,11 @@
source_reconfigure(u,
pa_droid_stream_sample_spec(primary_output),
pa_droid_stream_channel_map(primary_output),
+ new_data->proplist,
0);
} else
- source_reconfigure(u, &new_data->sample_spec, &new_data->channel_map, 0);
+ source_reconfigure(u, &new_data->sample_spec, &new_data->channel_map, new_data->proplist, 0);
return PA_HOOK_OK;
}
@@ -539,12 +528,12 @@
so = so_i;
}
- if (so) {
- if (!pa_sample_spec_equal(&so->sample_spec, pa_droid_stream_sample_spec(u->stream)) ||
- !pa_channel_map_equal(&so->channel_map, pa_droid_stream_channel_map(u->stream))) {
- pa_log_info("Source-output disconnected and our source needs to be reconfigured.");
- source_reconfigure(u, &so->sample_spec, &so->channel_map, 0);
- }
+ if (so && pa_droid_stream_reconfigure_input_needed(u->stream,
+ &so->sample_spec,
+ &so->channel_map,
+ so->proplist)) {
+ pa_log_info("Source-output disconnected and our source needs to be reconfigured.");
+ source_reconfigure(u, &so->sample_spec, &so->channel_map, so->proplist, 0);
}
}
@@ -574,7 +563,6 @@
pa_channel_map channel_map;
const char *format;
bool namereg_fail = false;
- pa_droid_config_audio *config = NULL; /* Only used when source is created without card */
uint32_t source_buffer = 0;
pa_assert(m);
@@ -650,20 +638,10 @@
pa_assert_se((u->hw_module = pa_droid_hw_module_get(u->core, NULL, card_data->module_id)));
} else {
/* Source wasn't created from inside card module, so we'll need to open
- * hw module ourself.
- *
- * First let's find out if hw module has already been opened, or if we need to
- * do it ourself. */
- if (!(u->hw_module = pa_droid_hw_module_get(u->core, NULL, module_id))) {
- if (!(config = pa_droid_config_load(ma)))
- goto fail;
-
- if (!(u->hw_module = pa_droid_hw_module_get(u->core, config, module_id)))
- goto fail;
+ * hw module ourself. */
- pa_droid_config_free(config);
- config = NULL;
- }
+ if (!(u->hw_module = pa_droid_hw_module_get2(u->core, ma, module_id)))
+ goto fail;
}
/* Default routing */
@@ -740,10 +718,8 @@
u->source->userdata = u;
- u->source->parent.process_msg = source_process_msg;
-#if PULSEAUDIO_VERSION >= 12
+ u->source->parent.process_msg = pa_source_process_msg;
u->source->set_state_in_io_thread = source_set_state_in_io_thread_cb;
-#endif
source_set_mute_control(u);
@@ -788,7 +764,6 @@
return u->source;
fail:
- pa_droid_config_free(config);
pa_xfree(thread_name);
if (u)
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.94.tar.bz2/src/droid/module-droid-card.c
^
|
@@ -64,8 +64,6 @@
#include "droid-sink.h"
#include "droid-source.h"
-#include "module-droid-card-symdef.h"
-
PA_MODULE_AUTHOR("Juho Hämäläinen");
PA_MODULE_DESCRIPTION("Droid card");
PA_MODULE_VERSION(PACKAGE_VERSION);
@@ -724,11 +722,9 @@
struct userdata *u = NULL;
pa_modargs *ma = NULL;
pa_card_new_data data;
- pa_droid_config_audio *config = NULL;
const char *module_id;
bool namereg_fail = false;
bool default_profile = true;
- const char *quirks;
pa_card_profile *voicecall = NULL;
pa_assert(m);
@@ -751,26 +747,8 @@
module_id = pa_modargs_get_value(ma, "module_id", DEFAULT_MODULE_ID);
- /* First let's find out if hw module has already been opened, or if we need to
- * do it ourself. */
- if (!(u->hw_module = pa_droid_hw_module_get(u->core, NULL, module_id))) {
- /* No hw module object in shared object db, let's open the module now. */
- if (!(config = pa_droid_config_load(ma)))
- goto fail;
-
- if (!(u->hw_module = pa_droid_hw_module_get(u->core, config, module_id)))
- goto fail;
-
- pa_droid_config_free(config);
- config = NULL;
- }
-
- if ((quirks = pa_modargs_get_value(ma, "quirks", NULL))) {
- if (!pa_droid_quirk_parse(u->hw_module, quirks)) {
- pa_log("Failed to parse quirks.");
- goto fail;
- }
- }
+ if (!(u->hw_module = pa_droid_hw_module_get2(u->core, ma, module_id)))
+ goto fail;
pa_droid_quirk_log(u->hw_module);
@@ -872,8 +850,6 @@
return 0;
fail:
- pa_droid_config_free(config);
-
if (ma)
pa_modargs_free(ma);
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.94.tar.bz2/src/droid/module-droid-sink.c
^
|
@@ -41,8 +41,6 @@
#include <droid/conversion.h>
#include "droid-sink.h"
-#include "module-droid-sink-symdef.h"
-
PA_MODULE_AUTHOR("Juho Hämäläinen");
PA_MODULE_DESCRIPTION("Droid sink");
PA_MODULE_USAGE("master_sink=<sink to connect to> "
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.94.tar.bz2/src/droid/module-droid-source.c
^
|
@@ -40,8 +40,6 @@
#include <droid/droid-util.h>
#include "droid-source.h"
-#include "module-droid-source-symdef.h"
-
PA_MODULE_AUTHOR("Juho Hämäläinen");
PA_MODULE_DESCRIPTION("Droid source");
PA_MODULE_USAGE("master_source=<source to connect to> "
|