[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -1,6 +1,6 @@
<services>
<service name="tar_git">
- <param name="url">https://github.com/NotKit/pulseaudio-modules-droid.git</param>
+ <param name="url">https://github.com/mer-hybris/pulseaudio-modules-droid.git</param>
<param name="branch">master</param>
<param name="revision"></param>
<param name="token"/>
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/README.md
^
|
@@ -0,0 +1,356 @@
+PulseAudio Droid modules
+========================
+
+For adapdations for Android versions 4 to 10,
+see [pulseaudio-modules-droid-jb2q](https://github.com/mer-hybris/pulseaudio-modules-droid-jb2q)
+
+Building of droid modules is split to two packages
+* **common** (and **common-devel**) which contains shared library code for use in
+ PulseAudio modules in this package and for inclusion in other projects
+* **droid** with actual PulseAudio modules
+
+Linking to libdroid is **not encouraged**, usually only HAL functions are needed
+which can be accessed using the pulsecore shared API (see below).
+
+Supported Android versions:
+
+* 11.x
+
+Headers for defining devices and strings for different droid versions are in
+src/common/droid-util-audio.h.
+
+When new devices with relevant new enums appear, add enum check to configure.ac.
+CC_CHECK_DROID_ENUM macro will create macros HAVE_ENUM_FOO, STRING_ENTRY_IF_FOO
+and FANCY_ENTRY_IF_FOO if enum FOO exists in HAL audio.h.
+
+For example:
+
+ # configure.ac:
+ CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_IP])
+ CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_OTHER_NEW])
+
+ # and then in droid-util-audio.h add macros to proper tables:
+ /* string_conversion_table_output_device[] */
+ STRING_ENTRY_IF_OUT_IP
+ STRING_ENTRY_IF_OUT_OTHER_NEW
+
+ /* string_conversion_table_output_device_fancy[] */
+ FANCY_ENTRY_IF_OUT_IP("output-ip")
+ FANCY_ENTRY_IF_OUT_OTHER_NEW("output-other_new")
+
+In addition to the above macros there are also now defines
+HAVE_ENUM_AUDIO_DEVICE_OUT_IP and HAVE_ENUM_AUDIO_DEVICE_OUT_OTHER_NEW.
+
+The purpose of droid-modules is to "replace AudioFlinger". Many hardware
+adaptations use ALSA as the kernel interface, but there is no saying that
+someday vendor would create and use something proprietary or otherwise
+different from ALSA. Also the ALSA implementation in droid devices may contain
+funny ways to achieve things (notable example is voicecall) which might be
+difficult to do if interfacing directly with ALSA to replace AudioFlinger.
+Also using ALSA directly would mean that the whole HAL adaptation would need to
+be ported for each new device adaptation. With droid-modules this is much more
+simpler, with somewhat stable HAL (HALv3 as of now, also different vendors add
+their own incompatible extensions) API. In best scenarios using droid-modules
+with new device is just compiling against target.
+
+Components
+==========
+
+common
+------
+
+The common part of PulseAudio Droid modules contains library for handling
+most operations towards audio HAL.
+
+### Audio policy configuration parsing
+
+Configuration parser reads audio policy xml files.
+
+### Configuration files
+
+If the configuration is in non-default location for some reason "config"
+module argument can be used to point to the configuration file location.
+
+By default files are tried in following order,
+
+ /odm/etc/audio_policy_configuration.xml
+ /vendor/etc/audio/audio_policy_configuration.xml
+ /vendor/etc/audio_policy_configuration.xml
+ /system/etc/audio_policy_configuration.xml
+
+module-droid-card
+-----------------
+
+Ideally only module-droid-card is loaded and then droid-card loads
+configuration, creates profiles and loads sinks and sources based on the
+selected profile.
+
+default profile
+---------------
+
+When module-droid-card is loaded with default arguments, droid-card will
+create a default profile (called unsurprisingly "default"). The default
+profile will merge supported output and input streams to one profile,
+to allow use of possible low latency or deep buffer outputs.
+
+virtual profiles
+----------------
+
+In addition to aforementioned card profile, droid-card creates some additional
+virtual profiles. These virtual profiles are used when enabling voicecall
+routings etc. When virtual profile is enabled, possible sinks and sources
+previously active profile had are not removed.
+
+As an illustration, following command line sequence enables voicecall mode and
+routes audio to internal handsfree (ihf - "handsfree speaker"):
+
+ pactl set-card-profile droid_card.primary voicecall
+ pactl set-sink-port sink.primary output-parking
+ pactl set-sink-port sink.primary output-speaker
+
+After this, when there is an active voicecall (created by ofono for example),
+voice audio starts to flow between modem and audio chip.
+
+To disable voicecall and return to media audio:
+
+ pactl set-card-profile droid_card.primary default
+ pactl set-sink-port sink.primary output-parking
+ pactl set-sink-port sink.primary output-speaker
+
+With this example sequence sinks and sources are the ones from default
+card profile, and they are maintained for the whole duration of the voicecall
+and after.
+
+This sequence follows the droid HAL idea that when changing audio mode the mode
+change is done when next routing change happens. output-parking and
+input-parking ports are just convenience for PulseAudio, where setting already
+active port is a no-op (output/input-parking doesn't do any real routing
+changes).
+
+Current virtual profiles are:
+* voicecall
+* voicecall-record
+* communication
+* ringtone
+
+Communication profile is used for VoIP-like applications, to enable some
+voicecall related algorithms without being in voicecall. Ringtone profile
+should be used when ringtone is playing, to again enable possible loudness
+related optimizations etc. Voicecall-record profile can be enabled when
+voicecall profile is active.
+
+If mix port with flag AUDIO_OUTPUT_FLAG_VOIP_RX exists when communication
+virtual profile is enabled additional droid-sink is created with the config
+defined in the mix port. Voip audio should then be played to this new sink.
+
+module-droid-sink and module-droid-source
+-----------------------------------------
+
+Normally user should not need to load droid-sink or droid-source modules by
+hand, but droid-card loads appropriate modules based on the active card
+profile.
+
+Changing output routing is as simple as
+
+ pactl set-sink-port sink.primary output-wired_headphone
+
+Sinks or sources do not track possible headphone/other wired accessory
+plugging, but this needs to be handled elsewhere and then that other entity
+needs to control sinks and sources. (For example in SailfishOS this entity is
+OHM with accessory-plugin and pulseaudio-policy-enforcement module for
+actually making the port switching)
+
+Droid source automatic reconfiguration
+--------------------------------------
+
+As droid HAL makes assumptions on (input) routing based on what the parameters
+for the stream are (device, sample rate, channels, format, etc.) normal
+PulseAudio sources are a bit inflexible as only sample rate can change after
+source creation and even then there are restrictions based on alternative
+sample rate value.
+
+To overcome this and to allow some more variables affecting the stream being
+passed to the input stream droid source is modified to reconfigure itself
+with the source-output that connects to it. This means, that just looking at
+inactive source from "pactl list" listing doesn't tell the whole story.
+
+Droid source is always reconfigured with the *last* source-output that
+connects to it, possibly already connected source-outputs will continue
+to read from the source but through resampler.
+
+For example,
+
+1) source-output 44100Hz, stereo connects (so1)
+ 1) source is configured with 44100Hz, stereo
+ 2) so1 connects to the source without resampler
+2) source-output 16000Hz, mono connects (so2)
+ 1) so1 is detached from the source
+ 2) source is configured with 16000Hz, mono
+ 3) so2 connects to the source without resampler
+ 4) resampler is created for so1, 16000Hz, mono -> 44100Hz stereo
+ 5) so1 is re-attached to the source through resampler
+3) source-output 16000Hz, mono connects (so3)
+ 1) so1 and so2 are detached from the source
+ 2) so3 connects to the source without resampler
+ 3) so1 is re-attached to the source through resampler
+ 4) so2 is attached to the source
+
+Classifying sinks and sources
+-----------------------------
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/meson.build
^
|
@@ -0,0 +1,172 @@
+project('pulseaudio-modules-droid', 'c',
+ version : run_command(find_program('git-version-gen'), join_paths(meson.current_source_dir(), '.tarball-version'), check: true).stdout().strip(),
+ meson_version : '>= 0.50.0',
+ default_options : [ 'c_std=gnu11' ]
+ )
+
+cc = meson.get_compiler('c')
+
+configinc = include_directories('.')
+libdir = join_paths(get_option('prefix'), get_option('libdir'))
+
+pa_c_args = ['-DHAVE_CONFIG_H']
+
+droiddevice = get_option('droid-device')
+pa_c_args += ['-DDROID_DEVICE_@0@=1'.format(droiddevice.underscorify().to_upper())]
+pa_c_args += ['-DDROID_DEVICE_STRING="@0@"'.format(droiddevice)]
+
+# dependencies
+droid_headers_dep = dependency('android-headers', required : true)
+expat_dep = dependency('expat', version : '>= 2.1', required : true)
+hybris_dep = dependency('libhardware', version : '>= 0.1.0', required : true)
+hybris_common_dep = cc.find_library('hybris-common', required : true)
+ltdl_dep = cc.find_library('ltdl', required : true)
+pulsecore_dep = dependency('pulsecore', version : '>= 14.2', required : true)
+
+pa_version_str = meson.project_version()
+# For tarballs, the first split will do nothing, but for builds in git, we
+# split out suffixes when there are commits since the last tag
+# (e.g.: v11.99.1-3-gad14bdb24 -> v11.99.1)
+version_split = pa_version_str.split('-')[0].split('.')
+pa_version_major = version_split[0].split('v')[0]
+pa_version_minor = version_split[1]
+pa_version_module = version_split[2].split('+')[0]
+pa_version_major_minor = pa_version_major + '.' + pa_version_minor
+
+modlibexecdir = get_option('modlibexecdir')
+if modlibexecdir == ''
+ modlibexecdir = join_paths(libdir, 'pulse-' + pa_version_major_minor, 'modules')
+endif
+
+privlibdir = join_paths(libdir, 'pulseaudio')
+rpath_dirs = join_paths(privlibdir) + ':' + join_paths(modlibexecdir)
+
+cdata = configuration_data()
+cdata.set_quoted('PACKAGE', meson.project_name())
+cdata.set_quoted('PACKAGE_NAME', meson.project_name())
+cdata.set_quoted('PACKAGE_VERSION', pa_version_str)
+cdata.set_quoted('VERSION', pa_version_str)
+
+# Atomic operations
+
+if get_option('atomic-arm-memory-barrier')
+ cdata.set('ATOMIC_ARM_MEMORY_BARRIER_ENABLED', 1)
+endif
+
+need_libatomic_ops = false
+
+atomictest = '''void func() {
+ volatile int atomic = 2;
+ __sync_bool_compare_and_swap (&atomic, 2, 3);
+}
+'''
+
+if cc.compiles(atomictest)
+ cdata.set('HAVE_ATOMIC_BUILTINS', 1)
+
+ newatomictest = '''void func() {
+ int c = 0;
+ __atomic_store_n(&c, 4, __ATOMIC_SEQ_CST);
+ }
+ '''
+
+ if(cc.compiles(newatomictest))
+ cdata.set('HAVE_ATOMIC_BUILTINS_MEMORY_MODEL', 1)
+ endif
+
+elif host_machine.cpu_family() == 'arm'
+ if host_machine.system() == 'linux' and get_option('atomic-arm-linux-helpers')
+ cdata.set('ATOMIC_ARM_LINUX_HELPERS', 1)
+ else
+ armatomictest = '''int func() {
+ volatile int a=0;
+ int o=0, n=1, r;
+ asm volatile (
+ "ldrex %0, [%1]\n"
+ "subs %0, %0, %2\n"
+ "strexeq %0, %3, [%1]\n"
+ : "=&r" (r)
+ : "r" (&a), "Ir" (o), "r" (n)
+ : "cc");
+ return (a==1 ? 0 : -1);
+ }
+ '''
+
+ if cc.compiles(armatomictest)
+ cdata.set('ATOMIC_ARM_INLINE_ASM', 1)
+ else
+ need_libatomic_ops = true
+ endif
+ endif # arm && !linux
+
+elif not ['freebsd', 'netbsd'].contains(host_machine.system())
+ need_libatomic_ops = true
+endif # !atomic helpers && !arm
+
+if need_libatomic_ops
+ assert(cc.has_header('atomic_ops.h'), 'Need libatomic_ops')
+
+ cdata.set('AO_REQUIRE_CAS', 1)
+
+ if host_machine.system() != 'windows'
+ libatomic_ops_dep = cc.find_library('atomic_ops', required : true)
+ else
+ libatomic_ops_dep = dependency('', required: false)
+ endif
+else
+ libatomic_ops_dep = dependency('', required: false)
+endif
+
+check_enums = [
+ # Input devices
+ 'AUDIO_DEVICE_IN_FM_RX',
+ 'AUDIO_DEVICE_IN_FM_RX_A2DP',
+ # Audio sources
+ 'AUDIO_SOURCE_ECHO_REFERENCE',
+ 'AUDIO_SOURCE_FM_TUNER',
+ 'AUDIO_SOURCE_FM_RX',
+ 'AUDIO_SOURCE_FM_RX_A2DP',
+ # Output flags
+ 'AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH',
+ # Channels
+ 'AUDIO_CHANNEL_IN_VOICE_CALL_MONO',
+ 'AUDIO_CHANNEL_IN_VOICE_UPLINK_MONO',
+ 'AUDIO_CHANNEL_IN_VOICE_DNLINK_MONO',
+ # Formats
+ 'AUDIO_FORMAT_PCM_OFFLOAD',
+ 'AUDIO_FORMAT_FLAC',
+ 'AUDIO_FORMAT_OPUS',
+]
+
+foreach e : check_enums
+ if cc.has_header_symbol('system/audio.h', e, dependencies : droid_headers_dep, prefix : '#include <android-config.h>\n#ifdef QCOM_BSP\n#define QCOM_HARDWARE\n#endif')
+ define = 'HAVE_ENUM_' + e
+ cdata.set(define, 1)
+ define = 'STRING_ENTRY_IF_' + e
+ cdata.set(define, 'STRING_ENTRY(' + e + '),')
+ define = 'FANCY_ENTRY_IF_' + e + '(n)'
+ cdata.set(define, '{' + e + ', n},')
+ else
+ define = 'STRING_ENTRY_IF_' + e
+ cdata.set(define, '')
+ define = 'FANCY_ENTRY_IF_' + e + '(n)'
+ cdata.set(define, '')
+ endif
+endforeach
+
+# Headers
+check_headers = [
+ 'valgrind/memcheck.h',
+]
+
+foreach h : check_headers
+ if cc.has_header(h)
+ define = 'HAVE_' + h.underscorify().to_upper()
+ cdata.set(define, 1)
+ endif
+endforeach
+
+# Now generate config.h from everything above
+configure_file(output : 'config.h', configuration : cdata)
+
+subdir('src')
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/meson_options.txt
^
|
@@ -0,0 +1,15 @@
+option('atomic-arm-linux-helpers',
+ type : 'boolean',
+ value : true,
+ description : 'Use inline asm or libatomic_ops instead')
+option('atomic-arm-memory-barrier',
+ type : 'boolean',
+ value : false,
+ description : 'Enable memory barriers (only really needed in SMP arm systems)')
+option('droid-device',
+ type : 'string',
+ value : 'generic',
+ description : 'Droid device type for possible specific quirks (defaults to generic).')
+option('modlibexecdir',
+ type : 'string',
+ description : 'Specify location where modules will be installed')
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/common/config-parser-xml.c
^
|
@@ -0,0 +1,1245 @@
+/*
+ * Copyright (C) 2018-2022 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"
+
+#include <stdarg.h>
+#include <string.h>
+#include <expat.h>
+
+#include <pulse/xmalloc.h>
+#include <pulsecore/core-util.h>
+#include <pulsecore/core-error.h>
+#include <pulsecore/strbuf.h>
+
+#include "droid/conversion.h"
+#include "droid/sllist.h"
+#include "droid/utils.h"
+#include "droid/droid-config.h"
+#include "config-parser-xml.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 ELEMENT_include "xi:include"
+
+#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 ATTRIBUTE_href "href"
+#define ATTRIBUTE_maxOpenCount "maxOpenCount"
+#define ATTRIBUTE_maxActiveCount "maxActiveCount"
+#define ATTRIBUTE_address "address"
+
+#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 bool parse_module_include(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
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/common/config-parser-xml.h
^
|
@@ -0,0 +1,33 @@
+#ifndef foodroidconfigparserxmlfoo
+#define foodroidconfigparserxmlfoo
+
+/*
+ * Copyright (C) 2022 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/droid-config.h>
+
+dm_config_device *pa_parse_droid_audio_config_xml(const char *filename);
+
+#endif
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/common/conversion.c
^
|
@@ -0,0 +1,529 @@
+/*
+ * Copyright (C) 2013-2022 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 " ,"
+
+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;
+
+ for (unsigned int i = 0; list[i].str; i++) {
+ 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;
+}
+
+/* Generic conversion */
+bool pa_string_convert_num_to_str(pa_conversion_string_t type, uint32_t value, const char **to_str) {
+ switch (type) {
+ case CONV_STRING_FORMAT:
+ return string_convert_num_to_str(string_conversion_table_format, value, to_str);
+
+ case CONV_STRING_OUTPUT_CHANNELS:
+ return string_convert_num_to_str(string_conversion_table_output_channels, value, to_str);
+
+ case CONV_STRING_INPUT_CHANNELS:
+ return string_convert_num_to_str(string_conversion_table_input_channels, value, to_str);
+
+ case CONV_STRING_OUTPUT_DEVICE:
+ return string_convert_num_to_str(string_conversion_table_output_device, value, to_str);
+
+ case CONV_STRING_INPUT_DEVICE:
+ return string_convert_num_to_str(string_conversion_table_input_device, value, to_str);
+
+ case CONV_STRING_OUTPUT_FLAG:
+ return string_convert_num_to_str(string_conversion_table_output_flag, value, to_str);
+
+ case CONV_STRING_INPUT_FLAG:
+ return string_convert_num_to_str(string_conversion_table_input_flag, value, to_str);
+
+ case CONV_STRING_AUDIO_SOURCE_FANCY:
+ return string_convert_num_to_str(string_conversion_table_audio_source_fancy, value, to_str);
+ }
+
+ pa_assert_not_reached();
+ return false;
+}
+
+bool pa_string_convert_str_to_num(pa_conversion_string_t type, const char *str, uint32_t *to_value) {
+ switch (type) {
+ case CONV_STRING_FORMAT:
+ return string_convert_str_to_num(string_conversion_table_format, str, to_value);
+
+ case CONV_STRING_OUTPUT_CHANNELS:
+ return string_convert_str_to_num(string_conversion_table_output_channels, str, to_value);
+
+ case CONV_STRING_INPUT_CHANNELS:
+ return string_convert_str_to_num(string_conversion_table_input_channels, str, to_value);
+
+ case CONV_STRING_OUTPUT_DEVICE:
+ return string_convert_str_to_num(string_conversion_table_output_device, str, to_value);
+
+ case CONV_STRING_INPUT_DEVICE:
+ return string_convert_str_to_num(string_conversion_table_input_device, str, to_value);
+
+ case CONV_STRING_OUTPUT_FLAG:
+ return string_convert_str_to_num(string_conversion_table_output_flag, str, to_value);
+
+ case CONV_STRING_INPUT_FLAG:
+ return string_convert_str_to_num(string_conversion_table_input_flag, str, to_value);
+
+ case CONV_STRING_AUDIO_SOURCE_FANCY:
+ return string_convert_str_to_num(string_conversion_table_audio_source_fancy, str, to_value);
+ }
+
+ pa_assert_not_reached();
+ return false;
+}
+
+/* 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);
+}
+
+/* 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);
+}
+
+/* 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) {
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/common/droid-config.c
^
|
@@ -0,0 +1,366 @@
+/*
+ * Copyright (C) 2013-2022 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 "config-parser-xml.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/xmalloc.h>
+#include <pulsecore/core-util.h>
+#include <pulsecore/log.h>
+#include <pulsecore/macro.h>
+#include <pulsecore/modargs.h>
+
+#include <hardware/audio.h>
+
+#define ODM_AUDIO_POLICY_CONFIG_XML_FILE "/odm/etc/audio_policy_configuration.xml"
+#define VENDOR_AUDIO_AUDIO_POLICY_CONFIG_XML_FILE "/vendor/etc/audio/audio_policy_configuration.xml"
+#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"
+
+
+dm_config_device *dm_config_load(pa_modargs *ma) {
+ dm_config_device *config = NULL;
+ const char *manual_config;
+ const char *config_location[] = {
+ ODM_AUDIO_POLICY_CONFIG_XML_FILE,
+ VENDOR_AUDIO_AUDIO_POLICY_CONFIG_XML_FILE,
+ VENDOR_AUDIO_POLICY_CONFIG_XML_FILE,
+ SYSTEM_AUDIO_POLICY_CONFIG_XML_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;
+}
+
+static dm_config_profile *config_profile_dup(const dm_config_profile *profile) {
+ dm_config_profile *copy = pa_xnew0(dm_config_profile, 1);
+
+ copy->name = pa_xstrdup(profile->name);
+ copy->format = profile->format;
+ memcpy(copy->sampling_rates,
+ profile->sampling_rates,
+ sizeof(profile->sampling_rates));
+ memcpy(copy->channel_masks,
+ profile->channel_masks,
+ sizeof(profile->channel_masks));
+
+ return copy;
+}
+
+static dm_config_port *config_port_dup(const dm_config_port *port, dm_config_module *module) {
+ dm_config_port *copy = pa_xnew0(dm_config_port, 1);
+ const dm_list_entry *i;
+
+ copy->module = module;
+ copy->port_type = port->port_type;
+ copy->name = pa_xstrdup(port->name);
+ copy->role = port->role;
+ copy->profiles = dm_list_new();
+
+ DM_LIST_FOREACH(i, port->profiles)
+ dm_list_push_back(copy->profiles, config_profile_dup(i->data));
+
+ if (port->port_type == DM_CONFIG_TYPE_DEVICE_PORT) {
+ copy->type = port->type;
+ copy->address = pa_xstrdup(port->address);
+ }
+
+ if (port->port_type == DM_CONFIG_TYPE_MIX_PORT) {
+ copy->flags = port->flags;
+ copy->max_open_count = port->max_open_count;
+ copy->max_active_count = port->max_active_count;
+ }
+
+ return copy;
+}
+
+static dm_config_route *config_route_dup(const dm_config_route *route, dm_list *ports) {
+ dm_config_route *copy = pa_xnew0(dm_config_route, 1);
+ dm_config_port *port_copy, *port;
+ void *state, *state2;
+
+ copy->type = route->type;
+ copy->sources = dm_list_new();
+
+ DM_LIST_FOREACH_DATA(port, route->sources, state) {
+ DM_LIST_FOREACH_DATA(port_copy, ports, state2) {
+ if (dm_config_port_equal(port, port_copy)) {
+ dm_list_push_back(copy->sources, port_copy);
+ break;
+ }
+ }
+ }
+
+ DM_LIST_FOREACH_DATA(port_copy, ports, state) {
+ if (dm_config_port_equal(port_copy, route->sink)) {
+ copy->sink = port_copy;
+ break;
+ }
+ }
+
+ return copy;
+}
+
+static dm_config_module *config_module_dup(const dm_config_module *module) {
+ dm_config_module *copy = pa_xnew0(dm_config_module, 1);
+ dm_config_port *device_port, *attached_device, *mix_port;
+ dm_config_route *route;
+ void *state, *state2;
+
+ copy = pa_xnew0(dm_config_module, 1);
+ copy->name = pa_xstrdup(module->name);
+ copy->version_major = module->version_major;
+ copy->version_minor = module->version_minor;
+ copy->attached_devices = dm_list_new();
+ copy->default_output_device = NULL;
+ copy->mix_ports = dm_list_new();
+ copy->device_ports = dm_list_new();
+ copy->ports = dm_list_new();
+ copy->routes = dm_list_new();
+
+ DM_LIST_FOREACH_DATA(device_port, module->device_ports, state) {
+ dm_config_port *device_port_copy = config_port_dup(device_port, copy);
+ dm_list_push_back(copy->device_ports, device_port_copy);
+ dm_list_push_back(copy->ports, device_port_copy);
+ if (module->default_output_device == device_port)
+ copy->default_output_device = device_port_copy;
+ DM_LIST_FOREACH_DATA(attached_device, module->attached_devices, state2) {
+ if (attached_device == device_port) {
+ dm_list_push_back(copy->attached_devices, device_port_copy);
+ break;
+ }
+ }
+ }
+
+ DM_LIST_FOREACH_DATA(mix_port, module->mix_ports, state) {
+ dm_config_port *mix_port_copy = config_port_dup(mix_port, copy);
+ dm_list_push_back(copy->mix_ports, mix_port_copy);
+ dm_list_push_back(copy->ports, mix_port_copy);
+ }
+
+ DM_LIST_FOREACH_DATA(route, module->routes, state)
+ dm_list_push_back(copy->routes, config_route_dup(route, copy->ports));
+
+ return copy;
+}
+
+dm_config_device *dm_config_dup(const dm_config_device *config) {
+ dm_config_device *copy;
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/common/droid-util-audio.h
^
|
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 Jolla Ltd.
+ * Copyright (C) 2017-2022 Jolla Ltd.
*
* Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
*
@@ -22,16 +22,14 @@
#ifndef _DROID_UTIL_AUDIO_H_
#define _DROID_UTIL_AUDIO_H_
+#include <android-config.h>
#ifdef QCOM_BSP
#define QCOM_HARDWARE
#endif
#include <hardware/audio.h>
-#include <hardware_legacy/audio_policy_conf.h>
-#ifdef SPEAKER_DRC_ENABLED_TAG
-#define DROID_HAVE_DRC
-#endif
+#include <pulse/channelmap.h>
#ifdef STRING_ENTRY
@@ -91,8 +89,9 @@
uint32_t conversion_table_format[][2] = {
{ PA_SAMPLE_U8, AUDIO_FORMAT_PCM_8_BIT },
{ PA_SAMPLE_S16LE, AUDIO_FORMAT_PCM_16_BIT },
- { PA_SAMPLE_S32LE, AUDIO_FORMAT_PCM_32_BIT },
- { PA_SAMPLE_S24LE, AUDIO_FORMAT_PCM_8_24_BIT }
+ { PA_SAMPLE_S24_32LE, AUDIO_FORMAT_PCM_8_24_BIT },
+ { PA_SAMPLE_S24LE, AUDIO_FORMAT_PCM_24_BIT_PACKED },
+ { PA_SAMPLE_S32LE, AUDIO_FORMAT_PCM_32_BIT }
};
uint32_t conversion_table_default_audio_source[][2] = {
@@ -103,18 +102,33 @@
{ AUDIO_DEVICE_IN_WIRED_HEADSET, AUDIO_SOURCE_MIC },
{ AUDIO_DEVICE_IN_AUX_DIGITAL, AUDIO_SOURCE_MIC },
{ AUDIO_DEVICE_IN_VOICE_CALL, AUDIO_SOURCE_VOICE_CALL },
+ { AUDIO_DEVICE_IN_TELEPHONY_RX, AUDIO_SOURCE_VOICE_CALL },
{ AUDIO_DEVICE_IN_BACK_MIC, AUDIO_SOURCE_MIC },
{ AUDIO_DEVICE_IN_REMOTE_SUBMIX, AUDIO_SOURCE_REMOTE_SUBMIX },
+ { AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET, AUDIO_SOURCE_MIC },
+ { AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET, AUDIO_SOURCE_MIC },
+ { AUDIO_DEVICE_IN_USB_ACCESSORY, AUDIO_SOURCE_MIC },
+ { AUDIO_DEVICE_IN_USB_DEVICE, AUDIO_SOURCE_MIC },
+ { AUDIO_DEVICE_IN_FM_TUNER, AUDIO_SOURCE_FM_TUNER },
+ { AUDIO_DEVICE_IN_TV_TUNER, AUDIO_SOURCE_MIC },
+ { AUDIO_DEVICE_IN_LINE, AUDIO_SOURCE_MIC },
+ { AUDIO_DEVICE_IN_SPDIF, AUDIO_SOURCE_MIC },
+ { AUDIO_DEVICE_IN_BLUETOOTH_A2DP, AUDIO_SOURCE_MIC },
+ { AUDIO_DEVICE_IN_LOOPBACK, AUDIO_SOURCE_MIC },
+ { AUDIO_DEVICE_IN_IP, AUDIO_SOURCE_MIC },
+ { AUDIO_DEVICE_IN_BUS, AUDIO_SOURCE_MIC },
+ { AUDIO_DEVICE_IN_PROXY, AUDIO_SOURCE_MIC },
+ { AUDIO_DEVICE_IN_USB_HEADSET, AUDIO_SOURCE_MIC },
+ { AUDIO_DEVICE_IN_BLUETOOTH_BLE, AUDIO_SOURCE_MIC },
+ { AUDIO_DEVICE_IN_HDMI_ARC, AUDIO_SOURCE_MIC },
+ { AUDIO_DEVICE_IN_ECHO_REFERENCE, AUDIO_SOURCE_MIC },
+
#if defined(HAVE_ENUM_AUDIO_DEVICE_IN_FM_RX) && defined(HAVE_ENUM_AUDIO_SOURCE_FM_RX)
{ AUDIO_DEVICE_IN_FM_RX, AUDIO_SOURCE_FM_RX },
#endif
-#if defined(HAVE_ENUM_AUDIO_DEVICE_IN_FM_TUNER) && defined(HAVE_ENUM_AUDIO_SOURCE_FM_TUNER)
- { AUDIO_DEVICE_IN_FM_TUNER, AUDIO_SOURCE_FM_TUNER },
-#endif
#if defined(HAVE_ENUM_AUDIO_DEVICE_IN_FM_RX_A2DP) && defined(HAVE_ENUM_AUDIO_SOURCE_FM_RX_A2DP)
{ AUDIO_DEVICE_IN_FM_RX_A2DP, AUDIO_SOURCE_FM_RX_A2DP },
#endif
- { AUDIO_DEVICE_IN_ALL, AUDIO_SOURCE_DEFAULT }
};
/* Output devices */
@@ -137,56 +151,30 @@
STRING_ENTRY( AUDIO_DEVICE_OUT_USB_ACCESSORY ),
STRING_ENTRY( AUDIO_DEVICE_OUT_USB_DEVICE ),
STRING_ENTRY( AUDIO_DEVICE_OUT_REMOTE_SUBMIX ),
- STRING_ENTRY( AUDIO_DEVICE_OUT_DEFAULT ),
-
- /* Devices which may or may not be defined for all devices,
- * update configure.ac CC_CHECK_DROID_ENUM list if you encounter new ones. */
-#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_HDMI_ARC ),
STRING_ENTRY( AUDIO_DEVICE_OUT_SPDIF ),
-#endif
-#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_AUX_LINE
+ STRING_ENTRY( AUDIO_DEVICE_OUT_FM ),
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
+ STRING_ENTRY( AUDIO_DEVICE_OUT_BUS ),
+ STRING_ENTRY( AUDIO_DEVICE_OUT_PROXY ),
+ STRING_ENTRY( AUDIO_DEVICE_OUT_USB_HEADSET ),
+ STRING_ENTRY( AUDIO_DEVICE_OUT_HEARING_AID ),
+ STRING_ENTRY( AUDIO_DEVICE_OUT_ECHO_CANCELLER ),
+ STRING_ENTRY( AUDIO_DEVICE_OUT_DEFAULT ),
+
+ { 0, NULL }
+};
- /* Combination entries consisting of multiple devices defined above.
- * These don't require counterpart in string_conversion_table_output_device_fancy. */
- STRING_ENTRY( AUDIO_DEVICE_OUT_ALL ),
- STRING_ENTRY( AUDIO_DEVICE_OUT_ALL_A2DP ),
- STRING_ENTRY( AUDIO_DEVICE_OUT_ALL_SCO ),
- STRING_ENTRY( AUDIO_DEVICE_OUT_ALL_USB ),
+struct string_conversion string_conversion_table_audio_mode_fancy[] = {
+ { AUDIO_MODE_NORMAL, "normal" },
+ { AUDIO_MODE_RINGTONE, "ringtone" },
+ { AUDIO_MODE_IN_CALL, "in call" },
+ { AUDIO_MODE_IN_COMMUNICATION, "in communication" },
+ { AUDIO_MODE_CALL_SCREEN, "call screen" },
{ 0, NULL }
};
@@ -194,8 +182,6 @@
struct string_conversion string_conversion_table_output_device_fancy[] = {
{ AUDIO_DEVICE_OUT_EARPIECE, "output-earpiece" },
{ AUDIO_DEVICE_OUT_SPEAKER, "output-speaker" },
- { AUDIO_DEVICE_OUT_SPEAKER
- | AUDIO_DEVICE_OUT_WIRED_HEADPHONE, "output-speaker+wired_headphone" },
{ AUDIO_DEVICE_OUT_WIRED_HEADSET, "output-wired_headset" },
{ AUDIO_DEVICE_OUT_WIRED_HEADPHONE, "output-wired_headphone" },
{ AUDIO_DEVICE_OUT_BLUETOOTH_SCO, "output-bluetooth_sco" },
@@ -210,48 +196,20 @@
{ AUDIO_DEVICE_OUT_USB_ACCESSORY, "output-usb_accessory" },
{ AUDIO_DEVICE_OUT_USB_DEVICE, "output-usb_device" },
{ AUDIO_DEVICE_OUT_REMOTE_SUBMIX, "output-remote_submix" },
- { AUDIO_DEVICE_OUT_DEFAULT, "output-default" },
-
- /* Devices which may or may not be defined for all devices, */
-#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_HDMI_ARC, "output-hdmi_arc" },
{ AUDIO_DEVICE_OUT_SPDIF, "output-spdif" },
-#endif
-#ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_AUX_LINE
+ { AUDIO_DEVICE_OUT_FM, "output-fm" },
{ 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" },
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/common/droid-util.c
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013 Jolla Ltd.
+ * Copyright (C) 2013-2022 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
+ * 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
@@ -23,9 +23,15 @@
#include <config.h>
#endif
+#include <stdlib.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <grp.h>
+#include <stdarg.h>
#ifdef HAVE_VALGRIND_MEMCHECK_H
#include <valgrind/memcheck.h>
@@ -35,6 +41,8 @@
#include <pulse/timeval.h>
#include <pulse/volume.h>
#include <pulse/xmalloc.h>
+#include <pulse/direction.h>
+#include <pulse/util.h>
#include <pulsecore/core.h>
#include <pulsecore/core-error.h>
@@ -58,870 +66,75 @@
#include <pulsecore/strlist.h>
#include <pulsecore/atomic.h>
-#include "droid-util.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/utils.h"
-struct droid_quirk {
+struct droid_option {
const char *name;
uint32_t value;
};
-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 },
+struct droid_option valid_options[] = {
+ { "input_atoi", DM_OPTION_INPUT_ATOI },
+ { "close_input", DM_OPTION_CLOSE_INPUT },
+ { "unload_no_close", DM_OPTION_UNLOAD_NO_CLOSE },
+ { "hw_volume", DM_OPTION_HW_VOLUME },
+ { "realcall", DM_OPTION_REALCALL },
+ { "unload_call_exit", DM_OPTION_UNLOAD_CALL_EXIT },
+ { "output_fast", DM_OPTION_OUTPUT_FAST },
+ { "output_deep_buffer", DM_OPTION_OUTPUT_DEEP_BUFFER },
+ { "audio_cal_wait", DM_OPTION_AUDIO_CAL_WAIT },
+ { "speaker_before_voice", DM_OPTION_SPEAKER_BEFORE_VOICE },
+ { "output_voip_rx", DM_OPTION_OUTPUT_VOIP_RX },
+ { "record_voice_16k", DM_OPTION_RECORD_VOICE_16K },
};
-struct pa_droid_quirks {
- bool enabled[QUIRK_COUNT];
+struct user_options {
+ struct user_option {
+ bool enable;
+ bool set;
+ } options[DM_OPTION_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);
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/common/include/droid/conversion.h
^
|
@@ -0,0 +1,111 @@
+#ifndef foodroidconversionfoo
+#define foodroidconversionfoo
+
+/*
+ * Copyright (C) 2018-2022 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,
+ CONV_STRING_AUDIO_SOURCE_FANCY,
+} pa_conversion_string_t;
+
+bool pa_string_convert_num_to_str(pa_conversion_string_t type, uint32_t value, const char **to_str);
+bool pa_string_convert_str_to_num(pa_conversion_string_t type, const char *str, uint32_t *to_value);
+
+bool pa_convert_output_channel(uint32_t value, pa_conversion_field_t from, uint32_t *to_value);
+bool pa_convert_input_channel(uint32_t value, pa_conversion_field_t from, uint32_t *to_value);
+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_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);
+
+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,
+ uint32_t sampling_rates[AUDIO_MAX_SAMPLING_RATES]);
+bool pa_conversion_parse_formats(const char *fn, const unsigned ln,
+ const char *str,
+ audio_format_t *formats);
+int pa_conversion_parse_output_channels(const char *fn, const unsigned ln,
+ const char *str,
+ audio_channel_mask_t channel_masks[AUDIO_MAX_CHANNEL_MASKS]);
+int pa_conversion_parse_input_channels(const char *fn, const unsigned ln,
+ const char *str,
+ audio_channel_mask_t channel_masks[AUDIO_MAX_CHANNEL_MASKS]);
+bool pa_conversion_parse_output_devices(const char *fn, const unsigned ln,
+ char *str, bool must_recognize_all,
+ audio_devices_t *devices);
+bool pa_conversion_parse_input_devices(const char *fn, const unsigned ln,
+ char *str, 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
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/common/include/droid/droid-config.h
^
|
@@ -0,0 +1,135 @@
+#ifndef foodroidconfigfoo
+#define foodroidconfigfoo
+
+/*
+ * Copyright (C) 2018-2022 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/sllist.h>
+#include <droid/version.h>
+
+#define AUDIO_MAX_SAMPLING_RATES (32)
+#define AUDIO_MAX_CHANNEL_MASKS (32)
+
+typedef struct dm_config_global dm_config_global;
+typedef struct dm_config_port dm_config_port;
+typedef struct dm_config_route dm_config_route;
+typedef struct dm_config_module dm_config_module;
+typedef struct dm_config_device dm_config_device;
+typedef struct dm_config_profile dm_config_profile;
+
+struct dm_config_global {
+ char *key;
+ char *value;
+};
+
+struct dm_config_profile {
+ char *name;
+ audio_format_t format; /* 0 -> dynamic TODO check that this is still true */
+ uint32_t sampling_rates[AUDIO_MAX_SAMPLING_RATES]; /* sampling_rates[0] == 0 -> dynamic, otherwise 0 terminates list */
+ audio_channel_mask_t channel_masks[AUDIO_MAX_CHANNEL_MASKS]; /* channel_masks[0] == 0 -> dynamic */
+};
+
+typedef enum dm_config_role {
+ DM_CONFIG_ROLE_SINK,
+ DM_CONFIG_ROLE_SOURCE,
+} dm_config_role_t;
+
+typedef enum dm_config_type {
+ DM_CONFIG_TYPE_MIX,
+ DM_CONFIG_TYPE_DEVICE_PORT,
+ DM_CONFIG_TYPE_MIX_PORT,
+} dm_config_type_t;
+
+struct dm_config_port {
+ dm_config_module *module;
+
+ /* common values */
+
+ dm_config_type_t port_type; /* either mixPort or devicePort */
+ char *name;
+ dm_config_role_t role;
+ dm_list *profiles; /* dm_config_profile* */
+
+ /* devicePort specific values */
+
+ audio_devices_t type;
+ char *address;
+
+ /* mixPort specific values */
+
+ uint32_t flags; /* audio_output_flag_t or audio_input_flag_t */
+ int max_open_count; /* 0 == not defined */
+ int max_active_count; /* 0 == not defined */
+};
+
+struct dm_config_route {
+ dm_config_type_t type;
+ dm_config_port *sink;
+ dm_list *sources; /* dm_config_port* */
+};
+
+struct dm_config_module {
+ dm_config_device *config;
+
+ char *name;
+ int version_major;
+ int version_minor;
+
+ dm_list *attached_devices; /* dm_config_port* owned by device_ports list below */
+ dm_config_port *default_output_device; /* owned by device_ports list below */
+ dm_list *ports; /* dm_config_port* - for convenience port types are filtered to two lists below: */
+ dm_list *mix_ports; /* dm_config_port* */
+ dm_list *device_ports; /* dm_config_port* */
+ dm_list *routes; /* dm_config_route* */
+};
+
+struct dm_config_device {
+ dm_list *global_config; /* dm_config_global* */
+ dm_list *modules; /* dm_config_module* */
+};
+
+
+/* Config parser */
+dm_config_device *dm_config_load(pa_modargs *ma);
+dm_config_device *dm_config_dup(const dm_config_device *config);
+void dm_config_free(dm_config_device *config);
+/* autodetect config type from filename and parse */
+dm_config_device *pa_parse_droid_audio_config(const char *filename);
+
+dm_config_module *dm_config_find_module(dm_config_device *config, const char* module_id);
+dm_config_port *dm_config_find_port(dm_config_module *module, const char* name);
+dm_config_port *dm_config_default_output_device(dm_config_module *module);
+dm_config_port *dm_config_find_device_port(dm_config_port *port, audio_devices_t device);
+char *dm_config_escape_string(const char *string);
+
+bool dm_config_port_equal(const dm_config_port *a, const dm_config_port *b);
+
+dm_config_port *dm_config_find_mix_port(dm_config_module *module, const char *name);
+
+#endif
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/common/include/droid/droid-util.h
^
|
@@ -0,0 +1,358 @@
+#ifndef foodroidutilfoo
+#define foodroidutilfoo
+
+/*
+ * Copyright (C) 2013-2022 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 <pulsecore/modargs.h>
+
+#include <droid/version.h>
+#include <droid/droid-config.h>
+
+#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_OUTPUT_VOIP "droid.output.voip"
+#define PROP_DROID_INPUT_BUILTIN "droid.input.builtin"
+#define PROP_DROID_INPUT_EXTERNAL "droid.input.external"
+#define PROP_DROID_INPUT_VOIP "droid.input.voip"
+
+#define EXT_PROP_AUDIO_SOURCE "audio.source"
+
+#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 struct pa_droid_options pa_droid_options;
+
+enum pa_droid_option_type {
+ DM_OPTION_INPUT_ATOI,
+ DM_OPTION_CLOSE_INPUT,
+ DM_OPTION_UNLOAD_NO_CLOSE,
+ DM_OPTION_HW_VOLUME,
+ DM_OPTION_REALCALL,
+ DM_OPTION_UNLOAD_CALL_EXIT,
+ DM_OPTION_OUTPUT_FAST,
+ DM_OPTION_OUTPUT_DEEP_BUFFER,
+ DM_OPTION_AUDIO_CAL_WAIT,
+ DM_OPTION_SPEAKER_BEFORE_VOICE,
+ DM_OPTION_OUTPUT_VOIP_RX,
+ DM_OPTION_RECORD_VOICE_16K,
+ DM_OPTION_COUNT
+};
+
+struct pa_droid_options {
+ bool enabled[DM_OPTION_COUNT];
+};
+
+struct pa_droid_hw_module {
+ PA_REFCNT_DECLARE;
+
+ pa_core *core;
+ char *shared_name;
+
+ dm_config_device *config;
+ dm_config_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_id;
+ bool bt_sco_enabled;
+
+ pa_idxset *outputs;
+ pa_idxset *inputs;
+ pa_hook_slot *sink_put_hook_slot;
+ pa_hook_slot *sink_unlink_hook_slot;
+
+ pa_atomic_t active_outputs;
+
+ pa_droid_options options;
+
+ /* Mode and input control */
+ struct _state {
+ audio_mode_t mode;
+ } state;
+};
+
+struct pa_droid_output_stream {
+ struct audio_stream_out *stream;
+ pa_sample_spec sample_spec;
+ pa_channel_map channel_map;
+};
+
+struct pa_droid_input_stream {
+ struct audio_stream_in *stream;
+ pa_sample_spec default_sample_spec;
+ pa_channel_map default_channel_map;
+ pa_sample_spec sample_spec;
+ pa_channel_map channel_map;
+ pa_sample_spec req_sample_spec;
+ pa_channel_map req_channel_map;
+
+ audio_source_t audio_source;
+ dm_config_port *default_mix_port;
+ dm_config_port *input_port;
+ pa_droid_stream *active_input;
+
+ uint32_t flags;
+ uint32_t device;
+ bool first;
+};
+
+struct pa_droid_stream {
+ PA_REFCNT_DECLARE;
+
+ pa_droid_hw_module *module;
+ dm_config_port *mix_port;
+ size_t buffer_size;
+ void *data;
+
+ audio_io_handle_t io_handle;
+ audio_patch_handle_t audio_patch;
+ const dm_config_port *active_device_port;
+
+ pa_droid_output_stream *output;
+ pa_droid_input_stream *input;
+};
+
+struct pa_droid_card_data {
+ void *userdata;
+ char *module_id;
+};
+
+
+/* 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 {
+ dm_config_port *device_port;
+} pa_droid_port_data;
+
+typedef struct pa_droid_port {
+ pa_droid_mapping *mapping;
+
+ dm_config_port *device_port;
+ char *name;
+ char *description;
+ unsigned priority;
+} pa_droid_port;
+
+struct pa_droid_mapping {
+ pa_droid_profile_set *profile_set;
+
+ dm_config_module *module;
+ dm_config_port *mix_port;
+ dm_list *device_ports;
+
+ char *name;
+ char *description;
+ unsigned priority;
+ pa_proplist *proplist;
+
+ /* Mapping doesn't own the ports */
+ pa_idxset *ports;
+
+ pa_direction_t direction;
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/common/include/droid/sllist.h
^
|
@@ -0,0 +1,94 @@
+#ifndef foosllistfoo
+#define foosllistfoo
+
+/*
+ * Copyright (C) 2018-2022 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 <pulse/def.h>
+
+#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)
+
+typedef struct dm_list_entry dm_list_entry;
+typedef struct dm_list dm_list;
+
+struct dm_list_entry {
+ struct dm_list_entry *next;
+ struct dm_list_entry *prev;
+ void *data;
+};
+
+struct dm_list {
+ struct dm_list_entry *head;
+ struct dm_list_entry *tail;
+ ssize_t size;
+};
+
+dm_list *dm_list_new(void);
+void dm_list_free(dm_list *list, pa_free_cb_t free_cb);
+bool dm_list_remove(dm_list *list, dm_list_entry *entry);
+void dm_list_prepend(dm_list *list, void *data);
+void dm_list_push_back(dm_list *list, void *data);
+dm_list_entry *dm_list_last(dm_list *list);
+void *dm_list_steal_first(dm_list *list);
+ssize_t dm_list_size(dm_list *list);
+void *dm_list_first_data(dm_list *list, void **state);
+void *dm_list_next_data(dm_list *list, void **state);
+/* For example
+ * dm_list *list;
+ * void *state;
+ * my_data *data;
+ * DM_LIST_FOREACH_DATA(data, list, state) {
+ * do_something_with_my(data);
+ * }
+ */
+#define DM_LIST_FOREACH_DATA(i, list, state) \
+ for (i = dm_list_first_data(list, &(state)); state; i = dm_list_next_data(list, &(state)))
+/* Access i->data */
+#define DM_LIST_FOREACH(i, list) \
+ for (i = list->head; i; i = i->next)
+
+#endif
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/common/include/droid/utils.h
^
|
@@ -0,0 +1,32 @@
+#ifndef foodroidcommonutilsfoo
+#define foodroidcommonutilsfoo
+
+/*
+ * Copyright (C) 2022 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
+
+void dm_replace_in_place(char **string, const char *a, const char *b);
+bool dm_strcasestr(const char *haystack, const char *needle);
+
+#endif
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/common/include/droid/version.h
^
|
@@ -0,0 +1,55 @@
+#ifndef foodroidversionfoo
+#define foodroidversionfoo
+
+/*
+ * Copyright (C) 2018-2022 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)
+#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.1 */
+#define DROID_API_VERSION_SUPPORT HARDWARE_DEVICE_API_VERSION(3, 1)
+
+#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 AUDIO_API_VERSION_MAJ < 3
+#error This module only supports audio API version 3 and upwards.
+#endif
+
+#endif
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/common/meson.build
^
|
@@ -0,0 +1,64 @@
+libdroid_util_sources = [
+ 'config-parser-xml.c',
+ 'config-parser-xml.h',
+ 'conversion.c',
+ 'droid-util.c',
+ 'droid-util-audio.h',
+ 'droid-config.c',
+ 'sllist.c',
+ 'utils.c',
+]
+
+libdroid_util_headers = [
+ 'include/droid/conversion.h',
+ 'include/droid/droid-config.h',
+ 'include/droid/droid-util.h',
+ 'include/droid/sllist.h',
+ 'include/droid/utils.h',
+ 'include/droid/version.h',
+]
+
+libdroid_util_deps = [
+ droid_headers_dep,
+ expat_dep,
+ hybris_dep,
+ hybris_common_dep,
+ ltdl_dep,
+ pulsecore_dep,
+]
+
+install_headers(libdroid_util_headers, subdir : 'pulsecore/modules/droid')
+
+libdroid_util = library('droid-util',
+ libdroid_util_sources,
+ c_args : [pa_c_args, '-DPULSEAUDIO_VERSION=@0@'.format(pa_version_major)],
+ dependencies : libdroid_util_deps,
+ pic : true,
+ include_directories : [configinc, include_directories('include')],
+ install : true,
+ install_dir : modlibexecdir,
+ install_rpath : rpath_dirs,
+)
+
+libdroid_util_dep = declare_dependency(
+ link_with : libdroid_util,
+ compile_args : pa_c_args + ['-DPULSEAUDIO_VERSION=@0@'.format(pa_version_major)],
+ dependencies : libdroid_util_deps,
+ include_directories : [configinc, include_directories('include')],
+)
+
+# pkgconfig
+pc_cdata = configuration_data()
+
+pc_cdata.set('prefix', get_option('prefix'))
+pc_cdata.set('libdir', libdir)
+pc_cdata.set('libexecdir', get_option('libexecdir'))
+pc_cdata.set('PA_MAJORMINOR', pa_version_major_minor)
+pc_cdata.set('PA_MODULE_VERSION', pa_version_module)
+
+configure_file(
+ input : 'libdroid-util.pc.in',
+ output : 'libdroid-util.pc',
+ configuration : pc_cdata,
+ install_dir : join_paths(libdir, 'pkgconfig')
+)
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/common/sllist.c
^
|
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2022 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 <pulse/xmalloc.h>
+#include <pulsecore/macro.h>
+
+#include "droid/sllist.h"
+
+dm_list *dm_list_new(void) {
+ return pa_xnew0(dm_list, 1);
+}
+
+void dm_list_free(dm_list *list, pa_free_cb_t free_cb) {
+ pa_assert(list);
+
+ while (list->head) {
+ void *data = dm_list_steal_first(list);
+
+ if (free_cb)
+ free_cb(data);
+ }
+
+ pa_xfree(list);
+}
+
+bool dm_list_remove(dm_list *list, dm_list_entry *entry) {
+ dm_list_entry *i;
+ bool removed = false;
+
+ for (i = list->head; i; i = i->next) {
+ if (i == entry) {
+ removed = true;
+ if (list->head == entry)
+ list->head = entry->next;
+ if (list->tail == entry)
+ list->tail = entry->prev;
+ if (entry->next)
+ entry->next->prev = entry->prev;
+ if (entry->prev)
+ entry->prev->next = entry->next;
+ pa_xfree(entry);
+ break;
+ }
+ }
+
+ return removed;
+}
+
+void dm_list_prepend(dm_list *list, void *data) {
+ dm_list_entry *entry;
+
+ pa_assert(list);
+
+ entry = pa_xnew0(dm_list_entry, 1);
+ entry->data = data;
+
+ if (!list->tail)
+ list->tail = entry;
+
+ if (list->head) {
+ entry->next = list->head;
+ list->head->prev = entry;
+ }
+
+ list->head = entry;
+ list->size++;
+}
+
+void dm_list_push_back(dm_list *list, void *data) {
+ dm_list_entry *entry;
+
+ pa_assert(list);
+
+ entry = pa_xnew0(dm_list_entry, 1);
+ entry->data = data;
+
+ if (!list->head)
+ list->head = entry;
+
+ if (list->tail) {
+ list->tail->next = entry;
+ entry->prev = list->tail;
+ }
+
+ list->tail = entry;
+ list->size++;
+}
+
+dm_list_entry *dm_list_last(dm_list *list) {
+ pa_assert(list);
+
+ return list->tail;
+}
+
+void *dm_list_steal_first(dm_list *list) {
+ dm_list_entry *entry;
+ void *data = NULL;
+
+ pa_assert(list);
+
+ if (list->head) {
+ data = list->head->data;
+ entry = list->head;
+ if (list->head == list->tail) {
+ list->head = NULL;
+ list->tail = NULL;
+ } else {
+ list->head->next->prev = NULL;
+ list->head = list->head->next;
+ }
+ pa_xfree(entry);
+ list->size--;
+ }
+
+ return data;
+}
+
+ssize_t dm_list_size(dm_list *list) {
+ pa_assert(list);
+
+ return list->size;
+}
+
+/* For iteration */
+
+void *dm_list_first_data(dm_list *list, void **state) {
+ pa_assert(list);
+ pa_assert(state);
+
+ *state = list->head;
+
+ if (list->head)
+ return list->head->data;
+ else
+ return NULL;
+}
+
+void *dm_list_next_data(dm_list *list, void **state) {
+ dm_list_entry *entry;
+
+ pa_assert(list);
+ pa_assert(state);
+
+ entry = *state;
+ *state = entry->next;
+
+ if (entry->next)
+ return entry->next->data;
+ else
+ return NULL;
+}
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/common/utils.c
^
|
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2022 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 <string.h>
+#include <strings.h>
+
+#include <pulsecore/core-util.h>
+#include <pulse/xmalloc.h>
+#include "droid/utils.h"
+
+void dm_replace_in_place(char **string, const char *a, const char *b) {
+ char *tmp;
+
+ pa_assert(*string);
+ pa_assert(a);
+ pa_assert(b);
+
+ tmp = pa_replace(*string, a, b);
+ pa_xfree(*string);
+ *string = tmp;
+}
+
+/* Simple strcasestr replacement. */
+bool dm_strcasestr(const char *haystack, const char *needle) {
+ size_t len_haystack, len_needle;
+
+ len_haystack = strlen(haystack);
+ len_needle = strlen(needle);
+
+ if (len_needle > len_haystack)
+ return false;
+
+ for (size_t i = 0; i < len_haystack; i++) {
+ if (len_needle > len_haystack - i)
+ return false;
+
+ if (strncasecmp(haystack + i, needle, len_needle) == 0)
+ return true;
+ }
+
+ return false;
+}
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/droid/droid-sink.c
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013 Jolla Ltd.
+ * Copyright (C) 2013-2022 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
+ * 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
@@ -54,9 +54,13 @@
#include <pulsecore/time-smoother.h>
#include <pulsecore/hashmap.h>
#include <pulsecore/core-subscribe.h>
+#include <pulse/util.h>
+#include <pulse/version.h>
#include "droid-sink.h"
-#include "droid-util.h"
+#include <droid/droid-util.h>
+#include <droid/conversion.h>
+#include <droid/sllist.h>
struct userdata {
pa_core *core;
@@ -76,23 +80,15 @@
pa_usec_t buffer_time;
pa_usec_t write_time;
pa_usec_t write_threshold;
- audio_devices_t prewrite_devices;
- uint32_t prewrite_silence;
- pa_hook_slot *sink_put_hook_slot;
- pa_hook_slot *sink_unlink_hook_slot;
- pa_hook_slot *sink_port_changed_hook_slot;
- pa_sink *primary_stream_sink;
-
- audio_devices_t primary_devices;
- audio_devices_t extra_devices;
- pa_hashmap *extra_devices_map;
- bool mix_route;
+
+ dm_config_port *active_device_port;
+ dm_config_port *override_device_port;
+ dm_list *extra_devices_stack;
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_hook_slot *sink_input_put_hook_slot;
@@ -127,88 +123,87 @@
static void parameter_free(droid_parameter_mapping *m);
static void userdata_free(struct userdata *u);
static void set_voice_volume(struct userdata *u, pa_sink_input *i);
+static void apply_volume(pa_sink *s);
+static pa_sink_input *find_volume_control_sink_input(struct userdata *u);
-static void set_primary_devices(struct userdata *u, audio_devices_t devices) {
- pa_assert(u);
- pa_assert(devices);
+static bool add_extra_devices(struct userdata *u, audio_devices_t device) {
+ dm_list_entry *prev;
+ dm_config_port *device_port;
- u->primary_devices = devices;
-}
+ pa_assert(u);
+ pa_assert(u->extra_devices_stack);
-static bool add_extra_devices(struct userdata *u, audio_devices_t devices) {
- void *value;
- uint32_t count;
- bool need_update = false;
+ if (!(device_port = dm_config_find_device_port(u->active_device_port, device))) {
+ pa_log("Unknown device port %u", device);
+ return false;
+ }
- pa_assert(u);
- pa_assert(u->extra_devices_map);
- pa_assert(devices);
+ prev = dm_list_last(u->extra_devices_stack);
- if ((value = pa_hashmap_get(u->extra_devices_map, PA_UINT_TO_PTR(devices)))) {
- count = PA_PTR_TO_UINT(value);
- count++;
- pa_hashmap_remove(u->extra_devices_map, PA_UINT_TO_PTR(devices));
- pa_hashmap_put(u->extra_devices_map, PA_UINT_TO_PTR(devices), PA_UINT_TO_PTR(count));
+ dm_list_push_back(u->extra_devices_stack, device_port);
- /* added extra device already exists in hashmap, so no need to update route. */
- need_update = false;
- } else {
- pa_hashmap_put(u->extra_devices_map, PA_UINT_TO_PTR(devices), PA_UINT_TO_PTR(1));
- u->extra_devices |= devices;
- need_update = true;
+ if (prev) {
+ dm_config_port *last_port = prev->data;
+ if (dm_config_port_equal(last_port, device_port))
+ return false;
}
- return need_update;
+ u->override_device_port = device_port;
+
+ return true;
}
-static bool remove_extra_devices(struct userdata *u, audio_devices_t devices) {
- void *value;
- uint32_t count;
+static bool remove_extra_devices(struct userdata *u, audio_devices_t device) {
+ dm_config_port *device_port;
+ dm_list_entry *remove = NULL, *i = NULL;
bool need_update = false;
pa_assert(u);
- pa_assert(u->extra_devices_map);
- pa_assert(devices);
+ pa_assert(u->extra_devices_stack);
- if ((value = pa_hashmap_get(u->extra_devices_map, PA_UINT_TO_PTR(devices)))) {
- pa_hashmap_remove(u->extra_devices_map, PA_UINT_TO_PTR(devices));
- count = PA_PTR_TO_UINT(value);
- count--;
- if (count == 0) {
- u->extra_devices &= ~devices;
- need_update = true;
- } else {
- /* added extra devices still exists in hashmap, so no need to update route. */
- pa_hashmap_put(u->extra_devices_map, PA_UINT_TO_PTR(devices), PA_UINT_TO_PTR(count));
- need_update = false;
+ if (!(device_port = dm_config_find_device_port(u->active_device_port, device))) {
+ pa_log("Unknown device port %u", device);
+ return false;
+ }
+
+ DM_LIST_FOREACH(i, u->extra_devices_stack) {
+ if (dm_config_port_equal(i->data, device_port)) {
+ remove = i;
+ break;
}
}
+ if (remove && dm_list_last(u->extra_devices_stack) == remove)
+ need_update = true;
+
+ if (remove)
+ dm_list_remove(u->extra_devices_stack, remove);
+
return need_update;
}
static void clear_extra_devices(struct userdata *u) {
pa_assert(u);
- pa_assert(u->extra_devices_map);
+ pa_assert(u->extra_devices_stack);
- pa_hashmap_remove_all(u->extra_devices_map);
- u->extra_devices = 0;
+ while (dm_list_steal_first(u->extra_devices_stack));
+ u->override_device_port = NULL;
}
/* Called from main context during voice calls, and from IO context during media operation. */
static void do_routing(struct userdata *u) {
- audio_devices_t routing;
+ dm_config_port *routing = NULL;
pa_assert(u);
pa_assert(u->stream);
- if (u->use_voice_volume && u->extra_devices)
+ if (u->use_voice_volume && u->override_device_port)
clear_extra_devices(u);
- if (!u->mix_route && u->extra_devices)
- routing = u->extra_devices;
+ if (u->override_device_port)
+ routing = u->override_device_port;
else
- routing = u->primary_devices | u->extra_devices;
+ routing = u->active_device_port;
pa_droid_stream_set_route(u->stream, routing);
}
@@ -239,30 +234,6 @@
return true;
}
-static int thread_write_silence(struct userdata *u) {
- const void *p;
- ssize_t wrote;
-
- /* Drop our rendered audio and write silence to HAL. */
- pa_memblockq_drop(u->memblockq, u->buffer_size);
- u->write_time = pa_rtclock_now();
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/droid/droid-sink.h
^
|
@@ -2,9 +2,9 @@
#define foodroidsinkfoo
/*
- * Copyright (C) 2013 Jolla Ltd.
+ * Copyright (C) 2013-2018 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
+ * 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
@@ -41,7 +41,7 @@
#include <pulsecore/macro.h>
#include <pulsecore/card.h>
-#include "droid-util.h"
+#include <droid/droid-util.h>
pa_sink *pa_droid_sink_new(pa_module *m,
pa_modargs *ma,
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/droid/droid-source.c
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013 Jolla Ltd.
+ * Copyright (C) 2013-2022 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
+ * 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
@@ -51,9 +51,12 @@
#include <pulsecore/rtpoll.h>
#include <pulsecore/time-smoother.h>
#include <pulsecore/resampler.h>
+#include <pulse/util.h>
+#include <pulse/version.h>
#include "droid-source.h"
-#include "droid-util.h"
+#include <droid/droid-util.h>
+#include <droid/conversion.h>
struct userdata {
pa_core *core;
@@ -66,23 +69,17 @@
pa_rtpoll *rtpoll;
pa_memchunk memchunk;
- audio_devices_t primary_devices;
size_t source_buffer_size;
size_t buffer_size;
pa_usec_t timestamp;
- pa_hook_slot *input_buffer_size_changed_slot;
- pa_hook_slot *input_channel_map_changed_slot;
pa_resampler *resampler;
pa_droid_card_data *card_data;
pa_droid_hw_module *hw_module;
pa_droid_stream *stream;
-};
-
-enum {
- SOURCE_MESSAGE_DO_ROUTING = PA_SOURCE_MESSAGE_MAX
+ bool stream_valid;
};
#define DEFAULT_MODULE_ID "primary"
@@ -91,73 +88,51 @@
#define DROID_AUDIO_SOURCE_UNDEFINED "undefined"
static void userdata_free(struct userdata *u);
-
-static int do_routing(struct userdata *u, audio_devices_t devices) {
- int ret;
- audio_devices_t old_device;
-
- pa_assert(u);
- pa_assert(u->stream);
-
- if (u->primary_devices == devices)
- pa_log_debug("Refresh active device routing.");
-
- old_device = u->primary_devices;
- u->primary_devices = devices;
-
- ret = pa_droid_stream_set_route(u->stream, devices);
-
- if (ret < 0)
- u->primary_devices = old_device;
-
- return ret;
-}
-
-static bool parse_device_list(const char *str, audio_devices_t *dst) {
- pa_assert(str);
- pa_assert(dst);
-
- char *dev;
- const char *state = NULL;
-
- *dst = 0;
-
- while ((dev = pa_split(str, "|", &state))) {
- audio_devices_t d;
-
- if (!pa_string_convert_input_device_str_to_num(dev, &d)) {
- pa_log_warn("Unknown device %s", dev);
- pa_xfree(dev);
- return false;
- }
-
- *dst |= d;
-
- pa_xfree(dev);
- }
-
- return true;
-}
+static int suspend(struct userdata *u);
+static void unsuspend(struct userdata *u);
+static void source_reconfigure(struct userdata *u,
+ const pa_sample_spec *reconfigure_sample_spec,
+ const pa_channel_map *reconfigure_channel_map,
+ const pa_proplist *proplist,
+ dm_config_port *update_device_port);
+
+/* Our droid source may be left in a state of not having an input stream
+ * if reconfiguration fails and fallback to previously active values fails
+ * as well. In this case just avoid using the stream but don't die. */
+#define assert_stream(x, action) if (!x) do { pa_log_warn("Assert " #x " failed."); action; } while(0)
static int thread_read(struct userdata *u) {
void *p;
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);
if (readd < 0) {
- pa_log("Failed to read from stream. (err %i)", readd);
+ pa_log("Failed to read from stream. (err %zd)", readd);
goto end;
}
u->timestamp += pa_bytes_to_usec(readd, &u->source->sample_spec);
- chunk.index = 0;
chunk.length = readd;
if (u->resampler) {
@@ -191,7 +166,11 @@
pa_log_debug("Thread starting up.");
if (u->core->realtime_scheduling)
+#if PA_CHECK_VERSION(13,0,0)
+ pa_thread_make_realtime(u->core->realtime_priority);
+#else
pa_make_realtime(u->core->realtime_priority);
+#endif
pa_thread_mq_install(&u->thread_mq);
@@ -208,11 +187,7 @@
pa_rtpoll_set_timer_disabled(u->rtpoll);
/* Sleep */
-#if (PULSEAUDIO_VERSION == 5)
- if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
-#elif (PULSEAUDIO_VERSION >= 6)
if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
-#endif
goto fail;
if (ret == 0)
@@ -235,7 +210,7 @@
int ret;
pa_assert(u);
- pa_assert(u->stream);
+ assert_stream(u->stream, return 0);
ret = pa_droid_stream_suspend(u->stream, true);
@@ -248,67 +223,59 @@
/* Called from IO context */
static void unsuspend(struct userdata *u) {
pa_assert(u);
- pa_assert(u->stream);
- pa_droid_stream_suspend(u->stream, false);
- pa_log_info("Resuming...");
+ if (!u->stream) {
+ assert_stream(u->stream, u->stream_valid = false);
+ } else if (pa_droid_stream_suspend(u->stream, false) >= 0) {
+ u->stream_valid = true;
+ pa_log_info("Resuming...");
+ } else
+ u->stream_valid = false;
}
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/droid/droid-source.h
^
|
@@ -2,9 +2,9 @@
#define foodroidsourcefoo
/*
- * Copyright (C) 2013 Jolla Ltd.
+ * Copyright (C) 2013-2022 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
+ * 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
@@ -41,13 +41,11 @@
#include <pulsecore/macro.h>
#include <pulsecore/card.h>
-#include "droid-util.h"
+#include <droid/droid-util.h>
-/* If device is non-zero, it will override whatever is set in modargs for input device. */
pa_source *pa_droid_source_new(pa_module *m,
pa_modargs *ma,
const char *driver,
- audio_devices_t device,
pa_droid_card_data *card_data,
pa_droid_mapping *am,
pa_card *card);
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/droid/meson.build
^
|
@@ -0,0 +1,62 @@
+droid_sink = library('droid-sink',
+ ['droid-sink.c', 'droid-sink.h'],
+ dependencies : libdroid_util_dep,
+ pic : true,
+ include_directories : configinc,
+ install : true,
+ install_dir : modlibexecdir,
+ install_rpath : rpath_dirs,
+)
+
+droid_sink_dep = declare_dependency(
+ link_with : droid_sink,
+ compile_args : pa_c_args + ['-DPULSEAUDIO_VERSION=@0@'.format(pa_version_major)],
+ dependencies : libdroid_util_dep,
+ include_directories : [configinc],
+)
+
+droid_source = library('droid-source',
+ ['droid-source.c', 'droid-source.h'],
+ dependencies : libdroid_util_dep,
+ pic : true,
+ install : true,
+ install_dir : modlibexecdir,
+ install_rpath : rpath_dirs,
+)
+
+droid_source_dep = declare_dependency(
+ link_with : droid_source,
+ compile_args : pa_c_args + ['-DPULSEAUDIO_VERSION=@0@'.format(pa_version_major)],
+ dependencies : libdroid_util_dep,
+ include_directories : [configinc],
+)
+
+module_sink = shared_module('module-droid-sink',
+ 'module-droid-sink.c',
+ name_prefix : '',
+ c_args : '-DPA_MODULE_NAME=module_droid_sink',
+ dependencies : [droid_sink_dep, libdroid_util_dep],
+ install : true,
+ install_dir : modlibexecdir,
+ install_rpath : rpath_dirs,
+)
+
+module_sink = shared_module('module-droid-source',
+ 'module-droid-source.c',
+ name_prefix : '',
+ c_args : '-DPA_MODULE_NAME=module_droid_source',
+ dependencies : [droid_source_dep, libdroid_util_dep],
+ install : true,
+ install_dir : modlibexecdir,
+ install_rpath : rpath_dirs,
+)
+
+module_sink = shared_module('module-droid-card',
+ 'module-droid-card.c',
+ name_prefix : '',
+ c_args : '-DPA_MODULE_NAME=module_droid_card',
+ dependencies : [droid_sink_dep, droid_source_dep, libdroid_util_dep],
+ install : true,
+ install_dir : modlibexecdir,
+ install_rpath : rpath_dirs,
+)
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/droid/module-droid-card.c
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013 Jolla Ltd.
+ * Copyright (C) 2013-2022 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
+ * 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
@@ -59,12 +59,12 @@
//#include <droid/hardware/audio_policy.h>
//#include <droid/system/audio_policy.h>
-#include "droid-util.h"
+#include <droid/droid-util.h>
+#include <droid/sllist.h>
+#include <droid/utils.h>
#include "droid-sink.h"
#include "droid-source.h"
-#include "module-droid-card-symdef.h"
-
PA_MODULE_AUTHOR("Juho Hämäläinen");
PA_MODULE_DESCRIPTION("Droid card");
PA_MODULE_VERSION(PACKAGE_VERSION);
@@ -74,16 +74,13 @@
"source_name=<name for the source> "
"namereg_fail=<when false attempt to synthesise new names if they are already taken> "
"rate=<sample rate> "
- "output_flags=<flags for sink> "
"module_id=<which droid hw module to load, default primary> "
"voice_source_routing=<always true, parameter left for compatibility> "
"deferred_volume=<synchronize software and hardware volume changes to avoid momentary jumps?> "
"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> "
- "quirks=<comma separated list of quirks to enable/disable>"
+ "options=<comma separated list of options to enable/disable>"
);
static const char* const valid_modargs[] = {
@@ -98,25 +95,18 @@
"sink_rate",
"sink_format",
"sink_channel_map",
- "sink_mix_route",
"source_rate",
"source_format",
"source_channel_map",
- "output_flags",
"module_id",
"voice_source_routing",
"sink_buffer",
"source_buffer",
"deferred_volume",
- "mute_routing_before",
- "mute_routing_after",
- "prewrite_on_resume",
"config",
"voice_property_key",
"voice_property_value",
- "default_profile",
- "combine",
- "quirks",
+ /* DM_OPTIONS */
NULL,
};
@@ -130,13 +120,16 @@
#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);
struct virtual_profile {
+ bool enabled;
pa_card_profile *parent;
- pa_card_profile *extension;
virtual_profile_event_cb event_cb;
};
@@ -153,31 +146,34 @@
pa_droid_hw_module *hw_module;
pa_droid_card_data card_data;
- pa_droid_profile *old_profile;
+ pa_card_profile *real_profile;
pa_modargs *modargs;
pa_card *card;
};
struct profile_data {
- pa_droid_profile *profile;
+ pa_droid_profile *droid_profile;
+ pa_card_profile *card_profile;
audio_mode_t mode;
bool virtual_profile;
/* Variables for virtual profiles: */
struct virtual_profile virtual;
};
-#ifdef DROID_AUDIO_HAL_USE_VSID
+#ifdef DROID_AUDIO_HAL_DEBUG_VSID
/* From hal/voice_extn/voice_extn.c */
#define AUDIO_PARAMETER_KEY_VSID "vsid"
#define AUDIO_PARAMETER_KEY_CALL_STATE "call_state"
/* From hal/voice_extn/voice_extn.c */
-#define VOICE2_VSID 0x10DC1000
-#define VOLTE_VSID 0x10C02000
-#define QCHAT_VSID 0x10803000
-#define VOWLAN_VSID 0x10002000
+#define VOICE2_VSID (0x10DC1000)
+#define VOLTE_VSID (0x10C02000)
+#define QCHAT_VSID (0x10803000)
+#define VOWLAN_VSID (0x10002000)
+#define VOICEMMODE1_VSID (0x11C05000)
+#define VOICEMMODE2_VSID (0x11DC5000)
/* From hal/voice.h */
#define BASE_CALL_STATE 1
@@ -186,24 +182,30 @@
#define VOICE_VSID 0x10C01000
/* For virtual profiles */
-#define VOICE_SESSION_VOICE1_PROFILE_NAME "voicecall-voice1"
-#define VOICE_SESSION_VOICE1_PROFILE_DESC "Call mode, default to voice 1 vsid"
-#define VOICE_SESSION_VOICE2_PROFILE_NAME "voicecall-voice2"
-#define VOICE_SESSION_VOICE2_PROFILE_DESC "Call mode, default to voice 2 vsid"
-#define VOICE_SESSION_VOLTE_PROFILE_NAME "voicecall-volte"
-#define VOICE_SESSION_VOLTE_PROFILE_DESC "Call mode, default to volte vsid"
-#define VOICE_SESSION_QCHAT_PROFILE_NAME "voicecall-qchat"
-#define VOICE_SESSION_QCHAT_PROFILE_DESC "Call mode, default to qchat vsid"
-#define VOICE_SESSION_VOWLAN_PROFILE_NAME "voicecall-vowlan"
-#define VOICE_SESSION_VOWLAN_PROFILE_DESC "Call mode, default to vowlan vsid"
+#define VOICE_SESSION_VOICE1_PROFILE_NAME "voicecall-voice1"
+#define VOICE_SESSION_VOICE1_PROFILE_DESC "Call mode, default to voice 1 vsid"
+#define VOICE_SESSION_VOICE2_PROFILE_NAME "voicecall-voice2"
+#define VOICE_SESSION_VOICE2_PROFILE_DESC "Call mode, default to voice 2 vsid"
+#define VOICE_SESSION_VOLTE_PROFILE_NAME "voicecall-volte"
+#define VOICE_SESSION_VOLTE_PROFILE_DESC "Call mode, default to volte vsid"
+#define VOICE_SESSION_QCHAT_PROFILE_NAME "voicecall-qchat"
+#define VOICE_SESSION_QCHAT_PROFILE_DESC "Call mode, default to qchat vsid"
+#define VOICE_SESSION_VOWLAN_PROFILE_NAME "voicecall-vowlan"
+#define VOICE_SESSION_VOWLAN_PROFILE_DESC "Call mode, default to vowlan vsid"
+#define VOICE_SESSION_VOICEMMODE1_PROFILE_NAME "voicecall-voicemmode1"
+#define VOICE_SESSION_VOICEMMODE1_PROFILE_DESC "Call mode, default to voicemmode1 vsid"
+#define VOICE_SESSION_VOICEMMODE2_PROFILE_NAME "voicecall-voicemmode2"
+#define VOICE_SESSION_VOICEMMODE2_PROFILE_DESC "Call mode, default to voicemmode2 vsid"
static bool voicecall_voice1_vsid_profile_event_cb(struct userdata *u, pa_droid_profile *p, bool enabling);
static bool voicecall_voice2_vsid_profile_event_cb(struct userdata *u, pa_droid_profile *p, bool enabling);
static bool voicecall_volte_vsid_profile_event_cb(struct userdata *u, pa_droid_profile *p, bool enabling);
static bool voicecall_qchat_vsid_profile_event_cb(struct userdata *u, pa_droid_profile *p, bool enabling);
static bool voicecall_vowlan_vsid_profile_event_cb(struct userdata *u, pa_droid_profile *p, bool enabling);
+static bool voicecall_voicemmode1_vsid_profile_event_cb(struct userdata *u, pa_droid_profile *p, bool enabling);
+static bool voicecall_voicemmode2_vsid_profile_event_cb(struct userdata *u, pa_droid_profile *p, bool enabling);
-#endif /* DROID_AUDIO_HAL_USE_VSID */
+#endif /* DROID_AUDIO_HAL_DEBUG_VSID */
static void add_disabled_profile(pa_hashmap *profiles) {
pa_card_profile *cp;
@@ -213,7 +215,8 @@
cp->available = PA_AVAILABLE_YES;
d = PA_CARD_PROFILE_DATA(cp);
- d->profile = NULL;
+ d->droid_profile = NULL;
+ d->card_profile = cp;
pa_hashmap_put(profiles, cp->name, cp);
}
@@ -225,7 +228,7 @@
pa_hashmap *profiles) {
pa_droid_profile *ap;
pa_card_profile *cp;
- struct profile_data *d, *ext;
+ struct profile_data *d;
pa_assert(u);
pa_assert(u->profile_set);
@@ -243,33 +246,18 @@
cp = pa_card_profile_new(ap->name, ap->description, sizeof(struct profile_data));
cp->available = available;
d = PA_CARD_PROFILE_DATA(cp);
- d->profile = ap;
+ d->droid_profile = ap;
+ d->card_profile = cp;
d->virtual_profile = true;
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/droid/module-droid-sink.c
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013 Jolla Ltd.
+ * Copyright (C) 2013-2018 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
+ * 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
@@ -37,11 +37,10 @@
#include <pulsecore/log.h>
#include <pulsecore/macro.h>
-#include "droid-util.h"
+#include <droid/droid-util.h>
+#include <droid/conversion.h>
#include "droid-sink.h"
-#include "module-droid-sink-symdef.h"
-
PA_MODULE_AUTHOR("Juho Hämäläinen");
PA_MODULE_DESCRIPTION("Droid sink");
PA_MODULE_USAGE("master_sink=<sink to connect to> "
@@ -49,6 +48,7 @@
PA_MODULE_VERSION(PACKAGE_VERSION);
static const char* const valid_modargs[] = {
+ "config",
"rate",
"format",
"channels",
@@ -58,6 +58,7 @@
"sink_channel_map",
"sink_mix_route",
"flags",
+ "output",
"output_devices",
"sink_name",
"module_id",
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/droid/module-droid-source.c
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013 Jolla Ltd.
+ * Copyright (C) 2013-2022 Jolla Ltd.
*
- * Contact: Juho Hämäläinen <juho.hamalainen@tieto.com>
+ * 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
@@ -37,11 +37,9 @@
#include <pulsecore/log.h>
#include <pulsecore/macro.h>
-#include "droid-util.h"
+#include <droid/droid-util.h>
#include "droid-source.h"
-#include "module-droid-source-symdef.h"
-
PA_MODULE_AUTHOR("Juho Hämäläinen");
PA_MODULE_DESCRIPTION("Droid source");
PA_MODULE_USAGE("master_source=<source to connect to> "
@@ -49,6 +47,7 @@
PA_MODULE_VERSION(PACKAGE_VERSION);
static const char* const valid_modargs[] = {
+ "config",
"rate",
"format",
"channels",
@@ -84,7 +83,7 @@
goto fail;
}
- if (!(m->userdata = pa_droid_source_new(m, ma, __FILE__, (audio_devices_t) 0, NULL, NULL, NULL)))
+ if (!(m->userdata = pa_droid_source_new(m, ma, __FILE__, NULL, NULL, NULL)))
goto fail;
pa_modargs_free(ma);
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.103.tar.bz2/src/meson.build
^
|
@@ -0,0 +1,2 @@
+subdir('common')
+subdir('droid')
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/Makefile.am
^
|
@@ -1,10 +0,0 @@
-SUBDIRS = src
-
-ACLOCAL_AMFLAGS = -I m4
-
-$(top_srcdir)/.version:
- echo $(VERSION) > $@-t && mv $@-t $@
-
-dist-hook:
- echo $(VERSION) > $(distdir)/.tarball-version
- echo $(VERSION) > $(distdir)/.version
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/README
^
|
@@ -1,331 +0,0 @@
-PulseAudio Droid modules
-========================
-
-Building of droid modules is split to two packages
- * common (and common-devel) which contains shared library code for use in
- PulseAudio modules in this package and for inclusion in other projects
- * droid with actual PulseAudio modules
-
-Supported Android versions:
-
- * 4.1.x with Qualcomm extensions (tested with 4.1.2)
- * 4.2.x
- * 4.4.x
- * 5.x
- * 6.0.x
- * 7.x
-
-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,
-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])
-
-and then in droid-util-audio.h add the enum to proper tables with ifdefs:
- /* string_conversion_table_output_device[] */
- #ifdef HAVE_ENUM_AUDIO_DEVICE_OUT_IP
- STRING_ENTRY( AUDIO_DEVICE_OUT_IP ),
- #endif
-
- /* string_conversion_table_output_device_fancy[] */
- #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
-someday vendor would create and use something proprietary or otherwise
-different from ALSA. Also the ALSA implementation in droid devices may contain
-funny ways to achieve things (notable example is voicecall) which might be
-difficult to do if interfacing directly with ALSA to replace AudioFlinger.
-Also using ALSA directly would mean that the whole HAL adaptation would need to
-be ported for each new device adaptation. With droid-modules this is much more
-simpler, with somewhat stable HAL (HALv3 as of now, also different vendors add
-their own incompatible extensions) API. In best scenarios using droid-modules
-with new device is just compiling against target.
-
-Components
-==========
-
-module-droid-card
------------------
-
-Ideally only module-droid-card is loaded and then droid-card loads
-configuration, creates profiles and loads sinks and sources based on the
-selected profile.
-
-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.
-
-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).
-
-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
-
- audio_hw_modules {
- primary {
- outputs {
- primary {}
- lpa {}
- }
- inputs {
- primary {}
- }
- }
- other {
- ...
- }
- }
-
-Would map to card profiles (input-output) primary-primary and lpa-primary.
-When module-droid-card is run without module_id argument, as default "primary"
-is used.
-
-virtual profiles
-----------------
-
-In addition to aforementioned card profiles, droid-card creates some additional
-virtual profiles. These virtual profiles are used when enabling voicecall
-routings etc. When virtual profile is enabled, possible sinks and sources
-previously active profile had are not removed.
-
-As an illustration, following command line sequence enables voicecall mode and
-routes audio to internal handsfree (ihf - "handsfree speaker"):
-
-(Before starting, droid_card.primary is using profile primary-primary and
-sink.primary port output-speaker)
-
-pactl set-card-profile droid_card.primary voicecall
-pactl set-sink-port sink.primary output-parking
-pactl set-sink-port sink.primary output-speaker
-
-After this, when there is an active voicecall (created by ofono for example),
-voice audio starts to flow between modem and audio chip.
-
-To disable voicecall and return to media audio:
-
-pactl set-card-profile droid_card.primary primary-primary
-pactl set-sink-port sink.primary output-parking
-pactl set-sink-port sink.primary output-speaker
-
-With this example sequence sinks and sources are the ones from primary-primary
-card profile, and they are maintained for the whole duration of the voicecall
-and after.
-
-This sequence follows the droid HAL idea that when changing audio mode the mode
-change is done when next routing change happens. output-parking and
-input-parking ports are just convenience for PulseAudio, where setting already
-active port is a no-op (output/input-parking doesn't do any real routing
-changes).
-
-Current virtual profiles are:
- * voicecall
- * voicecall-record
- * communication
- * ringtone
-
-Communication profile is used for VoIP-like applications, to enable some
-voicecall related algorithms without being in voicecall. Ringtone profile
-should be used when ringtone is playing, to again enable possible loudness
-related optimizations etc. Voicecall-record profile can be enabled when
-voicecall profile is active.
-
-module-droid-sink and module-droid-source
------------------------------------------
-
-Normally user should not need to load droid-sink or droid-source modules by
-hand, but droid-card loads appropriate modules based on the active card
-profile.
-
-Output and input ports for droid-sink and droid-source are generated from the
-audio_policy.conf, where each device generates (usually) one port, for example:
-
- audio_hw_modules {
- primary {
- outputs {
- primary {
- devices = AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_WIRED_HEADPHONE
- }
- lpa {}
- }
- inputs {
- primary {
- devices = AUDIO_DEVICE_IN_BUILTIN_MIC
- }
- }
- }
- }
-
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/bootstrap.sh
^
|
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-autoreconf -vfi
-
-if type -p colorgcc > /dev/null ; then
- export CC=colorgcc
-fi
-
-export CFLAGS=${CFLAGS-"-g -O0"}
-
-if test "x$NOCONFIGURE" = "x"; then
- ./configure --enable-maintainer-mode --disable-processing "$@"
- make clean
-fi
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/configure.ac
^
|
@@ -1,315 +0,0 @@
-AC_PREREQ(2.60)
-
-AC_INIT([pulseaudio-modules-droid], [m4_esyscmd(./git-version-gen .tarball-version)], [mer-general@lists.merproject.org])
-AC_CONFIG_HEADER([config.h])
-AM_INIT_AUTOMAKE([foreign -Wall silent-rules])
-AC_CONFIG_MACRO_DIR(m4)
-AM_SILENT_RULES([yes])
-
-AS_IF([! test -n "$VERSION"], [
- AC_MSG_ERROR([git-version-gen failed])
-])
-
-if type -p stow > /dev/null && test -d /usr/local/stow ; then
- AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
- ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
-fi
-
-AC_PROG_CC
-AC_PROG_CC_C99
-AM_PROG_CC_C_O
-AC_PROG_GCC_TRADITIONAL
-
-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
-
-for flag in $DESIRED_FLAGS ; do
- CC_CHECK_CFLAGS([$flag], [CFLAGS="$CFLAGS $flag"])
-done
-
-# FIXME: we should push that as .m4 macro installed by pulseaudio-dev package
-# Native atomic operation support
-AC_ARG_ENABLE([atomic-arm-linux-helpers],
- AS_HELP_STRING([--disable-atomic-arm-linux-helpers],[use inline asm or libatomic_ops instead]),
- [
- case "${enableval}" in
- yes) atomic_arm_linux_helpers=yes ;;
- no) atomic_arm_linux_helpers=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --disable-atomic-arm-linux-helpers) ;;
- esac
- ],
- [atomic_arm_linux_helpers=auto])
-
-AC_ARG_ENABLE([atomic-arm-memory-barrier],
- AS_HELP_STRING([--enable-atomic-arm-memory-barrier],[only really needed in SMP arm systems]),
- [
- case "${enableval}" in
- yes) AC_DEFINE_UNQUOTED(ATOMIC_ARM_MEMORY_BARRIER_ENABLED, 1, [Enable memory barriers]) ;;
- no) ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --disable-atomic-arm-linux-helpers) ;;
- esac
- ],)
-
-AC_CANONICAL_HOST
-AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.])
-
-AC_MSG_CHECKING([target operating system])
-
-case $host in
- *-*-linux*)
- AC_MSG_RESULT([linux])
- pulse_target_os=linux
- ;;
- *)
- AC_MSG_RESULT([unknown])
- pulse_target_os=unknown
- ;;
-esac
-
-# If everything else fails use libatomic_ops
-need_libatomic_ops=yes
-
-AC_MSG_CHECKING([whether $CC knows __sync_bool_compare_and_swap()])
-AC_LANG_CONFTEST([int main() { int a = 4; __sync_bool_compare_and_swap(&a, 4, 5); }])
-$CC conftest.c $CFLAGS -o conftest > /dev/null 2> /dev/null
-ret=$?
-rm -f conftest.o conftest
-if test $ret -eq 0 ; then
- AC_DEFINE([HAVE_ATOMIC_BUILTINS], 1, [Have __sync_bool_compare_and_swap() and friends.])
- AC_MSG_RESULT([yes])
- need_libatomic_ops=no
-else
- AC_MSG_RESULT([no])
- # HW specific atomic ops stuff
- AC_MSG_CHECKING([architecture for native atomic operations])
- case $host_cpu in
- arm*)
- AC_MSG_RESULT([arm])
- AC_MSG_CHECKING([compiler support for arm inline asm atomic operations])
- AC_LANG_CONFTEST([[int main()
- {
- volatile int a=0;
- int o=0, n=1, r;
- asm volatile ("ldrex %0, [%1]\n"
- "subs %0, %0, %2\n"
- "strexeq %0, %3, [%1]\n"
- : "=&r" (r)
- : "r" (&a), "Ir" (o), "r" (n)
- : "cc");
- return (a==1 ? 0 : -1);
- }]])
- $CC conftest.c $CFLAGS -o conftest > /dev/null 2>&1
- ret=$?
- rm -f conftest.o conftest
- if test $ret -eq 0 ; then
- AC_DEFINE([ATOMIC_ARM_INLINE_ASM], 1, [Have ARMv6 instructions.])
- AC_MSG_RESULT([yes])
- need_libatomic_ops=no
- else
- # We really want inline asm atomic operations!!
- echo "ERROR No ARMv6 instructions available check your compiler!!!"
- exit 1
-
- AC_MSG_CHECKING([whether we can use Linux kernel helpers])
- # The Linux kernel helper functions have been there since 2.6.16. However
- # compile time checking for kernel version in cross compile environment
- # (which is usually the case for arm cpu) is tricky (or impossible).
- if test "x$pulse_target_os" = "xlinux" && test "x$atomic_arm_linux_helpers" != "xno"; then
- AC_MSG_RESULT([yes])
- AC_DEFINE_UNQUOTED(ATOMIC_ARM_LINUX_HELPERS, 1, [special arm linux implementation])
- need_libatomic_ops=no
- else
- AC_MSG_RESULT([no])
- fi
- fi
- ;;
- *)
- AC_MSG_RESULT([unknown])
- ;;
- esac
-fi
-
-AC_MSG_CHECKING([whether we need libatomic_ops])
-if test "x$need_libatomic_ops" = "xyes"; then
- AC_MSG_RESULT([yes])
- AC_CHECK_HEADERS([atomic_ops.h], [], [
- AC_MSG_ERROR([*** libatomic-ops headers not found])
- ])
-
- # Win32 does not need the lib and breaks horribly if we try to include it
- if test "x$os_is_win32" != "x1" ; then
- LIBS="$LIBS -latomic_ops"
- fi
-else
- AC_MSG_RESULT([no])
-fi
-
-CC_CHECK_TLS
-
-AC_CACHE_CHECK([whether $CC knows _Bool],
- pulseaudio_cv__Bool,
- [AC_COMPILE_IFELSE(
- AC_LANG_PROGRAM([], [[_Bool b;]]),
- [pulseaudio_cv__Bool=yes],
- [pulseaudio_cv__Bool=no])
- ])
-
-AS_IF([test "$pulseaudio_cv__Bool" = "yes"], [
- AC_DEFINE([HAVE_STD_BOOL], 1, [Have _Bool.])
- ])
-
-#### libtool stuff (FIXME: when sbox will have 2.2 )####
-#LT_PREREQ(2.2)
-#LT_INIT([dlopen win32-dll disable-static])
-AC_PROG_LIBTOOL
-
-PKG_CHECK_MODULES([PULSEAUDIO], [libpulse >= 5.0 pulsecore >= 5.0])
-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])
-AC_SUBST(DROIDHEADERS_CFLAGS)
-
-PKG_CHECK_MODULES([HYBRIS], [libhardware >= 0.1.0])
-AC_SUBST(HYBRIS_CFLAGS)
-AC_SUBST(HYBRIS_LIBS)
-
-PKG_CHECK_MODULES([DBUS], [dbus-1 >= 1.2])
-AC_SUBST(DBUS_CFLAGS)
-AC_SUBST(DBUS_LIBS)
-
-# Output devices
-CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_HDMI])
-CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_HDMI_ARC])
-CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_TELEPHONY_TX])
-CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_LINE])
-CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_SPDIF])
-CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_AUX_LINE])
-CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_SPEAKER_SAFE])
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/m4/.gitignore
^
|
@@ -1,5 +0,0 @@
-libtool.m4
-ltoptions.m4
-ltsugar.m4
-ltversion.m4
-lt~obsolete.m4
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/m4/attributes.m4
^
|
@@ -1,258 +0,0 @@
-dnl Macros to check the presence of generic (non-typed) symbols.
-dnl Copyright (c) 2006-2007 Diego Pettenò <flameeyes@gmail.com>
-dnl Copyright (c) 2006-2007 xine project
-dnl
-dnl This program is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2, or (at your option)
-dnl any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-dnl 02110-1301, USA.
-dnl
-dnl As a special exception, the copyright owners of the
-dnl macro gives unlimited permission to copy, distribute and modify the
-dnl configure scripts that are the output of Autoconf when processing the
-dnl Macro. You need not follow the terms of the GNU General Public
-dnl License when using or distributing such scripts, even though portions
-dnl of the text of the Macro appear in them. The GNU General Public
-dnl License (GPL) does govern all other use of the material that
-dnl constitutes the Autoconf Macro.
-dnl
-dnl This special exception to the GPL applies to versions of the
-dnl Autoconf Macro released by this project. When you make and
-dnl distribute a modified version of the Autoconf Macro, you may extend
-dnl this special exception to the GPL to apply to your modified version as
-dnl well.
-
-AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [
- AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]),
- [ac_save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $1"
- AC_COMPILE_IFELSE([int a;],
- [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"],
- [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"])
- CFLAGS="$ac_save_CFLAGS"
- ])
-
- AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
- [$2], [$3])
-])
-
-AC_DEFUN([CC_CHECK_CFLAGS], [
- AC_CACHE_CHECK([if $CC supports $1 flag],
- AS_TR_SH([cc_cv_cflags_$1]),
- CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
- )
-
- AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
- [$2], [$3])
-])
-
-AC_DEFUN([CC_CHECK_LDFLAGS], [
- AC_CACHE_CHECK([if $CC supports $1 flag],
- AS_TR_SH([cc_cv_ldflags_$1]),
- [ac_save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $1"
- AC_LINK_IFELSE([int main() { return 1; }],
- [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
- [eval "AS_TR_SH([cc_cv_ldflags_$1])="])
- LDFLAGS="$ac_save_LDFLAGS"
- ])
-
- AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes],
- [$2], [$3])
-])
-
-dnl Check for a -Werror flag or equivalent. -Werror is the GCC
-dnl and ICC flag that tells the compiler to treat all the warnings
-dnl as fatal. We usually need this option to make sure that some
-dnl constructs (like attributes) are not simply ignored.
-dnl
-dnl Other compilers don't support -Werror per se, but they support
-dnl an equivalent flag:
-dnl - Sun Studio compiler supports -errwarn=%all
-AC_DEFUN([CC_CHECK_WERROR], [
- AC_CACHE_CHECK(
- [for $CC way to treat warnings as errors],
- [cc_cv_werror],
- [CC_CHECK_CFLAGS_SILENT([-Werror], [cc_cv_werror=-Werror],
- [CC_CHECK_CFLAGS_SILENT([-errwarn=%all], [cc_cv_werror=-errwarn=%all])])
- ])
-])
-
-AC_DEFUN([CC_CHECK_ATTRIBUTE], [
- AC_REQUIRE([CC_CHECK_WERROR])
- AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))],
- AS_TR_SH([cc_cv_attribute_$1]),
- [ac_save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $cc_cv_werror"
- AC_COMPILE_IFELSE([$3],
- [eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"],
- [eval "AS_TR_SH([cc_cv_attribute_$1])='no'"])
- CFLAGS="$ac_save_CFLAGS"
- ])
-
- AS_IF([eval test x$]AS_TR_SH([cc_cv_attribute_$1])[ = xyes],
- [AC_DEFINE(
- AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1,
- [Define this if the compiler supports __attribute__(( ifelse([$2], , [$1], [$2]) ))]
- )
- $4],
- [$5])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [
- CC_CHECK_ATTRIBUTE(
- [constructor],,
- [void __attribute__((constructor)) ctor() { int a; }],
- [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_FORMAT], [
- CC_CHECK_ATTRIBUTE(
- [format], [format(printf, n, n)],
- [void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { fmt = (void *)0; }],
- [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [
- CC_CHECK_ATTRIBUTE(
- [format_arg], [format_arg(printf)],
- [char *__attribute__((format_arg(1))) gettextlike(const char *fmt) { fmt = (void *)0; }],
- [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [
- CC_CHECK_ATTRIBUTE(
- [visibility_$1], [visibility("$1")],
- [void __attribute__((visibility("$1"))) $1_function() { }],
- [$2], [$3])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_NONNULL], [
- CC_CHECK_ATTRIBUTE(
- [nonnull], [nonnull()],
- [void __attribute__((nonnull())) some_function(void *foo, void *bar) { foo = (void*)0; bar = (void*)0; }],
- [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_UNUSED], [
- CC_CHECK_ATTRIBUTE(
- [unused], ,
- [void some_function(void *foo, __attribute__((unused)) void *bar);],
- [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_SENTINEL], [
- CC_CHECK_ATTRIBUTE(
- [sentinel], ,
- [void some_function(void *foo, ...) __attribute__((sentinel));],
- [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [
- CC_CHECK_ATTRIBUTE(
- [deprecated], ,
- [void some_function(void *foo, ...) __attribute__((deprecated));],
- [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_ALIAS], [
- CC_CHECK_ATTRIBUTE(
- [alias], [weak, alias],
- [void other_function(void *foo) { }
- void some_function(void *foo) __attribute__((weak, alias("other_function")));],
- [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_MALLOC], [
- CC_CHECK_ATTRIBUTE(
- [malloc], ,
- [void * __attribute__((malloc)) my_alloc(int n);],
- [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_PACKED], [
- CC_CHECK_ATTRIBUTE(
- [packed], ,
- [struct astructure { char a; int b; long c; void *d; } __attribute__((packed));],
- [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_CONST], [
- CC_CHECK_ATTRIBUTE(
- [const], ,
- [int __attribute__((const)) twopow(int n) { return 1 << n; } ],
- [$1], [$2])
-])
-
-AC_DEFUN([CC_FLAG_VISIBILITY], [
- AC_REQUIRE([CC_CHECK_WERROR])
- AC_CACHE_CHECK([if $CC supports -fvisibility=hidden],
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/m4/check_droid_enum.m4
^
|
@@ -1,21 +0,0 @@
-AC_DEFUN([CC_CHECK_DROID_ENUM],
-[AC_MSG_CHECKING([if droid headers have enum $2])
- AC_LANG_SAVE
- AC_LANG_C
- SAVE_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $1"
- AC_TRY_COMPILE(
- [ #include <android-config.h>
- #ifdef QCOM_BSP
- #define QCOM_HARDWARE
- #endif
- #include <system/audio.h> ],
- [ unsigned int e = $2; ],
- cc_check_droid_enum=yes, cc_check_droid_enum=no)
- CFLAGS="$SAVE_CFLAGS"
- AC_LANG_RESTORE
- 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])
-fi
-])
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/m4/tls.m4
^
|
@@ -1,17 +0,0 @@
-AC_DEFUN([CC_CHECK_TLS], [
- AC_CACHE_CHECK([whether $CC knows __thread for Thread-Local Storage],
- cc_cv_tls___thread,
- [AC_COMPILE_IFELSE(
- AC_LANG_PROGRAM(
- [[static __thread int a = 6;]],
- [[a = 5;]]),
- [cc_cv_tls___thread=yes],
- [cc_cv_tls___thread=no])
- ])
-
- AS_IF([test "x$cc_cv_tls___thread" = "xyes"],
- [AC_DEFINE([SUPPORT_TLS___THREAD], 1,
- [Define this if the compiler supports __thread for Thread-Local Storage])
- $1],
- [$2])
-])
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/src/Makefile.am
^
|
@@ -1 +0,0 @@
-SUBDIRS = common droid
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/src/common/Makefile.am
^
|
@@ -1,18 +0,0 @@
-AM_LIBADD = \
- $(PULSEAUDIO_LIBS) \
- $(HYBRIS_LIBS)
-AM_CFLAGS = \
- $(DROID_DEVICE_CFLAGS) \
- $(PULSEAUDIO_CFLAGS) \
- $(DROIDHEADERS_CFLAGS) \
- $(HYBRIS_CFLAGS) \
- -DPULSEAUDIO_VERSION=@PA_MAJOR@ \
- -I$(top_srcdir)/src/common
-
-
-modlibexec_LTLIBRARIES = libdroid-util.la
-
-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)
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/src/common/droid-util-41qc.h
^
|
@@ -1,305 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _ANDROID_UTIL_V412_H_
-#define _ANDROID_UTIL_V412_H_
-
-#ifdef DROID_DEVICE_SBJ
-#define QCOM_HARDWARE
-#endif
-
-#include <hardware/audio.h>
-#include <hardware_legacy/audio_policy_conf.h>
-
-// PulseAudio value - Android value
-
-uint32_t conversion_table_output_channel[][2] = {
- { PA_CHANNEL_POSITION_MONO, AUDIO_CHANNEL_OUT_MONO },
- { PA_CHANNEL_POSITION_FRONT_LEFT, AUDIO_CHANNEL_OUT_FRONT_LEFT },
- { PA_CHANNEL_POSITION_FRONT_RIGHT, AUDIO_CHANNEL_OUT_FRONT_RIGHT},
- { PA_CHANNEL_POSITION_FRONT_CENTER, AUDIO_CHANNEL_OUT_FRONT_CENTER },
- { PA_CHANNEL_POSITION_SUBWOOFER, AUDIO_CHANNEL_OUT_LOW_FREQUENCY },
- { PA_CHANNEL_POSITION_REAR_LEFT, AUDIO_CHANNEL_OUT_BACK_LEFT },
- { PA_CHANNEL_POSITION_REAR_RIGHT, AUDIO_CHANNEL_OUT_BACK_RIGHT },
- { PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, AUDIO_CHANNEL_OUT_FRONT_LEFT_OF_CENTER },
- { PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, AUDIO_CHANNEL_OUT_FRONT_RIGHT_OF_CENTER },
- { PA_CHANNEL_POSITION_REAR_CENTER, AUDIO_CHANNEL_OUT_BACK_CENTER },
- { PA_CHANNEL_POSITION_SIDE_LEFT, AUDIO_CHANNEL_OUT_SIDE_LEFT },
- { PA_CHANNEL_POSITION_SIDE_RIGHT, AUDIO_CHANNEL_OUT_SIDE_RIGHT },
- { PA_CHANNEL_POSITION_TOP_CENTER, AUDIO_CHANNEL_OUT_TOP_CENTER },
- { PA_CHANNEL_POSITION_TOP_FRONT_LEFT, AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT },
- { PA_CHANNEL_POSITION_TOP_FRONT_CENTER, AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER },
- { PA_CHANNEL_POSITION_TOP_FRONT_RIGHT, AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT },
- { PA_CHANNEL_POSITION_TOP_REAR_LEFT, AUDIO_CHANNEL_OUT_TOP_BACK_LEFT },
- { PA_CHANNEL_POSITION_TOP_REAR_CENTER, AUDIO_CHANNEL_OUT_TOP_BACK_CENTER },
- { PA_CHANNEL_POSITION_TOP_REAR_RIGHT, AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT }
-};
-
-uint32_t conversion_table_input_channel[][2] = {
- { PA_CHANNEL_POSITION_MONO, AUDIO_CHANNEL_IN_MONO },
- { PA_CHANNEL_POSITION_FRONT_LEFT, AUDIO_CHANNEL_IN_LEFT },
- { PA_CHANNEL_POSITION_FRONT_RIGHT, AUDIO_CHANNEL_IN_RIGHT},
- { PA_CHANNEL_POSITION_FRONT_CENTER, AUDIO_CHANNEL_IN_FRONT },
- { PA_CHANNEL_POSITION_REAR_CENTER, AUDIO_CHANNEL_IN_BACK },
- /* Following are missing suitable counterparts on PulseAudio side. */
- { AUDIO_CHANNEL_IN_LEFT_PROCESSED, AUDIO_CHANNEL_IN_LEFT_PROCESSED },
- { AUDIO_CHANNEL_IN_RIGHT_PROCESSED, AUDIO_CHANNEL_IN_RIGHT_PROCESSED },
- { AUDIO_CHANNEL_IN_FRONT_PROCESSED, AUDIO_CHANNEL_IN_FRONT_PROCESSED },
- { AUDIO_CHANNEL_IN_BACK_PROCESSED, AUDIO_CHANNEL_IN_BACK_PROCESSED },
- { AUDIO_CHANNEL_IN_PRESSURE, AUDIO_CHANNEL_IN_PRESSURE },
- { AUDIO_CHANNEL_IN_X_AXIS, AUDIO_CHANNEL_IN_X_AXIS },
- { AUDIO_CHANNEL_IN_Y_AXIS, AUDIO_CHANNEL_IN_Y_AXIS },
- { AUDIO_CHANNEL_IN_Z_AXIS, AUDIO_CHANNEL_IN_Z_AXIS },
- { AUDIO_CHANNEL_IN_VOICE_UPLINK, AUDIO_CHANNEL_IN_VOICE_UPLINK },
- { AUDIO_CHANNEL_IN_VOICE_DNLINK, AUDIO_CHANNEL_IN_VOICE_DNLINK }
-};
-
-uint32_t conversion_table_format[][2] = {
- { PA_SAMPLE_U8, AUDIO_FORMAT_PCM_8_BIT },
- { PA_SAMPLE_S16LE, AUDIO_FORMAT_PCM_16_BIT },
- { PA_SAMPLE_S32LE, AUDIO_FORMAT_PCM_32_BIT },
- { PA_SAMPLE_S24LE, AUDIO_FORMAT_PCM_8_24_BIT }
-};
-
-uint32_t conversion_table_default_audio_source[][2] = {
- { AUDIO_DEVICE_IN_ALL, AUDIO_SOURCE_DEFAULT }
-};
-
-struct string_conversion {
- uint32_t value;
- const char *str;
-};
-
-#if defined(STRING_ENTRY) || defined(STRING_ENTRY)
-#error STRING_ENTRY already defined somewhere, fix this lib.
-#endif
-#define STRING_ENTRY(str) { str, #str }
-/* Output devices */
-struct string_conversion string_conversion_table_output_device[] = {
- STRING_ENTRY(AUDIO_DEVICE_OUT_EARPIECE),
- STRING_ENTRY(AUDIO_DEVICE_OUT_SPEAKER),
- STRING_ENTRY(AUDIO_DEVICE_OUT_WIRED_HEADSET),
- STRING_ENTRY(AUDIO_DEVICE_OUT_WIRED_HEADPHONE),
- STRING_ENTRY(AUDIO_DEVICE_OUT_BLUETOOTH_SCO),
- STRING_ENTRY(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET),
- STRING_ENTRY(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT),
- STRING_ENTRY(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP),
- STRING_ENTRY(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES),
- STRING_ENTRY(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER),
- STRING_ENTRY(AUDIO_DEVICE_OUT_AUX_DIGITAL),
- STRING_ENTRY(AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET),
- STRING_ENTRY(AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET),
- STRING_ENTRY(AUDIO_DEVICE_OUT_USB_ACCESSORY),
- STRING_ENTRY(AUDIO_DEVICE_OUT_USB_DEVICE),
- STRING_ENTRY(AUDIO_DEVICE_OUT_FM),
- STRING_ENTRY(AUDIO_DEVICE_OUT_FM_TX),
- STRING_ENTRY(AUDIO_DEVICE_OUT_ANC_HEADSET),
- STRING_ENTRY(AUDIO_DEVICE_OUT_ANC_HEADPHONE),
- STRING_ENTRY(AUDIO_DEVICE_OUT_PROXY),
- STRING_ENTRY(AUDIO_DEVICE_OUT_ALL),
- STRING_ENTRY(AUDIO_DEVICE_OUT_ALL_A2DP),
- STRING_ENTRY(AUDIO_DEVICE_OUT_ALL_SCO),
- STRING_ENTRY(AUDIO_DEVICE_OUT_ALL_USB),
- { 0, NULL }
-};
-
-struct string_conversion string_conversion_table_output_device_fancy[] = {
- { AUDIO_DEVICE_OUT_EARPIECE, "output-earpiece" },
- { AUDIO_DEVICE_OUT_SPEAKER, "output-speaker" },
- { AUDIO_DEVICE_OUT_SPEAKER
- | AUDIO_DEVICE_OUT_WIRED_HEADPHONE, "output-speaker+wired_headphone" },
- { AUDIO_DEVICE_OUT_WIRED_HEADSET, "output-wired_headset" },
- { AUDIO_DEVICE_OUT_WIRED_HEADPHONE, "output-wired_headphone" },
- { AUDIO_DEVICE_OUT_BLUETOOTH_SCO, "output-bluetooth_sco" },
- { AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET, "output-sco_headset" },
- { AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT, "output-sco_carkit" },
- { AUDIO_DEVICE_OUT_BLUETOOTH_A2DP, "output-a2dp" },
- { AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES, "output-a2dp_headphones" },
- { AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER, "output-a2dp_speaker" },
- { AUDIO_DEVICE_OUT_AUX_DIGITAL, "output-aux_digital" },
- { AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET, "output-analog_dock_headset" },
- { AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET, "output-digital_dock_headset" },
- { AUDIO_DEVICE_OUT_USB_ACCESSORY, "output-usb_accessory" },
- { AUDIO_DEVICE_OUT_USB_DEVICE, "output-usb_device" },
- { AUDIO_DEVICE_OUT_FM, "output-fm" },
- { AUDIO_DEVICE_OUT_FM_TX, "output-fm_tx" },
- { AUDIO_DEVICE_OUT_ANC_HEADSET, "output-anc_headset" },
- { AUDIO_DEVICE_OUT_ANC_HEADPHONE, "output-anc_headphone" },
- { AUDIO_DEVICE_OUT_PROXY, "output-proxy" },
- { 0, NULL }
-};
-
-/* Input devices */
-struct string_conversion string_conversion_table_input_device[] = {
- STRING_ENTRY(AUDIO_DEVICE_IN_COMMUNICATION),
- STRING_ENTRY(AUDIO_DEVICE_IN_AMBIENT),
- STRING_ENTRY(AUDIO_DEVICE_IN_BUILTIN_MIC),
- STRING_ENTRY(AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET),
- STRING_ENTRY(AUDIO_DEVICE_IN_WIRED_HEADSET),
- STRING_ENTRY(AUDIO_DEVICE_IN_AUX_DIGITAL),
- STRING_ENTRY(AUDIO_DEVICE_IN_VOICE_CALL),
- STRING_ENTRY(AUDIO_DEVICE_IN_BACK_MIC),
- STRING_ENTRY(AUDIO_DEVICE_IN_ANC_HEADSET),
- STRING_ENTRY(AUDIO_DEVICE_IN_FM_RX),
- STRING_ENTRY(AUDIO_DEVICE_IN_FM_RX_A2DP),
- STRING_ENTRY(AUDIO_DEVICE_IN_PROXY),
- STRING_ENTRY(AUDIO_DEVICE_IN_DEFAULT),
- /* Combination entries consisting of multiple devices defined above.
- * 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),
- { 0, NULL }
-};
-
-struct string_conversion string_conversion_table_input_device_fancy[] = {
- { AUDIO_DEVICE_IN_COMMUNICATION, "input-communication" },
- { AUDIO_DEVICE_IN_AMBIENT, "input-ambient" },
- { AUDIO_DEVICE_IN_BUILTIN_MIC, "input-builtin_mic" },
- { AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET, "input-bluetooth_sco_headset" },
- { AUDIO_DEVICE_IN_WIRED_HEADSET, "input-wired_headset" },
- { AUDIO_DEVICE_IN_AUX_DIGITAL, "input-aux_digital" },
- { AUDIO_DEVICE_IN_VOICE_CALL, "input-voice_call" },
- { AUDIO_DEVICE_IN_BACK_MIC, "input-back_mic" },
- { AUDIO_DEVICE_IN_ANC_HEADSET, "input-anc_headset" },
- { AUDIO_DEVICE_IN_FM_RX, "input-fm_rx" },
- { AUDIO_DEVICE_IN_FM_RX_A2DP, "input-fm_rx_a2dp" },
- { AUDIO_DEVICE_IN_PROXY, "input-in_proxy" },
- { AUDIO_DEVICE_IN_DEFAULT, "input-default" },
- { 0, NULL }
-};
-
-struct string_conversion string_conversion_table_audio_source_fancy[] = {
- { AUDIO_SOURCE_DEFAULT, "default" },
- { AUDIO_SOURCE_MIC, "mic" },
- { AUDIO_SOURCE_VOICE_UPLINK, "voice uplink" },
- { AUDIO_SOURCE_VOICE_DOWNLINK, "voice downlink" },
- { AUDIO_SOURCE_VOICE_CALL, "voice call" },
- { AUDIO_SOURCE_CAMCORDER, "camcorder" },
- { AUDIO_SOURCE_VOICE_RECOGNITION, "voice recognition" },
- { AUDIO_SOURCE_VOICE_COMMUNICATION, "voice communication" },
- { AUDIO_SOURCE_FM_RX, "fm rx" },
- { AUDIO_SOURCE_FM_RX_A2DP, "fm rx a2dp" },
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/src/common/droid-util.h
^
|
@@ -1,446 +0,0 @@
-#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 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_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_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;
-};
-
-#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;
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/src/droid/Makefile.am
^
|
@@ -1,53 +0,0 @@
-AM_LIBADD = \
- $(PULSEAUDIO_LIBS) \
- $(HYBRIS_LIBS)
-
-AM_CFLAGS = \
- $(DROID_DEVICE_CFLAGS) \
- $(PULSEAUDIO_CFLAGS) \
- $(DROIDHEADERS_CFLAGS) \
- $(HYBRIS_CFLAGS) \
- -DPULSEAUDIO_VERSION=@PA_MAJOR@ \
- -I$(top_srcdir)/src/droid \
- -I$(top_srcdir)/src/common
-
-
-modlibexec_LTLIBRARIES = \
- libdroid-sink.la \
- libdroid-source.la \
- module-droid-keepalive.la \
- module-droid-sink.la \
- module-droid-source.la \
- module-droid-card.la
-
-noinst_HEADERS = module-droid-sink-symdef.h module-droid-source-symdef.h module-droid-card-symdef.h module-droid-keepalive-symdef.h
-
-module_droid_keepalive_la_SOURCES = keepalive.c keepalive.h module-droid-keepalive.c
-module_droid_keepalive_la_LDFLAGS = -module -avoid-version -Wl,-z,noexecstack
-module_droid_keepalive_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS)
-module_droid_keepalive_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
-
-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_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_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_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_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_CFLAGS = $(AM_CFLAGS)
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/src/droid/keepalive.c
^
|
@@ -1,243 +0,0 @@
-/*
- * 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 <signal.h>
-#include <stdio.h>
-
-#ifdef HAVE_VALGRIND_MEMCHECK_H
-#include <valgrind/memcheck.h>
-#endif
-
-#include <pulse/rtclock.h>
-#include <pulse/timeval.h>
-#include <pulse/xmalloc.h>
-
-#include <pulsecore/core.h>
-#include <pulsecore/core-error.h>
-#include <pulsecore/dbus-shared.h>
-#include <pulsecore/dbus-util.h>
-#include <pulsecore/atomic.h>
-
-#include "keepalive.h"
-
-#define MCE_BUS (DBUS_BUS_SYSTEM)
-#define MCE_DBUS_NAME "com.nokia.mce"
-#define MCE_DBUS_PATH "/com/nokia/mce/request"
-#define MCE_DBUS_IFACE "com.nokia.mce.request"
-#define MCE_DBUS_KEEPALIVE_PERIOD_REQ "req_cpu_keepalive_period"
-#define MCE_DBUS_KEEPALIVE_START_REQ "req_cpu_keepalive_start"
-#define MCE_DBUS_KEEPALIVE_STOP_REQ "req_cpu_keepalive_stop"
-
-struct pa_droid_keepalive {
- pa_core *core;
- pa_dbus_connection *dbus_connection;
- DBusPendingCall *pending;
-
- pa_atomic_t started;
- pa_usec_t timeout;
- pa_time_event *timer_event;
-
-};
-
-pa_droid_keepalive* pa_droid_keepalive_new(pa_core *c) {
- pa_droid_keepalive *k;
- pa_dbus_connection *dbus;
- DBusError error;
-
- pa_assert(c);
-
- dbus_error_init(&error);
-
- dbus = pa_dbus_bus_get(c, MCE_BUS, &error);
- if (dbus_error_is_set(&error)) {
- pa_log("Failed to get %s bus: %s", MCE_BUS == DBUS_BUS_SESSION ? "session" : "system", error.message);
- dbus_error_free(&error);
- return NULL;
- }
-
- k = pa_xnew0(pa_droid_keepalive, 1);
- k->core = c;
- k->dbus_connection = dbus;
- k->timeout = 0;
- pa_atomic_store(&k->started, 0);
-
- return k;
-}
-
-static void send_dbus_signal(pa_dbus_connection *dbus) {
- DBusMessage *msg;
-
- pa_assert(dbus);
-
- /* pa_log_debug("Send keepalive heartbeat."); */
-
- pa_assert_se((msg = dbus_message_new_method_call(MCE_DBUS_NAME,
- MCE_DBUS_PATH,
- MCE_DBUS_IFACE,
- MCE_DBUS_KEEPALIVE_START_REQ)));
-
- dbus_connection_send(pa_dbus_connection_get(dbus), msg, NULL);
- dbus_message_unref(msg);
-}
-
-static void keepalive_cb(pa_mainloop_api *m, pa_time_event *e, const struct timeval *t, void *userdata) {
- pa_droid_keepalive *k = userdata;
-
- pa_assert(k);
- pa_assert(k->timer_event == e);
-
- send_dbus_signal(k->dbus_connection);
- pa_core_rttime_restart(k->core, k->timer_event, pa_rtclock_now() + k->timeout);
-}
-
-static void keepalive_start(pa_droid_keepalive *k) {
- pa_assert(k);
- pa_assert(k->timeout);
- pa_assert(!k->timer_event);
-
- pa_log_info("Start keepalive heartbeat with interval %lu seconds.", (unsigned long) (k->timeout / PA_USEC_PER_SEC));
-
- /* Send first keepalive heartbeat immediately. */
- send_dbus_signal(k->dbus_connection);
-
- k->timer_event = pa_core_rttime_new(k->core, pa_rtclock_now() + k->timeout, keepalive_cb, k);
-}
-
-static void pending_req_reply_cb(DBusPendingCall *pending, void *userdata) {
- pa_droid_keepalive *k = userdata;
- DBusMessage *msg;
- uint32_t period;
-
- 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) {
- pa_log("Failed to get %s", MCE_DBUS_KEEPALIVE_PERIOD_REQ);
- goto finish;
- }
-
- pa_assert_se(dbus_message_get_args(msg, NULL,
- DBUS_TYPE_INT32, &period,
- DBUS_TYPE_INVALID));
-
- k->timeout = PA_USEC_PER_SEC * period;
-
- keepalive_start(k);
-
-finish:
- dbus_message_unref(msg);
- dbus_pending_call_unref(pending);
-}
-
-void pa_droid_keepalive_start(pa_droid_keepalive *k) {
- DBusMessage *msg = NULL;
-
- pa_assert(k);
-
- /* Only allow first call go through. pa_atomic_inc() returns previous value before incrementing. */
- if (pa_atomic_inc(&k->started) > 0)
- return;
-
- pa_assert(!k->timer_event);
- pa_assert(!k->pending);
-
- /* Period time already requested, just start hearbeat. */
- if (k->timeout > 0) {
- keepalive_start(k);
- return;
- }
-
- pa_log_debug("Starting keepalive - Request keepalive period.");
- /* Send first keepalive heartbeat immediately. */
- send_dbus_signal(k->dbus_connection);
-
- pa_assert_se((msg = dbus_message_new_method_call(MCE_DBUS_NAME,
- MCE_DBUS_PATH,
- 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_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.");
-}
-
-void pa_droid_keepalive_stop(pa_droid_keepalive *k) {
- DBusMessage *msg;
-
- pa_assert(k);
-
- /* Only allow last call go through. pa_atomic_dec() returns previous value before decrementing. */
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/src/droid/keepalive.h
^
|
@@ -1,44 +0,0 @@
-#ifndef foodroidkeepalivefoo
-#define foodroidkeepalivefoo
-
-/*
- * 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.h>
-#include <pulsecore/core-util.h>
-#include <pulsecore/macro.h>
-#include <pulsecore/dbus-shared.h>
-#include <pulsecore/atomic.h>
-
-typedef struct pa_droid_keepalive pa_droid_keepalive;
-
-pa_droid_keepalive* pa_droid_keepalive_new(pa_core *c);
-void pa_droid_keepalive_free(pa_droid_keepalive *k);
-
-void pa_droid_keepalive_start(pa_droid_keepalive *k);
-void pa_droid_keepalive_stop(pa_droid_keepalive *k);
-
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/src/droid/module-droid-card-symdef.h
^
|
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-#ifndef foomoduledroidcardsymdeffoo
-#define foomoduledroidcardsymdeffoo
-
-#include <pulsecore/core.h>
-#include <pulsecore/module.h>
-
-#define pa__init module_droid_card_LTX_pa__init
-#define pa__done module_droid_card_LTX_pa__done
-#define pa__get_author module_droid_card_LTX_pa__get_author
-#define pa__get_description module_droid_card_LTX_pa__get_description
-#define pa__get_usage module_droid_card_LTX_pa__get_usage
-#define pa__get_version module_droid_card_LTX_pa__get_version
-
-int pa__init(struct pa_module*m);
-void pa__done(struct pa_module*m);
-
-const char* pa__get_author(void);
-const char* pa__get_description(void);
-const char* pa__get_usage(void);
-const char* pa__get_version(void);
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/src/droid/module-droid-keepalive-symdef.h
^
|
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-#ifndef foomoduledroidkeepalivesymdeffoo
-#define foomoduledroidkeepalivesymdeffoo
-
-#include <pulsecore/core.h>
-#include <pulsecore/module.h>
-
-#define pa__init module_droid_keepalive_LTX_pa__init
-#define pa__done module_droid_keepalive_LTX_pa__done
-#define pa__get_author module_droid_keepalive_LTX_pa__get_author
-#define pa__get_description module_droid_keepalive_LTX_pa__get_description
-#define pa__get_usage module_droid_keepalive_LTX_pa__get_usage
-#define pa__get_version module_droid_keepalive_LTX_pa__get_version
-
-int pa__init(struct pa_module*m);
-void pa__done(struct pa_module*m);
-
-const char* pa__get_author(void);
-const char* pa__get_description(void);
-const char* pa__get_usage(void);
-const char* pa__get_version(void);
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/src/droid/module-droid-keepalive.c
^
|
@@ -1,182 +0,0 @@
-/*
- * 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 <signal.h>
-#include <stdio.h>
-
-#ifdef HAVE_VALGRIND_MEMCHECK_H
-#include <valgrind/memcheck.h>
-#endif
-
-#include <pulse/xmalloc.h>
-
-#include <pulsecore/core.h>
-#include <pulsecore/i18n.h>
-#include <pulsecore/module.h>
-#include <pulsecore/sink.h>
-#include <pulsecore/source.h>
-#include <pulsecore/modargs.h>
-#include <pulsecore/core-util.h>
-#include <pulsecore/log.h>
-#include <pulsecore/macro.h>
-#include <pulsecore/idxset.h>
-
-#include "keepalive.h"
-
-#include "module-droid-keepalive-symdef.h"
-
-PA_MODULE_AUTHOR("Juho Hämäläinen");
-PA_MODULE_DESCRIPTION("Droid keepalive. Send cpu wakeup heartbeat while streams are active.");
-PA_MODULE_VERSION(PACKAGE_VERSION);
-PA_MODULE_USAGE(
- "-"
-);
-
-static const char* const valid_modargs[] = {
- NULL,
-};
-
-struct userdata {
- pa_core *core;
- pa_module *module;
-
- pa_droid_keepalive *keepalive;
- bool active;
- pa_hook_slot *sink_state_changed_slot;
- pa_hook_slot *source_state_changed_slot;
-};
-
-static void start(struct userdata *u) {
- if (u->active)
- return;
-
- u->active = true;
-
- pa_droid_keepalive_start(u->keepalive);
-}
-
-static void stop(struct userdata *u) {
- void *state = NULL;
- pa_sink *sink;
- pa_source *source;
-
- if (!u->active)
- return;
-
- while ((sink = pa_idxset_iterate(u->core->sinks, &state, NULL))) {
- if (pa_sink_get_state(sink) != PA_SINK_SUSPENDED)
- return;
- }
-
- state = NULL;
- while ((source = pa_idxset_iterate(u->core->sources, &state, NULL))) {
- if (source->monitor_of)
- continue;
- if (pa_source_get_state(source) != PA_SOURCE_SUSPENDED)
- return;
- }
-
- /* We get here if all sinks and sources are in suspended state. */
- pa_droid_keepalive_stop(u->keepalive);
- u->active = false;
-}
-
-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)) {
- pa_source *s = PA_SOURCE(o);
-
- /* 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);
-
- if (state != PA_SINK_SUSPENDED)
- start(u);
- else
- stop(u);
- }
-
- return PA_HOOK_OK;
-}
-
-
-int pa__init(pa_module *m) {
-
- pa_assert(m);
-
- struct userdata *u = pa_xnew0(struct userdata, 1);
- u->core = m->core;
- u->active = false;
- u->module = m;
- m->userdata = u;
-
- if (!(u->keepalive = pa_droid_keepalive_new(u->core))) {
- pa_log("Failed to create keepalive handler.");
- goto fail;
- }
-
- 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);
-
- return 0;
-
-fail:
- pa__done(m);
-
- return -1;
-}
-
-void pa__done(pa_module *m) {
- struct userdata *u;
-
- pa_assert(m);
-
- if ((u = m->userdata)) {
-
- if (u->sink_state_changed_slot)
- pa_hook_slot_free(u->sink_state_changed_slot);
- if (u->source_state_changed_slot)
- pa_hook_slot_free(u->source_state_changed_slot);
-
- if (u->keepalive) {
- stop(u);
- pa_droid_keepalive_free(u->keepalive);
- }
-
- pa_xfree(u);
- }
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/src/droid/module-droid-sink-symdef.h
^
|
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-#ifndef foomoduledroidsinksymdeffoo
-#define foomoduledroidsinksymdeffoo
-
-#include <pulsecore/core.h>
-#include <pulsecore/module.h>
-
-#define pa__init module_droid_sink_LTX_pa__init
-#define pa__done module_droid_sink_LTX_pa__done
-#define pa__get_author module_droid_sink_LTX_pa__get_author
-#define pa__get_description module_droid_sink_LTX_pa__get_description
-#define pa__get_usage module_droid_sink_LTX_pa__get_usage
-#define pa__get_version module_droid_sink_LTX_pa__get_version
-
-int pa__init(struct pa_module*m);
-void pa__done(struct pa_module*m);
-
-const char* pa__get_author(void);
-const char* pa__get_description(void);
-const char* pa__get_usage(void);
-const char* pa__get_version(void);
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-8.0.64.1.tar.bz2/src/droid/module-droid-source-symdef.h
^
|
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-#ifndef foomoduledroidsourcesymdeffoo
-#define foomoduledroidsourcesymdeffoo
-
-#include <pulsecore/core.h>
-#include <pulsecore/module.h>
-
-#define pa__init module_droid_source_LTX_pa__init
-#define pa__done module_droid_source_LTX_pa__done
-#define pa__get_author module_droid_source_LTX_pa__get_author
-#define pa__get_description module_droid_source_LTX_pa__get_description
-#define pa__get_usage module_droid_source_LTX_pa__get_usage
-#define pa__get_version module_droid_source_LTX_pa__get_version
-
-int pa__init(struct pa_module*m);
-void pa__done(struct pa_module*m);
-
-const char* pa__get_author(void);
-const char* pa__get_description(void);
-const char* pa__get_usage(void);
-const char* pa__get_version(void);
-
-#endif
|