[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid.spec
^
|
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.78+master.20190515084647.12.g96c4e2e.tar.bz2/src/common/config-parser-legacy.c
^
|
@@ -1,436 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdbool.h>
-#include <pulsecore/macro.h>
-#include <pulsecore/core-util.h>
-#include <pulsecore/core-error.h>
-#include <pulsecore/log.h>
-#include <pulse/xmalloc.h>
-
-#include <hardware_legacy/audio_policy_conf.h>
-
-#include "droid/version.h"
-#include "droid/droid-config.h"
-#include "droid/conversion.h"
-#include "droid/sllist.h"
-
-/* Section defining custom global configuration variables. */
-#define GLOBAL_CONFIG_EXT_TAG "custom_properties"
-
-#define GAIN_TAG_PREFIX "gain_"
-
-#define MAX_LINE_LENGTH (1024)
-#define WHITESPACE "\n\r \t"
-
-static void log_parse_error(const char *fn, const unsigned ln, const char *section, const char *v) {
- pa_log("[%s:%u] failed to parse line in section %s: unknown section (%s)", fn, ln, section, v);
-}
-
-pa_droid_config_audio *pa_parse_droid_audio_config_legacy(const char *filename) {
- pa_droid_config_audio *config = NULL;
- FILE *f;
- unsigned n = 0;
- bool ret = true;
- char *full_line = NULL;
- uint32_t hw_module_count = 0;
-
- enum config_loc {
- IN_ROOT = 0,
- IN_GLOBAL = 1,
- IN_GLOBAL_EXT = 2,
- IN_HW_MODULES = 3,
- IN_MODULE = 4,
- IN_OUTPUT_INPUT = 5,
- IN_CONFIG = 6,
- IN_MODULE_GLOBAL = 10,
- IN_DEVICES = 20,
- IN_DEVICES_DEVICE = 21,
- IN_GAINS = 22,
- IN_GAIN_N = 23
- } loc = IN_ROOT;
-
- bool in_output = true;
-
- pa_droid_config_hw_module *module = NULL;
- pa_droid_config_device *output = NULL;
- pa_droid_config_device *input = NULL;
-
- pa_assert(filename);
-
- f = fopen(filename, "r");
-
- if (!f) {
- pa_log_info("Failed to open config file (%s): %s", filename, pa_cstrerror(errno));
- ret = false;
- goto finish;
- }
-
- config = pa_xnew0(pa_droid_config_audio, 1);
- config->global_config = pa_xnew0(pa_droid_config_global, 1);
-
- pa_lock_fd(fileno(f), 1);
-
- full_line = pa_xmalloc0(sizeof(char) * MAX_LINE_LENGTH);
-
- while (!feof(f)) {
- char *ln, *d, *v, *value;
-
- if (!fgets(full_line, MAX_LINE_LENGTH, f))
- break;
-
- n++;
-
- pa_strip_nl(full_line);
-
- if (!*full_line)
- continue;
-
- ln = full_line + strspn(full_line, WHITESPACE);
-
- if (ln[0] == '#')
- continue;
-
- v = ln;
- d = v + strcspn(v, WHITESPACE);
-
- value = d + strspn(d, WHITESPACE);
- d[0] = '\0';
- d = value + strcspn(value, WHITESPACE);
- d[0] = '\0';
-
- /* Enter section */
- if (pa_streq(value, "{")) {
-
- if (!*v) {
- pa_log("[%s:%u] failed to parse line - too few words", filename, n);
- goto finish;
- }
-
- switch (loc) {
- case IN_ROOT:
- if (pa_streq(v, GLOBAL_CONFIG_TAG)) {
- loc = IN_GLOBAL;
- }
- else if (pa_streq(v, AUDIO_HW_MODULE_TAG))
- loc = IN_HW_MODULES;
- else {
- log_parse_error(filename, n, "<root>", v);
- ret = false;
- goto finish;
- }
- break;
-
- case IN_GLOBAL:
- if (pa_streq(v, GLOBAL_CONFIG_EXT_TAG))
- loc = IN_GLOBAL_EXT;
- else {
- log_parse_error(filename, n, GLOBAL_CONFIG_TAG, v);
- ret = false;
- goto finish;
- }
- break;
-
- case IN_HW_MODULES:
- pa_assert(!module);
-
- module = pa_droid_config_hw_module_new(config, v);
- SLLIST_APPEND(pa_droid_config_hw_module, config->hw_modules, module);
- hw_module_count++;
- loc = IN_MODULE;
- pa_log_debug("config: New module: %s", module->name);
- break;
-
- case IN_MODULE:
- pa_assert(module);
-
- if (pa_streq(v, OUTPUTS_TAG)) {
- loc = IN_OUTPUT_INPUT;
- in_output = true;
- } else if (pa_streq(v, INPUTS_TAG)) {
- loc = IN_OUTPUT_INPUT;
- in_output = false;
- } else if (pa_streq(v, GLOBAL_CONFIG_TAG)) {
- loc = IN_MODULE_GLOBAL;
- } else if (pa_streq(v, DEVICES_TAG)) {
- loc = IN_DEVICES;
- } else {
- log_parse_error(filename, n, module->name, v);
- ret = false;
- goto finish;
- }
- break;
-
- case IN_OUTPUT_INPUT:
- pa_assert(module);
-
- if (in_output) {
- output = pa_droid_config_device_new(module, PA_DIRECTION_OUTPUT, v);
- SLLIST_APPEND(pa_droid_config_device, module->outputs, output);
- loc = IN_CONFIG;
- pa_log_debug("config: %s: New output: %s", module->name, output->name);
- } else {
- input = pa_droid_config_device_new(module, PA_DIRECTION_INPUT, v);
- SLLIST_APPEND(pa_droid_config_device, module->inputs, input);
- loc = IN_CONFIG;
- pa_log_debug("config: %s: New input: %s", module->name, input->name);
- }
- break;
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.78+master.20190515084647.12.g96c4e2e.tar.bz2/src/common/config-parser-xml.c
^
|
@@ -1,1063 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <pulsecore/log.h>
-
-#include "droid/droid-config.h"
-
-#ifndef HAVE_EXPAT
-#include <unistd.h>
-pa_droid_config_audio *pa_parse_droid_audio_config_xml(const char *filename) {
- if (access(filename, F_OK) == 0)
- pa_log_warn("Could not parse %s, xml configuration parsing support not compiled in", filename);
- return NULL;
-}
-#else
-
-#include <stdarg.h>
-#include <string.h>
-#include <expat.h>
-
-#include <pulse/xmalloc.h>
-#include <pulsecore/core-util.h>
-#include <pulsecore/core-error.h>
-
-#include "droid/conversion.h"
-#include "droid/sllist.h"
-
-#ifdef XML_UNICODE_WCHAR_T
-# include <wchar.h>
-# define XML_FMT_STR "ls"
-#else
-# define XML_FMT_STR "s"
-#endif
-
-#define POLICY_SUPPORTED_VERSION "1.0"
-
-#define ELEMENT_audioPolicyConfiguration "audioPolicyConfiguration"
-#define ELEMENT_globalConfiguration "globalConfiguration"
-#define ELEMENT_modules "modules"
-#define ELEMENT_module "module"
-#define ELEMENT_attachedDevices "attachedDevices"
-#define ELEMENT_item "item"
-#define ELEMENT_defaultOutputDevice "defaultOutputDevice"
-#define ELEMENT_mixPorts "mixPorts"
-#define ELEMENT_mixPort "mixPort"
-#define ELEMENT_profile "profile"
-#define ELEMENT_devicePorts "devicePorts"
-#define ELEMENT_devicePort "devicePort"
-/* ELEMENT_profile */
-#define ELEMENT_routes "routes"
-#define ELEMENT_route "route"
-
-#define ATTRIBUTE_version "version"
-#define ATTRIBUTE_name "name"
-#define ATTRIBUTE_halVersion "halVersion"
-#define ATTRIBUTE_format "format"
-#define ATTRIBUTE_samplingRates "samplingRates"
-#define ATTRIBUTE_channelMasks "channelMasks"
-#define ATTRIBUTE_tagName "tagName"
-#define ATTRIBUTE_role "role"
-#define ATTRIBUTE_flags "flags"
-#define ATTRIBUTE_sink "sink"
-#define ATTRIBUTE_sources "sources"
-#define ATTRIBUTE_type "type"
-
-#define PORT_TYPE_sink "sink"
-#define PORT_TYPE_source "source"
-
-
-struct parser_data;
-
-struct element_parser {
- const char *name;
- bool (*attributes)(struct parser_data *data, const char *element_name, const XML_Char **attributes);
- void (*char_data)(struct parser_data *data, const char *str);
- const struct element_parser *next;
- const struct element_parser *child;
-};
-
-struct element_parser_stack {
- const struct element_parser *data;
- struct element_parser_stack *next;
-};
-
-#define ELEMENT_STACK_PUSH(_stack, _item) \
- do { \
- struct element_parser_stack *_i; \
- _i = pa_xmalloc0(sizeof(*_i)); \
- _i->data = _item; \
- _i->next = _stack; \
- _stack = _i; \
- } while(0)
-
-#define ELEMENT_STACK_POP(_stack, _item) \
- do { \
- if (_stack) { \
- struct element_parser_stack *_t; \
- _t = _stack; \
- _item = _stack->data; \
- _stack = _stack->next; \
- pa_xfree(_t); \
- } else \
- _item = NULL; \
- } while(0)
-
-static bool parse_audio_policy_configuration(struct parser_data *data, const char *element_name, const XML_Char **attributes);
-static bool parse_route(struct parser_data *data, const char *element_name, const XML_Char **attributes);
-static bool parse_profile(struct parser_data *data, const char *element_name, const XML_Char **attributes);
-static bool parse_device_port(struct parser_data *data, const char *element_name, const XML_Char **attributes);
-static bool parse_mix_port(struct parser_data *data, const char *element_name, const XML_Char **attributes);
-static void parse_default_output_device(struct parser_data *data, const char *str);
-static void parse_item(struct parser_data *data, const char *str);
-static bool parse_module(struct parser_data *data, const char *element_name, const XML_Char **attributes);
-static bool parse_global_configuration(struct parser_data *data, const char *element_name, const XML_Char **attributes);
-
-static const struct element_parser element_parse_route = {
- ELEMENT_route,
- parse_route,
- NULL,
- NULL,
- NULL
-};
-
-static const struct element_parser element_parse_routes = {
- ELEMENT_routes,
- NULL,
- NULL,
- NULL,
- &element_parse_route
-};
-
-static const struct element_parser element_parse_profile = {
- ELEMENT_profile,
- parse_profile,
- NULL,
- NULL,
- NULL
-};
-
-static const struct element_parser element_parse_device_port = {
- ELEMENT_devicePort,
- parse_device_port,
- NULL,
- NULL,
- &element_parse_profile
-};
-
-static const struct element_parser element_parse_device_ports = {
- ELEMENT_devicePorts,
- NULL,
- NULL,
- &element_parse_routes,
- &element_parse_device_port
-};
-
-static const struct element_parser element_parse_mix_port = {
- ELEMENT_mixPort,
- parse_mix_port,
- NULL,
- NULL,
- &element_parse_profile
-};
-
-static const struct element_parser element_parse_mix_ports = {
- ELEMENT_mixPorts,
- NULL,
- NULL,
- &element_parse_device_ports,
- &element_parse_mix_port
-};
-
-static const struct element_parser element_parse_default_output_device = {
- ELEMENT_defaultOutputDevice,
- NULL,
- parse_default_output_device,
- &element_parse_mix_ports,
- NULL
-};
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.78+master.20190515084647.12.g96c4e2e.tar.bz2/src/common/conversion.c
^
|
@@ -1,475 +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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "droid/version.h"
-#if ANDROID_VERSION_MAJOR == 4 && ANDROID_VERSION_MINOR == 1
-#include "droid-util-41qc.h"
-#else
-#include "droid-util-audio.h"
-#endif
-
-#include <pulsecore/core-util.h>
-
-#include <hardware/audio.h>
-
-#include "droid/conversion.h"
-#include "droid/droid-config.h"
-
-#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++) { \
- if ( conversion_table_ ## TABL [i][field] == value) { \
- *to_value = conversion_table_ ## TABL [i][!field]; \
- return true; \
- } \
- } \
- return false; \
-} struct __funny_extra_to_allow_semicolon
-
-/* Creates convert_format convert_channel etc.
- * bool pa_convert_func(uint32_t value, pa_conversion_field_t field, uint32_t *to_value);
- * return true if conversion succesful */
-CONVERT_FUNC(format);
-CONVERT_FUNC(output_channel);
-CONVERT_FUNC(input_channel);
-
-#define value_separator(legacy) (legacy ? "|" : ",")
-
-static bool string_convert_num_to_str(const struct string_conversion *list, const uint32_t value, const char **to_str) {
- pa_assert(list);
- pa_assert(to_str);
-
- for (unsigned int i = 0; list[i].str; i++) {
- if (list[i].value == value) {
- *to_str = list[i].str;
- return true;
- }
- }
- return false;
-}
-
-static bool string_convert_str_to_num(const struct string_conversion *list, const char *str, uint32_t *to_value) {
- pa_assert(list);
- pa_assert(str);
- pa_assert(to_value);
-
- for (unsigned int i = 0; list[i].str; i++) {
- if (pa_streq(list[i].str, str)) {
- *to_value = list[i].value;
- return true;
- }
- }
- return false;
-}
-
-static char *list_string(struct string_conversion *list, uint32_t flags) {
- char *str = NULL;
- char *tmp;
-
-#if AUDIO_API_VERSION_MAJ >= 2
- if (flags & AUDIO_DEVICE_BIT_IN)
- flags &= ~AUDIO_DEVICE_BIT_IN;
-#endif
-
- for (unsigned int i = 0; list[i].str; i++) {
-#if AUDIO_API_VERSION_MAJ >= 2
- if (list[i].value & AUDIO_DEVICE_BIT_IN) {
- if (popcount(list[i].value & ~AUDIO_DEVICE_BIT_IN) != 1)
- continue;
- } else
-#endif
- if (popcount(list[i].value) != 1)
- continue;
-
- if (flags & list[i].value) {
- if (str) {
- tmp = pa_sprintf_malloc("%s|%s", str, list[i].str);
- pa_xfree(str);
- str = tmp;
- } else {
- str = pa_sprintf_malloc("%s", list[i].str);
- }
- }
- }
-
- return str;
-}
-
-
-/* Output device */
-bool pa_string_convert_output_device_num_to_str(audio_devices_t value, const char **to_str) {
- return string_convert_num_to_str(string_conversion_table_output_device, (uint32_t) value, to_str);
-}
-
-bool pa_string_convert_output_device_str_to_num(const char *str, audio_devices_t *to_value) {
- return string_convert_str_to_num(string_conversion_table_output_device, str, (uint32_t*) to_value);
-}
-
-char *pa_list_string_output_device(audio_devices_t devices) {
- return list_string(string_conversion_table_output_device, devices);
-}
-
-/* Input device */
-bool pa_string_convert_input_device_num_to_str(audio_devices_t value, const char **to_str) {
- return string_convert_num_to_str(string_conversion_table_input_device, (uint32_t) value, to_str);
-}
-
-bool pa_string_convert_input_device_str_to_num(const char *str, audio_devices_t *to_value) {
- return string_convert_str_to_num(string_conversion_table_input_device, str, (uint32_t*) to_value);
-}
-
-char *pa_list_string_input_device(audio_devices_t devices) {
- return list_string(string_conversion_table_input_device, devices);
-}
-
-/* Flags */
-bool pa_string_convert_flag_num_to_str(audio_output_flags_t value, const char **to_str) {
- return string_convert_num_to_str(string_conversion_table_output_flag, (uint32_t) value, to_str);
-}
-
-bool pa_string_convert_flag_str_to_num(const char *str, audio_output_flags_t *to_value) {
- return string_convert_str_to_num(string_conversion_table_output_flag, str, (uint32_t*) to_value);
-}
-
-char *pa_list_string_flags(audio_output_flags_t flags) {
- return list_string(string_conversion_table_output_flag, flags);
-}
-
-bool pa_input_device_default_audio_source(audio_devices_t input_device, audio_source_t *default_source)
-{
-#if AUDIO_API_VERSION_MAJ >= 2
- input_device &= ~AUDIO_DEVICE_BIT_IN;
-#endif
-
- /* Note converting HAL values to different HAL values! */
- for (unsigned int i = 0; i < sizeof(conversion_table_default_audio_source) / (sizeof(uint32_t) * 2); i++) {
- if (conversion_table_default_audio_source[i][0] & input_device) {
- *default_source = conversion_table_default_audio_source[i][1];
- return true;
- }
- }
- return false;
-}
-
-
-bool pa_droid_output_port_name(audio_devices_t value, const char **to_str) {
- return string_convert_num_to_str(string_conversion_table_output_device_fancy, (uint32_t) value, to_str);
-}
-
-bool pa_droid_input_port_name(audio_devices_t value, const char **to_str) {
- 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,
- uint32_t *dst,
- char **unknown_entries) {
- int count = 0;
- char *entry;
- char *unknown = NULL;
- const char *state = NULL;
-
- pa_assert(table);
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.78+master.20190515084647.12.g96c4e2e.tar.bz2/src/common/droid-config.c
^
|
@@ -1,243 +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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "droid/version.h"
-#include "droid/droid-config.h"
-#include "droid/sllist.h"
-
-#include <signal.h>
-#include <stdio.h>
-#include <string.h>
-#include <strings.h>
-
-#ifdef HAVE_VALGRIND_MEMCHECK_H
-#include <valgrind/memcheck.h>
-#endif
-
-#include <pulse/rtclock.h>
-#include <pulse/timeval.h>
-#include <pulse/volume.h>
-#include <pulse/xmalloc.h>
-
-#include <pulsecore/core.h>
-#include <pulsecore/core-error.h>
-#include <pulsecore/i18n.h>
-#include <pulsecore/module.h>
-#include <pulsecore/memchunk.h>
-#include <pulsecore/sink.h>
-#include <pulsecore/modargs.h>
-#include <pulsecore/core-rtclock.h>
-#include <pulsecore/core-util.h>
-#include <pulsecore/sample-util.h>
-#include <pulsecore/log.h>
-#include <pulsecore/macro.h>
-#include <pulsecore/thread.h>
-#include <pulsecore/thread-mq.h>
-#include <pulsecore/rtpoll.h>
-#include <pulsecore/time-smoother.h>
-#include <pulsecore/refcnt.h>
-#include <pulsecore/shared.h>
-#include <pulsecore/mutex.h>
-#include <pulsecore/strlist.h>
-#include <pulsecore/atomic.h>
-
-#include <hardware/audio.h>
-#include <hardware_legacy/audio_policy_conf.h>
-
-#define VENDOR_AUDIO_POLICY_CONFIG_XML_FILE "/vendor/etc/audio_policy_configuration.xml"
-#define SYSTEM_AUDIO_POLICY_CONFIG_XML_FILE "/system/etc/audio_policy_configuration.xml"
-
-
-pa_droid_config_audio *pa_droid_config_load(pa_modargs *ma) {
- pa_droid_config_audio *config = NULL;
- const char *manual_config;
- const char *config_location[] = {
- VENDOR_AUDIO_POLICY_CONFIG_XML_FILE,
- AUDIO_POLICY_VENDOR_CONFIG_FILE,
- SYSTEM_AUDIO_POLICY_CONFIG_XML_FILE,
- AUDIO_POLICY_CONFIG_FILE,
- NULL};
-
- pa_assert(ma);
-
- if ((manual_config = pa_modargs_get_value(ma, "config", NULL))) {
- if (!(config = pa_parse_droid_audio_config(manual_config)))
- pa_log("Failed to parse configuration from %s", manual_config);
- } else {
- int i;
- for (i = 0; config_location[i]; i++) {
- if ((config = pa_parse_droid_audio_config(config_location[i])))
- break;
- else
- pa_log_debug("Failed to parse configuration from %s", config_location[i]);
- }
-
- }
-
- if (!config)
- pa_log("Failed to parse any configuration.");
-
- return config;
-}
-
-pa_droid_config_audio *pa_droid_config_dup(const pa_droid_config_audio *config) {
- pa_droid_config_audio *config_copy;
- pa_droid_config_hw_module *module, *module_copy;
- pa_droid_config_device *device, *device_copy;
-
- pa_assert(config);
-
- config_copy = pa_xnew0(pa_droid_config_audio, 1);
-
- if (config->global_config)
- config_copy->global_config = pa_xmemdup(config->global_config, sizeof(*config->global_config));
-
- SLLIST_FOREACH(module, config->hw_modules) {
- module_copy = pa_droid_config_hw_module_new(config_copy, module->name);
- if (module->global_config)
- module_copy->global_config = pa_xmemdup(module->global_config, sizeof(*module->global_config));
-
- SLLIST_FOREACH(device, module->outputs) {
- device_copy = pa_xmemdup(device, sizeof(*device));
- device_copy->module = module_copy;
- device_copy->name = pa_xstrdup(device->name);
- SLLIST_APPEND(pa_droid_config_device, module_copy->outputs, device_copy);
- }
-
- SLLIST_FOREACH(device, module->inputs) {
- device_copy = pa_xmemdup(device, sizeof(*device));
- device_copy->module = module_copy;
- device_copy->name = pa_xstrdup(device->name);
- SLLIST_APPEND(pa_droid_config_device, module_copy->inputs, device_copy);
- }
-
- SLLIST_APPEND(pa_droid_config_hw_module, config_copy->hw_modules, module_copy);
- }
-
- return config_copy;
-}
-
-pa_droid_config_audio *pa_parse_droid_audio_config(const char *filename) {
- const char *suffix;
-
- pa_assert(filename);
-
- if ((suffix = rindex(filename, '.'))) {
- if (strlen(suffix) == 4 && pa_streq(suffix, ".xml"))
- return pa_parse_droid_audio_config_xml(filename);
- else if (strlen(suffix) == 5 && pa_streq(suffix, ".conf"))
- return pa_parse_droid_audio_config_legacy(filename);
- }
-
- return NULL;
-}
-
-void pa_droid_config_free(pa_droid_config_audio *config) {
- pa_droid_config_hw_module *module;
- pa_droid_config_device *device;
-
- if (!config)
- return;
-
- while (config->hw_modules) {
- SLLIST_STEAL_FIRST(module, config->hw_modules);
-
- while (module->outputs) {
- SLLIST_STEAL_FIRST(device, module->outputs);
- pa_droid_config_device_free(device);
- }
-
- while (module->inputs) {
- SLLIST_STEAL_FIRST(device, module->inputs);
- pa_droid_config_device_free(device);
- }
-
- pa_droid_config_hw_module_free(module);
- }
-
- pa_xfree(config->global_config);
- pa_xfree(config);
-}
-
-const pa_droid_config_hw_module *pa_droid_config_find_module(const pa_droid_config_audio *config, const char* module_id) {
- pa_droid_config_hw_module *module;
-
- pa_assert(config);
- pa_assert(module_id);
-
- SLLIST_FOREACH(module, config->hw_modules) {
- if (pa_streq(module_id, module->name))
- return module;
- }
-
- return NULL;
-}
-
-pa_droid_config_hw_module *pa_droid_config_hw_module_new(const pa_droid_config_audio *config, const char *name) {
- pa_droid_config_hw_module *hw_module;
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.78+master.20190515084647.12.g96c4e2e.tar.bz2/src/common/include/droid/conversion.h
^
|
@@ -1,112 +0,0 @@
-#ifndef foodroidconversionfoo
-#define foodroidconversionfoo
-
-/*
- * Copyright (C) 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <pulsecore/modargs.h>
-
-#include <hardware/audio.h>
-
-/* From recent audio_policy_conf.h */
-#ifndef AUDIO_HAL_VERSION_TAG
-#define AUDIO_HAL_VERSION_TAG "audio_hal_version"
-#endif
-#ifndef GAINS_TAG
-#define GAINS_TAG "gains"
-#endif
-
-#include <droid/version.h>
-#include <droid/droid-config.h>
-
-typedef enum {
- CONV_FROM_PA,
- CONV_FROM_HAL
-} pa_conversion_field_t;
-
-typedef enum {
- CONV_STRING_FORMAT,
- CONV_STRING_OUTPUT_CHANNELS,
- CONV_STRING_INPUT_CHANNELS,
- CONV_STRING_OUTPUT_DEVICE,
- CONV_STRING_INPUT_DEVICE,
- CONV_STRING_OUTPUT_FLAG,
- CONV_STRING_INPUT_FLAG
-} pa_conversion_string_t;
-
-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);
-bool pa_convert_format(uint32_t value, pa_conversion_field_t from, uint32_t *to_value);
-
-bool pa_string_convert_output_device_num_to_str(audio_devices_t value, const char **to_str);
-bool pa_string_convert_output_device_str_to_num(const char *str, audio_devices_t *to_value);
-bool pa_string_convert_input_device_num_to_str(audio_devices_t value, const char **to_str);
-bool pa_string_convert_input_device_str_to_num(const char *str, audio_devices_t *to_value);
-
-bool pa_string_convert_flag_num_to_str(audio_output_flags_t value, const char **to_str);
-bool pa_string_convert_flag_str_to_num(const char *str, audio_output_flags_t *to_value);
-
-char *pa_list_string_output_device(audio_devices_t devices);
-char *pa_list_string_input_device(audio_devices_t devices);
-char *pa_list_string_flags(audio_output_flags_t flags);
-
-/* Get default audio source associated with input device.
- * Return true if default source was found. */
-bool pa_input_device_default_audio_source(audio_devices_t input_device, audio_source_t *default_source);
-
-/* Pretty port names */
-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);
-
-bool pa_conversion_parse_sampling_rates(const char *fn, const unsigned ln,
- const char *str, bool legacy,
- uint32_t sampling_rates[AUDIO_MAX_SAMPLING_RATES]);
-bool pa_conversion_parse_formats(const char *fn, const unsigned ln,
- const char *str, bool legacy,
- audio_format_t *formats);
-bool pa_conversion_parse_output_channels(const char *fn, const unsigned ln,
- const char *str, bool legacy,
- audio_channel_mask_t *channels);
-bool pa_conversion_parse_input_channels(const char *fn, const unsigned ln,
- const char *str, bool legacy,
- audio_channel_mask_t *channels);
-bool pa_conversion_parse_output_devices(const char *fn, const unsigned ln,
- char *str, bool legacy, bool must_recognize_all,
- audio_devices_t *devices);
-bool pa_conversion_parse_input_devices(const char *fn, const unsigned ln,
- char *str, bool legacy, bool must_recognize_all,
- audio_devices_t *devices);
-bool pa_conversion_parse_output_flags(const char *fn, const unsigned ln,
- const char *str, audio_output_flags_t *flags);
-bool pa_conversion_parse_input_flags(const char *fn, const unsigned ln,
- const char *str, uint32_t *flags);
-bool pa_conversion_parse_version(const char *fn, const unsigned ln, const char *str, uint32_t *version);
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.78+master.20190515084647.12.g96c4e2e.tar.bz2/src/common/include/droid/droid-config.h
^
|
@@ -1,102 +0,0 @@
-#ifndef foodroidconfigfoo
-#define foodroidconfigfoo
-
-/*
- * Copyright (C) 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <pulsecore/modargs.h>
-
-#include <android-config.h>
-#include <hardware/audio.h>
-
-#include <droid/version.h>
-
-typedef struct pa_droid_config_audio pa_droid_config_audio;
-typedef struct pa_droid_config_hw_module pa_droid_config_hw_module;
-
-#define AUDIO_MAX_SAMPLING_RATES (32)
-
-typedef struct pa_droid_config_global {
- uint32_t audio_hal_version;
- audio_devices_t attached_output_devices;
- audio_devices_t default_output_device;
- audio_devices_t attached_input_devices;
-} pa_droid_config_global;
-
-typedef struct pa_droid_config_device {
- const pa_droid_config_hw_module *module;
-
- char *name;
- uint32_t sampling_rates[AUDIO_MAX_SAMPLING_RATES]; /* (uint32_t) -1 -> dynamic */
- audio_channel_mask_t channel_masks; /* 0 -> dynamic */
- audio_format_t formats; /* 0 -> dynamic */
- audio_devices_t devices;
- /* Instead of using audio_output_flags_t and audio_input_flags_t
- * unify the flags as uint32_t so that we can have single struct for both
- * output and input configurations.
- * audio_input_flags_t was introduced in APIs 2 & 3, depending on adaptation,
- * so having input flags as uint32_t is simpler from input implementation
- * point of view as well. */
- uint32_t flags;
- pa_direction_t direction;
-
- struct pa_droid_config_device *next;
-} pa_droid_config_device;
-
-struct pa_droid_config_hw_module {
- const pa_droid_config_audio *config;
-
- char *name;
- /* If global config is not defined for module, use root global config. */
- pa_droid_config_global *global_config;
- pa_droid_config_device *outputs;
- pa_droid_config_device *inputs;
-
- struct pa_droid_config_hw_module *next;
-};
-
-struct pa_droid_config_audio {
- pa_droid_config_global *global_config;
- pa_droid_config_hw_module *hw_modules;
-};
-
-/* Config parser */
-pa_droid_config_audio *pa_droid_config_load(pa_modargs *ma);
-pa_droid_config_audio *pa_droid_config_dup(const pa_droid_config_audio *config);
-void pa_droid_config_free(pa_droid_config_audio *config);
-pa_droid_config_audio *pa_parse_droid_audio_config_legacy(const char *filename);
-pa_droid_config_audio *pa_parse_droid_audio_config_xml(const char *filename);
-/* autodetect config type from filename and parse */
-pa_droid_config_audio *pa_parse_droid_audio_config(const char *filename);
-
-const pa_droid_config_hw_module *pa_droid_config_find_module(const pa_droid_config_audio *config, const char* module_id);
-
-pa_droid_config_hw_module *pa_droid_config_hw_module_new(const pa_droid_config_audio *config, const char *name);
-void pa_droid_config_hw_module_free(pa_droid_config_hw_module *hw_module);
-pa_droid_config_device *pa_droid_config_device_new(const pa_droid_config_hw_module *module,
- pa_direction_t direction,
- const char *name);
-void pa_droid_config_device_free(pa_droid_config_device *device);
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.78+master.20190515084647.12.g96c4e2e.tar.bz2/src/common/include/droid/droid-util.h
^
|
@@ -1,333 +0,0 @@
-#ifndef foodroidutilfoo
-#define foodroidutilfoo
-
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <pulsecore/core-util.h>
-#include <pulsecore/macro.h>
-#include <pulsecore/mutex.h>
-#include <pulsecore/strlist.h>
-#include <pulsecore/atomic.h>
-
-#include <droid/version.h>
-#include <droid/droid-config.h>
-
-#if defined(QCOM_BSP) && (AUDIO_API_VERSION_MAJ >= 3)
-#define DROID_AUDIO_HAL_USE_VSID
-#endif
-
-#define PROP_DROID_DEVICES "droid.devices"
-#define PROP_DROID_FLAGS "droid.flags"
-#define PROP_DROID_HW_MODULE "droid.hw_module"
-#define PROP_DROID_API_STRING "droid-hal"
-
-#define PROP_DROID_OUTPUT_PRIMARY "droid.output.primary"
-#define PROP_DROID_OUTPUT_LOW_LATENCY "droid.output.low_latency"
-#define PROP_DROID_OUTPUT_MEDIA_LATENCY "droid.output.media_latency"
-#define PROP_DROID_OUTPUT_OFFLOAD "droid.output.offload"
-#define PROP_DROID_INPUT_BUILTIN "droid.input.builtin"
-#define PROP_DROID_INPUT_EXTERNAL "droid.input.external"
-
-#define PA_DROID_PRIMARY_DEVICE "primary"
-
-typedef struct pa_droid_hw_module pa_droid_hw_module;
-typedef struct pa_droid_stream pa_droid_stream;
-typedef struct pa_droid_output_stream pa_droid_output_stream;
-typedef struct pa_droid_input_stream pa_droid_input_stream;
-typedef struct pa_droid_card_data pa_droid_card_data;
-typedef int (*common_set_parameters_cb_t)(pa_droid_card_data *card_data, const char *str);
-
-typedef struct pa_droid_quirks pa_droid_quirks;
-
-typedef enum pa_droid_hook {
- PA_DROID_HOOK_INPUT_CHANNEL_MAP_CHANGED, /* Call data: pa_droid_stream */
- PA_DROID_HOOK_INPUT_BUFFER_SIZE_CHANGED, /* Call data: pa_droid_stream */
- PA_DROID_HOOK_MAX
-} pa_droid_hook_t;
-
-
-struct pa_droid_hw_module {
- PA_REFCNT_DECLARE;
-
- pa_core *core;
- char *shared_name;
-
- pa_droid_config_audio *config;
- const pa_droid_config_hw_module *enabled_module;
- pa_mutex *hw_mutex;
- pa_mutex *output_mutex;
- pa_mutex *input_mutex;
-
- struct hw_module_t *hwmod;
- audio_hw_device_t *device;
-
- const char *module_id;
-
- uint32_t stream_out_id;
- uint32_t stream_in_id;
-
- pa_idxset *outputs;
- pa_idxset *inputs;
- pa_hook_slot *sink_put_hook_slot;
- pa_hook_slot *sink_unlink_hook_slot;
- pa_hook_slot *source_put_hook_slot;
- pa_hook_slot *source_unlink_hook_slot;
-
- pa_atomic_t active_outputs;
-
- pa_droid_quirks *quirks;
- pa_hook hooks[PA_DROID_HOOK_MAX];
-};
-
-struct pa_droid_output_stream {
- struct audio_stream_out *stream;
- pa_sample_spec sample_spec;
- pa_channel_map channel_map;
- uint32_t flags;
- uint32_t device;
-};
-
-struct pa_droid_input_stream {
- struct audio_stream_in *stream;
- pa_sample_spec sample_spec;
- pa_channel_map channel_map;
- pa_sample_spec input_sample_spec;
- pa_channel_map input_channel_map;
- uint32_t flags;
- uint32_t device;
- audio_devices_t all_devices;
- bool merged;
-};
-
-struct pa_droid_stream {
- PA_REFCNT_DECLARE;
-
- pa_droid_hw_module *module;
- size_t buffer_size;
- void *data;
-
- pa_droid_output_stream *output;
- pa_droid_input_stream *input;
-};
-
-struct pa_droid_card_data {
- void *userdata;
- /* General functions */
- char *module_id;
- common_set_parameters_cb_t set_parameters;
-};
-
-
-/* Profiles */
-
-typedef struct pa_droid_profile_set pa_droid_profile_set;
-typedef struct pa_droid_mapping pa_droid_mapping;
-
-typedef struct pa_droid_port_data {
- audio_devices_t device;
-} pa_droid_port_data;
-
-typedef struct pa_droid_port {
- pa_droid_mapping *mapping;
-
- audio_devices_t device;
- char *name;
- char *description;
- unsigned priority;
-} pa_droid_port;
-
-struct pa_droid_mapping {
- pa_droid_profile_set *profile_set;
-
- const pa_droid_config_device *output;
- const pa_droid_config_device *input;
- const pa_droid_config_device *input2;
-
- char *name;
- char *description;
- unsigned priority;
- pa_proplist *proplist;
-
- /* Mapping doesn't own the ports */
- pa_idxset *ports;
-
- pa_direction_t direction;
-
- pa_sink *sink;
- pa_source *source;
-};
-
-typedef struct pa_droid_profile {
- pa_droid_profile_set *profile_set;
-
- const pa_droid_config_hw_module *module;
-
- char *name;
- char *description;
- unsigned priority;
-
- /* Idxsets contain pa_droid_mapping objects.
- * Profile doesn't own the mappings. */
- pa_idxset *output_mappings;
- pa_idxset *input_mappings;
-
-} pa_droid_profile;
-
-struct pa_droid_profile_set {
- const pa_droid_config_audio *config;
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.78+master.20190515084647.12.g96c4e2e.tar.bz2/src/common/include/droid/sllist.h
^
|
@@ -1,49 +0,0 @@
-#ifndef foosllistfoo
-#define foosllistfoo
-
-/*
- * Copyright (C) 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.
- */
-
-#define SLLIST_APPEND(t, head, item) \
- do { \
- item->next = NULL; \
- if (!head) { \
- head = item; \
- } else { \
- t *_list; \
- for (_list = head; _list->next; _list = _list->next); \
- _list->next = item; \
- } \
- } while (0)
-
-#define SLLIST_FOREACH(i, head) \
- for (i = (head); i; i = i->next)
-
-#define SLLIST_STEAL_FIRST(i, head) \
- do { \
- if (head) { \
- i = head; \
- head = head->next; \
- } else \
- i = NULL; \
- } while (0)
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.78+master.20190515084647.12.g96c4e2e.tar.bz2/src/common/include/droid/version.h
^
|
@@ -1,51 +0,0 @@
-#ifndef foodroidversionfoo
-#define foodroidversionfoo
-
-/*
- * Copyright (C) 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.
- */
-
-
-#include <android-config.h>
-#if defined(QCOM_BSP) || defined(DROID_DEVICE_SBJ)
-#define QCOM_HARDWARE
-#endif
-
-#include <hardware/audio.h>
-
-#if !defined(ANDROID_VERSION_MAJOR) || !defined(ANDROID_VERSION_MINOR) || !defined(ANDROID_VERSION_PATCH)
-#error "ANDROID_VERSION_* not defined. Did you get your headers via extract-headers.sh?"
-#endif
-
-/* We currently support API version up-to 3.0 */
-#define DROID_API_VERSION_SUPPORT HARDWARE_DEVICE_API_VERSION(3, 0)
-
-#if AUDIO_DEVICE_API_VERSION_CURRENT > DROID_API_VERSION_SUPPORT
-#warning Compiling against higher audio device API version than currently supported!
-#warning Compile likely fails or module may malfunction.
-#endif
-
-#define AUDIO_API_VERSION_MAJ ((AUDIO_DEVICE_API_VERSION_CURRENT >> 8) & 0xff)
-#define AUDIO_API_VERSION_MIN (AUDIO_DEVICE_API_VERSION_CURRENT & 0xff)
-
-#define AUDIO_API_VERSION_GET_MAJ(x) ((x >> 8) & 0xff)
-#define AUDIO_API_VERSION_GET_MIN(x) (x & 0xff)
-
-#endif
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/README
^
|
@@ -13,33 +13,25 @@
* 4.4.x
* 5.x
* 6.0.x
- * 7.x
- * 8.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:
+When new devices with relevant new enums appear, add enum check to configure.ac,
+for example: (the CC_CHECK_DROID_ENUM m4 macro will create define HAVE_ENUM_FOO
+if the enum FOO exists in HAL audio.h)
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:
+and then in droid-util-audio.h add the enum to proper tables with ifdefs:
/* string_conversion_table_output_device[] */
- STRING_ENTRY_IF_OUT_IP
- STRING_ENTRY_IF_OUT_OTHER_NEW
+ #ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_IP
+ STRING_ENTRY( AUDIO_DEVICE_OUT_IP ),
+ #endif
/* 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.
+ #ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_IP
+ { AUDIO_DEVICE_OUT_IP, "output-ip" },
+ #endif
The purpose of droid-modules is to "replace AudioFlinger". Many hardware
adaptations use ALSA as the kernel interface, but there is no saying that
@@ -49,42 +41,16 @@
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
+simpler, with somewhat stable HAL (HALv2 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.
+Android version and device specific variations should be optimally handled in
+droid-util-XXX.h files, without modifying other parts of the implementation.
+
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,
-
- /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
-----------------
@@ -92,47 +58,13 @@
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 outputs or multiple inputs if the
-input streams are split to multiple devices.
-
-For example configuration with
-
- audio_hw_modules {
- primary {
- outputs {
- primary {}
- deep_buffer {}
- }
- inputs {
- builtin {}
- external {}
- }
- }
- other {
- ...
- }
- }
-
-The default profile would contain two sinks, sink.primary and sink.deep_buffer
-and one source, source.builtin_external. Then this combined source would use
-either "builtin" or "external" input stream, depending on which one has the
-input route currently in use (for example, input-wired_headset from "external"
-and input-back_mic from "builtin" input stream).
+Droid-card reads configuration from /vendor/etc/audio_policy.conf or
+/system/etc/audio_policy.conf, depending on which is found first. If vendor
+config is found, configuration is read from there, otherwise from system
+configuration.
-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.
-
-additional profiles
--------------------
-
-In addition to the default profile all input and output definitions are
-translated to PulseAudio card profiles. For example configuration with
+From audio_policy.conf file input and output definitions are translated to
+PulseAudio card profiles. For example configuration with
audio_hw_modules {
primary {
@@ -252,97 +184,6 @@
accessory-plugin and pulseaudio-policy-enforcement module for actually making
the port switching)
-Classifying sinks and sources
------------------------------
-
-Certain property values are set to all active sinks and sources based on their
-functionality to ease device classification.
-
-Currently following properties are set:
-
- * For droid sinks
- * droid.output.primary
- * droid.output.low_latency
- * droid.output.media_latency
- * droid.output.offload
- * For droid sources
- * droid.input.builtin
- * droid.input.external
-
-If the property is set and with value "true", the sink or source should be
-used for the property type. If the property is not defined or contains
-value "false" it shouldn't be used for the property type.
-
-For example, we might have sink.primary and sink.low_latency with following
-properties:
-
- * sink.primary
- * droid.output.primary "true"
- * droid.output.media_latency "true"
- * sink.low_latency
- * droid.output.low_latency "true"
-
-There also may be just one sink, with all the properties defined as "true"
-and so on.
-
-Similarly if there is only one input device the sole source would have both
-input type properties set as "true", but it also might be that the different
-input type properties are split to two different sources.
-
-Quirks
-------
-
-There are some adaptations that require hacks to get things working. These
-hacks can be enabled or disabled with module argument "quirks". Some quirks
-are enabled by default with some adaptations etc.
-
-Currently there are following quirks:
-
- * input_atoi
- * Enabled by default with Android versions 5 and up.
- * Due to how atoi works in bionic vs libc we need to pass the input
- route a bit funny. If input routing doesn't work switch this on or off.
- * set_parameters
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/configure.ac
^
|
@@ -22,11 +22,9 @@
m4_define(pa_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
m4_define(pa_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)
-m4_define(pa_module_version, `echo $VERSION | cut -d. -f3 | cut -d- -f1`)
AC_SUBST(PA_MAJOR, pa_major)
AC_SUBST(PA_MAJORMINOR, pa_major.pa_minor)
-AC_SUBST(PA_MODULE_VERSION, pa_module_version)
DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wno-long-long -Winline -Wvla -Wno-overlength-strings -Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wpacked -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wpointer-arith -Winit-self -Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -ffast-math -Wp,-D_FORTIFY_SOURCE=2 -fno-common -fdiagnostics-show-option" # PulseAudio 0.9.15 usess same + -Wcast-align -Wdeclaration-after-statement
@@ -174,6 +172,8 @@
AC_SUBST(PULSEAUDIO_CFLAGS)
AC_SUBST(PULSEAUDIO_LIBS)
+pulseaudiodir=`pkg-config --variable=prefix pulsecore`
+
#PKG_CHECK_MODULES([DROIDHEADERS], [android-headers >= 0.0.6])
# android-headers.pc has broken version field
PKG_CHECK_MODULES([DROIDHEADERS], [android-headers])
@@ -187,25 +187,6 @@
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)
-#### expat (for xml config format parsing) (optional) ####
-
-AC_ARG_ENABLE([xml],
- AS_HELP_STRING([--disable-xml],[Disable optional xml config support]))
-
-AS_IF([test "x$enable_xml" != "xno"],
- [PKG_CHECK_MODULES(EXPAT, [ expat >= 2.1 ], HAVE_EXPAT=1, HAVE_EXPAT=0)],
- HAVE_EXPAT=0)
-
-AS_IF([test "x$enable_xml" = "xyes" && test "x$HAVE_EXPAT" = "x0"],
- [AC_MSG_ERROR([*** expat not found])])
-
-AC_SUBST(HAVE_EXPAT)
-AC_SUBST(EXPAT_CFLAGS)
-AC_SUBST(EXPAT_LIBS)
-AM_CONDITIONAL([HAVE_EXPAT], [test "x$HAVE_EXPAT" = x1])
-AS_IF([test "x$HAVE_EXPAT" = "x1"], AC_DEFINE([HAVE_EXPAT], 1, [Have expat?]))
-AS_IF([test "x$HAVE_EXPAT" = "x1"], ENABLE_XML="yes (expat)", ENABLE_XML=no)
-
# Output devices
CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_HDMI])
CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_HDMI_ARC])
@@ -269,18 +250,15 @@
CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_CHANNEL_OUT_5POINT1_BACK])
CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_CHANNEL_OUT_5POINT1_SIDE])
CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_CHANNEL_IN_VOICE_CALL_MONO])
-CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_CHANNEL_IN_VOICE_UPLINK_MONO])
-CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_CHANNEL_IN_VOICE_DNLINK_MONO])
# Formats
CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_FORMAT_PCM_OFFLOAD])
CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_FORMAT_FLAC])
CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_FORMAT_OPUS])
-AC_ARG_WITH(
- [module-dir],
- AS_HELP_STRING([--with-module-dir],[Directory where to install the modules to (defaults to ${libdir}/pulse-${PA_MAJORMINOR}/modules]),
- [modlibexecdir=$withval], [modlibexecdir="${libdir}/pulse-${PA_MAJORMINOR}/modules"])
+AC_ARG_WITH([module-dir],
+ AS_HELP_STRING([--with-module-dir],[Directory where to install the modules to (defaults to ${pulseaudiodir}/lib/pulse-${PA_MAJORMINOR}/modules/]),
+ [modlibexecdir=$withval], [modlibexecdir="${pulseaudiodir}/lib/pulse-${PA_MAJORMINOR}/modules"])
AC_SUBST(modlibexecdir)
@@ -296,12 +274,6 @@
AC_SUBST([DROID_DEVICE_CFLAGS])
fi
-# Workaround for SBJ HAL headers
-if test "x$droiddevice" = xsbj ; then
- SBJ_DEVICE_LDFLAGS="-Wl,--allow-multiple-definition"
- AC_SUBST([SBJ_DEVICE_LDFLAGS])
-fi
-
AC_MSG_CHECKING([If we are using hardfp tool chain])
case `echo | gcc -v -xc -o - - 2>&1 | grep COLLECT_GCC_OPTIONS | tail -1` in
*float-abi=hard*) hardfp=yes; AC_MSG_RESULT([yes]) ;;
@@ -332,8 +304,8 @@
CFLAGS: ${CFLAGS}
prefix: ${prefix}
+ PulseAudio prefix: ${pulseaudiodir}
modules directory: ${modlibexecdir}
- Droid device: ${droiddevice}
- XML config support: ${ENABLE_XML}
+ Droid device ${droiddevice}
"
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/m4/check_droid_enum.m4
^
|
@@ -17,10 +17,5 @@
AC_MSG_RESULT([$cc_check_droid_enum])
if test x"$cc_check_droid_enum" = x"yes"; then
AC_DEFINE(HAVE_ENUM_$2,,[define if enum $2 is found in headers])
- AC_DEFINE(STRING_ENTRY_IF_$2,[STRING_ENTRY($2),],[string entry for enum $2])
- AC_DEFINE(FANCY_ENTRY_IF_$2(n),[{$2, n},],[fancy entry for enum $2])
-else
- AC_DEFINE(STRING_ENTRY_IF_$2,,[string entry for enum $2])
- AC_DEFINE(FANCY_ENTRY_IF_$2(n),,[fancy entry for enum $2])
fi
])
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/common/Makefile.am
^
|
@@ -1,35 +1,18 @@
AM_LIBADD = \
$(PULSEAUDIO_LIBS) \
- $(HYBRIS_LIBS) \
- $(EXPAT_LIBS)
+ $(HYBRIS_LIBS)
AM_CFLAGS = \
$(DROID_DEVICE_CFLAGS) \
$(PULSEAUDIO_CFLAGS) \
$(DROIDHEADERS_CFLAGS) \
$(HYBRIS_CFLAGS) \
- $(EXPAT_CFLAGS) \
-DPULSEAUDIO_VERSION=@PA_MAJOR@ \
- -I$(top_srcdir)/src/common \
- -I$(top_srcdir)/src/common/include
+ -I$(top_srcdir)/src/common
modlibexec_LTLIBRARIES = libdroid-util.la
-includedir = @includedir@/pulsecore/modules/droid
-include_HEADERS = include/droid/version.h \
- include/droid/conversion.h \
- include/droid/droid-config.h \
- include/droid/droid-util.h
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libdroid-util.pc
-
-libdroid_util_la_SOURCES = droid-util.c \
- droid-config.c \
- conversion.c \
- config-parser-legacy.c \
- config-parser-xml.c \
- droid-util-audio.h \
- droid-util-41qc.h
-libdroid_util_la_LDFLAGS = -avoid-version -Wl,-z,noexecstack -lhybris-common $(SBJ_DEVICE_LDFLAGS)
+libdroid_util_la_SOURCES = droid-util.c droid-util.h
+libdroid_util_la_LDFLAGS = -avoid-version -Wl,-z,noexecstack -lhybris-common
libdroid_util_la_LIBADD = $(AM_LIBADD)
libdroid_util_la_CFLAGS = $(AM_CFLAGS)
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/common/droid-util-41qc.h
^
|
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
@@ -29,8 +29,6 @@
#include <hardware/audio.h>
#include <hardware_legacy/audio_policy_conf.h>
-#include <pulse/channelmap.h>
-
// PulseAudio value - Android value
uint32_t conversion_table_output_channel[][2] = {
@@ -216,10 +214,6 @@
{ 0, NULL }
};
-struct string_conversion string_conversion_table_input_flag[] = {
- { 0, NULL }
-};
-
/* Channels */
struct string_conversion string_conversion_table_output_channels[] = {
STRING_ENTRY(AUDIO_CHANNEL_OUT_FRONT_LEFT),
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/common/droid-util-audio.h
^
|
@@ -22,7 +22,6 @@
#ifndef _DROID_UTIL_AUDIO_H_
#define _DROID_UTIL_AUDIO_H_
-#include <android-config.h>
#ifdef QCOM_BSP
#define QCOM_HARDWARE
#endif
@@ -30,7 +29,9 @@
#include <hardware/audio.h>
#include <hardware_legacy/audio_policy_conf.h>
-#include <pulse/channelmap.h>
+#ifdef SPEAKER_DRC_ENABLED_TAG
+#define DROID_HAVE_DRC
+#endif
#ifdef STRING_ENTRY
@@ -140,19 +141,45 @@
/* Devices which may or may not be defined for all devices,
* update configure.ac CC_CHECK_DROID_ENUM list if you encounter new ones. */
- STRING_ENTRY_IF_AUDIO_DEVICE_OUT_HDMI
- STRING_ENTRY_IF_AUDIO_DEVICE_OUT_HDMI_ARC
- STRING_ENTRY_IF_AUDIO_DEVICE_OUT_TELEPHONY_TX
- STRING_ENTRY_IF_AUDIO_DEVICE_OUT_LINE
- STRING_ENTRY_IF_AUDIO_DEVICE_OUT_SPDIF
- STRING_ENTRY_IF_AUDIO_DEVICE_OUT_AUX_LINE
- STRING_ENTRY_IF_AUDIO_DEVICE_OUT_SPEAKER_SAFE
- STRING_ENTRY_IF_AUDIO_DEVICE_OUT_FM
- STRING_ENTRY_IF_AUDIO_DEVICE_OUT_FM_TX
- STRING_ENTRY_IF_AUDIO_DEVICE_OUT_ANC_HEADSET
- STRING_ENTRY_IF_AUDIO_DEVICE_OUT_ANC_HEADPHONE
- STRING_ENTRY_IF_AUDIO_DEVICE_OUT_PROXY
- STRING_ENTRY_IF_AUDIO_DEVICE_OUT_IP
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_HDMI
+ STRING_ENTRY( AUDIO_DEVICE_OUT_HDMI ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_HDMI_ARC
+ STRING_ENTRY( AUDIO_DEVICE_OUT_HDMI_ARC ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_TELEPHONY_TX
+ STRING_ENTRY( AUDIO_DEVICE_OUT_TELEPHONY_TX ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_LINE
+ STRING_ENTRY( AUDIO_DEVICE_OUT_LINE ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_SPDIF
+ STRING_ENTRY( AUDIO_DEVICE_OUT_SPDIF ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_AUX_LINE
+ STRING_ENTRY( AUDIO_DEVICE_OUT_AUX_LINE ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_SPEAKER_SAFE
+ STRING_ENTRY( AUDIO_DEVICE_OUT_SPEAKER_SAFE ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_FM
+ STRING_ENTRY( AUDIO_DEVICE_OUT_FM ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_FM_TX
+ STRING_ENTRY( AUDIO_DEVICE_OUT_FM_TX ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_ANC_HEADSET
+ STRING_ENTRY( AUDIO_DEVICE_OUT_ANC_HEADSET ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_ANC_HEADPHONE
+ STRING_ENTRY( AUDIO_DEVICE_OUT_ANC_HEADPHONE ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_PROXY
+ STRING_ENTRY( AUDIO_DEVICE_OUT_PROXY ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_IP
+ STRING_ENTRY( AUDIO_DEVICE_OUT_IP ),
+#endif
/* Combination entries consisting of multiple devices defined above.
* These don't require counterpart in string_conversion_table_output_device_fancy. */
@@ -186,19 +213,45 @@
{ AUDIO_DEVICE_OUT_DEFAULT, "output-default" },
/* Devices which may or may not be defined for all devices, */
- FANCY_ENTRY_IF_AUDIO_DEVICE_OUT_HDMI ( "output-hdmi" )
- FANCY_ENTRY_IF_AUDIO_DEVICE_OUT_HDMI_ARC ( "output-hdmi_arc" )
- FANCY_ENTRY_IF_AUDIO_DEVICE_OUT_TELEPHONY_TX ( "output-telephony_tx" )
- FANCY_ENTRY_IF_AUDIO_DEVICE_OUT_LINE ( "output-line" )
- FANCY_ENTRY_IF_AUDIO_DEVICE_OUT_SPDIF ( "output-spdif" )
- FANCY_ENTRY_IF_AUDIO_DEVICE_OUT_AUX_LINE ( "output-aux_line" )
- FANCY_ENTRY_IF_AUDIO_DEVICE_OUT_SPEAKER_SAFE ( "output-speaker_safe" )
- FANCY_ENTRY_IF_AUDIO_DEVICE_OUT_FM ( "output-fm" )
- FANCY_ENTRY_IF_AUDIO_DEVICE_OUT_FM_TX ( "output-fm_tx" )
- FANCY_ENTRY_IF_AUDIO_DEVICE_OUT_ANC_HEADSET ( "output-and_headset" )
- FANCY_ENTRY_IF_AUDIO_DEVICE_OUT_ANC_HEADPHONE ( "output-anc_headphone" )
- FANCY_ENTRY_IF_AUDIO_DEVICE_OUT_PROXY ( "output-proxy" )
- FANCY_ENTRY_IF_AUDIO_DEVICE_OUT_IP ( "output-ip" )
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_HDMI
+ { AUDIO_DEVICE_OUT_HDMI, "output-hdmi" },
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_HDMI_ARC
+ { AUDIO_DEVICE_OUT_HDMI_ARC, "output-hdmi_arc" },
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_TELEPHONY_TX
+ { AUDIO_DEVICE_OUT_TELEPHONY_TX, "output-telephony_tx" },
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_LINE
+ { AUDIO_DEVICE_OUT_LINE, "output-line" },
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_SPDIF
+ { AUDIO_DEVICE_OUT_SPDIF, "output-spdif" },
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_AUX_LINE
+ { AUDIO_DEVICE_OUT_AUX_LINE, "output-aux_line" },
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_SPEAKER_SAFE
+ { AUDIO_DEVICE_OUT_SPEAKER_SAFE, "output-speaker_safe" },
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_FM
+ { AUDIO_DEVICE_OUT_FM, "output-fm" },
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_FM_TX
+ { AUDIO_DEVICE_OUT_FM_TX, "output-fm_tx" },
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_ANC_HEADSET
+ { AUDIO_DEVICE_OUT_ANC_HEADSET, "output-anc_headset" },
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_ANC_HEADPHONE
+ { AUDIO_DEVICE_OUT_ANC_HEADPHONE, "output-anc_headphone" },
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_PROXY
+ { AUDIO_DEVICE_OUT_PROXY, "output-proxy" },
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_IP
+ { AUDIO_DEVICE_OUT_IP, "output-ip" },
+#endif
{ 0, NULL }
};
@@ -224,18 +277,42 @@
/* Devices which may or may not be defined for all devices,
* update configure.ac CC_CHECK_DROID_ENUM list if you encounter new ones. */
- STRING_ENTRY_IF_AUDIO_DEVICE_IN_HDMI
- STRING_ENTRY_IF_AUDIO_DEVICE_IN_TELEPHONY_RX
- STRING_ENTRY_IF_AUDIO_DEVICE_IN_FM_TUNER
- STRING_ENTRY_IF_AUDIO_DEVICE_IN_TV_TUNER
- STRING_ENTRY_IF_AUDIO_DEVICE_IN_LINE
- STRING_ENTRY_IF_AUDIO_DEVICE_IN_SPDIF
- STRING_ENTRY_IF_AUDIO_DEVICE_IN_BLUETOOTH_A2DP
- STRING_ENTRY_IF_AUDIO_DEVICE_IN_LOOPBACK
- STRING_ENTRY_IF_AUDIO_DEVICE_IN_PROXY
- STRING_ENTRY_IF_AUDIO_DEVICE_IN_FM_RX
- STRING_ENTRY_IF_AUDIO_DEVICE_IN_FM_RX_A2DP
- STRING_ENTRY_IF_AUDIO_DEVICE_IN_IP
+#ifdef HAVE_ENUM_AUDIO_DEVICE_IN_HDMI
+ STRING_ENTRY( AUDIO_DEVICE_IN_HDMI ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_IN_TELEPHONY_RX
+ STRING_ENTRY( AUDIO_DEVICE_IN_TELEPHONY_RX ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_IN_FM_TUNER
+ STRING_ENTRY( AUDIO_DEVICE_IN_FM_TUNER ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_IN_TV_TUNER
+ STRING_ENTRY( AUDIO_DEVICE_IN_TV_TUNER ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_IN_LINE
+ STRING_ENTRY( AUDIO_DEVICE_IN_LINE ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_IN_SPDIF
+ STRING_ENTRY( AUDIO_DEVICE_IN_SPDIF ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_IN_BLUETOOTH_A2DP
+ STRING_ENTRY( AUDIO_DEVICE_IN_BLUETOOTH_A2DP ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_IN_LOOPBACK
+ STRING_ENTRY( AUDIO_DEVICE_IN_LOOPBACK ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_IN_PROXY
+ STRING_ENTRY( AUDIO_DEVICE_IN_PROXY ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_IN_FM_RX
+ STRING_ENTRY( AUDIO_DEVICE_IN_FM_RX ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_IN_FM_RX_A2DP
+ STRING_ENTRY( AUDIO_DEVICE_IN_FM_RX_A2DP ),
+#endif
+#ifdef HAVE_ENUM_AUDIO_DEVICE_IN_IP
+ STRING_ENTRY( AUDIO_DEVICE_IN_IP ),
+#endif
#ifdef DROID_AUDIO_HAL_SECONDARY_MIC
STRING_ENTRY( AUDIO_DEVICE_IN_SECONDARY_MIC ),
@@ -245,7 +322,9 @@
* These don't require counterpart in string_conversion_table_input_device_fancy. */
STRING_ENTRY( AUDIO_DEVICE_IN_ALL ),
STRING_ENTRY( AUDIO_DEVICE_IN_ALL_SCO ),
- STRING_ENTRY_IF_AUDIO_DEVICE_IN_ALL_USB
+#ifdef HAVE_ENUM_AUDIO_DEVICE_IN_ALL_USB
+ STRING_ENTRY( AUDIO_DEVICE_IN_ALL_USB ),
+#endif
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/common/droid-util.c
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013-2018 Jolla Ltd.
+ * Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
@@ -23,7 +23,6 @@
#include <config.h>
#endif
-#include <stdlib.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
@@ -36,7 +35,6 @@
#include <pulse/timeval.h>
#include <pulse/volume.h>
#include <pulse/xmalloc.h>
-#include <pulse/direction.h>
#include <pulsecore/core.h>
#include <pulsecore/core-error.h>
@@ -60,11 +58,7 @@
#include <pulsecore/strlist.h>
#include <pulsecore/atomic.h>
-#include "droid/version.h"
-#include "droid/droid-util.h"
-#include "droid/droid-config.h"
-#include "droid/conversion.h"
-#include "droid/sllist.h"
+#include "droid-util.h"
struct droid_quirk {
const char *name;
@@ -74,26 +68,856 @@
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 },
+ { "close_input", QUIRK_CLOSE_INPUT }
};
+struct pa_droid_quirks {
+ bool enabled[QUIRK_COUNT];
+};
+
+#define SLLIST_APPEND(t, head, item) \
+ do { \
+ item->next = NULL; \
+ if (!head) { \
+ head = item; \
+ } else { \
+ t *_list; \
+ for (_list = head; _list->next; _list = _list->next); \
+ _list->next = item; \
+ } \
+ } while (0)
+
+#define SLLIST_FOREACH(i, head) \
+ for (i = (head); i; i = i->next)
+
+#define SLLIST_STEAL_FIRST(i, head) \
+ do { \
+ if (head) { \
+ i = head; \
+ head = head->next; \
+ } else \
+ i = NULL; \
+ } while (0)
+
+
+#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++) { \
+ if ( conversion_table_ ## TABL [i][field] == value) { \
+ *to_value = conversion_table_ ## TABL [i][!field]; \
+ return true; \
+ } \
+ } \
+ return false; \
+} struct __funny_extra_to_allow_semicolon
+
+/* Creates convert_format convert_channel etc.
+ * bool pa_convert_func(uint32_t value, pa_conversion_field_t field, uint32_t *to_value);
+ * return true if conversion succesful */
+CONVERT_FUNC(format);
+CONVERT_FUNC(output_channel);
+CONVERT_FUNC(input_channel);
#define DEFAULT_PRIORITY (100)
+/* Section defining custom global configuration variables. */
+#define GLOBAL_CONFIG_EXT_TAG "custom_properties"
+
+/* From recent audio_policy_conf.h */
+#ifndef AUDIO_HAL_VERSION_TAG
+#define AUDIO_HAL_VERSION_TAG "audio_hal_version"
+#endif
+#ifndef GAINS_TAG
+#define GAINS_TAG "gains"
+#endif
+
+#define GAIN_TAG_PREFIX "gain_"
+
static const char * const droid_combined_auto_outputs[3] = { "primary", "low_latency", NULL };
static const char * const droid_combined_auto_inputs[2] = { "primary", NULL };
+static void droid_config_free(pa_droid_config_audio *config);
static void droid_port_free(pa_droid_port *p);
static pa_droid_stream *get_primary_output(pa_droid_hw_module *hw);
static int input_stream_set_route(pa_droid_stream *s, audio_devices_t device);
+static bool string_convert_num_to_str(const struct string_conversion *list, const uint32_t value, const char **to_str) {
+ pa_assert(list);
+ pa_assert(to_str);
+
+ for (unsigned int i = 0; list[i].str; i++) {
+ if (list[i].value == value) {
+ *to_str = list[i].str;
+ return true;
+ }
+ }
+ return false;
+}
+
+static bool string_convert_str_to_num(const struct string_conversion *list, const char *str, uint32_t *to_value) {
+ pa_assert(list);
+ pa_assert(str);
+ pa_assert(to_value);
+
+ for (unsigned int i = 0; list[i].str; i++) {
+ if (pa_streq(list[i].str, str)) {
+ *to_value = list[i].value;
+ return true;
+ }
+ }
+ return false;
+}
+
+static char *list_string(struct string_conversion *list, uint32_t flags) {
+ char *str = NULL;
+ char *tmp;
+
+#if AUDIO_API_VERSION_MAJ >= 2
+ if (flags & AUDIO_DEVICE_BIT_IN)
+ flags &= ~AUDIO_DEVICE_BIT_IN;
+#endif
+
+ for (unsigned int i = 0; list[i].str; i++) {
+#if AUDIO_API_VERSION_MAJ >= 2
+ if (list[i].value & AUDIO_DEVICE_BIT_IN) {
+ if (popcount(list[i].value & ~AUDIO_DEVICE_BIT_IN) != 1)
+ continue;
+ } else
+#endif
+ if (popcount(list[i].value) != 1)
+ continue;
+
+ if (flags & list[i].value) {
+ if (str) {
+ tmp = pa_sprintf_malloc("%s|%s", str, list[i].str);
+ pa_xfree(str);
+ str = tmp;
+ } else {
+ str = pa_sprintf_malloc("%s", list[i].str);
+ }
+ }
+ }
+
+ return str;
+}
+
+
+/* Output device */
+bool pa_string_convert_output_device_num_to_str(audio_devices_t value, const char **to_str) {
+ return string_convert_num_to_str(string_conversion_table_output_device, (uint32_t) value, to_str);
+}
+
+bool pa_string_convert_output_device_str_to_num(const char *str, audio_devices_t *to_value) {
+ return string_convert_str_to_num(string_conversion_table_output_device, str, (uint32_t*) to_value);
+}
+
+char *pa_list_string_output_device(audio_devices_t devices) {
+ return list_string(string_conversion_table_output_device, devices);
+}
+
+/* Input device */
+bool pa_string_convert_input_device_num_to_str(audio_devices_t value, const char **to_str) {
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/common/droid-util.h
^
|
@@ -0,0 +1,414 @@
+#ifndef foodroidutilfoo
+#define foodroidutilfoo
+
+/*
+ * Copyright (C) 2013 Jolla Ltd.
+ *
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <pulsecore/core-util.h>
+#include <pulsecore/macro.h>
+#include <pulsecore/mutex.h>
+#include <pulsecore/strlist.h>
+#include <pulsecore/atomic.h>
+
+#include <android-config.h>
+
+#if !defined(ANDROID_VERSION_MAJOR) || !defined(ANDROID_VERSION_MINOR) || !defined(ANDROID_VERSION_PATCH)
+#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"
+#else
+#include "droid-util-audio.h"
+#endif
+
+/* We currently support API version up-to 3.0 */
+#define DROID_API_VERSION_SUPPORT HARDWARE_DEVICE_API_VERSION(3, 0)
+
+#if AUDIO_DEVICE_API_VERSION_CURRENT > DROID_API_VERSION_SUPPORT
+#warning Compiling against higher audio device API version than currently supported!
+#warning Compile likely fails or module may malfunction.
+#endif
+
+#define AUDIO_API_VERSION_MAJ ((AUDIO_DEVICE_API_VERSION_CURRENT >> 8) & 0xff)
+#define AUDIO_API_VERSION_MIN (AUDIO_DEVICE_API_VERSION_CURRENT & 0xff)
+
+#define AUDIO_API_VERSION_GET_MAJ(x) ((x >> 8) & 0xff)
+#define AUDIO_API_VERSION_GET_MIN(x) (x & 0xff)
+
+#if defined(QCOM_BSP) && (AUDIO_API_VERSION_MAJ >= 3)
+#define DROID_AUDIO_HAL_USE_VSID
+#endif
+
+#define PROP_DROID_DEVICES "droid.devices"
+#define PROP_DROID_FLAGS "droid.flags"
+#define PROP_DROID_HW_MODULE "droid.hw_module"
+#define PROP_DROID_API_STRING "droid-hal"
+
+#define PA_DROID_PRIMARY_DEVICE "primary"
+
+/* Special keywords for combined profile creation. */
+#define PA_DROID_COMBINED_ALL "*all*"
+#define PA_DROID_COMBINED_AUTO "*auto*"
+
+typedef struct pa_droid_hw_module pa_droid_hw_module;
+typedef struct pa_droid_stream pa_droid_stream;
+typedef struct pa_droid_card_data pa_droid_card_data;
+typedef int (*common_set_parameters_cb_t)(pa_droid_card_data *card_data, const char *str);
+
+typedef struct pa_droid_config_audio pa_droid_config_audio;
+typedef struct pa_droid_config_hw_module pa_droid_config_hw_module;
+
+typedef struct pa_droid_quirks pa_droid_quirks;
+
+typedef enum pa_droid_hook {
+ PA_DROID_HOOK_INPUT_CHANNEL_MAP_CHANGED, /* Call data: pa_droid_stream */
+ PA_DROID_HOOK_INPUT_BUFFER_SIZE_CHANGED, /* Call data: pa_droid_stream */
+ PA_DROID_HOOK_MAX
+} pa_droid_hook_t;
+
+
+struct pa_droid_hw_module {
+ PA_REFCNT_DECLARE;
+
+ pa_core *core;
+ char *shared_name;
+
+ pa_droid_config_audio *config;
+ const pa_droid_config_hw_module *enabled_module;
+ pa_mutex *hw_mutex;
+ pa_mutex *output_mutex;
+ pa_mutex *input_mutex;
+
+ struct hw_module_t *hwmod;
+ audio_hw_device_t *device;
+
+ const char *module_id;
+
+ uint32_t stream_out_id;
+ uint32_t stream_in_id;
+
+ pa_idxset *outputs;
+ pa_idxset *inputs;
+
+ pa_atomic_t active_outputs;
+
+ pa_droid_quirks *quirks;
+ pa_hook hooks[PA_DROID_HOOK_MAX];
+};
+
+struct pa_droid_stream {
+ PA_REFCNT_DECLARE;
+
+ pa_droid_hw_module *module;
+
+ pa_sample_spec sample_spec;
+ pa_channel_map channel_map;
+ pa_sample_spec input_sample_spec;
+ pa_channel_map input_channel_map;
+ uint32_t flags;
+ uint32_t device;
+ size_t buffer_size;
+
+ struct audio_stream_out *out;
+ struct audio_stream_in *in;
+};
+
+struct pa_droid_card_data {
+ void *userdata;
+ /* General functions */
+ char *module_id;
+ common_set_parameters_cb_t set_parameters;
+};
+
+#define AUDIO_MAX_SAMPLING_RATES (32)
+
+typedef struct pa_droid_config_global {
+ uint32_t audio_hal_version;
+ audio_devices_t attached_output_devices;
+ audio_devices_t default_output_device;
+ audio_devices_t attached_input_devices;
+} pa_droid_config_global;
+
+typedef struct pa_droid_config_output {
+ const pa_droid_config_hw_module *module;
+
+ char *name;
+ uint32_t sampling_rates[AUDIO_MAX_SAMPLING_RATES]; /* (uint32_t) -1 -> dynamic */
+ audio_channel_mask_t channel_masks; /* 0 -> dynamic */
+ audio_format_t formats; /* 0 -> dynamic */
+ audio_devices_t devices;
+ audio_output_flags_t flags;
+
+ struct pa_droid_config_output *next;
+} pa_droid_config_output;
+
+typedef struct pa_droid_config_input {
+ const pa_droid_config_hw_module *module;
+
+ char *name;
+ uint32_t sampling_rates[AUDIO_MAX_SAMPLING_RATES]; /* (uint32_t) -1 -> dynamic */
+ audio_channel_mask_t channel_masks; /* 0 -> dynamic */
+ audio_format_t formats; /* 0 -> dynamic */
+ audio_devices_t devices;
+#if AUDIO_API_VERSION_MAJ >= 3
+ audio_input_flags_t flags;
+#endif
+
+ struct pa_droid_config_input *next;
+} pa_droid_config_input;
+
+struct pa_droid_config_hw_module {
+ const pa_droid_config_audio *config;
+
+ char *name;
+ /* If global config is not defined for module, use root global config. */
+ pa_droid_config_global *global_config;
+ pa_droid_config_output *outputs;
+ pa_droid_config_input *inputs;
+
+ struct pa_droid_config_hw_module *next;
+};
+
+struct pa_droid_config_audio {
+ pa_droid_config_global *global_config;
+ pa_droid_config_hw_module *hw_modules;
+};
+
+
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/common/libdroid-util.pc.in
^
|
@@ -6,6 +6,6 @@
Name: libdroid-util
Description: Common droid module building interface.
-Version: @PA_MODULE_VERSION@
+Version: @PACKAGE_VERSION@
Libs: -L${libdir}/pulse-@PA_MAJORMINOR@/modules -ldroid-util
Cflags: -D_REENTRANT -I${includedir}/pulsecore/modules
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/droid/Makefile.am
^
|
@@ -9,7 +9,7 @@
$(HYBRIS_CFLAGS) \
-DPULSEAUDIO_VERSION=@PA_MAJOR@ \
-I$(top_srcdir)/src/droid \
- -I$(top_srcdir)/src/common/include
+ -I$(top_srcdir)/src/common
modlibexec_LTLIBRARIES = \
@@ -29,25 +29,25 @@
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)
+libdroid_sink_la_LIBADD = $(AM_LIBADD) $(top_builddir)/src/common/libdroid-util.la
libdroid_sink_la_CFLAGS = $(AM_CFLAGS)
libdroid_source_la_SOURCES = droid-source.c droid-source.h
libdroid_source_la_LDFLAGS = -avoid-version -Wl,-z,noexecstack -lhybris-common
-libdroid_source_la_LIBADD = $(top_builddir)/src/common/libdroid-util.la $(AM_LIBADD)
+libdroid_source_la_LIBADD = $(AM_LIBADD) $(top_builddir)/src/common/libdroid-util.la
libdroid_source_la_CFLAGS = $(AM_CFLAGS)
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_LIBADD = $(AM_LIBADD) -lm libdroid-sink.la
module_droid_sink_la_CFLAGS = $(AM_CFLAGS)
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_LIBADD = $(AM_LIBADD) -lm libdroid-source.la
module_droid_source_la_CFLAGS = $(AM_CFLAGS)
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_LIBADD = $(AM_LIBADD) -lm libdroid-sink.la libdroid-source.la $(top_builddir)/src/common/libdroid-util.la
module_droid_card_la_CFLAGS = $(AM_CFLAGS)
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/droid/droid-sink.c
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013-2018 Jolla Ltd.
+ * Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
@@ -56,8 +56,7 @@
#include <pulsecore/core-subscribe.h>
#include "droid-sink.h"
-#include <droid/droid-util.h>
-#include <droid/conversion.h>
+#include "droid-util.h"
struct userdata {
pa_core *core;
@@ -68,6 +67,9 @@
pa_thread *thread;
pa_thread_mq thread_mq;
pa_rtpoll *rtpoll;
+ int32_t routing_counter;
+ int32_t mute_routing_before;
+ int32_t mute_routing_after;
bool deferred_volume; /* TODO */
@@ -87,14 +89,13 @@
audio_devices_t primary_devices;
audio_devices_t extra_devices;
pa_hashmap *extra_devices_map;
- bool mix_route;
bool use_hw_volume;
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_subscription *sink_input_subscription;
pa_hook_slot *sink_input_put_hook_slot;
pa_hook_slot *sink_input_unlink_hook_slot;
@@ -106,6 +107,10 @@
pa_droid_stream *stream;
};
+enum {
+ SINK_MESSAGE_DO_ROUTING = PA_SINK_MESSAGE_MAX,
+};
+
#define DEFAULT_MODULE_ID "primary"
/* sink properties */
@@ -206,10 +211,7 @@
if (u->use_voice_volume && u->extra_devices)
clear_extra_devices(u);
- if (!u->mix_route && u->extra_devices)
- routing = u->extra_devices;
- else
- routing = u->primary_devices | u->extra_devices;
+ routing = u->primary_devices | u->extra_devices;
pa_droid_stream_set_route(u->stream, routing);
}
@@ -252,8 +254,8 @@
* is multiples of buffer_size. Even if we don't write whole buffer size
* here it's okay, as long as mute time isn't configured too strictly. */
- p = pa_memblock_acquire_chunk(&u->silence);
- wrote = pa_droid_stream_write(u->stream, p, u->silence.length);
+ p = pa_memblock_acquire(u->silence.memblock);
+ wrote = pa_droid_stream_write(u->stream, (const uint8_t *) p + u->silence.index, u->silence.length);
pa_memblock_release(u->silence.memblock);
u->write_time = pa_rtclock_now() - u->write_time;
@@ -277,11 +279,8 @@
u->write_time = pa_rtclock_now();
for (;;) {
- if (pa_droid_quirk(u->hw_module, QUIRK_OUTPUT_MAKE_WRITABLE))
- pa_memchunk_make_writable(&c, c.length);
-
- p = pa_memblock_acquire_chunk(&c);
- wrote = pa_droid_stream_write(u->stream, p, c.length);
+ p = pa_memblock_acquire(c.memblock);
+ wrote = pa_droid_stream_write(u->stream, (const uint8_t *) p + c.index, c.length);
pa_memblock_release(c.memblock);
if (wrote < 0) {
@@ -387,7 +386,15 @@
pa_usec_t sleept = 0;
thread_render(u);
- thread_write(u);
+
+ if (u->routing_counter == u->mute_routing_after) {
+ do_routing(u);
+ u->routing_counter--;
+ } else if (u->routing_counter > -1) {
+ thread_write_silence(u);
+ u->routing_counter--;
+ } else
+ thread_write(u);
if (u->write_time > u->write_threshold)
sleept = u->buffer_time;
@@ -426,6 +433,7 @@
pa_assert(u);
pa_assert(u->sink);
+ pa_assert(u->stream->out);
ret = pa_droid_stream_suspend(u->stream, true);
@@ -442,7 +450,6 @@
return ret;
}
-/* Called from IO context */
static int unsuspend(struct userdata *u) {
uint32_t i;
@@ -467,69 +474,71 @@
}
/* Called from IO context */
-static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, pa_suspend_cause_t new_suspend_cause) {
- struct userdata *u;
- int r;
-
- pa_assert(s);
- pa_assert_se(u = s->userdata);
-
- /* It may be that only the suspend cause is changing, in which case there's
- * nothing more to do. */
- if (new_state == s->thread_info.state)
- return 0;
-
- switch (new_state) {
- case PA_SINK_SUSPENDED:
- pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state));
-
- if ((r = suspend(u)) < 0)
- return r;
-
- break;
-
- case PA_SINK_IDLE:
- /* Fall through */
- case PA_SINK_RUNNING:
- if (u->sink->thread_info.state == PA_SINK_SUSPENDED) {
- if ((r = unsuspend(u)) < 0)
- return r;
- }
-
- pa_rtpoll_set_timer_absolute(u->rtpoll, pa_rtclock_now());
- break;
-
- case PA_SINK_UNLINKED:
- /* Suspending since some implementations do not want to free running stream. */
- suspend(u);
- break;
-
- /* not needed */
- case PA_SINK_INIT:
- case PA_SINK_INVALID_STATE:
- break;
- }
-
- return 0;
-}
-
-/* Called from IO context */
static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
struct userdata *u = PA_SINK(o)->userdata;
switch (code) {
+ case SINK_MESSAGE_DO_ROUTING: {
+ /* When mute_routing_before & mute_routing_after are 0, routing change is done
+ * immediately when next round in thread_func. Otherwise write silence until
+ * counter equals mute_routing_after, execute routing, and write silence until
+ * routing_counter is 0. */
+ u->routing_counter = u->mute_routing_before + u->mute_routing_after;
+ return 0;
+ }
+
case PA_SINK_MESSAGE_GET_LATENCY: {
- *((pa_usec_t*) data) = pa_droid_stream_get_latency(u->stream);
+ pa_usec_t r = 0;
+
+ /* HAL reports milliseconds */
+ if (u->stream->out)
+ r = u->stream->out->get_latency(u->stream->out) * PA_USEC_PER_MSEC;
+
+ *((pa_usec_t*) data) = r;
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/droid/droid-sink.h
^
|
@@ -2,9 +2,9 @@
#define foodroidsinkfoo
/*
- * Copyright (C) 2013-2018 Jolla Ltd.
+ * Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
@@ -41,7 +41,7 @@
#include <pulsecore/macro.h>
#include <pulsecore/card.h>
-#include <droid/droid-util.h>
+#include "droid-util.h"
pa_sink *pa_droid_sink_new(pa_module *m,
pa_modargs *ma,
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/droid/droid-source.c
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013-2018 Jolla Ltd.
+ * Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
@@ -53,8 +53,7 @@
#include <pulsecore/resampler.h>
#include "droid-source.h"
-#include <droid/droid-util.h>
-#include <droid/conversion.h>
+#include "droid-util.h"
struct userdata {
pa_core *core;
@@ -80,7 +79,6 @@
pa_droid_card_data *card_data;
pa_droid_hw_module *hw_module;
pa_droid_stream *stream;
- bool stream_valid;
};
enum {
@@ -93,8 +91,6 @@
#define DROID_AUDIO_SOURCE_UNDEFINED "undefined"
static void userdata_free(struct userdata *u);
-static int suspend(struct userdata *u);
-static void unsuspend(struct userdata *u);
static int do_routing(struct userdata *u, audio_devices_t devices) {
int ret;
@@ -148,22 +144,8 @@
ssize_t readd;
pa_memchunk chunk;
- chunk.index = 0;
chunk.memblock = pa_memblock_new(u->core->mempool, (size_t) u->buffer_size);
- if (!u->stream_valid) {
- /* try to resume or post silence */
- unsuspend(u);
- if (!u->stream_valid) {
- p = pa_memblock_acquire(chunk.memblock);
- chunk.length = pa_memblock_get_length(chunk.memblock);
- pa_silence_memory(p, chunk.length, &u->source->sample_spec);
- pa_source_post(u->source, &chunk);
- pa_memblock_release(chunk.memblock);
- goto end;
- }
- }
-
p = pa_memblock_acquire(chunk.memblock);
readd = pa_droid_stream_read(u->stream, p, pa_memblock_get_length(chunk.memblock));
pa_memblock_release(chunk.memblock);
@@ -175,6 +157,7 @@
u->timestamp += pa_bytes_to_usec(readd, &u->source->sample_spec);
+ chunk.index = 0;
chunk.length = readd;
if (u->resampler) {
@@ -267,56 +250,8 @@
pa_assert(u);
pa_assert(u->stream);
- if (pa_droid_stream_suspend(u->stream, false) >= 0) {
- u->stream_valid = true;
- pa_log_info("Resuming...");
- } else
- u->stream_valid = false;
-}
-
-/* Called from IO context */
-static int source_set_state_in_io_thread_cb(pa_source *s, pa_source_state_t new_state, pa_suspend_cause_t new_suspend_cause) {
- struct userdata *u;
- int r;
-
- pa_assert(s);
- pa_assert_se(u = s->userdata);
-
- /* It may be that only the suspend cause is changing, in which case there's
- * nothing more to do. */
- if (new_state == s->thread_info.state)
- return 0;
-
- switch (new_state) {
- case PA_SOURCE_SUSPENDED:
- if (PA_SOURCE_IS_OPENED(u->source->thread_info.state)) {
- if ((r = suspend(u)) < 0)
- return r;
- }
-
- break;
-
- case PA_SOURCE_IDLE:
- /* Fall through */
- case PA_SOURCE_RUNNING:
- if (u->source->thread_info.state == PA_SOURCE_SUSPENDED) {
- unsuspend(u);
- u->timestamp = pa_rtclock_now();
- }
- break;
-
- case PA_SOURCE_UNLINKED:
- /* Suspending since some implementations do not want to free running stream. */
- suspend(u);
- break;
-
- /* not needed */
- case PA_SOURCE_INIT:
- case PA_SOURCE_INVALID_STATE:
- break;
- }
-
- return 0;
+ pa_droid_stream_suspend(u->stream, false);
+ pa_log_info("Resuming...");
}
/* Called from IO context */
@@ -329,19 +264,48 @@
pa_assert(PA_SOURCE_IS_OPENED(u->source->thread_info.state));
- suspend(u);
+ pa_droid_stream_suspend(u->stream, true);
do_routing(u, device);
- unsuspend(u);
+ pa_droid_stream_suspend(u->stream, false);
break;
}
-#if PULSEAUDIO_VERSION < 12
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;
+ switch ((pa_source_state_t) PA_PTR_TO_UINT(data)) {
+ case PA_SOURCE_SUSPENDED: {
+ int r;
+
+ if (PA_SOURCE_IS_OPENED(u->source->thread_info.state)) {
+ if ((r = suspend(u)) < 0)
+ return r;
+ }
+
+ break;
+ }
+
+ case PA_SOURCE_IDLE:
+ /* Fall through */
+ case PA_SOURCE_RUNNING: {
+ if (u->source->thread_info.state == PA_SOURCE_SUSPENDED) {
+ unsuspend(u);
+ u->timestamp = pa_rtclock_now();
+ }
+ break;
+ }
+
+ case PA_SOURCE_UNLINKED: {
+ /* Suspending since some implementations do not want to free running stream. */
+ suspend(u);
+ break;
+ }
+
+ /* not needed */
+ case PA_SOURCE_INIT:
+ case PA_SOURCE_INVALID_STATE:
+ ;
+ }
+ break;
}
-#endif
}
return pa_source_process_msg(o, code, data, offset, chunk);
@@ -468,11 +432,11 @@
pa_log_info("Using buffer size %u.", u->buffer_size);
if (pa_thread_mq_get())
- pa_source_set_fixed_latency_within_thread(u->source, pa_bytes_to_usec(u->buffer_size, &u->stream->input->sample_spec));
+ pa_source_set_fixed_latency_within_thread(u->source, pa_bytes_to_usec(u->buffer_size, &u->stream->sample_spec));
else
- pa_source_set_fixed_latency(u->source, pa_bytes_to_usec(u->buffer_size, &u->stream->input->sample_spec));
+ pa_source_set_fixed_latency(u->source, pa_bytes_to_usec(u->buffer_size, &u->stream->sample_spec));
- pa_log_debug("Set fixed latency %" PRIu64 " usec", pa_bytes_to_usec(u->buffer_size, &u->stream->input->sample_spec));
+ pa_log_debug("Set fixed latency %" PRIu64 " usec", pa_bytes_to_usec(u->buffer_size, &u->stream->sample_spec));
}
/* Called from IO context. */
@@ -502,12 +466,12 @@
if (stream != u->stream)
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/droid/droid-source.h
^
|
@@ -2,9 +2,9 @@
#define foodroidsourcefoo
/*
- * Copyright (C) 2013-2018 Jolla Ltd.
+ * Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
@@ -41,7 +41,7 @@
#include <pulsecore/macro.h>
#include <pulsecore/card.h>
-#include <droid/droid-util.h>
+#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,
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/droid/keepalive.c
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013-2018 Jolla Ltd.
+ * Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
@@ -53,7 +53,6 @@
struct pa_droid_keepalive {
pa_core *core;
pa_dbus_connection *dbus_connection;
- DBusPendingCall *pending;
pa_atomic_t started;
pa_usec_t timeout;
@@ -132,9 +131,7 @@
pa_assert(pending);
pa_assert(k);
- pa_assert(pending == k->pending);
- k->pending = NULL;
pa_assert_se(msg = dbus_pending_call_steal_reply(pending));
if (dbus_message_get_type(msg) == DBUS_MESSAGE_TYPE_ERROR) {
@@ -146,7 +143,7 @@
DBUS_TYPE_INT32, &period,
DBUS_TYPE_INVALID));
- k->timeout = PA_USEC_PER_SEC * period;
+ k->timeout = PA_USEC_PER_SEC * (period - 5);
keepalive_start(k);
@@ -156,6 +153,7 @@
}
void pa_droid_keepalive_start(pa_droid_keepalive *k) {
+ DBusPendingCall *pending = NULL;
DBusMessage *msg = NULL;
pa_assert(k);
@@ -165,7 +163,6 @@
return;
pa_assert(!k->timer_event);
- pa_assert(!k->pending);
/* Period time already requested, just start hearbeat. */
if (k->timeout > 0) {
@@ -182,13 +179,10 @@
MCE_DBUS_IFACE,
MCE_DBUS_KEEPALIVE_PERIOD_REQ)));
- dbus_connection_send_with_reply(pa_dbus_connection_get(k->dbus_connection), msg, &k->pending, -1);
+ dbus_connection_send_with_reply(pa_dbus_connection_get(k->dbus_connection), msg, &pending, -1);
dbus_message_unref(msg);
- if (k->pending)
- dbus_pending_call_set_notify(k->pending, pending_req_reply_cb, k, NULL);
- else
- pa_log("D-Bus method call failed.");
+ dbus_pending_call_set_notify(pending, pending_req_reply_cb, k, NULL);
}
void pa_droid_keepalive_stop(pa_droid_keepalive *k) {
@@ -202,18 +196,12 @@
pa_assert(pa_atomic_load(&k->started) == 0);
- pa_log_debug("Stopping keepalive.");
-
- if (k->pending) {
- dbus_pending_call_cancel(k->pending);
- dbus_pending_call_unref(k->pending);
- k->pending = NULL;
- }
+ if (!k->timer_event)
+ return;
- if (k->timer_event) {
- k->core->mainloop->time_free(k->timer_event);
- k->timer_event = NULL;
- }
+ pa_log_debug("Stopping keepalive.");
+ k->core->mainloop->time_free(k->timer_event);
+ k->timer_event = NULL;
pa_assert_se((msg = dbus_message_new_method_call(MCE_DBUS_NAME,
MCE_DBUS_PATH,
@@ -230,14 +218,6 @@
pa_assert(pa_atomic_load(&k->started) == 0);
- if (k->timer_event)
- k->core->mainloop->time_free(k->timer_event);
-
- if (k->pending) {
- dbus_pending_call_cancel(k->pending);
- dbus_pending_call_unref(k->pending);
- }
-
pa_dbus_connection_unref(k->dbus_connection);
pa_xfree(k);
}
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/droid/keepalive.h
^
|
@@ -2,9 +2,9 @@
#define foodroidkeepalivefoo
/*
- * Copyright (C) 2013-2018 Jolla Ltd.
+ * Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/droid/module-droid-card-symdef.h
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013-2018 Jolla Ltd.
+ * Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/droid/module-droid-card.c
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013-2018 Jolla Ltd.
+ * Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
@@ -59,7 +59,7 @@
//#include <droid/hardware/audio_policy.h>
//#include <droid/system/audio_policy.h>
-#include <droid/droid-util.h>
+#include "droid-util.h"
#include "droid-sink.h"
#include "droid-source.h"
@@ -81,8 +81,7 @@
"config=<location for droid audio configuration> "
"voice_property_key=<proplist key searched for sink-input that should control voice call volume> "
"voice_property_value=<proplist value for the key for voice control sink-input> "
- "default_profile=<boolean. create default profile for primary module or not. defaults to true> "
- "merge_inputs=<boolean. merge input streams to single source with default profile. defaults to true> "
+ "combine=<comma separated list of outputs that should be merged to one profile. defaults to none> "
"quirks=<comma separated list of quirks to enable/disable>"
);
@@ -98,7 +97,6 @@
"sink_rate",
"sink_format",
"sink_channel_map",
- "sink_mix_route",
"source_rate",
"source_format",
"source_channel_map",
@@ -114,7 +112,6 @@
"config",
"voice_property_key",
"voice_property_value",
- "default_profile",
"combine",
"quirks",
NULL,
@@ -130,9 +127,6 @@
#define COMMUNICATION_PROFILE_NAME "communication"
#define COMMUNICATION_PROFILE_DESC "Communication mode"
-#define VENDOR_EXT_REALCALL_ON "realcall=on"
-#define VENDOR_EXT_REALCALL_OFF "realcall=off"
-
struct userdata;
typedef bool (*virtual_profile_event_cb)(struct userdata *u, pa_droid_profile *p, bool enabling);
@@ -213,7 +207,6 @@
struct profile_data *d;
cp = pa_card_profile_new("off", _("Off"), sizeof(struct profile_data));
- cp->available = PA_AVAILABLE_YES;
d = PA_CARD_PROFILE_DATA(cp);
d->profile = NULL;
@@ -431,8 +424,8 @@
}
static bool voicecall_profile_event_cb(struct userdata *u, pa_droid_profile *p, bool enabling) {
- pa_card_profile *cp = NULL;
- pa_droid_mapping *am_output;
+ pa_card_profile *cp;
+ pa_droid_mapping *am_output, *am_input;
pa_assert(u);
pa_assert(p);
@@ -443,27 +436,28 @@
return false;
}
- if (pa_droid_idxset_mapping_with_device(u->old_profile->input_mappings,
- AUDIO_DEVICE_IN_VOICE_CALL))
- cp = pa_hashmap_get(u->card->profiles, VOICE_RECORD_PROFILE_NAME);
+ if (!(am_input = pa_droid_idxset_get_primary(u->old_profile->input_mappings)))
+ pa_log_warn("Active profile doesn't have primary input device.");
/* call mode specialities */
if (enabling) {
pa_droid_sink_set_voice_control(am_output->sink, true);
- if (cp && cp->available == PA_AVAILABLE_NO) {
- pa_log_debug("Enable " VOICE_RECORD_PROFILE_NAME " profile.");
- pa_card_profile_set_available(cp, PA_AVAILABLE_YES);
+ if (am_input && am_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);
+ }
}
- if (pa_droid_quirk(u->hw_module, QUIRK_REALCALL))
- pa_droid_set_parameters(u->hw_module, VENDOR_EXT_REALCALL_ON);
} else {
pa_droid_sink_set_voice_control(am_output->sink, false);
- if (cp && cp->available == PA_AVAILABLE_YES) {
- pa_log_debug("Disable " VOICE_RECORD_PROFILE_NAME " profile.");
- pa_card_profile_set_available(cp, PA_AVAILABLE_NO);
+ if (am_input && am_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);
+ }
}
- if (pa_droid_quirk(u->hw_module, QUIRK_REALCALL))
- pa_droid_set_parameters(u->hw_module, VENDOR_EXT_REALCALL_OFF);
}
return true;
@@ -548,7 +542,6 @@
pa_droid_mapping *am;
struct profile_data *nd, *od;
pa_queue *sink_inputs = NULL, *source_outputs = NULL;
- pa_sink *primary_sink = NULL;
uint32_t idx;
pa_assert(c);
@@ -618,12 +611,8 @@
continue;
if (nd->profile &&
- pa_idxset_get_by_data(nd->profile->output_mappings, am, NULL)) {
-
- if (pa_droid_mapping_is_primary(am))
- primary_sink = am->sink;
+ pa_idxset_get_by_data(nd->profile->output_mappings, am, NULL))
continue;
- }
sink_inputs = pa_sink_move_all_start(am->sink, sink_inputs);
pa_droid_sink_free(am->sink);
@@ -670,13 +659,6 @@
}
}
- /* if only primary sink is left after profile change and we have detached sink-inputs attach
- * them to primary sink. */
- if (sink_inputs && primary_sink) {
- pa_sink_move_all_finish(primary_sink, sink_inputs, false);
- sink_inputs = NULL;
- }
-
if (sink_inputs)
pa_sink_move_all_fail(sink_inputs);
@@ -688,15 +670,13 @@
int pa__init(pa_module *m) {
- 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;
pa_card_profile *virtual;
- bool default_profile = true;
- bool merge_inputs = true;
+ const char *combine;
const char *quirks;
pa_assert(m);
@@ -706,35 +686,20 @@
goto fail;
}
- if (pa_modargs_get_value_boolean(ma, "default_profile", &default_profile) < 0) {
- pa_log("Failed to parse default_profile argument. Expects boolean value");
- goto fail;
- }
-
- if (pa_modargs_get_value_boolean(ma, "merge_inputs", &merge_inputs) < 0) {
- pa_log("Failed to parse merge_inputs argument. Expects boolean value");
- goto fail;
- }
+ combine = pa_modargs_get_value(ma, "combine", NULL);
- u = pa_xnew0(struct userdata, 1);
+ struct userdata *u = pa_xnew0(struct userdata, 1);
u->core = m->core;
m->userdata = u;
- 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 (!(config = pa_droid_config_load(ma)))
+ goto fail;
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/droid/module-droid-keepalive-symdef.h
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013-2018 Jolla Ltd.
+ * Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/droid/module-droid-keepalive.c
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013-2018 Jolla Ltd.
+ * Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
@@ -103,52 +103,42 @@
u->active = false;
}
-static void update_sink(pa_sink *sink, struct userdata *u) {
- pa_assert(sink);
+static pa_hook_result_t device_state_changed_hook_cb(pa_core *c, pa_object *o, struct userdata *u) {
+ pa_assert(c);
+ pa_object_assert_ref(o);
pa_assert(u);
- if (pa_sink_get_state(sink) != PA_SINK_SUSPENDED)
- start(u);
- else
- stop(u);
-}
+ if (pa_source_isinstance(o)) {
+ pa_source *s = PA_SOURCE(o);
-static void update_source(pa_source *source, struct userdata *u) {
- pa_assert(source);
- pa_assert(u);
+ /* Don't react on monitor state changes. */
+ if (!s->monitor_of) {
+ pa_source_state_t state = pa_source_get_state(s);
+
+ if (state != PA_SOURCE_SUSPENDED)
+ start(u);
+ else
+ stop(u);
+ }
+ } else if (pa_sink_isinstance(o)) {
+ pa_sink *s = PA_SINK(o);
+ pa_sink_state_t state = pa_sink_get_state(s);
- /* Don't react on monitor state changes. */
- if (!source->monitor_of) {
- if (pa_source_get_state(source) != PA_SOURCE_SUSPENDED)
+ if (state != PA_SINK_SUSPENDED)
start(u);
else
stop(u);
}
-}
-
-static pa_hook_result_t device_state_changed_hook_cb(pa_core *c, pa_object *o, struct userdata *u) {
- pa_assert(c);
- pa_object_assert_ref(o);
- pa_assert(u);
-
- if (pa_source_isinstance(o))
- update_source(PA_SOURCE(o), u);
- else if (pa_sink_isinstance(o))
- update_sink(PA_SINK(o), u);
return PA_HOOK_OK;
}
int pa__init(pa_module *m) {
- uint32_t idx = 0;
- pa_sink *sink;
- pa_source *source;
- struct userdata *u;
pa_assert(m);
- u = pa_xnew0(struct userdata, 1);
+ struct userdata *u = pa_xnew0(struct userdata, 1);
u->core = m->core;
u->active = false;
u->module = m;
@@ -162,12 +152,6 @@
u->sink_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) device_state_changed_hook_cb, u);
u->source_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) device_state_changed_hook_cb, u);
- PA_IDXSET_FOREACH(source, u->core->sources, idx)
- update_source(source, u);
-
- PA_IDXSET_FOREACH(sink, u->core->sinks, idx)
- update_sink(sink, u);
-
return 0;
fail:
@@ -189,7 +173,7 @@
pa_hook_slot_free(u->source_state_changed_slot);
if (u->keepalive) {
- pa_droid_keepalive_stop(u->keepalive);
+ stop(u);
pa_droid_keepalive_free(u->keepalive);
}
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/droid/module-droid-sink-symdef.h
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013-2018 Jolla Ltd.
+ * Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/droid/module-droid-sink.c
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013-2018 Jolla Ltd.
+ * Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
@@ -37,8 +37,7 @@
#include <pulsecore/log.h>
#include <pulsecore/macro.h>
-#include <droid/droid-util.h>
-#include <droid/conversion.h>
+#include "droid-util.h"
#include "droid-sink.h"
#include "module-droid-sink-symdef.h"
@@ -50,7 +49,6 @@
PA_MODULE_VERSION(PACKAGE_VERSION);
static const char* const valid_modargs[] = {
- "config",
"rate",
"format",
"channels",
@@ -58,7 +56,6 @@
"sink_rate",
"sink_format",
"sink_channel_map",
- "sink_mix_route",
"flags",
"output_devices",
"sink_name",
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/droid/module-droid-source-symdef.h
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013-2018 Jolla Ltd.
+ * Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-8.0.59.tar.bz2/src/droid/module-droid-source.c
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013-2018 Jolla Ltd.
+ * Copyright (C) 2013 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
+ * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
*
* These PulseAudio Modules are free software; you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
@@ -37,7 +37,7 @@
#include <pulsecore/log.h>
#include <pulsecore/macro.h>
-#include <droid/droid-util.h>
+#include "droid-util.h"
#include "droid-source.h"
#include "module-droid-source-symdef.h"
@@ -49,7 +49,6 @@
PA_MODULE_VERSION(PACKAGE_VERSION);
static const char* const valid_modargs[] = {
- "config",
"rate",
"format",
"channels",
|