Projects
Essentials
pipewire-aptx
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 10
View file
pipewire-aptx.changes
Changed
@@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Thu Jul 7 18:13:40 UTC 2022 - Bjørn Lie <zaitor@opensuse.org> + +- Update to version 0.3.53 + +------------------------------------------------------------------- Tue Jun 21 11:57:28 UTC 2022 - Bjørn Lie <zaitor@opensuse.org> - Update to version 0.3.52
View file
pipewire-aptx.spec
Changed
@@ -7,7 +7,7 @@ %define soversion 0_2 Name: pipewire-aptx -Version: 0.3.52 +Version: 0.3.53 Release: 0 Summary: PipeWire Bluetooth aptX codec plugin License: MIT
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/channelmix.c
Deleted
@@ -1,1786 +0,0 @@ -/* Spa - * - * Copyright © 2018 Wim Taymans - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include <errno.h> -#include <string.h> -#include <stdio.h> - -#include <spa/support/plugin.h> -#include <spa/support/log.h> -#include <spa/support/cpu.h> -#include <spa/utils/list.h> -#include <spa/utils/names.h> -#include <spa/utils/json.h> -#include <spa/utils/string.h> -#include <spa/node/keys.h> -#include <spa/node/node.h> -#include <spa/node/io.h> -#include <spa/node/utils.h> -#include <spa/param/audio/format-utils.h> -#include <spa/param/param.h> -#include <spa/pod/filter.h> -#include <spa/debug/types.h> - -#include "channelmix-ops.h" - - -#define DEFAULT_RATE 48000 -#define DEFAULT_CHANNELS 2 - -#define MAX_BUFFERS 32 -#define MAX_DATAS SPA_AUDIO_MAX_CHANNELS -#define MAX_ALIGN CHANNELMIX_OPS_MAX_ALIGN - -#define DEFAULT_CONTROL_BUFFER_SIZE 32768 - -struct impl; - -#define DEFAULT_MUTE false -#define DEFAULT_VOLUME 1.0f - -struct volumes { - bool mute; - uint32_t n_volumes; - float volumesSPA_AUDIO_MAX_CHANNELS; -}; - -static void init_volumes(struct volumes *vol) -{ - uint32_t i; - vol->mute = DEFAULT_MUTE; - vol->n_volumes = 0; - for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++) - vol->volumesi = DEFAULT_VOLUME; -} - -struct props { - float volume; - uint32_t n_channels; - uint32_t channel_mapSPA_AUDIO_MAX_CHANNELS; - struct volumes channel; - struct volumes soft; - struct volumes monitor; - unsigned int have_soft_volume:1; - unsigned int disabled:1; -}; - -static void props_reset(struct props *props) -{ - uint32_t i; - props->volume = DEFAULT_VOLUME; - props->n_channels = 0; - for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++) - props->channel_mapi = SPA_AUDIO_CHANNEL_UNKNOWN; - init_volumes(&props->channel); - init_volumes(&props->soft); - init_volumes(&props->monitor); -} - -struct buffer { - uint32_t id; -#define BUFFER_FLAG_OUT (1 << 0) - uint32_t flags; - struct spa_list link; - struct spa_buffer *outbuf; - struct spa_meta_header *h; - void *datasMAX_DATAS; -}; - -struct port { - uint32_t direction; - uint32_t id; - - uint64_t info_all; - struct spa_port_info info; -#define IDX_EnumFormat 0 -#define IDX_Meta 1 -#define IDX_IO 2 -#define IDX_Format 3 -#define IDX_Buffers 4 - struct spa_param_info params5; - - struct spa_io_buffers *io; - - bool have_format; - struct spa_audio_info format; - uint32_t stride; - uint32_t blocks; - uint32_t size; - - struct buffer buffersMAX_BUFFERS; - uint32_t n_buffers; - - struct spa_list queue; - - struct spa_pod_sequence *ctrl; - uint32_t ctrl_offset; -}; - -struct impl { - struct spa_handle handle; - struct spa_node node; - - struct spa_log *log; - struct spa_cpu *cpu; - uint32_t quantum_limit; - - enum spa_direction direction; - struct spa_io_position *io_position; - - struct spa_hook_list hooks; - - uint64_t info_all; - struct spa_node_info info; - struct props props; -#define IDX_PropInfo 0 -#define IDX_Props 1 - struct spa_param_info params2; - - - struct port control_port; - struct port in_port; - struct port out_port; - - struct channelmix mix; - unsigned int started:1; - unsigned int is_passthrough:1; - uint32_t cpu_flags; - uint32_t max_align; -}; - -#define IS_CONTROL_PORT(this,d,id) (id == 1 && d == SPA_DIRECTION_INPUT) -#define IS_DATA_PORT(this,d,id) (id == 0) - -#define CHECK_PORT(this,d,id) (IS_CONTROL_PORT(this,d,id) || IS_DATA_PORT(this,d,id)) -#define GET_CONTROL_PORT(this,id) (&this->control_port) -#define GET_IN_PORT(this,id) (&this->in_port) -#define GET_OUT_PORT(this,id) (&this->out_port) -#define GET_PORT(this,d,id) (IS_CONTROL_PORT(this,d,id) ? GET_CONTROL_PORT(this,id) : (d == SPA_DIRECTION_INPUT ? GET_IN_PORT(this,id) : GET_OUT_PORT(this,id))) - -#define _MASK(ch) (1ULL << SPA_AUDIO_CHANNEL_ ## ch) -#define STEREO (_MASK(FL)|_MASK(FR)) - -static void emit_info(struct impl *this, bool full) -{ - uint64_t old = full ? this->info.change_mask : 0; - if (full) - this->info.change_mask = this->info_all; - if (this->info.change_mask) { - spa_node_emit_info(&this->hooks, &this->info); - this->info.change_mask = old; - } -} - -static void emit_props_changed(struct impl *this) -{ - this->info.change_mask |= SPA_NODE_CHANGE_MASK_PARAMS; - this->paramsIDX_Props.flags ^= SPA_PARAM_INFO_SERIAL; - emit_info(this, false);
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/fmtconvert.c
Deleted
@@ -1,1161 +0,0 @@ -/* Spa - * - * Copyright © 2018 Wim Taymans - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include <errno.h> -#include <string.h> -#include <stdio.h> -#include <limits.h> - -#include <spa/support/plugin.h> -#include <spa/support/log.h> -#include <spa/support/cpu.h> -#include <spa/utils/list.h> -#include <spa/utils/names.h> -#include <spa/utils/string.h> -#include <spa/node/node.h> -#include <spa/node/io.h> -#include <spa/node/utils.h> -#include <spa/param/audio/format-utils.h> -#include <spa/param/latency-utils.h> -#include <spa/param/param.h> -#include <spa/pod/filter.h> -#include <spa/debug/types.h> -#include <spa/debug/format.h> - -#include "fmt-ops.h" - -#undef SPA_LOG_TOPIC_DEFAULT -#define SPA_LOG_TOPIC_DEFAULT log_topic -static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.fmtconvert"); - -#define DEFAULT_RATE 48000 -#define DEFAULT_CHANNELS 2 - -#define MAX_BUFFERS 32 -#define MAX_ALIGN FMT_OPS_MAX_ALIGN -#define MAX_DATAS SPA_AUDIO_MAX_CHANNELS - -#define PROP_DEFAULT_TRUNCATE false -#define PROP_DEFAULT_DITHER 0 - -struct impl; - -struct props { - bool truncate; - uint32_t dither; -}; - -static void props_reset(struct props *props) -{ - props->truncate = PROP_DEFAULT_TRUNCATE; - props->dither = PROP_DEFAULT_DITHER; -} - -struct buffer { - uint32_t id; -#define BUFFER_FLAG_OUT (1 << 0) - uint32_t flags; - struct spa_list link; - struct spa_buffer *outbuf; - struct spa_meta_header *h; - void *datasMAX_DATAS; -}; - -struct port { - uint32_t direction; - uint32_t id; - - struct spa_io_buffers *io; - - uint64_t info_all; - struct spa_port_info info; -#define PORT_EnumFormat 0 -#define PORT_Meta 1 -#define PORT_IO 2 -#define PORT_Format 3 -#define PORT_Buffers 4 -#define PORT_Latency 5 -#define N_PORT_PARAMS 6 - struct spa_param_info paramsN_PORT_PARAMS; - - struct spa_audio_info format; - uint32_t stride; - uint32_t blocks; - uint32_t size; - unsigned int have_format:1; - - struct buffer buffersMAX_BUFFERS; - uint32_t n_buffers; - - struct spa_list queue; -}; - -struct impl { - struct spa_handle handle; - struct spa_node node; - - struct spa_log *log; - struct spa_cpu *cpu; - uint32_t cpu_flags; - uint32_t max_align; - uint32_t quantum_limit; - - struct spa_io_position *io_position; - - uint64_t info_all; - struct spa_node_info info; - struct props props; -#define N_NODE_PARAMS 0 - struct spa_param_info params1; - - struct spa_hook_list hooks; - - struct port ports21; - - uint32_t src_remapSPA_AUDIO_MAX_CHANNELS; - uint32_t dst_remapSPA_AUDIO_MAX_CHANNELS; - - struct spa_latency_info latency2; - - struct convert conv; - unsigned int started:1; - unsigned int is_passthrough:1; -}; - -#define CHECK_PORT(this,d,id) (id == 0) -#define GET_PORT(this,d,id) (&this->portsdid) -#define GET_IN_PORT(this,id) GET_PORT(this,SPA_DIRECTION_INPUT,id) -#define GET_OUT_PORT(this,id) GET_PORT(this,SPA_DIRECTION_OUTPUT,id) - -static int can_convert(const struct spa_audio_info *info1, const struct spa_audio_info *info2) -{ - if (info1->info.raw.channels != info2->info.raw.channels || - info1->info.raw.rate != info2->info.raw.rate) { - return 0; - } - return 1; -} - -static int setup_convert(struct impl *this) -{ - uint32_t src_fmt, dst_fmt; - struct spa_audio_info informat, outformat; - struct port *inport, *outport; - uint32_t i, j; - int res; - - inport = GET_IN_PORT(this, 0); - outport = GET_OUT_PORT(this, 0); - - if (!inport->have_format || !outport->have_format) - return -EIO; - - informat = inport->format; - outformat = outport->format; - - src_fmt = informat.info.raw.format; - dst_fmt = outformat.info.raw.format; - - spa_log_info(this->log, "%p: %s/%d@%d->%s/%d@%d", this, - spa_debug_type_find_name(spa_type_audio_format, src_fmt), - informat.info.raw.channels, - informat.info.raw.rate, - spa_debug_type_find_name(spa_type_audio_format, dst_fmt), - outformat.info.raw.channels, - outformat.info.raw.rate); - - if (!can_convert(&informat, &outformat)) - return -EINVAL; - - for (i = 0; i < informat.info.raw.channels; i++) { - for (j = 0; j < outformat.info.raw.channels; j++) { - if (informat.info.raw.positioni != - outformat.info.raw.positionj) - continue; - if (inport->blocks > 1) { - this->src_remapj = i; - if (outport->blocks > 1) - this->dst_remapj = j;
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/merger.c
Deleted
@@ -1,1550 +0,0 @@ -/* Spa - * - * Copyright © 2018 Wim Taymans - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include <errno.h> -#include <string.h> -#include <stdio.h> -#include <limits.h> - -#include <spa/support/plugin.h> -#include <spa/support/cpu.h> -#include <spa/support/log.h> -#include <spa/utils/result.h> -#include <spa/utils/list.h> -#include <spa/utils/names.h> -#include <spa/utils/string.h> -#include <spa/node/node.h> -#include <spa/node/io.h> -#include <spa/node/utils.h> -#include <spa/node/keys.h> -#include <spa/param/audio/format-utils.h> -#include <spa/param/param.h> -#include <spa/param/latency-utils.h> -#include <spa/pod/filter.h> -#include <spa/debug/types.h> -#include <spa/debug/pod.h> - -#include "volume-ops.h" -#include "fmt-ops.h" - -#undef SPA_LOG_TOPIC_DEFAULT -#define SPA_LOG_TOPIC_DEFAULT log_topic -static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.merger"); - -#define DEFAULT_RATE 48000 -#define DEFAULT_CHANNELS 2 - -#define MAX_ALIGN FMT_OPS_MAX_ALIGN -#define MAX_BUFFERS 32 -#define MAX_DATAS SPA_AUDIO_MAX_CHANNELS -#define MAX_PORTS SPA_AUDIO_MAX_CHANNELS - -#define DEFAULT_MUTE false -#define DEFAULT_VOLUME VOLUME_NORM - -struct volumes { - bool mute; - uint32_t n_volumes; - float volumesSPA_AUDIO_MAX_CHANNELS; -}; - -static void init_volumes(struct volumes *vol) -{ - uint32_t i; - vol->mute = DEFAULT_MUTE; - vol->n_volumes = 0; - for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++) - vol->volumesi = DEFAULT_VOLUME; -} - -struct props { - float volume; - uint32_t n_channels; - uint32_t channel_mapSPA_AUDIO_MAX_CHANNELS; - struct volumes channel; - struct volumes soft; - struct volumes monitor; -}; - -static void props_reset(struct props *props) -{ - uint32_t i; - props->volume = DEFAULT_VOLUME; - props->n_channels = 0; - for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++) - props->channel_mapi = SPA_AUDIO_CHANNEL_UNKNOWN; - init_volumes(&props->channel); - init_volumes(&props->soft); - init_volumes(&props->monitor); -} - -struct buffer { - uint32_t id; -#define BUFFER_FLAG_QUEUED (1<<0) - uint32_t flags; - struct spa_list link; - struct spa_buffer *buf; - void *datasMAX_DATAS; -}; - -struct port { - uint32_t direction; - uint32_t id; - - struct spa_io_buffers *io; - - uint64_t info_all; - struct spa_port_info info; -#define IDX_EnumFormat 0 -#define IDX_Meta 1 -#define IDX_IO 2 -#define IDX_Format 3 -#define IDX_Buffers 4 -#define IDX_Latency 5 -#define N_PORT_PARAMS 6 - struct spa_param_info paramsN_PORT_PARAMS; - char position16; - - struct spa_audio_info format; - uint32_t blocks; - uint32_t stride; - - struct buffer buffersMAX_BUFFERS; - uint32_t n_buffers; - - struct spa_list queue; - - unsigned int have_format:1; -}; - -struct impl { - struct spa_handle handle; - struct spa_node node; - - struct spa_log *log; - struct spa_cpu *cpu; - - uint32_t cpu_flags; - uint32_t max_align; - uint32_t quantum_limit; - - struct spa_io_position *io_position; - - uint64_t info_all; - struct spa_node_info info; -#define IDX_PortConfig 0 -#define IDX_PropInfo 1 -#define IDX_Props 2 -#define N_NODE_PARAMS 3 - struct spa_param_info paramsN_NODE_PARAMS; - - struct spa_hook_list hooks; - - uint32_t port_count; - uint32_t monitor_count; - struct port *in_portsMAX_PORTS; - struct port *out_portsMAX_PORTS + 1; - - struct spa_audio_info format; - unsigned int have_profile:1; - - struct convert conv; - unsigned int is_passthrough:1; - unsigned int started:1; - unsigned int monitor:1; - unsigned int monitor_channel_volumes:1; - - struct volume volume; - struct props props; - - uint32_t src_remapSPA_AUDIO_MAX_CHANNELS; - uint32_t dst_remapSPA_AUDIO_MAX_CHANNELS; - - struct spa_latency_info latency2; - - uint32_t empty_size; - float *empty; -}; - -#define CHECK_IN_PORT(this,d,p) ((d) == SPA_DIRECTION_INPUT && (p) < this->port_count) -#define CHECK_OUT_PORT(this,d,p) ((d) == SPA_DIRECTION_OUTPUT && (p) <= this->monitor_count) -#define CHECK_PORT(this,d,p) (CHECK_OUT_PORT(this,d,p) || CHECK_IN_PORT (this,d,p)) -#define GET_IN_PORT(this,p) (this->in_portsp) -#define GET_OUT_PORT(this,p) (this->out_portsp) -#define GET_PORT(this,d,p) (d == SPA_DIRECTION_INPUT ? GET_IN_PORT(this,p) : GET_OUT_PORT(this,p)) - -#define PORT_IS_DSP(d,p) (p != 0 || d != SPA_DIRECTION_OUTPUT) - -static void emit_node_info(struct impl *this, bool full)
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/resample.c
Deleted
@@ -1,1307 +0,0 @@ -/* Spa - * - * Copyright © 2018 Wim Taymans - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include <errno.h> -#include <string.h> -#include <stdio.h> - -#include <spa/support/plugin.h> -#include <spa/support/log.h> -#include <spa/utils/list.h> -#include <spa/utils/names.h> -#include <spa/utils/string.h> -#include <spa/node/node.h> -#include <spa/node/io.h> -#include <spa/node/utils.h> -#include <spa/param/audio/format-utils.h> -#include <spa/param/param.h> -#include <spa/pod/filter.h> -#include <spa/debug/types.h> - -#include "resample.h" - -#undef SPA_LOG_TOPIC_DEFAULT -#define SPA_LOG_TOPIC_DEFAULT log_topic -static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.resample"); - -#define DEFAULT_RATE 48000 -#define DEFAULT_CHANNELS 2 - -#define MAX_BUFFERS 32 - -struct impl; - -struct props { - double rate; - int quality; - bool disabled; -}; - -static void props_reset(struct props *props) -{ - props->rate = 1.0; - props->quality = RESAMPLE_DEFAULT_QUALITY; - props->disabled = false; -} - -struct buffer { - uint32_t id; -#define BUFFER_FLAG_OUT (1 << 0) - uint32_t flags; - struct spa_list link; - struct spa_buffer *outbuf; - struct spa_meta_header *h; -}; - -struct port { - uint32_t direction; - uint32_t id; - - uint64_t info_all; - struct spa_port_info info; - struct spa_param_info params8; - - struct spa_io_buffers *io; - - struct spa_audio_info format; - uint32_t stride; - uint32_t blocks; - uint32_t size; - unsigned int have_format:1; - - struct buffer buffersMAX_BUFFERS; - uint32_t n_buffers; - - uint32_t offset; - struct spa_list queue; -}; - -struct impl { - struct spa_handle handle; - struct spa_node node; - - struct spa_log *log; - struct spa_cpu *cpu; - - uint32_t quantum_limit; - - struct spa_io_position *io_position; - struct spa_io_rate_match *io_rate_match; - - uint64_t info_all; - struct spa_node_info info; - struct props props; - - struct spa_hook_list hooks; - - struct port in_port; - struct port out_port; - -#define MODE_SPLIT 0 -#define MODE_MERGE 1 -#define MODE_CONVERT 2 - int mode; - unsigned int started:1; - unsigned int peaks:1; - unsigned int drained:1; - - struct resample resample; - - double rate_scale; -}; - -#define CHECK_PORT(this,d,id) (id == 0) -#define GET_IN_PORT(this,id) (&this->in_port) -#define GET_OUT_PORT(this,id) (&this->out_port) -#define GET_PORT(this,d,id) (d == SPA_DIRECTION_INPUT ? GET_IN_PORT(this,id) : GET_OUT_PORT(this,id)) - -static int setup_convert(struct impl *this, - enum spa_direction direction, - const struct spa_audio_info *info) -{ - const struct spa_audio_info *src_info, *dst_info; - int err; - - if (direction == SPA_DIRECTION_INPUT) { - src_info = info; - dst_info = &GET_OUT_PORT(this, 0)->format; - } else { - src_info = &GET_IN_PORT(this, 0)->format; - dst_info = info; - } - - spa_log_info(this->log, "%p: %s/%d@%d->%s/%d@%d", this, - spa_debug_type_find_name(spa_type_audio_format, src_info->info.raw.format), - src_info->info.raw.channels, - src_info->info.raw.rate, - spa_debug_type_find_name(spa_type_audio_format, dst_info->info.raw.format), - dst_info->info.raw.channels, - dst_info->info.raw.rate); - - if (src_info->info.raw.channels != dst_info->info.raw.channels) - return -EINVAL; - - if (this->resample.free) - resample_free(&this->resample); - - this->resample.channels = src_info->info.raw.channels; - this->resample.i_rate = src_info->info.raw.rate; - this->resample.o_rate = dst_info->info.raw.rate; - this->resample.log = this->log; - this->resample.quality = this->props.quality; - - if (this->peaks) - err = resample_peaks_init(&this->resample); - else - err = resample_native_init(&this->resample); - - return err; -} - -static int impl_node_enum_params(void *object, int seq, - uint32_t id, uint32_t start, uint32_t num, - const struct spa_pod *filter) -{ - struct impl *this = object; - struct spa_pod *param; - struct spa_pod_builder b = { 0 }; - uint8_t buffer4096; - struct spa_result_node_params result; - uint32_t count = 0; - - spa_return_val_if_fail(this != NULL, -EINVAL); - spa_return_val_if_fail(num != 0, -EINVAL); - - result.id = id; - result.next = start; - next: - result.index = result.next++;
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/splitter.c
Deleted
@@ -1,1251 +0,0 @@ -/* Spa - * - * Copyright © 2018 Wim Taymans - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include <errno.h> -#include <string.h> -#include <stdio.h> -#include <limits.h> - -#include <spa/support/plugin.h> -#include <spa/support/cpu.h> -#include <spa/support/log.h> -#include <spa/utils/list.h> -#include <spa/utils/names.h> -#include <spa/utils/string.h> -#include <spa/node/node.h> -#include <spa/node/utils.h> -#include <spa/node/io.h> -#include <spa/param/audio/format-utils.h> -#include <spa/param/latency-utils.h> -#include <spa/param/param.h> -#include <spa/pod/filter.h> -#include <spa/debug/types.h> -#include <spa/debug/pod.h> - -#include "fmt-ops.h" - -#undef SPA_LOG_TOPIC_DEFAULT -#define SPA_LOG_TOPIC_DEFAULT log_topic -static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.splitter"); - -#define DEFAULT_RATE 48000 -#define DEFAULT_CHANNELS 2 -#define DEFAULT_MASK (1LL << SPA_AUDIO_CHANNEL_FL) | (1LL << SPA_AUDIO_CHANNEL_FR) - -#define MAX_ALIGN FMT_OPS_MAX_ALIGN -#define MAX_BUFFERS 32 -#define MAX_DATAS SPA_AUDIO_MAX_CHANNELS -#define MAX_PORTS SPA_AUDIO_MAX_CHANNELS - -struct buffer { - uint32_t id; -#define BUFFER_FLAG_QUEUED (1<<0) - uint32_t flags; - struct spa_list link; - struct spa_buffer *buf; - void *datasMAX_DATAS; -}; - -struct port { - uint32_t direction; - uint32_t id; - - struct spa_io_buffers *io; - - uint64_t info_all; - struct spa_port_info info; -#define IDX_EnumFormat 0 -#define IDX_Meta 1 -#define IDX_IO 2 -#define IDX_Format 3 -#define IDX_Buffers 4 -#define IDX_Latency 5 -#define N_PORT_PARAMS 6 - struct spa_param_info paramsN_PORT_PARAMS; - - struct spa_dict info_props; - struct spa_dict_item info_props_items2; - char position16; - - bool have_format; - struct spa_audio_info format; - uint32_t blocks; - uint32_t stride; - - struct buffer buffersMAX_BUFFERS; - uint32_t n_buffers; - - struct spa_list queue; -}; - -struct impl { - struct spa_handle handle; - struct spa_node node; - - struct spa_log *log; - struct spa_cpu *cpu; - - uint32_t cpu_flags; - uint32_t max_align; - uint32_t quantum_limit; - - struct spa_io_position *io_position; - - uint64_t info_all; - struct spa_node_info info; -#define IDX_PortConfig 0 -#define N_NODE_PARAMS 1 - struct spa_param_info paramsN_NODE_PARAMS; - - struct spa_hook_list hooks; - - struct port in_ports1; - struct port *out_portsMAX_PORTS; - uint32_t port_count; - - struct spa_audio_info format; - unsigned int have_profile:1; - - struct convert conv; - unsigned int is_passthrough:1; - unsigned int started:1; - - struct spa_latency_info latency2; - - uint32_t src_remapSPA_AUDIO_MAX_CHANNELS; - uint32_t dst_remapSPA_AUDIO_MAX_CHANNELS; - - uint32_t empty_size; - float *empty; -}; - -#define CHECK_OUT_PORT(this,d,p) ((d) == SPA_DIRECTION_OUTPUT && (p) < this->port_count) -#define CHECK_IN_PORT(this,d,p) ((d) == SPA_DIRECTION_INPUT && (p) == 0) -#define CHECK_PORT(this,d,p) (CHECK_OUT_PORT(this,d,p) || CHECK_IN_PORT (this,d,p)) -#define GET_IN_PORT(this,p) (&this->in_portsp) -#define GET_OUT_PORT(this,p) (this->out_portsp) -#define GET_PORT(this,d,p) (d == SPA_DIRECTION_INPUT ? GET_IN_PORT(this,p) : GET_OUT_PORT(this,p)) - -static void emit_node_info(struct impl *this, bool full) -{ - uint64_t old = full ? this->info.change_mask : 0; - if (full) - this->info.change_mask = this->info_all; - if (this->info.change_mask) { - spa_node_emit_info(&this->hooks, &this->info); - this->info.change_mask = old; - } -} -static void emit_port_info(struct impl *this, struct port *port, bool full) -{ - uint64_t old = full ? port->info.change_mask : 0; - if (full) - port->info.change_mask = port->info_all; - if (port->info.change_mask) { - spa_node_emit_port_info(&this->hooks, - port->direction, port->id, &port->info); - port->info.change_mask = old; - } -} - -static int init_port(struct impl *this, enum spa_direction direction, - uint32_t port_id, uint32_t position) -{ - struct port *port = GET_OUT_PORT(this, port_id); - const char *name; - - if (port == NULL) { - port = calloc(1, sizeof(struct port)); - if (port == NULL) - return -errno; - this->out_portsport_id = port; - } - port->direction = direction; - port->id = port_id; - - name = spa_debug_type_find_short_name(spa_type_audio_channel, position); - snprintf(port->position, sizeof(port->position), "%s", name ? name : "UNK"); - - port->info_all = SPA_PORT_CHANGE_MASK_FLAGS | - SPA_PORT_CHANGE_MASK_PROPS | - SPA_PORT_CHANGE_MASK_PARAMS; - - port->info = SPA_PORT_INFO_INIT(); - port->info.flags = SPA_PORT_FLAG_DYNAMIC_DATA; - port->info_props_items0 = SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "32 bit float mono audio"); - port->info_props_items1 = SPA_DICT_ITEM_INIT(SPA_KEY_AUDIO_CHANNEL, port->position); - port->info_props = SPA_DICT_INIT(port->info_props_items, 2); - port->info.props = &port->info_props;
View file
pipewire-0.3.52.tar.gz/INSTALL.md -> pipewire-0.3.53.tar.gz/INSTALL.md
Changed
@@ -1,8 +1,8 @@ ## Building -PipeWire uses a build tool called *Meson* as a basis for its build +PipeWire uses a build tool called *Meson*(https://mesonbuild.com) as a basis for its build process. It's a tool with some resemblance to Autotools and CMake. Meson -again generates build files for a lower level build tool called *Ninja*, +again generates build files for a lower level build tool called *Ninja*(https://ninja-build.org/), working in about the same level of abstraction as more familiar GNU Make does. @@ -39,7 +39,7 @@ Finally, invoke the build: ``` -$ ninja -C builddir +$ meson compile -C builddir ``` Just to avoid any confusion: `autogen.sh` is a script invoked by *Jhbuild*, @@ -68,10 +68,10 @@ ``` This will use the default config file to configure and start the daemon. -The default config will also start pipewire-media-session, a default -example media session and pipewire-pulse, a PulseAudio compatible server. +The default config will also start `pipewire-media-session`, a default +example media session and `pipewire-pulse`, a PulseAudio compatible server. -You can also enable more debugging with the PIPEWIRE_DEBUG environment +You can also enable more debugging with the `PIPEWIRE_DEBUG` environment variable like so: ``` @@ -92,14 +92,15 @@ ## Installing -PipeWire comes with quite a bit of libraries and tools, run -inside `builddir`: +PipeWire comes with quite a bit of libraries and tools, run: ``` -sudo meson install +meson install -C builddir ``` to install everything onto the system into the specified prefix. +Depending on the configured installation prefix, the above command +may need to be run with elevated privileges (e.g. with `sudo`). Some additional steps will have to be performed to integrate with the distribution as shown below. @@ -111,7 +112,7 @@ systemd unit using socket activation or as a service. Configuration of the PipeWire daemon can be found in -/usr/share/pipewire/pipewire.conf. Please refer to the comments in the +`/usr/share/pipewire/pipewire.conf`. Please refer to the comments in the config file for more information about the configuration options. The daemon is started with: @@ -150,14 +151,14 @@ ``` The plugin will be picked up by alsa when the following files -are in /etc/alsa/conf.d/ +are in `/etc/alsa/conf.d/`: ``` /etc/alsa/conf.d/50-pipewire.conf -> /usr/share/alsa/alsa.conf.d/50-pipewire.conf /etc/alsa/conf.d/99-pipewire-default.conf ``` -With this setup, aplay -l should list a pipewire: device that can be used as +With this setup, `aplay -l` should list a pipewire device that can be used as a regular alsa device for playback and record. ### JACK emulation @@ -180,7 +181,7 @@ ``` -The provided pw-jack script uses LD_LIBRARY_PATH to set the library +The provided `pw-jack` script uses `LD_LIBRARY_PATH` to set the library search path to these replacement libraries. This allows you to run jack apps on both the real JACK server or on PipeWire with the script. @@ -193,7 +194,7 @@ ``` Note that when JACK is replaced by PipeWire, the SPA JACK plugin (installed -in /usr/lib64/spa-0.2/jack/libspa-jack.so) is not useful anymore and +in `/usr/lib64/spa-0.2/jack/libspa-jack.so`) is not useful anymore and distributions should make them conflict. @@ -216,14 +217,21 @@ ``` You can also start additional PulseAudio servers listening on other -sockets with the -a option. See `pipewire-pulse -h` for more info. +sockets with the `-a` option. See `pipewire-pulse -h` for more info. ## Uninstalling -To uninstall, in the `builddir` directory run: +To uninstall, run: ``` -sudo ninja uninstall +ninja -C builddir uninstall ``` +Depending on the configured installation prefix, the above command +may need to be run with elevated privileges (e.g. with `sudo`). + +Note that at the time of writing uninstallation only works with the +same build directory that was used for installation. Meson stores the +list of installed files in the build directory, and this list is +necessary for uninstallation to work.
View file
pipewire-0.3.52.tar.gz/NEWS -> pipewire-0.3.53.tar.gz/NEWS
Changed
@@ -1,3 +1,81 @@ +# PipeWire 0.3.53 (2022-06-30) + +This is a bugfix release that is API and ABI compatible with previous +0.3.x releases. + +## Highlights + - The 44.1KHz samplerate was removed again from the defaults, it caused + all kinds of problems with various hardware. + - The ALSA plugin should now be able to deal with unsupported samplerates + and fall back to the nearest supported one. + - The rlimits performance tuning wiki page was updated. Please check + you limits.conf file, the version on the wiki used to give all + processes a -19 nice level instead of just the pipewire daemon. + - The audioconvert plugin was rewritten to be more maintainable and + faster. It also gained support for control ports and dithering with + optional noise shaping. + - An impossible buffering situation is avoided in pulse-server that would + cause some applications (sunshine, ...) to stutter. + + +## PipeWire + - 44.1KHz was removed from the allowed rates again. It caused all kinds + of regressions due to driver bugs and timing issues on HDMI. + +## modules + - filter-chain now does some more error checking and reporting to + avoid some crashes. + - filter-chain now supports more channel layouts for input and output + that does not need to match the plugin layout. + - Format parsing is now more consistent in the modules. + +## Tools + - pw-cli can now also work without readline support. + - pw-cat can now also read multichannel ulaw/alaw/u8/s8. + +## SPA + - The audioconvert plugin was rewritten. This should make it more + maintainable. It also fixed some issues such as CPU spikes in some + cases and crashes in others. The old plugins were removed, for a + code reduction of some 6000 lines. + - The audioconvert plugin now supports control ports, which can be + enabled on nodes in the session manager. This makes it possible to + control audioconvert properties using timed events or midi. + - NoteOn 0-velocity MIDI events are no longer filtered out. This is + a valid event, nodes that can't deal with it should fix it up + themselves. The JACK layer still filters out these events by default + but this can now be configured with a per-client property. + - The running status on midi events is now disabled to match what + JACK does. + - The ALSA plugin will now deal with driver bugs when a driver announces + support for a samplerate but then refuses to use it later. + - The ALSA plugin has been optimized a little for sample IO. + - V4L2 now doesn't error when there are no controls. + - Error handling was improved in the audio converter. + - The audioconvert plugin now supports rectangular dithering and + noise shaping. + - The audioconvert plugin can now insert additional inaudible noise + that can be used to keep some amplifiers alive. (#705) + - The audioconvert format conversion was changed so that it now produces + the full 32 bits range in the C fallback conversion code as well. + - The resampler window function was changed to a cosh() window + function. (#2483) + - Vendor and device id are now in hex. + +## pulse-server + - Tweak the record buffer attributes some more and make sure we don't + end up in impossible buffering situations. Fixes an issue with + distorted sound in sunshine. (#2447) + - Fix a potential crash when updating the client property list. + - Some properties on cards were aligned with pulseaudio. + +## Wiki + - Change "priority" to "nice" in the example limits.conf file. It was + giving a -19 nice level to all processes, not just the pipewire + daemon. + +Older versions: + # PipeWire 0.3.52 (2022-06-09) This is a bugfix release that is API and ABI compatible with previous @@ -112,9 +190,6 @@ - Fixes to the source and fd use. - It is now possible to set client properties as well. (#1573) - -Older versions: - # PipeWire 0.3.51 (2022-04-28) This is a bugfix release that is API and ABI compatible with previous
View file
pipewire-0.3.52.tar.gz/meson.build -> pipewire-0.3.53.tar.gz/meson.build
Changed
@@ -1,5 +1,5 @@ project('pipewire', 'c' , - version : '0.3.52', + version : '0.3.53', license : 'MIT', 'LGPL-2.1-or-later', 'GPL-2.0-only' , meson_version : '>= 0.59.0', default_options : 'warning_level=3', @@ -266,6 +266,7 @@ endif summary({'readline (for pw-cli)': readline_dep.found()}, bool_yn: true, section: 'Misc dependencies') +cdata.set('HAVE_READLINE', readline_dep.found()) ncurses_dep = dependency('ncursesw', required : false) sndfile_dep = dependency('sndfile', version : '>= 1.0.20', required : get_option('sndfile')) summary({'sndfile': sndfile_dep.found()}, bool_yn: true, section: 'pw-cat/pw-play/pw-dump/filter-chain') @@ -335,16 +336,16 @@ summary({'WebRTC Echo Canceling': webrtc_dep.found()}, bool_yn: true, section: 'Misc dependencies') cdata.set('HAVE_WEBRTC', webrtc_dep.found()) -# On FreeBSD, epoll-shim library is required for eventfd() and timerfd() -epoll_shim_dep = (build_machine.system() == 'freebsd' +# On FreeBSD and MidnightBSD, epoll-shim library is required for eventfd() and timerfd() +epoll_shim_dep = (build_machine.system() == 'freebsd' or build_machine.system() == 'midnightbsd' ? dependency('epoll-shim', required: true) : dependency('', required: false)) -libinotify_dep = (build_machine.system() == 'freebsd' +libinotify_dep = (build_machine.system() == 'freebsd' or build_machine.system() == 'midnightbsd' ? dependency('libinotify', required: true) : dependency('', required: false)) -# On FreeBSD, libintl library is required for gettext +# On FreeBSD and MidnightBSD, libintl library is required for gettext libintl_dep = cc.find_library('intl', required: false) if not libintl_dep.found() libintl_dep = dependency('intl', required: false) @@ -355,8 +356,8 @@ alsa_dep = dependency('alsa', version : '>=1.1.7', required: need_alsa) summary({'pipewire-alsa': alsa_dep.found()}, bool_yn: true) -if build_machine.system() == 'freebsd' -# On FreeBSD the OpenSSL library may come from base or a package. +if build_machine.system() == 'freebsd' or build_machine.system() == 'midnightbsd' +# On FreeBSD and MidnightBSD the OpenSSL library may come from base or a package. # Check for a package first and fallback to the base library if we can't find it via pkgconfig openssl_lib = dependency('openssl', required: false) if not openssl_lib.found()
View file
pipewire-0.3.52.tar.gz/pipewire-alsa/alsa-plugins/pcm_pipewire.c -> pipewire-0.3.53.tar.gz/pipewire-alsa/alsa-plugins/pcm_pipewire.c
Changed
@@ -25,7 +25,7 @@ #define __USE_GNU #include <limits.h> -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) #include <byteswap.h> #endif #include <sys/shm.h>
View file
pipewire-0.3.52.tar.gz/pipewire-jack/src/pipewire-jack.c -> pipewire-0.3.53.tar.gz/pipewire-jack/src/pipewire-jack.c
Changed
@@ -400,6 +400,7 @@ unsigned int default_as_system:1; int self_connect_mode; int rt_max; + unsigned int fix_midi_events:1; jack_position_t jack_position; jack_transport_state_t jack_state; @@ -985,10 +986,20 @@ return b.state.offset; } -static void convert_to_midi(struct spa_pod_sequence **seq, uint32_t n_seq, void *midi) +static inline void fix_midi_event(uint8_t *data, size_t size) +{ + /* fixup NoteOn with vel 0 */ + if (size > 2 && (data0 & 0xF0) == 0x90 && data2 == 0x00) { + data0 = 0x80 + (data0 & 0x0F); + data2 = 0x40; + } +} + +static void convert_to_midi(struct spa_pod_sequence **seq, uint32_t n_seq, void *midi, bool fix) { struct spa_pod_control *cn_seq; uint32_t i; + int res; for (i = 0; i < n_seq; i++) ci = spa_pod_control_first(&seqi->body); @@ -996,6 +1007,8 @@ while (true) { struct spa_pod_control *next = NULL; uint32_t next_index = 0; + uint8_t *data; + size_t size; for (i = 0; i < n_seq; i++) { if (!spa_pod_control_is_inside(&seqi->body, @@ -1010,12 +1023,17 @@ if (SPA_UNLIKELY(next == NULL)) break; + data = SPA_POD_BODY(&next->value); + size = SPA_POD_BODY_SIZE(&next->value); + switch(next->type) { case SPA_CONTROL_Midi: - jack_midi_event_write(midi, - next->offset, - SPA_POD_BODY(&next->value), - SPA_POD_BODY_SIZE(&next->value)); + if (fix) + fix_midi_event(data, size); + + if ((res = jack_midi_event_write(midi, next->offset, data, size)) < 0) + pw_log_warn("midi %p: can't write event: %s", midi, + spa_strerror(res)); break; } cnext_index = spa_pod_control_next(cnext_index); @@ -3383,6 +3401,7 @@ client->filter_name = pw_properties_get_bool(client->props, "jack.filter-name", false); client->locked_process = pw_properties_get_bool(client->props, "jack.locked-process", true); client->default_as_system = pw_properties_get_bool(client->props, "jack.default-as-system", false); + client->fix_midi_events = pw_properties_get_bool(client->props, "jack.fix-midi-events", true); client->self_connect_mode = SELF_CONNECT_ALLOW; if ((str = pw_properties_get(client->props, "jack.self-connect-mode")) != NULL) { @@ -4462,7 +4481,7 @@ if (n_seq == MAX_MIDI_MIX) break; } - convert_to_midi(seq, n_seq, ptr); + convert_to_midi(seq, n_seq, ptr, p->client->fix_midi_events); return ptr; }
View file
pipewire-0.3.52.tar.gz/pipewire-v4l2/src/pipewire-v4l2.c -> pipewire-0.3.53.tar.gz/pipewire-v4l2/src/pipewire-v4l2.c
Changed
@@ -1756,7 +1756,7 @@ if ((file = find_file(fd)) == NULL) return globals.old_fops.ioctl(fd, request, arg); -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__MidnightBSD__) if (arg == NULL && (request & IOC_DIRMASK != IOC_VOID)) { #else if (arg == NULL && (_IOC_DIR(request) & (_IOC_WRITE | _IOC_READ))) {
View file
pipewire-0.3.52.tar.gz/po/uk.po -> pipewire-0.3.53.tar.gz/po/uk.po
Changed
@@ -7,8 +7,8 @@ "Project-Id-Version: pipewire\n" "Report-Msgid-Bugs-To: https://gitlab.freedesktop.org/pipewire/pipewire/-/issue" "s\n" -"POT-Creation-Date: 2022-05-05 03:28+0000\n" -"PO-Revision-Date: 2022-05-05 21:06+0300\n" +"POT-Creation-Date: 2022-05-20 15:26+0000\n" +"PO-Revision-Date: 2022-06-18 13:07+0300\n" "Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n" "Language-Team: Ukrainian <trans-uk@lists.fedoraproject.org>\n" "Language: uk\n" @@ -48,7 +48,6 @@ msgstr "Тунель до %s/%s" #: src/modules/module-fallback-sink.c:51 -#| msgid "Game Output" msgid "Dummy Output" msgstr "Фіктивний вихід" @@ -71,23 +70,29 @@ msgid "%s on %s" msgstr "%s на %s" -#: src/tools/pw-cat.c:871 +#: src/tools/pw-cat.c:872 #, c-format +#| msgid "" +#| "%s options <file>\n" +#| " -h, --help Show this help\n" +#| " --version Show version\n" +#| " -v, --verbose Enable verbose operations\n" +#| "\n" msgid "" -"%s options <file>\n" +"%s options <file>|-\n" " -h, --help Show this help\n" " --version Show version\n" " -v, --verbose Enable verbose operations\n" "\n" msgstr "" -"%s параметри <файл>\n" +"%s параметри <файл>|-\n" " -h, --help вивести довідку\n" " --version вивести дані щодо версії\n" " -v, --verbose ввімкнути відображення докладної " "інформації\n" "\n" -#: src/tools/pw-cat.c:878 +#: src/tools/pw-cat.c:879 #, c-format #| msgid "" #| " -R, --remote Remote daemon name\n" @@ -101,8 +106,6 @@ #| " or direct samples (256)\n" #| " the rate is the one of the " #| "source file\n" -#| " --list-targets List available targets for --" -#| "target\n" #| "\n" msgid "" " -R, --remote Remote daemon name\n" @@ -116,6 +119,7 @@ " or direct samples (256)\n" " the rate is the one of the source " "file\n" +" -P --properties Set node properties\n" "\n" msgstr "" " -R, --remote назва віддаленої фонової служби\n" @@ -133,9 +137,10 @@ "ns)\n" " або безпосередні семпли (256)\n" " частота — частота з файла джерела\n" +" -P --properties встановити властивості вузла\n" "\n" -#: src/tools/pw-cat.c:895 +#: src/tools/pw-cat.c:897 #, c-format msgid "" " --rate Sample rate (req. for rec) (default " @@ -171,7 +176,7 @@ "(типово, %d)\n" "\n" -#: src/tools/pw-cat.c:912 +#: src/tools/pw-cat.c:914 msgid "" " -p, --playback Playback mode\n" " -r, --record Recording mode\n"
View file
pipewire-0.3.52.tar.gz/spa/examples/adapter-control.c -> pipewire-0.3.53.tar.gz/spa/examples/adapter-control.c
Changed
@@ -62,7 +62,9 @@ static SPA_LOG_IMPL(default_log); -#define MIN_LATENCY 1024 +#define MIN_LATENCY 1024 +#define CONTROL_BUFFER_SIZE 32768 + struct buffer { struct spa_buffer buffer; @@ -95,10 +97,19 @@ struct spa_node *sink_follower_node; // alsa-pcm-sink struct spa_node *sink_node; // adapter for alsa-pcm-sink + struct spa_io_position position; struct spa_io_buffers source_sink_io1; struct spa_buffer *source_buffers1; struct buffer source_buffer1; - uint8_t ctrl1024; + + struct spa_io_buffers control_io; + struct spa_buffer *control_buffers1; + struct buffer control_buffer1; + + int buffer_count; + bool start_fade_in; + double volume_accum; + uint32_t volume_offs; bool running; pthread_t thread; @@ -168,6 +179,11 @@ str = PLUGINDIR; data->plugin_dir = str; + /* start not doing fade-in */ + data->start_fade_in = true; + data->volume_accum = 0.0; + data->volume_offs = 0; + /* init the graph */ spa_graph_init(&data->graph, &data->graph_state); @@ -274,29 +290,104 @@ return res; } -static int on_sink_node_ready(void *_data, int status) +static int fade_in(struct data *data) { - struct data *data = _data; + struct spa_pod_builder b; + struct spa_pod_frame f1; + void *buffer = data->control_buffer->datas0.data; + uint32_t buffer_size = data->control_buffer->datas0.maxsize; + data->control_buffer->datas0.chunk0.size = buffer_size; + + printf ("fading in\n"); + + spa_pod_builder_init(&b, buffer, buffer_size); + spa_pod_builder_push_sequence(&b, &f0, 0); + data->volume_offs = 0; + do { + spa_pod_builder_control(&b, data->volume_offs, SPA_CONTROL_Properties); + spa_pod_builder_add_object(&b, + SPA_TYPE_OBJECT_Props, 0, + SPA_PROP_volume, SPA_POD_Float(data->volume_accum)); + data->volume_accum += 0.003; + data->volume_offs += 200; + } while (data->volume_accum < 1.0); + spa_pod_builder_pop(&b, &f0); - spa_graph_node_process(&data->graph_source_node); - spa_graph_node_process(&data->graph_sink_node); return 0; } -static int -on_sink_node_reuse_buffer(void *_data, uint32_t port_id, uint32_t buffer_id) +static int fade_out(struct data *data) +{ + struct spa_pod_builder b; + struct spa_pod_frame f1; + void *buffer = data->control_buffer->datas0.data; + uint32_t buffer_size = data->control_buffer->datas0.maxsize; + data->control_buffer->datas0.chunk0.size = buffer_size; + + printf ("fading out\n"); + + spa_pod_builder_init(&b, buffer, buffer_size); + spa_pod_builder_push_sequence(&b, &f0, 0); + data->volume_offs = 200; + do { + spa_pod_builder_control(&b, data->volume_offs, SPA_CONTROL_Properties); + spa_pod_builder_add_object(&b, + SPA_TYPE_OBJECT_Props, 0, + SPA_PROP_volume, SPA_POD_Float(data->volume_accum)); + data->volume_accum -= 0.003; + data->volume_offs += 200; + } while (data->volume_accum > 0.0); + spa_pod_builder_pop(&b, &f0); + + return 0; +} + +static void do_fade(struct data *data) +{ + switch (data->control_io.status) { + case SPA_STATUS_OK: + case SPA_STATUS_NEED_DATA: + break; + case SPA_STATUS_HAVE_DATA: + case SPA_STATUS_STOPPED: + default: + return; + } + + /* fade */ + if (data->start_fade_in) + fade_in(data); + else + fade_out(data); + + data->control_io.status = SPA_STATUS_HAVE_DATA; + data->control_io.buffer_id = 0; + + /* alternate */ + data->start_fade_in = !data->start_fade_in; +} + +static int on_sink_node_ready(void *_data, int status) { struct data *data = _data; - printf ("reuse_buffer: port_id=%d\n", port_id); - data->source_sink_io0.buffer_id = buffer_id; + /* only do fade in/out when buffer count is 0 */ + if (data->buffer_count == 0) + do_fade(data); + + /* update buffer count */ + data->buffer_count++; + if (data->buffer_count > 64) + data->buffer_count = 0; + + spa_graph_node_process(&data->graph_source_node); + spa_graph_node_process(&data->graph_sink_node); return 0; } static const struct spa_node_callbacks sink_node_callbacks = { SPA_VERSION_NODE_CALLBACKS, .ready = on_sink_node_ready, - .reuse_buffer = on_sink_node_reuse_buffer }; static int make_nodes(struct data *data, const char *device) @@ -306,15 +397,17 @@ struct spa_pod_builder b = { 0 }; uint8_t buffer1024; char value32; - struct spa_dict_item items1; + struct spa_dict_item items2; struct spa_audio_info_raw info; struct spa_pod *param; + items0 = SPA_DICT_ITEM_INIT("clock.quantum-limit", "8192"); + /* make the source node (audiotestsrc) */ if ((res = make_node(data, &data->source_follower_node, - "audiotestsrc/libspa-audiotestsrc.so", - "audiotestsrc", - NULL)) < 0) { + "audiotestsrc/libspa-audiotestsrc.so", + "audiotestsrc", + &SPA_DICT_INIT(items, 1))) < 0) { printf("can't create source follower node (audiotestsrc): %d\n", res); return res; } @@ -335,11 +428,11 @@ /* make the sink adapter node */ snprintf(value, sizeof(value), "pointer:%p", data->source_follower_node); - items0 = SPA_DICT_ITEM_INIT("audio.adapt.follower", value); + items1 = SPA_DICT_ITEM_INIT("audio.adapt.follower", value); if ((res = make_node(data, &data->source_node, - "audioconvert/libspa-audioconvert.so", - SPA_NAME_AUDIO_ADAPT, - &SPA_DICT_INIT(items, 1))) < 0) { + "audioconvert/libspa-audioconvert.so", + SPA_NAME_AUDIO_ADAPT, + &SPA_DICT_INIT(items, 2))) < 0) { printf("can't create source adapter node: %d\n", res); return res; } @@ -376,20 +469,20 @@ /* make the sink follower node (alsa-pcm-sink) */ if ((res = make_node(data, &data->sink_follower_node,
View file
pipewire-0.3.52.tar.gz/spa/include/spa/buffer/buffer.h -> pipewire-0.3.53.tar.gz/spa/include/spa/buffer/buffer.h
Changed
@@ -63,6 +63,9 @@ int32_t stride; /**< stride of valid data */ #define SPA_CHUNK_FLAG_NONE 0 #define SPA_CHUNK_FLAG_CORRUPTED (1u<<0) /**< chunk data is corrupted in some way */ +#define SPA_CHUNK_FLAG_EMPTY (1u<<1) /**< chunk data is empty with media specific + * neutral data such as silence or black. This + * could be used to optimize processing. */ int32_t flags; /**< chunk flags */ };
View file
pipewire-0.3.52.tar.gz/spa/include/spa/param/audio/layout.h -> pipewire-0.3.53.tar.gz/spa/include/spa/param/audio/layout.h
Changed
@@ -29,7 +29,7 @@ extern "C" { #endif -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) #include <endian.h> #endif
View file
pipewire-0.3.52.tar.gz/spa/include/spa/param/audio/raw.h -> pipewire-0.3.53.tar.gz/spa/include/spa/param/audio/raw.h
Changed
@@ -31,7 +31,7 @@ #include <stdint.h> -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) #include <endian.h> #endif
View file
pipewire-0.3.52.tar.gz/spa/plugins/alsa/90-pipewire-alsa.rules -> pipewire-0.3.53.tar.gz/spa/plugins/alsa/90-pipewire-alsa.rules
Changed
@@ -177,6 +177,10 @@ # Sennheiser GSP 670 USB headset ATTRS{idVendor}=="1395", ATTRS{idProduct}=="008a", ENV{ACP_PROFILE_SET}="usb-gaming-headset.conf" +# Audioengine HD3 powered speakers support IEC958 but don't actually +# have any digital outputs. +ATTRS{idVendor}=="0a12", ATTRS{idProduct}=="4007", ENV{ACP_PROFILE_SET}="analog-only.conf" + GOTO="pipewire_end" LABEL="pipewire_check_pci"
View file
pipewire-0.3.52.tar.gz/spa/plugins/alsa/acp/alsa-util.c -> pipewire-0.3.53.tar.gz/spa/plugins/alsa/acp/alsa-util.c
Changed
@@ -1626,7 +1626,12 @@ { int err; const char *name = snd_hctl_elem_get_name(helem); - if (mask & SND_CTL_EVENT_MASK_ADD) { + // NOTE: The remove event defined as '~0U`. + if (mask == SND_CTL_EVENT_MASK_REMOVE) { + // NOTE: unless remove pointer to melem from link-list at private_data of helem, hits + // assersion in alsa-lib since the list is not empty. + snd_mixer_elem_detach(melem, helem); + } else if (mask & SND_CTL_EVENT_MASK_ADD) { snd_ctl_elem_iface_t iface = snd_hctl_elem_get_interface(helem); if (iface == SND_CTL_ELEM_IFACE_CARD || iface == SND_CTL_ELEM_IFACE_PCM) { snd_mixer_elem_t *new_melem;
View file
pipewire-0.3.52.tar.gz/spa/plugins/alsa/alsa-pcm-sink.c -> pipewire-0.3.53.tar.gz/spa/plugins/alsa/alsa-pcm-sink.c
Changed
@@ -616,7 +616,7 @@ const struct spa_pod *format) { struct state *this = object; - int err; + int err = 0; if (format == NULL) { if (!this->have_format) @@ -673,7 +673,7 @@ } emit_port_info(this, false); - return 0; + return err; } static int
View file
pipewire-0.3.52.tar.gz/spa/plugins/alsa/alsa-pcm-source.c -> pipewire-0.3.53.tar.gz/spa/plugins/alsa/alsa-pcm-source.c
Changed
@@ -566,7 +566,7 @@ uint32_t flags, const struct spa_pod *format) { struct state *this = object; - int err; + int err = 0; if (format == NULL) { if (!this->have_format) @@ -610,7 +610,7 @@ } emit_port_info(this, false); - return 0; + return err; } static int
View file
pipewire-0.3.52.tar.gz/spa/plugins/alsa/alsa-pcm.c -> pipewire-0.3.53.tar.gz/spa/plugins/alsa/alsa-pcm.c
Changed
@@ -1409,7 +1409,10 @@ state->props.device, rchannels, val); if (!SPA_FLAG_IS_SET(flags, SPA_NODE_PARAM_FLAG_NEAREST)) return -EINVAL; + if (fmt->media_subtype != SPA_MEDIA_SUBTYPE_raw) + return -EINVAL; rchannels = val; + fmt->info.raw.channels = rchannels; match = false; } @@ -1429,7 +1432,10 @@ state->props.device, rrate, val); if (!SPA_FLAG_IS_SET(flags, SPA_NODE_PARAM_FLAG_NEAREST)) return -EINVAL; + if (fmt->media_subtype != SPA_MEDIA_SUBTYPE_raw) + return -EINVAL; rrate = val; + fmt->info.raw.rate = rrate; match = false; } @@ -1895,6 +1901,7 @@ snd_pcm_uframes_t written, frames, offset, off, to_write, total_written, max_write; snd_pcm_sframes_t commitres; int res = 0; + size_t frame_size = state->frame_size; check_position_config(state); @@ -1951,56 +1958,37 @@ written = 0; while (!spa_list_is_empty(&state->ready) && to_write > 0) { - uint8_t *dst, *src; size_t n_bytes, n_frames; struct buffer *b; struct spa_data *d; - uint32_t i, index, offs, avail, size, maxsize, l0, l1; + uint32_t i, offs, size; b = spa_list_first(&state->ready, struct buffer, link); d = b->buf->datas; - size = d0.chunk->size; - maxsize = d0.maxsize; - - index = d0.chunk->offset + state->ready_offset; - avail = size - state->ready_offset; - avail /= state->frame_size; + offs = d0.chunk->offset + state->ready_offset; + size = d0.chunk->size - state->ready_offset; - n_frames = SPA_MIN(avail, to_write); - n_bytes = n_frames * state->frame_size; + offs = SPA_MIN(offs, d0.maxsize); + size = SPA_MIN(d0.maxsize - offs, size); - offs = index % maxsize; - l0 = SPA_MIN(n_bytes, maxsize - offs); - l1 = n_bytes - l0; + n_frames = SPA_MIN(size / frame_size, to_write); + n_bytes = n_frames * frame_size; if (SPA_LIKELY(state->use_mmap)) { for (i = 0; i < b->buf->n_datas; i++) { - dst = SPA_PTROFF(my_areasi.addr, off * state->frame_size, uint8_t); - src = di.data; - - spa_memcpy(dst, src + offs, l0); - if (SPA_UNLIKELY(l1 > 0)) - spa_memcpy(dst + l0, src, l1); + spa_memcpy(SPA_PTROFF(my_areasi.addr, off * frame_size, void), + SPA_PTROFF(di.data, offs, void), n_bytes); } } else { - if (state->planar) { - void *bufsb->buf->n_datas; - - for (i = 0; i < b->buf->n_datas; i++) - bufsi = SPA_PTROFF(di.data, offs, void); - snd_pcm_writen(hndl, bufs, l0 / state->frame_size); - if (SPA_UNLIKELY(l1 > 0)) { - for (i = 0; i < b->buf->n_datas; i++) - bufsi = di.data; - snd_pcm_writen(hndl, bufs, l1 / state->frame_size); - } - } else { - src = d0.data; - snd_pcm_writei(hndl, src + offs, l0 / state->frame_size); - if (SPA_UNLIKELY(l1 > 0)) - snd_pcm_writei(hndl, src, l1 / state->frame_size); - } + void *bufsb->buf->n_datas; + for (i = 0; i < b->buf->n_datas; i++) + bufsi = SPA_PTROFF(di.data, offs, void); + + if (state->planar) + snd_pcm_writen(hndl, bufs, n_frames); + else + snd_pcm_writei(hndl, bufs0, n_frames); } state->ready_offset += n_bytes; @@ -2071,8 +2059,7 @@ spa_log_warn(state->log, "%s: no more buffers", state->props.device); total_frames = frames; } else { - uint8_t *src; - size_t n_bytes, left; + size_t n_bytes, left, frame_size = state->frame_size; struct buffer *b; struct spa_data *d; uint32_t i, avail, l0, l1; @@ -2088,23 +2075,26 @@ d = b->buf->datas; - avail = d0.maxsize / state->frame_size; + avail = d0.maxsize / frame_size; total_frames = SPA_MIN(avail, frames); - n_bytes = total_frames * state->frame_size; + n_bytes = total_frames * frame_size; if (my_areas) { left = state->buffer_frames - offset; - l0 = SPA_MIN(n_bytes, left * state->frame_size); + l0 = SPA_MIN(n_bytes, left * frame_size); l1 = n_bytes - l0; for (i = 0; i < b->buf->n_datas; i++) { - src = SPA_PTROFF(my_areasi.addr, offset * state->frame_size, uint8_t); - spa_memcpy(di.data, src, l0); - if (l1 > 0) - spa_memcpy(SPA_PTROFF(di.data, l0, void), my_areasi.addr, l1); + spa_memcpy(di.data, + SPA_PTROFF(my_areasi.addr, offset * frame_size, void), + l0); + if (SPA_UNLIKELY(l1 > 0)) + spa_memcpy(SPA_PTROFF(di.data, l0, void), + my_areasi.addr, + l1); di.chunk->offset = 0; di.chunk->size = n_bytes; - di.chunk->stride = state->frame_size; + di.chunk->stride = frame_size; } } else { void *bufsb->buf->n_datas; @@ -2112,7 +2102,7 @@ bufsi = di.data; di.chunk->offset = 0; di.chunk->size = n_bytes; - di.chunk->stride = state->frame_size; + di.chunk->stride = frame_size; } if (state->planar) { snd_pcm_readn(state->hndl, bufs, total_frames);
View file
pipewire-0.3.52.tar.gz/spa/plugins/alsa/alsa-seq.c -> pipewire-0.3.53.tar.gz/spa/plugins/alsa/alsa-seq.c
Changed
@@ -131,13 +131,19 @@ static int init_stream(struct seq_state *state, enum spa_direction direction) { struct seq_stream *stream = &state->streamsdirection; + int res; stream->direction = direction; if (direction == SPA_DIRECTION_INPUT) { stream->caps = SND_SEQ_PORT_CAP_SUBS_WRITE; } else { stream->caps = SND_SEQ_PORT_CAP_SUBS_READ; } - snd_midi_event_new(MAX_EVENT_SIZE, &stream->codec); + if ((res = snd_midi_event_new(MAX_EVENT_SIZE, &stream->codec)) < 0) { + spa_log_error(state->log, "can make event decoder: %s", + snd_strerror(res)); + return res; + } + snd_midi_event_no_status(stream->codec, 1); memset(stream->ports, 0, sizeof(stream->ports)); return 0; } @@ -145,7 +151,9 @@ static int uninit_stream(struct seq_state *state, enum spa_direction direction) { struct seq_stream *stream = &state->streamsdirection; - snd_midi_event_free(stream->codec); + if (stream->codec) + snd_midi_event_free(stream->codec); + stream->codec = NULL; return 0; } @@ -543,12 +551,6 @@ continue; } - /* fixup NoteOn with vel 0 */ - if ((data0 & 0xF0) == 0x90 && data2 == 0x00) { - data0 = 0x80 + (data0 & 0x0F); - data2 = 0x40; - } - /* queue_time is the estimated current time of the queue as calculated by * the DLL. Calculate the age of the event. */ ev_time = SPA_TIMESPEC_TO_NSEC(&ev->time.time);
View file
pipewire-0.3.52.tar.gz/spa/plugins/alsa/alsa-udev.c -> pipewire-0.3.53.tar.gz/spa/plugins/alsa/alsa-udev.c
Changed
@@ -477,15 +477,9 @@ if ((str = udev_device_get_property_value(dev, "SUBSYSTEM")) && *str) { itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_SUBSYSTEM, str); } - if ((str = udev_device_get_property_value(dev, "ID_VENDOR_ID")) && *str) { - char *dec = alloca(6); /* 65535 is max */ - int32_t val; + if ((str = udev_device_get_property_value(dev, "ID_VENDOR_ID")) && *str) + itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_VENDOR_ID, str); - if (spa_atoi32(str, &val, 16)) { - snprintf(dec, 6, "%d", val); - itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_VENDOR_ID, dec); - } - } str = udev_device_get_property_value(dev, "ID_VENDOR_FROM_DATABASE"); if (!(str && *str)) { str = udev_device_get_property_value(dev, "ID_VENDOR_ENC"); @@ -500,15 +494,9 @@ if (str && *str) { itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_VENDOR_NAME, str); } - if ((str = udev_device_get_property_value(dev, "ID_MODEL_ID")) && *str) { - char *dec = alloca(6); /* 65535 is max */ - int32_t val; + if ((str = udev_device_get_property_value(dev, "ID_MODEL_ID")) && *str) + itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_PRODUCT_ID, str); - if (spa_atoi32(str, &val, 16)) { - snprintf(dec, 6, "%d", val); - itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_PRODUCT_ID, dec); - } - } str = udev_device_get_property_value(dev, "ID_MODEL_FROM_DATABASE"); if (!(str && *str)) { str = udev_device_get_property_value(dev, "ID_MODEL_ENC");
View file
pipewire-0.3.53.tar.gz/spa/plugins/alsa/mixer/profile-sets/analog-only.conf
Added
@@ -0,0 +1,102 @@ +# PulseAudio is 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; either version 2.1 of the +# License, or (at your option) any later version. +# +# PulseAudio 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 +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. + +; Some USB DACs appear to support IEC958, but don't physically have any +; digital outputs. + +General +auto-profiles = yes + +Mapping analog-stereo +device-strings = front:%f +channel-map = left,right +paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-headphones analog-output-headphones-2 +paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic +priority = 15 + +# If everything else fails, try to use hw:0 as a stereo device... +Mapping stereo-fallback +device-strings = hw:%f +fallback = yes +channel-map = front-left,front-right +paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-headphones analog-output-headphones-2 +paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic +priority = 1 + +# ...and if even that fails, try to use hw:0 as a mono device. +Mapping mono-fallback +device-strings = hw:%f +fallback = yes +channel-map = mono +paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-headphones analog-output-headphones-2 analog-output-mono +paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headset-mic +priority = 1 + +Mapping analog-surround-21 +device-strings = surround21:%f +channel-map = front-left,front-right,lfe +paths-input = analog-input analog-input-linein analog-input-mic +paths-output = analog-output analog-output-lineout analog-output-speaker +priority = 13 + +Mapping analog-surround-40 +device-strings = surround40:%f +channel-map = front-left,front-right,rear-left,rear-right +paths-input = analog-input analog-input-linein analog-input-mic +paths-output = analog-output analog-output-lineout analog-output-speaker +priority = 12 + +Mapping analog-surround-41 +device-strings = surround41:%f +channel-map = front-left,front-right,rear-left,rear-right,lfe +paths-input = analog-input analog-input-linein analog-input-mic +paths-output = analog-output analog-output-lineout analog-output-speaker +priority = 13 + +Mapping analog-surround-50 +device-strings = surround50:%f +channel-map = front-left,front-right,rear-left,rear-right,front-center +paths-input = analog-input analog-input-linein analog-input-mic +paths-output = analog-output analog-output-lineout analog-output-speaker +priority = 12 + +Mapping analog-surround-51 +device-strings = surround51:%f +channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe +paths-input = analog-input analog-input-linein analog-input-mic +paths-output = analog-output analog-output-lineout analog-output-speaker +priority = 13 + +Mapping analog-surround-71 +device-strings = surround71:%f +channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right +description = Analog Surround 7.1 +paths-input = analog-input analog-input-linein analog-input-mic +paths-output = analog-output analog-output-lineout analog-output-speaker +priority = 12 + +Mapping multichannel-output +device-strings = hw:%f +channel-map = left,right,rear-left,rear-right +exact-channels = false +fallback = yes +priority = 1 +direction = output + +Mapping multichannel-input +device-strings = hw:%f +channel-map = left,right,rear-left,rear-right +exact-channels = false +fallback = yes +priority = 1 +direction = input
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/audioadapter.c -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/audioadapter.c
Changed
@@ -49,7 +49,7 @@ #define DEFAULT_ALIGN 16 -#define MAX_PORTS SPA_AUDIO_MAX_CHANNELS +#define MAX_PORTS (SPA_AUDIO_MAX_CHANNELS+1) /** \cond */ @@ -442,6 +442,29 @@ if (format && spa_log_level_enabled(this->log, SPA_LOG_LEVEL_DEBUG)) spa_debug_format(0, NULL, format); + if ((res = spa_node_port_set_param(this->follower, + this->direction, 0, + SPA_PARAM_Format, flags, + format)) < 0) + return res; + if (res > 0) { + uint8_t buffer4096; + struct spa_pod_builder b = { 0 }; + uint32_t state = 0; + struct spa_pod *fmt; + + /* format was changed to nearest compatible format */ + spa_pod_builder_init(&b, buffer, sizeof(buffer)); + + if ((res = spa_node_port_enum_params_sync(this->follower, + this->direction, 0, + SPA_PARAM_Format, &state, + NULL, &fmt, &b)) != 1) + return -EIO; + + format = fmt; + } + if (this->target != this->follower && this->convert) { if ((res = spa_node_port_set_param(this->convert, SPA_DIRECTION_REVERSE(this->direction), 0, @@ -450,12 +473,6 @@ return res; } - if ((res = spa_node_port_set_param(this->follower, - this->direction, 0, - SPA_PARAM_Format, flags, - format)) < 0) - return res; - this->have_format = format != NULL; if (format == NULL) { this->n_buffers = 0; @@ -494,7 +511,7 @@ int res = 0; struct spa_hook l; - spa_log_debug(this->log, "%p: passthrough mode %d", this, passthrough); + spa_log_info(this->log, "%p: passthrough mode %d", this, passthrough); if (this->passthrough != passthrough) { if (passthrough) { @@ -513,7 +530,7 @@ /* set new target */ this->target = passthrough ? this->follower : this->convert; - if ((res = configure_format(this, 0, format)) < 0) + if ((res = configure_format(this, SPA_NODE_PARAM_FLAG_NEAREST, format)) < 0) return res; if (this->passthrough != passthrough) { @@ -595,7 +612,6 @@ enum spa_direction dir; enum spa_param_port_config_mode mode; struct spa_pod *format = NULL; - int monitor = false; if (this->started) { spa_log_error(this->log, "was started"); @@ -606,7 +622,6 @@ SPA_TYPE_OBJECT_ParamPortConfig, NULL, SPA_PARAM_PORT_CONFIG_direction, SPA_POD_Id(&dir), SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(&mode), - SPA_PARAM_PORT_CONFIG_monitor, SPA_POD_OPT_Bool(&monitor), SPA_PARAM_PORT_CONFIG_format, SPA_POD_OPT_Pod(&format)) < 0) return -EINVAL; @@ -777,7 +792,7 @@ spa_pod_fixate(format); - res = configure_format(this, 0, format); + res = configure_format(this, SPA_NODE_PARAM_FLAG_NEAREST, format); done: spa_node_send_command(this->follower, @@ -852,6 +867,12 @@ uint32_t idx; switch (info->paramsi.id) { + case SPA_PARAM_EnumPortConfig: + idx = IDX_EnumPortConfig; + break; + case SPA_PARAM_PortConfig: + idx = IDX_PortConfig; + break; case SPA_PARAM_PropInfo: idx = IDX_PropInfo; break;
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/audioconvert.c -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/audioconvert.c
Changed
@@ -1,6 +1,6 @@ /* Spa * - * Copyright © 2018 Wim Taymans + * Copyright © 2022 Wim Taymans * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -25,52 +25,153 @@ #include <errno.h> #include <string.h> #include <stdio.h> +#include <limits.h> #include <spa/support/plugin.h> -#include <spa/support/log.h> #include <spa/support/cpu.h> +#include <spa/support/log.h> #include <spa/utils/result.h> #include <spa/utils/list.h> #include <spa/utils/names.h> #include <spa/utils/string.h> #include <spa/node/node.h> -#include <spa/buffer/alloc.h> #include <spa/node/io.h> #include <spa/node/utils.h> +#include <spa/node/keys.h> #include <spa/param/audio/format-utils.h> #include <spa/param/param.h> +#include <spa/param/latency-utils.h> #include <spa/pod/filter.h> -#include <spa/debug/pod.h> #include <spa/debug/types.h> +#include <spa/debug/pod.h> + +#include "volume-ops.h" +#include "fmt-ops.h" +#include "channelmix-ops.h" +#include "resample.h" #undef SPA_LOG_TOPIC_DEFAULT #define SPA_LOG_TOPIC_DEFAULT log_topic static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.audioconvert"); -#define DEFAULT_ALIGN 16 +#define DEFAULT_RATE 48000 +#define DEFAULT_CHANNELS 2 + +#define MAX_ALIGN FMT_OPS_MAX_ALIGN +#define MAX_BUFFERS 32 +#define MAX_DATAS SPA_AUDIO_MAX_CHANNELS +#define MAX_PORTS (SPA_AUDIO_MAX_CHANNELS+1) + +#define DEFAULT_MUTE false +#define DEFAULT_VOLUME VOLUME_NORM + +struct volumes { + bool mute; + uint32_t n_volumes; + float volumesSPA_AUDIO_MAX_CHANNELS; +}; + +static void init_volumes(struct volumes *vol) +{ + uint32_t i; + vol->mute = DEFAULT_MUTE; + vol->n_volumes = 0; + for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++) + vol->volumesi = DEFAULT_VOLUME; +} + +struct props { + float volume; + uint32_t n_channels; + uint32_t channel_mapSPA_AUDIO_MAX_CHANNELS; + struct volumes channel; + struct volumes soft; + struct volumes monitor; + unsigned int have_soft_volume:1; + unsigned int mix_disabled:1; + unsigned int resample_quality; + unsigned int resample_disabled:1; + double rate; +}; -#define MAX_PORTS SPA_AUDIO_MAX_CHANNELS +static void props_reset(struct props *props) +{ + uint32_t i; + props->volume = DEFAULT_VOLUME; + props->n_channels = 0; + for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++) + props->channel_mapi = SPA_AUDIO_CHANNEL_UNKNOWN; + init_volumes(&props->channel); + init_volumes(&props->soft); + init_volumes(&props->monitor); + props->mix_disabled = false; + props->rate = 1.0; + props->resample_quality = RESAMPLE_DEFAULT_QUALITY; + props->resample_disabled = false; +} struct buffer { - struct spa_list link; -#define BUFFER_FLAG_OUT (1 << 0) + uint32_t id; +#define BUFFER_FLAG_QUEUED (1<<0) uint32_t flags; - struct spa_buffer *outbuf; - struct spa_meta_header *h; + struct spa_list link; + struct spa_buffer *buf; + void *datasMAX_DATAS; }; -struct link { - struct spa_node *out_node; - uint32_t out_port; - uint32_t out_flags; - struct spa_node *in_node; - uint32_t in_port; - uint32_t in_flags; - struct spa_io_buffers io; - uint32_t min_buffers; +struct port { + uint32_t direction; + uint32_t id; + + struct spa_io_buffers *io; + + uint64_t info_all; + struct spa_port_info info; +#define IDX_EnumFormat 0 +#define IDX_Meta 1 +#define IDX_IO 2 +#define IDX_Format 3 +#define IDX_Buffers 4 +#define IDX_Latency 5 +#define N_PORT_PARAMS 6 + struct spa_param_info paramsN_PORT_PARAMS; + char position16; + + struct buffer buffersMAX_BUFFERS; uint32_t n_buffers; - struct spa_buffer **buffers; - unsigned int negotiated:1; + + struct spa_audio_info format; + unsigned int have_format:1; + unsigned int is_dsp:1; + unsigned int is_monitor:1; + unsigned int is_control:1; + + uint32_t blocks; + uint32_t stride; + + const struct spa_pod_sequence *ctrl; + uint32_t ctrl_offset; + + struct spa_list queue; +}; + +struct dir { + struct port *portsMAX_PORTS; + uint32_t n_ports; + + enum spa_param_port_config_mode mode; + + struct spa_audio_info format; + unsigned int have_format:1; + unsigned int have_profile:1; + struct spa_latency_info latency; + + uint32_t src_remapMAX_PORTS; + uint32_t dst_remapMAX_PORTS; + + struct convert conv; + unsigned int is_passthrough:1; + unsigned int control:1; }; struct impl { @@ -80,9 +181,15 @@ struct spa_log *log; struct spa_cpu *cpu; + uint32_t cpu_flags; uint32_t max_align; + uint32_t quantum_limit; + enum spa_direction direction; - struct spa_hook_list hooks; + struct props props; + + struct spa_io_position *io_position; + struct spa_io_rate_match *io_rate_match; uint64_t info_all; struct spa_node_info info; @@ -90,52 +197,50 @@
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/channelmix-ops-c.c -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/channelmix-ops-c.c
Changed
@@ -177,6 +177,7 @@ channelmix_f32_2_4_c(struct channelmix *mix, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, uint32_t n_samples) { + uint32_t i, n_dst = mix->dst_chan; float **d = (float **)dst; const float **s = (const float **)src; const float v0 = mix->matrix00; @@ -184,10 +185,25 @@ const float v2 = mix->matrix20; const float v3 = mix->matrix31; - vol_c(d0, s0, v0, n_samples); - vol_c(d1, s1, v1, n_samples); - vol_c(d2, s0, v2, n_samples); - vol_c(d3, s1, v3, n_samples); + if (SPA_FLAG_IS_SET(mix->flags, CHANNELMIX_FLAG_ZERO)) { + for (i = 0; i < n_dst; i++) + clear_c(di, n_samples); + } + else { + vol_c(d0, s0, v0, n_samples); + vol_c(d1, s1, v1, n_samples); + if (mix->upmix != CHANNELMIX_UPMIX_PSD) { + vol_c(d2, s0, v2, n_samples); + vol_c(d3, s1, v3, n_samples); + } else { + sub_c(d2, s0, s1, n_samples); + + delay_convolve_run(mix->buffer1, &mix->pos1, BUFFER_SIZE, mix->delay, + mix->taps, mix->n_taps, d3, d2, -v3, n_samples); + delay_convolve_run(mix->buffer0, &mix->pos0, BUFFER_SIZE, mix->delay, + mix->taps, mix->n_taps, d2, d2, v2, n_samples); + } + } } #define MASK_3_1 _M(FL)|_M(FR)|_M(FC)|_M(LFE) @@ -294,6 +310,32 @@ } } +/* FL+FR+FC+LFE -> FL+FR */ +void +channelmix_f32_3p1_2_c(struct channelmix *mix, void * SPA_RESTRICT dst, + const void * SPA_RESTRICT src, uint32_t n_samples) +{ + uint32_t n; + float **d = (float **) dst; + const float **s = (const float **) src; + const float v0 = mix->matrix00; + const float v1 = mix->matrix11; + const float clev = (mix->matrix02 + mix->matrix12) * 0.5f; + const float llev = (mix->matrix03 + mix->matrix13) * 0.5f; + + if (SPA_FLAG_IS_SET(mix->flags, CHANNELMIX_FLAG_ZERO)) { + clear_c(d0, n_samples); + clear_c(d1, n_samples); + } + else { + for (n = 0; n < n_samples; n++) { + const float ctr = clev * s2n + llev * s3n; + d0n = s0n * v0 + ctr; + d1n = s1n * v1 + ctr; + } + } +} + /* FL+FR+FC+LFE+SL+SR -> FL+FR */ void channelmix_f32_5p1_2_c(struct channelmix *mix, void * SPA_RESTRICT dst, @@ -356,13 +398,9 @@ channelmix_f32_5p1_4_c(struct channelmix *mix, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, uint32_t n_samples) { - uint32_t i, n, n_dst = mix->dst_chan; + uint32_t i, n_dst = mix->dst_chan; float **d = (float **) dst; const float **s = (const float **) src; - const float clev = mix->matrix02; - const float llev = mix->matrix03; - const float v0 = mix->matrix00; - const float v1 = mix->matrix11; const float v4 = mix->matrix24; const float v5 = mix->matrix35; @@ -371,11 +409,8 @@ clear_c(di, n_samples); } else { - for (n = 0; n < n_samples; n++) { - const float ctr = s2n * clev + s3n * llev; - d0n = s0n * v0 + ctr; - d1n = s1n * v1 + ctr; - } + channelmix_f32_3p1_2_c(mix, dst, src, n_samples); + vol_c(d2, s4, v4, n_samples); vol_c(d3, s5, v5, n_samples); }
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/channelmix-ops-sse.c -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/channelmix-ops-sse.c
Changed
@@ -26,113 +26,104 @@ #include <xmmintrin.h> -void channelmix_copy_sse(struct channelmix *mix, void * SPA_RESTRICT dst, - const void * SPA_RESTRICT src, uint32_t n_samples) +static inline void clear_sse(float *d, uint32_t n_samples) { - uint32_t i, n, unrolled, n_dst = mix->dst_chan; - float **d = (float **)dst; - const float **s = (const float **)src; + memset(d, 0, n_samples * sizeof(float)); +} - if (SPA_FLAG_IS_SET(mix->flags, CHANNELMIX_FLAG_ZERO)) { - for (i = 0; i < n_dst; i++) - memset(di, 0, n_samples * sizeof(float)); - } - else if (SPA_FLAG_IS_SET(mix->flags, CHANNELMIX_FLAG_IDENTITY)) { - for (i = 0; i < n_dst; i++) - spa_memcpy(di, si, n_samples * sizeof(float)); - } - else { - for (i = 0; i < n_dst; i++) { - float *di = di; - const float *si = si; - __m128 t4; - const __m128 vol = _mm_set1_ps(mix->matrixii); +static inline void copy_sse(float *d, const float *s, uint32_t n_samples) +{ + spa_memcpy(d, s, n_samples * sizeof(float)); +} - if (SPA_IS_ALIGNED(di, 16) && - SPA_IS_ALIGNED(si, 16)) - unrolled = n_samples & ~15; - else - unrolled = 0; +static inline void vol_sse(float *d, const float *s, float vol, uint32_t n_samples) +{ + uint32_t n, unrolled; + if (vol == 0.0f) { + clear_sse(d, n_samples); + } else if (vol == 1.0f) { + copy_sse(d, s, n_samples); + } else { + __m128 t4; + const __m128 v = _mm_set1_ps(vol); + + if (SPA_IS_ALIGNED(d, 16) && + SPA_IS_ALIGNED(s, 16)) + unrolled = n_samples & ~15; + else + unrolled = 0; - for(n = 0; n < unrolled; n += 16) { - t0 = _mm_load_ps(&sin); - t1 = _mm_load_ps(&sin+4); - t2 = _mm_load_ps(&sin+8); - t3 = _mm_load_ps(&sin+12); - _mm_store_ps(&din, _mm_mul_ps(t0, vol)); - _mm_store_ps(&din+4, _mm_mul_ps(t1, vol)); - _mm_store_ps(&din+8, _mm_mul_ps(t2, vol)); - _mm_store_ps(&din+12, _mm_mul_ps(t3, vol)); - } - for(; n < n_samples; n++) - _mm_store_ss(&din, _mm_mul_ss(_mm_load_ss(&sin), vol)); + for(n = 0; n < unrolled; n += 16) { + t0 = _mm_load_ps(&sn); + t1 = _mm_load_ps(&sn+4); + t2 = _mm_load_ps(&sn+8); + t3 = _mm_load_ps(&sn+12); + _mm_store_ps(&dn, _mm_mul_ps(t0, v)); + _mm_store_ps(&dn+4, _mm_mul_ps(t1, v)); + _mm_store_ps(&dn+8, _mm_mul_ps(t2, v)); + _mm_store_ps(&dn+12, _mm_mul_ps(t3, v)); } + for(; n < n_samples; n++) + _mm_store_ss(&dn, _mm_mul_ss(_mm_load_ss(&sn), v)); } } -void -channelmix_f32_2_4_sse(struct channelmix *mix, void * SPA_RESTRICT dst, +void channelmix_copy_sse(struct channelmix *mix, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, uint32_t n_samples) { - uint32_t i, n, unrolled, n_dst = mix->dst_chan; + uint32_t i, n_dst = mix->dst_chan; float **d = (float **)dst; const float **s = (const float **)src; - const float m00 = mix->matrix00; - const float m11 = mix->matrix11; - __m128 in; - const float *sFL = s0, *sFR = s1; - float *dFL = d0, *dFR = d1, *dRL = d2, *dRR = d3; + for (i = 0; i < n_dst; i++) + vol_sse(di, si, mix->matrixii, n_samples); +} - if (SPA_IS_ALIGNED(sFL, 16) && - SPA_IS_ALIGNED(sFR, 16) && - SPA_IS_ALIGNED(dFL, 16) && - SPA_IS_ALIGNED(dFR, 16) && - SPA_IS_ALIGNED(dRL, 16) && - SPA_IS_ALIGNED(dRR, 16)) - unrolled = n_samples & ~3; - else - unrolled = 0; +/* FL+FR+FC+LFE -> FL+FR */ +void +channelmix_f32_3p1_2_sse(struct channelmix *mix, void * SPA_RESTRICT dst, + const void * SPA_RESTRICT src, uint32_t n_samples) +{ + float **d = (float **) dst; + const float **s = (const float **) src; + const float m0 = mix->matrix00; + const float m1 = mix->matrix11; + const float m2 = (mix->matrix02 + mix->matrix12) * 0.5f; + const float m3 = (mix->matrix03 + mix->matrix13) * 0.5f; - if (SPA_FLAG_IS_SET(mix->flags, CHANNELMIX_FLAG_ZERO)) { - for (i = 0; i < n_dst; i++) - memset(di, 0, n_samples * sizeof(float)); - } - else if (m00 == 1.0f && m11 == 1.0f) { - for(n = 0; n < unrolled; n += 4) { - in = _mm_load_ps(&sFLn); - _mm_store_ps(&dFLn, in); - _mm_store_ps(&dRLn, in); - in = _mm_load_ps(&sFRn); - _mm_store_ps(&dFRn, in); - _mm_store_ps(&dRRn, in); - } - for(; n < n_samples; n++) { - in = _mm_load_ss(&sFLn); - _mm_store_ss(&dFLn, in); - _mm_store_ss(&dRLn, in); - in = _mm_load_ss(&sFRn); - _mm_store_ss(&dFRn, in); - _mm_store_ss(&dRRn, in); - } + if (m0 == 0.0f && m1 == 0.0f && m2 == 0.0f && m3 == 0.0f) { + clear_sse(d0, n_samples); + clear_sse(d1, n_samples); } else { - const __m128 v0 = _mm_set1_ps(m00); - const __m128 v1 = _mm_set1_ps(m11); + uint32_t n, unrolled; + const __m128 v0 = _mm_set1_ps(m0); + const __m128 v1 = _mm_set1_ps(m1); + const __m128 clev = _mm_set1_ps(m2); + const __m128 llev = _mm_set1_ps(m3); + __m128 ctr; + + if (SPA_IS_ALIGNED(s0, 16) && + SPA_IS_ALIGNED(s1, 16) && + SPA_IS_ALIGNED(s2, 16) && + SPA_IS_ALIGNED(s3, 16) && + SPA_IS_ALIGNED(d0, 16) && + SPA_IS_ALIGNED(d1, 16)) + unrolled = n_samples & ~3; + else + unrolled = 0; + for(n = 0; n < unrolled; n += 4) { - in = _mm_mul_ps(_mm_load_ps(&sFLn), v0); - _mm_store_ps(&dFLn, in); - _mm_store_ps(&dRLn, in); - in = _mm_mul_ps(_mm_load_ps(&sFRn), v1); - _mm_store_ps(&dFRn, in); - _mm_store_ps(&dRRn, in); + ctr = _mm_add_ps( + _mm_mul_ps(_mm_load_ps(&s2n), clev), + _mm_mul_ps(_mm_load_ps(&s3n), llev)); + _mm_store_ps(&d0n, _mm_add_ps(_mm_mul_ps(_mm_load_ps(&s0n), v0), ctr)); + _mm_store_ps(&d1n, _mm_add_ps(_mm_mul_ps(_mm_load_ps(&s1n), v1), ctr)); } for(; n < n_samples; n++) { - in = _mm_mul_ss(_mm_load_ss(&sFLn), v0); - _mm_store_ss(&dFLn, in); - _mm_store_ss(&dRLn, in); - in = _mm_mul_ss(_mm_load_ss(&sFRn), v1); - _mm_store_ss(&dFRn, in); - _mm_store_ss(&dRRn, in); + ctr = _mm_add_ss(_mm_mul_ss(_mm_load_ss(&s2n), clev), + _mm_mul_ss(_mm_load_ss(&s3n), llev)); + _mm_store_ss(&d0n, _mm_add_ss(_mm_mul_ss(_mm_load_ss(&s0n), v0), ctr)); + _mm_store_ss(&d1n, _mm_add_ss(_mm_mul_ss(_mm_load_ss(&s1n), v1), ctr)); } } } @@ -152,77 +143,49 @@ const __m128 slev0 = _mm_set1_ps(mix->matrix04); const __m128 slev1 = _mm_set1_ps(mix->matrix15); __m128 in, ctr; - const float *sFL = s0, *sFR = s1, *sFC = s2, *sLFE = s3, *sSL = s4, *sSR = s5; - float *dFL = d0, *dFR = d1;
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/channelmix-ops.c -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/channelmix-ops.c
Changed
@@ -37,9 +37,6 @@ #include "channelmix-ops.h" #include "hilbert.h" -#undef SPA_LOG_TOPIC_DEFAULT -#define SPA_LOG_TOPIC_DEFAULT log_topic -struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.channelmix"); #define _M(ch) (1UL << SPA_AUDIO_CHANNEL_ ## ch) #define MASK_MONO _M(FC)|_M(MONO)|_M(UNKNOWN) @@ -55,6 +52,9 @@ typedef void (*channelmix_func_t) (struct channelmix *mix, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, uint32_t n_samples); +#define MAKE(sc,sm,dc,dm,func,...) \ + { sc, sm, dc, dm, func, #func, __VA_ARGS__ } + static const struct channelmix_info { uint32_t src_chan; uint64_t src_mask; @@ -62,50 +62,53 @@ uint64_t dst_mask; channelmix_func_t process; - uint32_t cpu_flags; const char *name; + + uint32_t cpu_flags; } channelmix_table = { #if defined (HAVE_SSE) - { 2, MASK_MONO, 2, MASK_MONO, channelmix_copy_sse, SPA_CPU_FLAG_SSE, "copy_sse" }, - { 2, MASK_STEREO, 2, MASK_STEREO, channelmix_copy_sse, SPA_CPU_FLAG_SSE, "copy_sse" }, - { EQ, 0, EQ, 0, channelmix_copy_sse, SPA_CPU_FLAG_SSE, "copy_sse" }, + MAKE(2, MASK_MONO, 2, MASK_MONO, channelmix_copy_sse, SPA_CPU_FLAG_SSE), + MAKE(2, MASK_STEREO, 2, MASK_STEREO, channelmix_copy_sse, SPA_CPU_FLAG_SSE), + MAKE(EQ, 0, EQ, 0, channelmix_copy_sse, SPA_CPU_FLAG_SSE), #endif - { 2, MASK_MONO, 2, MASK_MONO, channelmix_copy_c, 0, "copy_c" }, - { 2, MASK_STEREO, 2, MASK_STEREO, channelmix_copy_c, 0, "copy_c" }, - { EQ, 0, EQ, 0, channelmix_copy_c, 0 }, - - { 1, MASK_MONO, 2, MASK_STEREO, channelmix_f32_1_2_c, 0, "f32_1_2_c" }, - { 2, MASK_STEREO, 1, MASK_MONO, channelmix_f32_2_1_c, 0, "f32_2_1_c" }, - { 4, MASK_QUAD, 1, MASK_MONO, channelmix_f32_4_1_c, 0, "f32_4_1_c" }, - { 4, MASK_3_1, 1, MASK_MONO, channelmix_f32_4_1_c, 0, "f32_4_1_c" }, + MAKE(2, MASK_MONO, 2, MASK_MONO, channelmix_copy_c), + MAKE(2, MASK_STEREO, 2, MASK_STEREO, channelmix_copy_c), + MAKE(EQ, 0, EQ, 0, channelmix_copy_c), + + MAKE(1, MASK_MONO, 2, MASK_STEREO, channelmix_f32_1_2_c), + MAKE(2, MASK_STEREO, 1, MASK_MONO, channelmix_f32_2_1_c), + MAKE(4, MASK_QUAD, 1, MASK_MONO, channelmix_f32_4_1_c), + MAKE(4, MASK_3_1, 1, MASK_MONO, channelmix_f32_4_1_c), + MAKE(2, MASK_STEREO, 4, MASK_QUAD, channelmix_f32_2_4_c), + MAKE(2, MASK_STEREO, 4, MASK_3_1, channelmix_f32_2_3p1_c), + MAKE(2, MASK_STEREO, 6, MASK_5_1, channelmix_f32_2_5p1_c), + MAKE(2, MASK_STEREO, 8, MASK_7_1, channelmix_f32_2_7p1_c), #if defined (HAVE_SSE) - { 2, MASK_STEREO, 4, MASK_QUAD, channelmix_f32_2_4_sse, SPA_CPU_FLAG_SSE, "f32_2_4_sse" }, + MAKE(4, MASK_3_1, 2, MASK_STEREO, channelmix_f32_3p1_2_sse, SPA_CPU_FLAG_SSE), #endif - { 2, MASK_STEREO, 4, MASK_QUAD, channelmix_f32_2_4_c, 0, "f32_2_4_c" }, - { 2, MASK_STEREO, 4, MASK_3_1, channelmix_f32_2_3p1_c, 0, "f32_2_3p1_c" }, - { 2, MASK_STEREO, 6, MASK_5_1, channelmix_f32_2_5p1_c, 0, "f32_2_5p1_c" }, - { 2, MASK_STEREO, 8, MASK_7_1, channelmix_f32_2_7p1_c, 0, "f32_2_7p1_c" }, + MAKE(4, MASK_3_1, 2, MASK_STEREO, channelmix_f32_3p1_2_c), #if defined (HAVE_SSE) - { 6, MASK_5_1, 2, MASK_STEREO, channelmix_f32_5p1_2_sse, SPA_CPU_FLAG_SSE, "f32_5p1_2_sse" }, + MAKE(6, MASK_5_1, 2, MASK_STEREO, channelmix_f32_5p1_2_sse, SPA_CPU_FLAG_SSE), #endif - { 6, MASK_5_1, 2, MASK_STEREO, channelmix_f32_5p1_2_c, 0, "f32_5p1_2_c" }, + MAKE(6, MASK_5_1, 2, MASK_STEREO, channelmix_f32_5p1_2_c), #if defined (HAVE_SSE) - { 6, MASK_5_1, 4, MASK_QUAD, channelmix_f32_5p1_4_sse, SPA_CPU_FLAG_SSE, "f32_5p1_4_sse" }, + MAKE(6, MASK_5_1, 4, MASK_QUAD, channelmix_f32_5p1_4_sse, SPA_CPU_FLAG_SSE), #endif - { 6, MASK_5_1, 4, MASK_QUAD, channelmix_f32_5p1_4_c, 0, "f32_5p1_4_c" }, + MAKE(6, MASK_5_1, 4, MASK_QUAD, channelmix_f32_5p1_4_c), #if defined (HAVE_SSE) - { 6, MASK_5_1, 4, MASK_3_1, channelmix_f32_5p1_3p1_sse, SPA_CPU_FLAG_SSE, "f32_5p1_3p1_sse" }, + MAKE(6, MASK_5_1, 4, MASK_3_1, channelmix_f32_5p1_3p1_sse, SPA_CPU_FLAG_SSE), #endif - { 6, MASK_5_1, 4, MASK_3_1, channelmix_f32_5p1_3p1_c, 0, "f32_5p1_3p1_c" }, + MAKE(6, MASK_5_1, 4, MASK_3_1, channelmix_f32_5p1_3p1_c), - { 8, MASK_7_1, 2, MASK_STEREO, channelmix_f32_7p1_2_c, 0, "f32_7p1_2_c" }, - { 8, MASK_7_1, 4, MASK_QUAD, channelmix_f32_7p1_4_c, 0, "f32_7p1_4_c" }, - { 8, MASK_7_1, 4, MASK_3_1, channelmix_f32_7p1_3p1_c, 0, "f32_7p1_3p1_c" }, + MAKE(8, MASK_7_1, 2, MASK_STEREO, channelmix_f32_7p1_2_c), + MAKE(8, MASK_7_1, 4, MASK_QUAD, channelmix_f32_7p1_4_c), + MAKE(8, MASK_7_1, 4, MASK_3_1, channelmix_f32_7p1_3p1_c), - { ANY, 0, ANY, 0, channelmix_f32_n_m_c, 0, "f32_n_m_c" }, + MAKE(ANY, 0, ANY, 0, channelmix_f32_n_m_c), }; +#undef MAKE #define MATCH_CHAN(a,b) ((a) == ANY || (a) == (b)) #define MATCH_CPU_FLAGS(a,b) ((a) == 0 || ((a) & (b)) == a) @@ -426,8 +429,8 @@ _MATRIX(SR,RR) += 1.0f; } else if ((src_mask & STEREO) == STEREO) { spa_log_debug(mix->log, "produce SIDE from STEREO"); - _MATRIX(SL,FL) += 1.0f; - _MATRIX(SR,FR) += 1.0f; + _MATRIX(SL,FL) += slev; + _MATRIX(SR,FR) += slev; } else if ((src_mask & FRONT) == FRONT) { spa_log_debug(mix->log, "produce SIDE from FC"); _MATRIX(SL,FC) += clev; @@ -441,8 +444,8 @@ _MATRIX(RR,SR) += 1.0f; } else if ((src_mask & STEREO) == STEREO) { spa_log_debug(mix->log, "produce REAR from STEREO"); - _MATRIX(RL,FL) += 1.0f; - _MATRIX(RR,FR) += 1.0f; + _MATRIX(RL,FL) += slev; + _MATRIX(RR,FR) += slev; } else if ((src_mask & FRONT) == FRONT) { spa_log_debug(mix->log, "produce REAR from FC"); _MATRIX(RL,FC) += clev; @@ -551,6 +554,10 @@ { const struct channelmix_info *info; + if (mix->src_chan > SPA_AUDIO_MAX_CHANNELS || + mix->dst_chan > SPA_AUDIO_MAX_CHANNELS) + return -EINVAL; + info = find_channelmix_info(mix->src_chan, mix->src_mask, mix->dst_chan, mix->dst_mask, mix->cpu_flags); if (info == NULL) @@ -561,6 +568,7 @@ mix->set_volume = impl_channelmix_set_volume; mix->cpu_flags = info->cpu_flags; mix->delay = mix->rear_delay * mix->freq / 1000.0f; + mix->func_name = info->name; spa_log_debug(mix->log, "selected %s delay:%d options:%08x", info->name, mix->delay, mix->options);
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/channelmix-ops.h -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/channelmix-ops.h
Changed
@@ -29,10 +29,6 @@ #include <spa/utils/string.h> #include <spa/param/audio/raw.h> -#undef SPA_LOG_TOPIC_DEFAULT -#define SPA_LOG_TOPIC_DEFAULT log_topic -extern struct spa_log_topic *log_topic; - #include "crossover.h" #include "delay.h" @@ -48,8 +44,6 @@ #define MASK_7_1 _M(FL)|_M(FR)|_M(FC)|_M(LFE)|_M(SL)|_M(SR)|_M(RL)|_M(RR) #define BUFFER_SIZE 4096 - -#define BUFFER_SIZE 4096 #define MAX_TAPS 255 struct channelmix { @@ -62,12 +56,13 @@ #define CHANNELMIX_OPTION_NORMALIZE (1<<1) /**< normalize volumes */ #define CHANNELMIX_OPTION_UPMIX (1<<2) /**< do simple upmixing */ uint32_t options; -#define CHANNELMIX_UPMIX_NONE (0) /**< disable upmixing */ -#define CHANNELMIX_UPMIX_SIMPLE (1) /**< simple upmixing */ -#define CHANNELMIX_UPMIX_PSD (2) /**< Passive Surround Decoding upmixing */ +#define CHANNELMIX_UPMIX_NONE 0 /**< disable upmixing */ +#define CHANNELMIX_UPMIX_SIMPLE 1 /**< simple upmixing */ +#define CHANNELMIX_UPMIX_PSD 2 /**< Passive Surround Decoding upmixing */ uint32_t upmix; struct spa_log *log; + const char *func_name; #define CHANNELMIX_FLAG_ZERO (1<<0) /**< all zero components */ #define CHANNELMIX_FLAG_IDENTITY (1<<1) /**< identity matrix */ @@ -142,6 +137,7 @@ DEFINE_FUNCTION(f32_2_3p1, c); DEFINE_FUNCTION(f32_2_5p1, c); DEFINE_FUNCTION(f32_2_7p1, c); +DEFINE_FUNCTION(f32_3p1_2, c); DEFINE_FUNCTION(f32_5p1_2, c); DEFINE_FUNCTION(f32_5p1_3p1, c); DEFINE_FUNCTION(f32_5p1_4, c); @@ -151,9 +147,11 @@ #if defined (HAVE_SSE) DEFINE_FUNCTION(copy, sse); -DEFINE_FUNCTION(f32_2_4, sse); +DEFINE_FUNCTION(f32_3p1_2, sse); DEFINE_FUNCTION(f32_5p1_2, sse); DEFINE_FUNCTION(f32_5p1_3p1, sse); DEFINE_FUNCTION(f32_5p1_4, sse); DEFINE_FUNCTION(f32_7p1_4, sse); #endif + +#undef DEFINE_FUNCTION
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/fmt-ops-avx2.c -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/fmt-ops-avx2.c
Changed
@@ -41,7 +41,7 @@ const int16_t *s = src; float *d0 = dst0; uint32_t n, unrolled; - __m256i in; + __m256i in = _mm256_setzero_si256(); __m256 out, factor = _mm256_set1_ps(1.0f / S16_SCALE); if (SPA_LIKELY(SPA_IS_ALIGNED(d0, 32))) @@ -67,7 +67,7 @@ } for(; n < n_samples; n++) { __m128 out, factor = _mm_set1_ps(1.0f / S16_SCALE); - out = _mm_cvtsi32_ss(out, s0); + out = _mm_cvtsi32_ss(factor, s0); out = _mm_mul_ss(out, factor); _mm_store_ss(&d0n, out); s += n_channels; @@ -133,9 +133,9 @@ } for(; n < n_samples; n++) { __m128 out4, factor = _mm_set1_ps(1.0f / S16_SCALE); - out0 = _mm_cvtsi32_ss(out0, s0); + out0 = _mm_cvtsi32_ss(factor, s0); out0 = _mm_mul_ss(out0, factor); - out1 = _mm_cvtsi32_ss(out1, s1); + out1 = _mm_cvtsi32_ss(factor, s1); out1 = _mm_mul_ss(out1, factor); _mm_store_ss(&d0n, out0); _mm_store_ss(&d1n, out1); @@ -175,7 +175,7 @@ s += 12 * n_channels; } for(; n < n_samples; n++) { - out = _mm_cvtsi32_ss(out, read_s24(s)); + out = _mm_cvtsi32_ss(factor, read_s24(s)); out = _mm_mul_ss(out, factor); _mm_store_ss(&d0n, out); s += 3 * n_channels; @@ -232,8 +232,8 @@ s += 12 * n_channels; } for(; n < n_samples; n++) { - out0 = _mm_cvtsi32_ss(out0, read_s24(s)); - out1 = _mm_cvtsi32_ss(out1, read_s24(s+3)); + out0 = _mm_cvtsi32_ss(factor, read_s24(s)); + out1 = _mm_cvtsi32_ss(factor, read_s24(s+3)); out0 = _mm_mul_ss(out0, factor); out1 = _mm_mul_ss(out1, factor); _mm_store_ss(&d0n, out0); @@ -313,10 +313,10 @@ s += 12 * n_channels; } for(; n < n_samples; n++) { - out0 = _mm_cvtsi32_ss(out0, read_s24(s)); - out1 = _mm_cvtsi32_ss(out1, read_s24(s+3)); - out2 = _mm_cvtsi32_ss(out2, read_s24(s+6)); - out3 = _mm_cvtsi32_ss(out3, read_s24(s+9)); + out0 = _mm_cvtsi32_ss(factor, read_s24(s)); + out1 = _mm_cvtsi32_ss(factor, read_s24(s+3)); + out2 = _mm_cvtsi32_ss(factor, read_s24(s+6)); + out3 = _mm_cvtsi32_ss(factor, read_s24(s+9)); out0 = _mm_mul_ss(out0, factor); out1 = _mm_mul_ss(out1, factor); out2 = _mm_mul_ss(out2, factor); @@ -406,10 +406,10 @@ } for(; n < n_samples; n++) { __m128 out4, factor = _mm_set1_ps(1.0f / S24_SCALE); - out0 = _mm_cvtsi32_ss(out0, s0>>8); - out1 = _mm_cvtsi32_ss(out1, s1>>8); - out2 = _mm_cvtsi32_ss(out2, s2>>8); - out3 = _mm_cvtsi32_ss(out3, s3>>8); + out0 = _mm_cvtsi32_ss(factor, s0>>8); + out1 = _mm_cvtsi32_ss(factor, s1>>8); + out2 = _mm_cvtsi32_ss(factor, s2>>8); + out3 = _mm_cvtsi32_ss(factor, s3>>8); out0 = _mm_mul_ss(out0, factor); out1 = _mm_mul_ss(out1, factor); out2 = _mm_mul_ss(out2, factor); @@ -467,8 +467,8 @@ } for(; n < n_samples; n++) { __m128 out2, factor = _mm_set1_ps(1.0f / S24_SCALE); - out0 = _mm_cvtsi32_ss(out0, s0>>8); - out1 = _mm_cvtsi32_ss(out1, s1>>8); + out0 = _mm_cvtsi32_ss(factor, s0>>8); + out1 = _mm_cvtsi32_ss(factor, s1>>8); out0 = _mm_mul_ss(out0, factor); out1 = _mm_mul_ss(out1, factor); _mm_store_ss(&d0n, out0); @@ -518,7 +518,7 @@ } for(; n < n_samples; n++) { __m128 out, factor = _mm_set1_ps(1.0f / S24_SCALE); - out = _mm_cvtsi32_ss(out, s0>>8); + out = _mm_cvtsi32_ss(factor, s0>>8); out = _mm_mul_ss(out, factor); _mm_store_ss(&d0n, out); s += n_channels; @@ -550,7 +550,7 @@ __m128 in1; __m128i out4; __m128 scale = _mm_set1_ps(S32_SCALE); - __m128 int_min = _mm_set1_ps(S32_MIN); + __m128 int_max = _mm_set1_ps(S32_MAX); if (SPA_IS_ALIGNED(s0, 16)) unrolled = n_samples & ~3; @@ -559,7 +559,7 @@ for(n = 0; n < unrolled; n += 4) { in0 = _mm_mul_ps(_mm_load_ps(&s0n), scale); - in0 = _mm_min_ps(in0, int_min); + in0 = _mm_min_ps(in0, int_max); out0 = _mm_cvtps_epi32(in0); out1 = _mm_shuffle_epi32(out0, _MM_SHUFFLE(0, 3, 2, 1)); out2 = _mm_shuffle_epi32(out0, _MM_SHUFFLE(1, 0, 3, 2)); @@ -574,7 +574,7 @@ for(; n < n_samples; n++) { in0 = _mm_load_ss(&s0n); in0 = _mm_mul_ss(in0, scale); - in0 = _mm_min_ss(in0, int_min); + in0 = _mm_min_ss(in0, int_max); *d = _mm_cvtss_si32(in0); d += n_channels; } @@ -590,7 +590,7 @@ __m256 in2; __m256i out2, t2; __m256 scale = _mm256_set1_ps(S32_SCALE); - __m256 int_min = _mm256_set1_ps(S32_MIN); + __m256 int_max = _mm256_set1_ps(S32_MAX); if (SPA_IS_ALIGNED(s0, 32) && SPA_IS_ALIGNED(s1, 32)) @@ -602,8 +602,8 @@ in0 = _mm256_mul_ps(_mm256_load_ps(&s0n), scale); in1 = _mm256_mul_ps(_mm256_load_ps(&s1n), scale); - in0 = _mm256_min_ps(in0, int_min); - in1 = _mm256_min_ps(in1, int_min); + in0 = _mm256_min_ps(in0, int_max); + in1 = _mm256_min_ps(in1, int_max); out0 = _mm256_cvtps_epi32(in0); /* a0 a1 a2 a3 a4 a5 a6 a7 */ out1 = _mm256_cvtps_epi32(in1); /* b0 b1 b2 b3 b4 b5 b6 b7 */ @@ -636,7 +636,7 @@ __m128 in2; __m128i out2; __m128 scale = _mm_set1_ps(S32_SCALE); - __m128 int_min = _mm_set1_ps(S32_MIN); + __m128 int_max = _mm_set1_ps(S32_MAX); in0 = _mm_load_ss(&s0n); in1 = _mm_load_ss(&s1n); @@ -644,7 +644,7 @@ in0 = _mm_unpacklo_ps(in0, in1); in0 = _mm_mul_ps(in0, scale); - in0 = _mm_min_ps(in0, int_min); + in0 = _mm_min_ps(in0, int_max); out0 = _mm_cvtps_epi32(in0); _mm_storel_epi64((__m128i*)d, out0); d += n_channels; @@ -661,7 +661,7 @@ __m256 in4; __m256i out4, t4; __m256 scale = _mm256_set1_ps(S32_SCALE); - __m256 int_min = _mm256_set1_ps(S32_MIN); + __m256 int_max = _mm256_set1_ps(S32_MAX); if (SPA_IS_ALIGNED(s0, 32) && SPA_IS_ALIGNED(s1, 32) && @@ -677,10 +677,10 @@ in2 = _mm256_mul_ps(_mm256_load_ps(&s2n), scale); in3 = _mm256_mul_ps(_mm256_load_ps(&s3n), scale); - in0 = _mm256_min_ps(in0, int_min); - in1 = _mm256_min_ps(in1, int_min); - in2 = _mm256_min_ps(in2, int_min); - in3 = _mm256_min_ps(in3, int_min); + in0 = _mm256_min_ps(in0, int_max); + in1 = _mm256_min_ps(in1, int_max); + in2 = _mm256_min_ps(in2, int_max); + in3 = _mm256_min_ps(in3, int_max); out0 = _mm256_cvtps_epi32(in0); /* a0 a1 a2 a3 a4 a5 a6 a7 */ out1 = _mm256_cvtps_epi32(in1); /* b0 b1 b2 b3 b4 b5 b6 b7 */ @@ -711,7 +711,7 @@ __m128 in4; __m128i out4; __m128 scale = _mm_set1_ps(S32_SCALE); - __m128 int_min = _mm_set1_ps(S32_MIN); + __m128 int_max = _mm_set1_ps(S32_MAX); in0 = _mm_load_ss(&s0n); in1 = _mm_load_ss(&s1n); @@ -723,7 +723,7 @@ in0 = _mm_unpacklo_ps(in0, in1);
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/fmt-ops-c.c -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/fmt-ops-c.c
Changed
@@ -736,6 +736,43 @@ } } +static inline int32_t +lcnoise(uint32_t *state) +{ + *state = (*state * 96314165) + 907633515; + return (int32_t)(*state); +} + +static inline void update_dither_c(struct convert *conv, uint32_t n_samples) +{ + uint32_t n; + float *dither = conv->dither, scale = conv->scale; + uint32_t *state = &conv->random0; + + for (n = 0; n < n_samples; n++) + dithern = lcnoise(state) * scale; +} + +#define SHAPER5(type,s,scale,offs,sh,min,max,d) \ +({ \ + type t; \ + float v = s * scale + offs + \ + - sh->eidx * 2.033f \ + + sh->e(idx - 1) & NS_MASK * 2.165f \ + - sh->e(idx - 2) & NS_MASK * 1.959f \ + + sh->e(idx - 3) & NS_MASK * 1.590f \ + - sh->e(idx - 4) & NS_MASK * 0.6149f; \ + t = (type)SPA_CLAMP(v + d, min, max); \ + idx = (idx + 1) & NS_MASK; \ + sh->eidx = t - v; \ + t; \ +}) + +#define F32_TO_U8_SH(s,sh,d) SHAPER5(uint8_t, s, U8_SCALE, U8_OFFS, sh, U8_MIN, U8_MAX, d) +#define F32_TO_S8_SH(s,sh,d) SHAPER5(int8_t, s, S8_SCALE, 0, sh, S8_MIN, S8_MAX, d) +#define F32_TO_S16_SH(s,sh,d) SHAPER5(int16_t, s, S16_SCALE, 0, sh, S16_MIN, S16_MAX, d) +#define F32_TO_S16S_SH(s,sh,d) bswap_16(F32_TO_S16_SH(s,sh,d)) + void conv_f32d_to_u8d_c(struct convert *conv, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, uint32_t n_samples) @@ -752,6 +789,51 @@ } void +conv_f32d_to_u8d_dither_c(struct convert *conv, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, + uint32_t n_samples) +{ + uint32_t i, j, k, chunk, n_channels = conv->n_channels, dither_size = conv->dither_size; + float *dither = conv->dither; + + update_dither_c(conv, SPA_MIN(n_samples, dither_size)); + + for (i = 0; i < n_channels; i++) { + const float *s = srci; + uint8_t *d = dsti; + + for (j = 0; j < n_samples;) { + chunk = SPA_MIN(n_samples - j, dither_size); + for (k = 0; k < chunk; k++, j++) + dj = F32_TO_U8_D(sj, ditherk); + } + } +} + +void +conv_f32d_to_u8d_shaped_c(struct convert *conv, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, + uint32_t n_samples) +{ + uint32_t i, j, k, chunk, n_channels = conv->n_channels, dither_size = conv->dither_size; + float *dither = conv->dither; + + update_dither_c(conv, SPA_MIN(n_samples, dither_size)); + + for (i = 0; i < n_channels; i++) { + const float *s = srci; + uint8_t *d = dsti; + struct shaper *sh = &conv->shaperi; + uint32_t idx = sh->idx; + + for (j = 0; j < n_samples;) { + chunk = SPA_MIN(n_samples - j, dither_size); + for (k = 0; k < chunk; k++, j++) + dj = F32_TO_U8_SH(sj, sh, ditherk); + } + sh->idx = idx; + } +} + +void conv_f32_to_u8_c(struct convert *conv, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, uint32_t n_samples) { @@ -794,6 +876,51 @@ } void +conv_f32d_to_u8_dither_c(struct convert *conv, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, + uint32_t n_samples) +{ + const float **s = (const float **) src; + uint8_t *d = dst0; + uint32_t i, j, k, chunk, n_channels = conv->n_channels, dither_size = conv->dither_size; + float *dither = conv->dither; + + update_dither_c(conv, SPA_MIN(n_samples, dither_size)); + + for (j = 0; j < n_samples;) { + chunk = SPA_MIN(n_samples - j, dither_size); + for (k = 0; k < chunk; k++, j++) { + for (i = 0; i < n_channels; i++) + *d++ = F32_TO_U8_D(sij, ditherk); + } + } +} + +void +conv_f32d_to_u8_shaped_c(struct convert *conv, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, + uint32_t n_samples) +{ + uint8_t *d0 = dst0; + uint32_t i, j, k, chunk, n_channels = conv->n_channels, dither_size = conv->dither_size; + float *dither = conv->dither; + + update_dither_c(conv, SPA_MIN(n_samples, dither_size)); + + for (i = 0; i < n_channels; i++) { + const float *s = srci; + uint8_t *d = &d0i; + struct shaper *sh = &conv->shaperi; + uint32_t idx = sh->idx; + + for (j = 0; j < n_samples;) { + chunk = SPA_MIN(n_samples - j, dither_size); + for (k = 0; k < chunk; k++, j++) + dj * n_channels = F32_TO_U8_SH(sj, sh, ditherk); + } + sh->idx = idx; + } +} + +void conv_f32d_to_s8d_c(struct convert *conv, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, uint32_t n_samples) { @@ -809,6 +936,51 @@ } void +conv_f32d_to_s8d_dither_c(struct convert *conv, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, + uint32_t n_samples) +{ + uint32_t i, j, k, chunk, n_channels = conv->n_channels, dither_size = conv->dither_size; + float *dither = conv->dither; + + update_dither_c(conv, SPA_MIN(n_samples, dither_size)); + + for (i = 0; i < n_channels; i++) { + const float *s = srci; + int8_t *d = dsti; + + for (j = 0; j < n_samples;) { + chunk = SPA_MIN(n_samples - j, dither_size); + for (k = 0; k < chunk; k++, j++) + dj = F32_TO_S8_D(sj, ditherk); + } + } +} + +void +conv_f32d_to_s8d_shaped_c(struct convert *conv, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, + uint32_t n_samples) +{ + uint32_t i, j, k, chunk, n_channels = conv->n_channels, dither_size = conv->dither_size; + float *dither = conv->dither; + + update_dither_c(conv, SPA_MIN(n_samples, dither_size)); + + for (i = 0; i < n_channels; i++) { + const float *s = srci; + int8_t *d = dsti; + struct shaper *sh = &conv->shaperi; + uint32_t idx = sh->idx; + + for (j = 0; j < n_samples;) { + chunk = SPA_MIN(n_samples - j, dither_size); + for (k = 0; k < chunk; k++, j++) + dj = F32_TO_S8_SH(sj, sh, ditherk); + } + sh->idx = idx; + } +} + +void conv_f32_to_s8_c(struct convert *conv, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, uint32_t n_samples) {
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/fmt-ops-sse2.c -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/fmt-ops-sse2.c
Changed
@@ -33,7 +33,7 @@ const int16_t *s = src; float *d0 = dst0; uint32_t n, unrolled; - __m128i in; + __m128i in = _mm_setzero_si128(); __m128 out, factor = _mm_set1_ps(1.0f / S16_SCALE); if (SPA_LIKELY(SPA_IS_ALIGNED(d0, 16))) @@ -53,7 +53,7 @@ s += 4*n_channels; } for(; n < n_samples; n++) { - out = _mm_cvtsi32_ss(out, s0); + out = _mm_cvtsi32_ss(factor, s0); out = _mm_mul_ss(out, factor); _mm_store_ss(&d0n, out); s += n_channels; @@ -118,9 +118,9 @@ s += 16; } for(; n < n_samples; n++) { - out0 = _mm_cvtsi32_ss(out0, s0); + out0 = _mm_cvtsi32_ss(factor, s0); out0 = _mm_mul_ss(out0, factor); - out1 = _mm_cvtsi32_ss(out1, s1); + out1 = _mm_cvtsi32_ss(factor, s1); out1 = _mm_mul_ss(out1, factor); _mm_store_ss(&d0n, out0); _mm_store_ss(&d1n, out1); @@ -160,7 +160,7 @@ s += 12 * n_channels; } for(; n < n_samples; n++) { - out = _mm_cvtsi32_ss(out, read_s24(s)); + out = _mm_cvtsi32_ss(factor, read_s24(s)); out = _mm_mul_ss(out, factor); _mm_store_ss(&d0n, out); s += 3 * n_channels; @@ -217,8 +217,8 @@ s += 12 * n_channels; } for(; n < n_samples; n++) { - out0 = _mm_cvtsi32_ss(out0, read_s24(s)); - out1 = _mm_cvtsi32_ss(out1, read_s24(s+3)); + out0 = _mm_cvtsi32_ss(factor, read_s24(s)); + out1 = _mm_cvtsi32_ss(factor, read_s24(s+3)); out0 = _mm_mul_ss(out0, factor); out1 = _mm_mul_ss(out1, factor); _mm_store_ss(&d0n, out0); @@ -298,10 +298,10 @@ s += 12 * n_channels; } for(; n < n_samples; n++) { - out0 = _mm_cvtsi32_ss(out0, read_s24(s)); - out1 = _mm_cvtsi32_ss(out1, read_s24(s+3)); - out2 = _mm_cvtsi32_ss(out2, read_s24(s+6)); - out3 = _mm_cvtsi32_ss(out3, read_s24(s+9)); + out0 = _mm_cvtsi32_ss(factor, read_s24(s)); + out1 = _mm_cvtsi32_ss(factor, read_s24(s+3)); + out2 = _mm_cvtsi32_ss(factor, read_s24(s+6)); + out3 = _mm_cvtsi32_ss(factor, read_s24(s+9)); out0 = _mm_mul_ss(out0, factor); out1 = _mm_mul_ss(out1, factor); out2 = _mm_mul_ss(out2, factor); @@ -357,7 +357,7 @@ s += 4*n_channels; } for(; n < n_samples; n++) { - out = _mm_cvtsi32_ss(out, s0>>8); + out = _mm_cvtsi32_ss(factor, s0>>8); out = _mm_mul_ss(out, factor); _mm_store_ss(&d0n, out); s += n_channels; @@ -385,7 +385,7 @@ __m128 in1; __m128i out4; __m128 scale = _mm_set1_ps(S32_SCALE); - __m128 int_min = _mm_set1_ps(S32_MIN); + __m128 int_max = _mm_set1_ps(S32_MAX); if (SPA_IS_ALIGNED(s0, 16)) unrolled = n_samples & ~3; @@ -394,7 +394,7 @@ for(n = 0; n < unrolled; n += 4) { in0 = _mm_mul_ps(_mm_load_ps(&s0n), scale); - in0 = _mm_min_ps(in0, int_min); + in0 = _mm_min_ps(in0, int_max); out0 = _mm_cvtps_epi32(in0); out1 = _mm_shuffle_epi32(out0, _MM_SHUFFLE(0, 3, 2, 1)); out2 = _mm_shuffle_epi32(out0, _MM_SHUFFLE(1, 0, 3, 2)); @@ -409,7 +409,7 @@ for(; n < n_samples; n++) { in0 = _mm_load_ss(&s0n); in0 = _mm_mul_ss(in0, scale); - in0 = _mm_min_ss(in0, int_min); + in0 = _mm_min_ss(in0, int_max); *d = _mm_cvtss_si32(in0); d += n_channels; } @@ -425,7 +425,7 @@ __m128 in2; __m128i out2, t2; __m128 scale = _mm_set1_ps(S32_SCALE); - __m128 int_min = _mm_set1_ps(S32_MIN); + __m128 int_max = _mm_set1_ps(S32_MAX); if (SPA_IS_ALIGNED(s0, 16) && SPA_IS_ALIGNED(s1, 16)) @@ -437,8 +437,8 @@ in0 = _mm_mul_ps(_mm_load_ps(&s0n), scale); in1 = _mm_mul_ps(_mm_load_ps(&s1n), scale); - in0 = _mm_min_ps(in0, int_min); - in1 = _mm_min_ps(in1, int_min); + in0 = _mm_min_ps(in0, int_max); + in1 = _mm_min_ps(in1, int_max); out0 = _mm_cvtps_epi32(in0); out1 = _mm_cvtps_epi32(in1); @@ -459,7 +459,7 @@ in0 = _mm_unpacklo_ps(in0, in1); in0 = _mm_mul_ps(in0, scale); - in0 = _mm_min_ps(in0, int_min); + in0 = _mm_min_ps(in0, int_max); out0 = _mm_cvtps_epi32(in0); _mm_storel_epi64((__m128i*)d, out0); d += n_channels; @@ -476,7 +476,7 @@ __m128 in4; __m128i out4; __m128 scale = _mm_set1_ps(S32_SCALE); - __m128 int_min = _mm_set1_ps(S32_MIN); + __m128 int_max = _mm_set1_ps(S32_MAX); if (SPA_IS_ALIGNED(s0, 16) && SPA_IS_ALIGNED(s1, 16) && @@ -492,10 +492,10 @@ in2 = _mm_mul_ps(_mm_load_ps(&s2n), scale); in3 = _mm_mul_ps(_mm_load_ps(&s3n), scale); - in0 = _mm_min_ps(in0, int_min); - in1 = _mm_min_ps(in1, int_min); - in2 = _mm_min_ps(in2, int_min); - in3 = _mm_min_ps(in3, int_min); + in0 = _mm_min_ps(in0, int_max); + in1 = _mm_min_ps(in1, int_max); + in2 = _mm_min_ps(in2, int_max); + in3 = _mm_min_ps(in3, int_max); _MM_TRANSPOSE4_PS(in0, in1, in2, in3); @@ -521,7 +521,7 @@ in0 = _mm_unpacklo_ps(in0, in1); in0 = _mm_mul_ps(in0, scale); - in0 = _mm_min_ps(in0, int_min); + in0 = _mm_min_ps(in0, int_max); out0 = _mm_cvtps_epi32(in0); _mm_storeu_si128((__m128i*)d, out0); d += n_channels; @@ -543,6 +543,92 @@ conv_f32d_to_s32_1s_sse2(conv, &di, &srci, n_channels, n_samples); } +static inline void update_dither_sse2(struct convert *conv, uint32_t n_samples) +{ + uint32_t n; + const uint32_t *r = SPA_PTR_ALIGN(conv->random, 16, uint32_t); + float *dither = SPA_PTR_ALIGN(conv->dither, 16, float); + __m128 scale = _mm_set1_ps(conv->scale), out1; + __m128i in1, t1; + + for (n = 0; n < n_samples; n += 4) { + /* 32 bit xorshift PRNG, see https://en.wikipedia.org/wiki/Xorshift */ + in0 = _mm_load_si128((__m128i*)r); + t0 = _mm_slli_epi32(in0, 13); + in0 = _mm_xor_si128(in0, t0); + t0 = _mm_srli_epi32(in0, 17); + in0 = _mm_xor_si128(in0, t0); + t0 = _mm_slli_epi32(in0, 5); + in0 = _mm_xor_si128(in0, t0); + _mm_store_si128((__m128i*)r, in0); + + out0 = _mm_cvtepi32_ps(in0); + out0 = _mm_mul_ps(out0, scale); + _mm_store_ps(&dithern, out0); + } +} + +static void +conv_f32d_to_s32_1s_dither_sse2(struct convert *conv, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, + uint32_t n_channels, uint32_t n_samples) +{ + const float *s = src; + float *dither = SPA_PTR_ALIGN(conv->dither, 16, float); + int32_t *d = dst; + uint32_t n, unrolled;
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/fmt-ops-sse41.c -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/fmt-ops-sse41.c
Changed
@@ -33,7 +33,7 @@ const uint8_t *s = src; float *d0 = dst0; uint32_t n, unrolled; - __m128i in; + __m128i in = _mm_setzero_si128(); __m128 out, factor = _mm_set1_ps(1.0f / S24_SCALE); if (SPA_IS_ALIGNED(d0, 16)) @@ -54,7 +54,7 @@ s += 12 * n_channels; } for(; n < n_samples; n++) { - out = _mm_cvtsi32_ss(out, read_s24(s)); + out = _mm_cvtsi32_ss(factor, read_s24(s)); out = _mm_mul_ss(out, factor); _mm_store_ss(&d0n, out); s += 3 * n_channels;
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/fmt-ops-ssse3.c -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/fmt-ops-ssse3.c
Changed
@@ -77,10 +77,10 @@ s += 12 * n_channels; } for(; n < n_samples; n++) { - out0 = _mm_cvtsi32_ss(out0, read_s24(s)); - out1 = _mm_cvtsi32_ss(out1, read_s24(s+3)); - out2 = _mm_cvtsi32_ss(out2, read_s24(s+6)); - out3 = _mm_cvtsi32_ss(out3, read_s24(s+9)); + out0 = _mm_cvtsi32_ss(factor, read_s24(s)); + out1 = _mm_cvtsi32_ss(factor, read_s24(s+3)); + out2 = _mm_cvtsi32_ss(factor, read_s24(s+6)); + out3 = _mm_cvtsi32_ss(factor, read_s24(s+9)); out0 = _mm_mul_ss(out0, factor); out1 = _mm_mul_ss(out1, factor); out2 = _mm_mul_ss(out2, factor);
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/fmt-ops.c -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/fmt-ops.c
Changed
@@ -32,6 +32,8 @@ #include "fmt-ops.h" +#define DITHER_SIZE (1<<10) + typedef void (*convert_func_t) (struct convert *conv, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, uint32_t n_samples); @@ -39,277 +41,316 @@ uint32_t src_fmt; uint32_t dst_fmt; uint32_t n_channels; - uint32_t cpu_flags; convert_func_t process; + const char *name; + + uint32_t cpu_flags; +#define CONV_DITHER (1<<0) +#define CONV_SHAPE (1<<1) + uint32_t dither_flags; }; +#define MAKE(fmt1,fmt2,chan,func,...) \ + { SPA_AUDIO_FORMAT_ ##fmt1, SPA_AUDIO_FORMAT_ ##fmt2, chan, func, #func , __VA_ARGS__ } + static struct conv_info conv_table = { /* to f32 */ - { SPA_AUDIO_FORMAT_U8, SPA_AUDIO_FORMAT_F32, 0, 0, conv_u8_to_f32_c }, - { SPA_AUDIO_FORMAT_U8P, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_u8d_to_f32d_c }, - { SPA_AUDIO_FORMAT_U8, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_u8_to_f32d_c }, - { SPA_AUDIO_FORMAT_U8P, SPA_AUDIO_FORMAT_F32, 0, 0, conv_u8d_to_f32_c }, + MAKE(U8, F32, 0, conv_u8_to_f32_c), + MAKE(U8, F32, 0, conv_u8_to_f32_c), + MAKE(U8P, F32P, 0, conv_u8d_to_f32d_c), + MAKE(U8, F32P, 0, conv_u8_to_f32d_c), + MAKE(U8P, F32, 0, conv_u8d_to_f32_c), - { SPA_AUDIO_FORMAT_S8, SPA_AUDIO_FORMAT_F32, 0, 0, conv_s8_to_f32_c }, - { SPA_AUDIO_FORMAT_S8P, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_s8d_to_f32d_c }, - { SPA_AUDIO_FORMAT_S8, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_s8_to_f32d_c }, - { SPA_AUDIO_FORMAT_S8P, SPA_AUDIO_FORMAT_F32, 0, 0, conv_s8d_to_f32_c }, + MAKE(S8, F32, 0, conv_s8_to_f32_c), + MAKE(S8P, F32P, 0, conv_s8d_to_f32d_c), + MAKE(S8, F32P, 0, conv_s8_to_f32d_c), + MAKE(S8P, F32, 0, conv_s8d_to_f32_c), - { SPA_AUDIO_FORMAT_ALAW, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_alaw_to_f32d_c }, - { SPA_AUDIO_FORMAT_ULAW, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_ulaw_to_f32d_c }, + MAKE(ALAW, F32P, 0, conv_alaw_to_f32d_c), + MAKE(ULAW, F32P, 0, conv_ulaw_to_f32d_c), - { SPA_AUDIO_FORMAT_U16, SPA_AUDIO_FORMAT_F32, 0, 0, conv_u16_to_f32_c }, - { SPA_AUDIO_FORMAT_U16, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_u16_to_f32d_c }, + MAKE(U16, F32, 0, conv_u16_to_f32_c), + MAKE(U16, F32P, 0, conv_u16_to_f32d_c), - { SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_F32, 0, 0, conv_s16_to_f32_c }, - { SPA_AUDIO_FORMAT_S16P, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_s16d_to_f32d_c }, + MAKE(S16, F32, 0, conv_s16_to_f32_c), + MAKE(S16P, F32P, 0, conv_s16d_to_f32d_c), #if defined (HAVE_NEON) - { SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_F32P, 2, SPA_CPU_FLAG_NEON, conv_s16_to_f32d_2_neon }, - { SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_F32P, 0, SPA_CPU_FLAG_NEON, conv_s16_to_f32d_neon }, + MAKE(S16, F32P, 2, conv_s16_to_f32d_2_neon, SPA_CPU_FLAG_NEON), + MAKE(S16, F32P, 0, conv_s16_to_f32d_neon, SPA_CPU_FLAG_NEON), #endif #if defined (HAVE_AVX2) - { SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_F32P, 2, SPA_CPU_FLAG_AVX2, conv_s16_to_f32d_2_avx2 }, - { SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_F32P, 0, SPA_CPU_FLAG_AVX2, conv_s16_to_f32d_avx2 }, + MAKE(S16, F32P, 2, conv_s16_to_f32d_2_avx2, SPA_CPU_FLAG_AVX2), + MAKE(S16, F32P, 0, conv_s16_to_f32d_avx2, SPA_CPU_FLAG_AVX2), #endif #if defined (HAVE_SSE2) - { SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_F32P, 2, SPA_CPU_FLAG_SSE2, conv_s16_to_f32d_2_sse2 }, - { SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_F32P, 0, SPA_CPU_FLAG_SSE2, conv_s16_to_f32d_sse2 }, + MAKE(S16, F32P, 2, conv_s16_to_f32d_2_sse2, SPA_CPU_FLAG_SSE2), + MAKE(S16, F32P, 0, conv_s16_to_f32d_sse2, SPA_CPU_FLAG_SSE2), #endif - { SPA_AUDIO_FORMAT_S16, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_s16_to_f32d_c }, - { SPA_AUDIO_FORMAT_S16P, SPA_AUDIO_FORMAT_F32, 0, 0, conv_s16d_to_f32_c }, + MAKE(S16, F32P, 0, conv_s16_to_f32d_c), + MAKE(S16P, F32, 0, conv_s16d_to_f32_c), - { SPA_AUDIO_FORMAT_S16_OE, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_s16s_to_f32d_c }, + MAKE(S16_OE, F32P, 0, conv_s16s_to_f32d_c), - { SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_F32, 0, 0, conv_copy32_c }, - { SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_copy32d_c }, + MAKE(F32, F32, 0, conv_copy32_c), + MAKE(F32P, F32P, 0, conv_copy32d_c), #if defined (HAVE_SSE2) - { SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_deinterleave_32_sse2 }, + MAKE(F32, F32P, 0, conv_deinterleave_32_sse2, SPA_CPU_FLAG_SSE2), #endif - { SPA_AUDIO_FORMAT_F32, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_deinterleave_32_c }, + MAKE(F32, F32P, 0, conv_deinterleave_32_c), #if defined (HAVE_SSE2) - { SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_F32, 0, 0, conv_interleave_32_sse2 }, + MAKE(F32P, F32, 0, conv_interleave_32_sse2, SPA_CPU_FLAG_SSE2), #endif - { SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_F32, 0, 0, conv_interleave_32_c }, + MAKE(F32P, F32, 0, conv_interleave_32_c), #if defined (HAVE_SSE2) - { SPA_AUDIO_FORMAT_F32_OE, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_deinterleave_32s_sse2 }, + MAKE(F32_OE, F32P, 0, conv_deinterleave_32s_sse2, SPA_CPU_FLAG_SSE2), #endif - { SPA_AUDIO_FORMAT_F32_OE, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_deinterleave_32s_c }, + MAKE(F32_OE, F32P, 0, conv_deinterleave_32s_c), #if defined (HAVE_SSE2) - { SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_F32_OE, 0, 0, conv_interleave_32s_sse2 }, + MAKE(F32P, F32_OE, 0, conv_interleave_32s_sse2, SPA_CPU_FLAG_SSE2), #endif - { SPA_AUDIO_FORMAT_F32P, SPA_AUDIO_FORMAT_F32_OE, 0, 0, conv_interleave_32s_c }, + MAKE(F32P, F32_OE, 0, conv_interleave_32s_c), - { SPA_AUDIO_FORMAT_U32, SPA_AUDIO_FORMAT_F32, 0, 0, conv_u32_to_f32_c }, - { SPA_AUDIO_FORMAT_U32, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_u32_to_f32d_c }, + MAKE(U32, F32, 0, conv_u32_to_f32_c), + MAKE(U32, F32P, 0, conv_u32_to_f32d_c), #if defined (HAVE_AVX2) - { SPA_AUDIO_FORMAT_S32, SPA_AUDIO_FORMAT_F32P, 0, SPA_CPU_FLAG_AVX2, conv_s32_to_f32d_avx2 }, + MAKE(S32, F32P, 0, conv_s32_to_f32d_avx2, SPA_CPU_FLAG_AVX2), #endif #if defined (HAVE_SSE2) - { SPA_AUDIO_FORMAT_S32, SPA_AUDIO_FORMAT_F32P, 0, SPA_CPU_FLAG_SSE2, conv_s32_to_f32d_sse2 }, + MAKE(S32, F32P, 0, conv_s32_to_f32d_sse2, SPA_CPU_FLAG_SSE2), #endif - { SPA_AUDIO_FORMAT_S32, SPA_AUDIO_FORMAT_F32, 0, 0, conv_s32_to_f32_c }, - { SPA_AUDIO_FORMAT_S32P, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_s32d_to_f32d_c }, - { SPA_AUDIO_FORMAT_S32, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_s32_to_f32d_c }, - { SPA_AUDIO_FORMAT_S32P, SPA_AUDIO_FORMAT_F32, 0, 0, conv_s32d_to_f32_c }, + MAKE(S32, F32, 0, conv_s32_to_f32_c), + MAKE(S32P, F32P, 0, conv_s32d_to_f32d_c), + MAKE(S32, F32P, 0, conv_s32_to_f32d_c), + MAKE(S32P, F32, 0, conv_s32d_to_f32_c), - { SPA_AUDIO_FORMAT_S32_OE, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_s32s_to_f32d_c }, + MAKE(S32_OE, F32P, 0, conv_s32s_to_f32d_c), - { SPA_AUDIO_FORMAT_U24, SPA_AUDIO_FORMAT_F32, 0, 0, conv_u24_to_f32_c }, - { SPA_AUDIO_FORMAT_U24, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_u24_to_f32d_c }, + MAKE(U24, F32, 0, conv_u24_to_f32_c), + MAKE(U24, F32P, 0, conv_u24_to_f32d_c), - { SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_F32, 0, 0, conv_s24_to_f32_c }, - { SPA_AUDIO_FORMAT_S24P, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_s24d_to_f32d_c }, + MAKE(S24, F32, 0, conv_s24_to_f32_c), + MAKE(S24P, F32P, 0, conv_s24d_to_f32d_c), #if defined (HAVE_AVX2) - { SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_F32P, 0, SPA_CPU_FLAG_AVX2, conv_s24_to_f32d_avx2 }, + MAKE(S24, F32P, 0, conv_s24_to_f32d_avx2, SPA_CPU_FLAG_AVX2), #endif #if defined (HAVE_SSSE3) -// { SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_F32P, 0, SPA_CPU_FLAG_SSSE3, conv_s24_to_f32d_ssse3 }, +// MAKE(S24, F32P, 0, conv_s24_to_f32d_ssse3, SPA_CPU_FLAG_SSSE3), #endif #if defined (HAVE_SSE41) - { SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_F32P, 0, SPA_CPU_FLAG_SSE41, conv_s24_to_f32d_sse41 }, + MAKE(S24, F32P, 0, conv_s24_to_f32d_sse41, SPA_CPU_FLAG_SSE41), #endif #if defined (HAVE_SSE2) - { SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_F32P, 0, SPA_CPU_FLAG_SSE2, conv_s24_to_f32d_sse2 }, + MAKE(S24, F32P, 0, conv_s24_to_f32d_sse2, SPA_CPU_FLAG_SSE2), #endif - { SPA_AUDIO_FORMAT_S24, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_s24_to_f32d_c }, - { SPA_AUDIO_FORMAT_S24P, SPA_AUDIO_FORMAT_F32, 0, 0, conv_s24d_to_f32_c }, + MAKE(S24, F32P, 0, conv_s24_to_f32d_c), + MAKE(S24P, F32, 0, conv_s24d_to_f32_c), - { SPA_AUDIO_FORMAT_S24_OE, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_s24s_to_f32d_c }, + MAKE(S24_OE, F32P, 0, conv_s24s_to_f32d_c), - { SPA_AUDIO_FORMAT_U24_32, SPA_AUDIO_FORMAT_F32, 0, 0, conv_u24_32_to_f32_c }, - { SPA_AUDIO_FORMAT_U24_32, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_u24_32_to_f32d_c }, + MAKE(U24_32, F32, 0, conv_u24_32_to_f32_c), + MAKE(U24_32, F32P, 0, conv_u24_32_to_f32d_c), - { SPA_AUDIO_FORMAT_S24_32, SPA_AUDIO_FORMAT_F32, 0, 0, conv_s24_32_to_f32_c }, - { SPA_AUDIO_FORMAT_S24_32P, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_s24_32d_to_f32d_c }, - { SPA_AUDIO_FORMAT_S24_32, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_s24_32_to_f32d_c }, - { SPA_AUDIO_FORMAT_S24_32P, SPA_AUDIO_FORMAT_F32, 0, 0, conv_s24_32d_to_f32_c }, + MAKE(S24_32, F32, 0, conv_s24_32_to_f32_c), + MAKE(S24_32P, F32P, 0, conv_s24_32d_to_f32d_c), + MAKE(S24_32, F32P, 0, conv_s24_32_to_f32d_c), + MAKE(S24_32P, F32, 0, conv_s24_32d_to_f32_c), - { SPA_AUDIO_FORMAT_S24_32_OE, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_s24_32s_to_f32d_c }, + MAKE(S24_32_OE, F32P, 0, conv_s24_32s_to_f32d_c), - { SPA_AUDIO_FORMAT_F64, SPA_AUDIO_FORMAT_F32, 0, 0, conv_f64_to_f32_c }, - { SPA_AUDIO_FORMAT_F64P, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_f64d_to_f32d_c }, - { SPA_AUDIO_FORMAT_F64, SPA_AUDIO_FORMAT_F32P, 0, 0, conv_f64_to_f32d_c }, - { SPA_AUDIO_FORMAT_F64P, SPA_AUDIO_FORMAT_F32, 0, 0, conv_f64d_to_f32_c }, + MAKE(F64, F32, 0, conv_f64_to_f32_c), + MAKE(F64P, F32P, 0, conv_f64d_to_f32d_c),
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/fmt-ops.h -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/fmt-ops.h
Changed
@@ -23,7 +23,7 @@ */ #include <math.h> -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__MidnightBSD__) #include <sys/endian.h> #define bswap_16 bswap16 #define bswap_32 bswap32 @@ -33,73 +33,96 @@ #endif #include <spa/utils/defs.h> +#include <spa/utils/string.h> -#define U8_MIN 0 -#define U8_MAX 255 -#define U8_SCALE 127.5f -#define U8_OFFS 128 -#define U8_TO_F32(v) ((((uint8_t)(v)) * (1.0f / U8_OFFS)) - 1.0) -#define F32_TO_U8(v) (uint8_t)((SPA_CLAMP(v, -1.0f, 1.0f) * U8_SCALE) + U8_OFFS) - -#define S8_MIN -127 -#define S8_MAX 127 -#define S8_MAX_F 127.0f -#define S8_SCALE 127.0f -#define S8_TO_F32(v) (((int8_t)(v)) * (1.0f / S8_SCALE)) -#define F32_TO_S8(v) (int8_t)(SPA_CLAMP(v, -1.0f, 1.0f) * S8_SCALE) - -#define U16_MIN 0 -#define U16_MAX 65535 -#define U16_SCALE 32767.5f -#define U16_OFFS 32768 -#define U16_TO_F32(v) ((((uint16_t)(v)) * (1.0f / U16_OFFS)) - 1.0) -#define U16S_TO_F32(v) (((uint16_t)bswap_16((uint16_t)(v)) * (1.0f / U16_OFFS)) - 1.0) -#define F32_TO_U16(v) (uint16_t)((SPA_CLAMP(v, -1.0f, 1.0f) * U16_SCALE) + U16_OFFS) -#define F32_TO_U16S(v) ((uint16_t)bswap_16((uint16_t)((SPA_CLAMP(v, -1.0f, 1.0f) * U16_SCALE) + U16_OFFS))) - -#define S16_MIN -32767 -#define S16_MAX 32767 -#define S16_MAX_F 32767.0f -#define S16_SCALE 32767.0f -#define S16_TO_F32(v) (((int16_t)(v)) * (1.0f / S16_SCALE)) -#define S16S_TO_F32(v) (((int16_t)bswap_16((uint16_t)v)) * (1.0f / S16_SCALE)) -#define F32_TO_S16(v) (int16_t)(SPA_CLAMP(v, -1.0f, 1.0f) * S16_SCALE) -#define F32_TO_S16S(v) ((int16_t)bswap_16((uint16_t)(SPA_CLAMP(v, -1.0f, 1.0f) * S16_SCALE))) - -#define U24_MIN 0 -#define U24_MAX 16777215 -#define U24_SCALE 8388607.5f -#define U24_OFFS 8388608 -#define U24_TO_F32(v) ((((uint32_t)(v)) * (1.0f / U24_OFFS)) - 1.0) -#define F32_TO_U24(v) (uint32_t)((SPA_CLAMP(v, -1.0f, 1.0f) * U24_SCALE) + U24_OFFS) - -#define S24_MIN -8388607 -#define S24_MAX 8388607 -#define S24_MAX_F 8388607.0f -#define S24_SCALE 8388607.0f -#define S24_TO_F32(v) (((int32_t)(v)) * (1.0f / S24_SCALE)) -#define F32_TO_S24(v) (int32_t)(SPA_CLAMP(v, -1.0f, 1.0f) * S24_SCALE) - -#define U32_TO_F32(v) U24_TO_F32(((uint32_t)(v)) >> 8) -#define F32_TO_U32(v) (F32_TO_U24(v) << 8) - -#define S32_SCALE 2147483648.0f -#define S32_MIN 2147483520.0f - -#define S32_TO_F32(v) S24_TO_F32(((int32_t)(v)) >> 8) -#define S32S_TO_F32(v) S24_TO_F32(((int32_t)bswap_32(v)) >> 8) -#define F32_TO_S32(v) (F32_TO_S24(v) << 8) -#define F32_TO_S32S(v) bswap_32((F32_TO_S24(v) << 8)) +#define FMT_OPS_MAX_ALIGN 32 + +#define U8_MIN 0u +#define U8_MAX 255u +#define U8_SCALE 127.5f +#define U8_OFFS 128.f +#define U8_TO_F32(v) ((((uint8_t)(v)) * (1.0f / U8_OFFS)) - 1.0f) +#define F32_TO_U8(v) (uint8_t)SPA_CLAMP((v) * U8_SCALE + U8_OFFS, U8_MIN, U8_MAX) +#define F32_TO_U8_D(v,d) (uint8_t)SPA_CLAMP((v) * U8_SCALE + U8_OFFS + (d), U8_MIN, U8_MAX) + +#define S8_MIN -127 +#define S8_MAX 127 +#define S8_MAX_F 127.0f +#define S8_SCALE 127.0f +#define S8_TO_F32(v) (((int8_t)(v)) * (1.0f / S8_SCALE)) +#define F32_TO_S8(v) (int8_t)SPA_CLAMP((v) * S8_SCALE, S8_MIN, S8_MAX) +#define F32_TO_S8_D(v,d) (int8_t)SPA_CLAMP((v) * S8_SCALE + (d), S8_MIN, S8_MAX) + +#define U16_MIN 0u +#define U16_MAX 65535u +#define U16_SCALE 32767.5f +#define U16_OFFS 32768.f +#define U16_TO_F32(v) ((((uint16_t)(v)) * (1.0f / U16_OFFS)) - 1.0) +#define U16S_TO_F32(v) (((uint16_t)bswap_16((uint16_t)(v)) * (1.0f / U16_OFFS)) - 1.0) +#define F32_TO_U16(v) (uint16_t)SPA_CLAMP((v) * U16_SCALE + U16_OFFS, U16_MIN, U16_MAX) +#define F32_TO_U16_D(v,d) (uint16_t)SPA_CLAMP((v) * U16_SCALE + U16_OFFS + (d), U16_MIN, U16_MAX) +#define F32_TO_U16S(v) bswap_16(F32_TO_U16(v)) +#define F32_TO_U16S_D(v,d) bswap_16(F32_TO_U16_D(v,d)) + +#define S16_MIN -32767 +#define S16_MAX 32767 +#define S16_MAX_F 32767.0f +#define S16_SCALE 32767.0f +#define S16_TO_F32(v) (((int16_t)(v)) * (1.0f / S16_SCALE)) +#define S16S_TO_F32(v) (((int16_t)bswap_16(v)) * (1.0f / S16_SCALE)) +#define F32_TO_S16(v) (int16_t)SPA_CLAMP((v) * S16_SCALE, S16_MIN, S16_MAX) +#define F32_TO_S16_D(v,d) (int16_t)SPA_CLAMP((v) * S16_SCALE + (d), S16_MIN, S16_MAX) +#define F32_TO_S16S(v) bswap_16(F32_TO_S16(v)) +#define F32_TO_S16S_D(v,d) bswap_16(F32_TO_S16_D(v,d)) + +#define U24_MIN 0u +#define U24_MAX 16777215u +#define U24_SCALE 8388607.5f +#define U24_OFFS 8388608.f +#define U24_TO_F32(v) ((((uint32_t)(v)) * (1.0f / U24_OFFS)) - 1.0) +#define F32_TO_U24(v) (uint32_t)SPA_CLAMP((v) * U24_SCALE + U24_OFFS, U24_MIN, U24_MAX) +#define F32_TO_U24_D(v,d) (uint32_t)SPA_CLAMP((v) * U24_SCALE + U24_OFFS + (d), U24_MIN, U24_MAX) + +#define S24_MIN -8388607 +#define S24_MAX 8388607 +#define S24_MAX_F 8388607.0f +#define S24_SCALE 8388607.0f +#define S24_TO_F32(v) (((int32_t)(v)) * (1.0f / S24_SCALE)) +#define F32_TO_S24(v) (int32_t)SPA_CLAMP((v) * S24_SCALE, S24_MIN, S24_MAX) +#define F32_TO_S24_D(v,d) (int32_t)SPA_CLAMP((v) * S24_SCALE + (d), S24_MIN, S24_MAX) + +#define U32_MIN 0u +#define U32_MAX 4294967040u +#define U32_SCALE 2147483520.f +#define U32_OFFS 2147483520.f +#define U32_TO_F32(v) ((((uint32_t)(v)) * (1.0f / U32_OFFS)) - 1.0) +#define F32_TO_U32(v) (uint32_t)SPA_CLAMP((v) * U32_SCALE + U32_OFFS, U32_MIN, U32_MAX) +#define F32_TO_U32_D(v,d) (uint32_t)SPA_CLAMP((v) * U32_SCALE + U32_OFFS + (d), U32_MIN, U32_MAX) + +#define S32_MIN -2147483520 +#define S32_MAX 2147483520 +#define S32_MAX_F 2147483520.f +#define S32_SCALE 2147483648.f +#define S32_TO_F32(v) (((int32_t)(v)) * (1.0f / S32_SCALE)) +#define S32S_TO_F32(v) (((int32_t)bswap_32(v)) * (1.0f / S32_SCALE)) +#define F32_TO_S32(v) (int32_t)SPA_CLAMP((v) * S32_SCALE, S32_MIN, S32_MAX) +#define F32_TO_S32_D(v,d) (int32_t)SPA_CLAMP((v) * S32_SCALE + (d), S32_MIN, S32_MAX) +#define F32_TO_S32S(v) bswap_32(F32_TO_S32(v)) +#define F32_TO_S32S_D(v,d) bswap_32(F32_TO_S32_D(v,d)) #define U24_32_TO_F32(v) U32_TO_F32((v)<<8) #define U24_32S_TO_F32(v) U32_TO_F32(((int32_t)bswap_32(v))<<8) #define F32_TO_U24_32(v) F32_TO_U24(v) #define F32_TO_U24_32S(v) bswap_32(F32_TO_U24(v)) +#define F32_TO_U24_32_D(v,d) F32_TO_U24_D(v,d) +#define F32_TO_U24_32S_D(v,d) bswap_32(F32_TO_U24_D(v,d)) #define S24_32_TO_F32(v) S32_TO_F32((v)<<8) #define S24_32S_TO_F32(v) S32_TO_F32(((int32_t)bswap_32(v))<<8) #define F32_TO_S24_32(v) F32_TO_S24(v) #define F32_TO_S24_32S(v) bswap_32(F32_TO_S24(v)) +#define F32_TO_S24_32_D(v,d) F32_TO_S24_D(v,d) +#define F32_TO_S24_32S_D(v,d) bswap_32(F32_TO_S24_D(v,d)) static inline uint32_t read_u24(const void *src) { @@ -173,18 +196,38 @@ #endif } -#define MAX_NS 64 +#define NS_MAX 8 +#define NS_MASK (NS_MAX-1) + +struct shaper { + float eNS_MAX; + uint32_t idx; + float r; +}; struct convert { + uint32_t quantize; + uint32_t noise; +#define DITHER_METHOD_NONE 0 +#define DITHER_METHOD_RECTANGULAR 1 +#define DITHER_METHOD_TRIANGULAR 2 +#define DITHER_METHOD_SHAPED_5 3 + uint32_t method; + uint32_t src_fmt; uint32_t dst_fmt; uint32_t n_channels; + uint32_t rate; uint32_t cpu_flags; + const char *func_name; unsigned int is_passthrough:1; - float ns_dataMAX_NS; - uint32_t ns_idx; - uint32_t ns_size; + + float scale; + uint32_t random16 + FMT_OPS_MAX_ALIGN/4; + float *dither;
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/meson.build -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/meson.build
Changed
@@ -1,11 +1,8 @@ -audioconvert_sources = 'audioadapter.c', +audioconvert_sources = + 'audioadapter.c', 'audioconvert.c', - 'fmtconvert.c', - 'channelmix.c', - 'merger.c', - 'plugin.c', - 'resample.c', - 'splitter.c' + 'plugin.c' + simd_cargs = simd_dependencies =
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/plugin.c -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/plugin.c
Changed
@@ -27,11 +27,6 @@ #include <spa/support/plugin.h> extern const struct spa_handle_factory spa_audioconvert_factory; -extern const struct spa_handle_factory spa_fmtconvert_factory; -extern const struct spa_handle_factory spa_channelmix_factory; -extern const struct spa_handle_factory spa_resample_factory; -extern const struct spa_handle_factory spa_splitter_factory; -extern const struct spa_handle_factory spa_merger_factory; extern const struct spa_handle_factory spa_audioadapter_factory; SPA_EXPORT @@ -45,21 +40,6 @@ *factory = &spa_audioconvert_factory; break; case 1: - *factory = &spa_fmtconvert_factory; - break; - case 2: - *factory = &spa_channelmix_factory; - break; - case 3: - *factory = &spa_resample_factory; - break; - case 4: - *factory = &spa_splitter_factory; - break; - case 5: - *factory = &spa_merger_factory; - break; - case 6: *factory = &spa_audioadapter_factory; break; default:
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/resample-native-impl.h -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/resample-native-impl.h
Changed
@@ -34,10 +34,13 @@ struct resample_info { uint32_t format; - uint32_t cpu_flags; resample_func_t process_copy; + const char *copy_name; resample_func_t process_full; + const char *full_name; resample_func_t process_inter; + const char *inter_name; + uint32_t cpu_flags; }; struct native_data {
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/resample-native.c -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/resample-native.c
Changed
@@ -58,14 +58,23 @@ return sin(x) / x; } -static inline double blackman(double x, double n_taps) +#if 0 +static inline double window_blackman(double x, double n_taps) { double alpha = 0.232; x = 2.0 * M_PI * x / n_taps; return (1.0 - alpha) / 2.0 + (1.0 / 2.0) * cos(x) + (alpha / 2.0) * cos(2 * x); } - +#else +static inline double window_cosh(double x, double n_taps) +{ + double R = 95.0; + double A = -325.1E-6 * (R * R) + 0.1677 * R - 3.149; + x = 2.0 * M_PI * x / n_taps; + return cosh(A * sqrt(1 - pow(x / M_PI, 2))) / cosh(A); +} +#endif static int build_filter(float *taps, uint32_t stride, uint32_t n_taps, uint32_t n_phases, double cutoff) { @@ -77,7 +86,7 @@ /* exploit symmetry in filter taps */ taps(n_phases - i) * stride + n_taps12 + j = tapsi * stride + (n_taps12 - j - 1) = - cutoff * sinc(t * cutoff) * blackman(t, n_taps); + cutoff * sinc(t * cutoff) * window_cosh(t, n_taps); } } return 0; @@ -124,27 +133,27 @@ MAKE_RESAMPLER_FULL(c); MAKE_RESAMPLER_INTER(c); +#define MAKE(fmt,copy,full,inter,...) \ + { SPA_AUDIO_FORMAT_ ##fmt, do_resample_ ##copy, #copy, \ + do_resample_ ##full, #full, do_resample_ ##inter, #inter, __VA_ARGS__ } + static struct resample_info resample_table = { #if defined (HAVE_NEON) - { SPA_AUDIO_FORMAT_F32, SPA_CPU_FLAG_NEON, - do_resample_copy_c, do_resample_full_neon, do_resample_inter_neon }, + MAKE(F32, copy_c, full_neon, inter_neon, SPA_CPU_FLAG_NEON), #endif #if defined(HAVE_AVX) && defined(HAVE_FMA) - { SPA_AUDIO_FORMAT_F32, SPA_CPU_FLAG_AVX | SPA_CPU_FLAG_FMA3, - do_resample_copy_c, do_resample_full_avx, do_resample_inter_avx }, + MAKE(F32, copy_c, full_avx, inter_avx, SPA_CPU_FLAG_AVX | SPA_CPU_FLAG_FMA3), #endif #if defined (HAVE_SSSE3) - { SPA_AUDIO_FORMAT_F32, SPA_CPU_FLAG_SSSE3 | SPA_CPU_FLAG_SLOW_UNALIGNED, - do_resample_copy_c, do_resample_full_ssse3, do_resample_inter_ssse3 }, + MAKE(F32, copy_c, full_ssse3, inter_ssse3, SPA_CPU_FLAG_SSSE3 | SPA_CPU_FLAG_SLOW_UNALIGNED), #endif #if defined (HAVE_SSE) - { SPA_AUDIO_FORMAT_F32, SPA_CPU_FLAG_SSE, - do_resample_copy_c, do_resample_full_sse, do_resample_inter_sse }, + MAKE(F32, copy_c, full_sse, inter_sse, SPA_CPU_FLAG_SSE), #endif - { SPA_AUDIO_FORMAT_F32, 0, - do_resample_copy_c, do_resample_full_c, do_resample_inter_c }, + MAKE(F32, copy_c, full_c, inter_c), }; +#undef MAKE #define MATCH_CPU_FLAGS(a,b) ((a) == 0 || ((a) & (b)) == a) static const struct resample_info *find_resample_info(uint32_t format, uint32_t cpu_flags) @@ -200,12 +209,18 @@ data->inc = data->in_rate / data->out_rate; data->frac = data->in_rate % data->out_rate; - if (data->in_rate == data->out_rate) + if (data->in_rate == data->out_rate) { data->func = data->info->process_copy; - else if (rate == 1.0) + r->func_name = data->info->copy_name; + } + else if (rate == 1.0) { data->func = data->info->process_full; - else + r->func_name = data->info->full_name; + } + else { data->func = data->info->process_inter; + r->func_name = data->info->inter_name; + } spa_log_trace_fp(r->log, "native %p: rate:%f in:%d out:%d phase:%d inc:%d frac:%d", r, rate, data->in_rate, data->out_rate, data->phase, data->inc, data->frac); @@ -396,10 +411,9 @@ build_filter(d->filter, d->filter_stride, n_taps, n_phases, scale); d->info = find_resample_info(SPA_AUDIO_FORMAT_F32, r->cpu_flags); - if (SPA_UNLIKELY(!d->info)) - { + if (SPA_UNLIKELY(d->info == NULL)) { spa_log_error(r->log, "failed to find suitable resample format!"); - return -1; + return -ENOTSUP; } spa_log_debug(r->log, "native %p: q:%d in:%d out:%d n_taps:%d n_phases:%d features:%08x:%08x",
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/resample.h -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/resample.h
Changed
@@ -31,11 +31,13 @@ #define RESAMPLE_DEFAULT_QUALITY 4 struct resample { + struct spa_log *log; uint32_t cpu_flags; + const char *func_name; + uint32_t channels; uint32_t i_rate; uint32_t o_rate; - struct spa_log *log; double rate; int quality;
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/test-audioconvert.c -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/test-audioconvert.c
Changed
@@ -43,7 +43,7 @@ extern const struct spa_handle_factory test_source_factory; -#define MAX_PORTS SPA_AUDIO_MAX_CHANNELS +#define MAX_PORTS (SPA_AUDIO_MAX_CHANNELS+1) struct context { struct spa_handle *convert_handle;
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/volume-ops.c -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/volume-ops.c
Changed
@@ -36,16 +36,21 @@ typedef void (*volume_func_t) (struct volume *vol, void * SPA_RESTRICT dst, const void * SPA_RESTRICT src, float volume, uint32_t n_samples); +#define MAKE(func,...) \ + { func, #func , __VA_ARGS__ } + static const struct volume_info { volume_func_t process; + const char *name; uint32_t cpu_flags; } volume_table = { #if defined (HAVE_SSE) - { volume_f32_sse, SPA_CPU_FLAG_SSE }, + MAKE(volume_f32_sse, SPA_CPU_FLAG_SSE), #endif - { volume_f32_c, 0 }, + MAKE(volume_f32_c), }; +#undef MAKE #define MATCH_CPU_FLAGS(a,b) ((a) == 0 || ((a) & (b)) == a) @@ -73,6 +78,8 @@ if (info == NULL) return -ENOTSUP; + vol->cpu_flags = info->cpu_flags; + vol->func_name = info->name; vol->free = impl_volume_free; vol->process = info->process; return 0;
View file
pipewire-0.3.52.tar.gz/spa/plugins/audioconvert/volume-ops.h -> pipewire-0.3.53.tar.gz/spa/plugins/audioconvert/volume-ops.h
Changed
@@ -33,6 +33,7 @@ struct volume { uint32_t cpu_flags; + const char *func_name; struct spa_log *log;
View file
pipewire-0.3.52.tar.gz/spa/plugins/audiomixer/audiomixer.c -> pipewire-0.3.53.tar.gz/spa/plugins/audiomixer/audiomixer.c
Changed
@@ -755,6 +755,8 @@ struct port *inport = GET_IN_PORT(this, i); struct spa_io_buffers *inio = NULL; struct buffer *inb; + struct spa_data *bd; + uint32_t size, offs; if (SPA_UNLIKELY(!PORT_VALID(inport) || (inio = inport->io) == NULL || @@ -770,13 +772,20 @@ } inb = &inport->buffersinio->buffer_id; - maxsize = SPA_MIN(inb->buffer->datas0.chunk->size, maxsize); + bd = &inb->buffer->datas0; - spa_log_trace_fp(this->log, "%p: mix input %d %p->%p %d %d %d", this, - i, inio, outio, inio->status, inio->buffer_id, maxsize); + offs = SPA_MIN(bd->chunk->offset, bd->maxsize); + size = SPA_MIN(bd->maxsize - offs, bd->chunk->size); + maxsize = SPA_MIN(size, maxsize); - datasn_buffers = inb->buffer->datas0.data; - buffersn_buffers++ = inb; + spa_log_trace_fp(this->log, "%p: mix input %d %p->%p %d %d %d:%d", this, + i, inio, outio, inio->status, inio->buffer_id, + offs, size); + + if (!SPA_FLAG_IS_SET(bd->chunk->flags, SPA_CHUNK_FLAG_EMPTY)) { + datasn_buffers = SPA_PTROFF(bd->data, offs, void); + buffersn_buffers++ = inb; + } inio->status = SPA_STATUS_NEED_DATA; } @@ -788,8 +797,7 @@ if (n_buffers == 1) { *outb->buffer = *buffers0->buffer; - } - else { + } else { struct spa_data *d = outb->buf.datas; *outb->buffer = outb->buf; @@ -799,6 +807,7 @@ d0.chunk->offset = 0; d0.chunk->size = maxsize; d0.chunk->stride = this->stride; + SPA_FLAG_UPDATE(d0.chunk->flags, SPA_CHUNK_FLAG_EMPTY, n_buffers == 0); mix_ops_process(&this->ops, d0.data, datas, n_buffers, maxsize / this->stride);
View file
pipewire-0.3.52.tar.gz/spa/plugins/audiomixer/mixer-dsp.c -> pipewire-0.3.53.tar.gz/spa/plugins/audiomixer/mixer-dsp.c
Changed
@@ -105,6 +105,7 @@ uint32_t cpu_flags; uint32_t max_align; + struct spa_io_position *io_position; uint32_t quantum_limit; struct mix_ops ops; @@ -152,7 +153,20 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size) { - return -ENOTSUP; + struct impl *this = object; + + spa_return_val_if_fail(this != NULL, -EINVAL); + + spa_log_debug(this->log, "%p: io %d %p/%zd", this, id, data, size); + + switch (id) { + case SPA_IO_Position: + this->io_position = data; + break; + default: + return -ENOENT; + } + return 0; } static int impl_node_send_command(void *object, const struct spa_command *command) @@ -694,7 +708,10 @@ datas = alloca(MAX_PORTS * sizeof(void *)); n_buffers = 0; - maxsize = UINT32_MAX; + if (SPA_LIKELY(this->io_position)) + maxsize = this->io_position->clock.duration * sizeof(float); + else + maxsize = this->quantum_limit; for (i = 0; i < this->last_port; i++) { struct port *inport = GET_IN_PORT(this, i); @@ -727,8 +744,10 @@ i, inio, outio, inio->status, inio->buffer_id, offs, size); - datasn_buffers = SPA_PTROFF(bd->data, offs, void); - buffersn_buffers++ = inb; + if (!SPA_FLAG_IS_SET(bd->chunk->flags, SPA_CHUNK_FLAG_EMPTY)) { + datasn_buffers = SPA_PTROFF(bd->data, offs, void); + buffersn_buffers++ = inb; + } inio->status = SPA_STATUS_NEED_DATA; } @@ -742,6 +761,7 @@ *outb->buffer = *buffers0->buffer; } else { struct spa_data *d = outb->buf.datas; + *outb->buffer = outb->buf; maxsize = SPA_MIN(maxsize, d0.maxsize); @@ -749,6 +769,7 @@ d0.chunk->offset = 0; d0.chunk->size = maxsize; d0.chunk->stride = sizeof(float); + SPA_FLAG_UPDATE(d0.chunk->flags, SPA_CHUNK_FLAG_EMPTY, n_buffers == 0); spa_log_trace_fp(this->log, "%p: %d mix %d", this, n_buffers, maxsize); @@ -846,6 +867,7 @@ this->max_align = SPA_MIN(MAX_ALIGN, spa_cpu_get_max_align(this->cpu)); } + this->quantum_limit = 8192; for (i = 0; info && i < info->n_items; i++) { const char *k = info->itemsi.key; const char *s = info->itemsi.value;
View file
pipewire-0.3.52.tar.gz/spa/plugins/bluez5/meson.build -> pipewire-0.3.53.tar.gz/spa/plugins/bluez5/meson.build
Changed
@@ -116,7 +116,7 @@ bluez_codec_lc3plus = shared_library('spa-codec-bluez5-lc3plus', 'a2dp-codec-lc3plus.c', 'a2dp-codecs.c' , include_directories : configinc , - c_args : ldac_args, + c_args : codec_args, dependencies : spa_dep, lc3plus_dep, mathlib , install : true, install_dir : spa_plugindir / 'bluez5')
View file
pipewire-0.3.52.tar.gz/spa/plugins/ffmpeg/ffmpeg-dec.c -> pipewire-0.3.53.tar.gz/spa/plugins/ffmpeg/ffmpeg-dec.c
Changed
@@ -38,6 +38,8 @@ #include <spa/param/video/format.h> #include <spa/pod/filter.h> +#include "ffmpeg.h" + #define IS_VALID_PORT(this,d,id) ((id) == 0) #define GET_IN_PORT(this,p) (&this->in_portsp) #define GET_OUT_PORT(this,p) (&this->out_portsp) @@ -456,6 +458,20 @@ return 0; } +static int +impl_clear(struct spa_handle *handle) +{ + spa_return_val_if_fail(handle != NULL, -EINVAL); + + return 0; +} + +size_t +spa_ffmpeg_dec_get_size(const struct spa_handle_factory *factory, const struct spa_dict *params) +{ + return sizeof(struct impl); +} + int spa_ffmpeg_dec_init(struct spa_handle *handle, const struct spa_dict *info, @@ -466,6 +482,7 @@ struct port *port; handle->get_interface = impl_get_interface; + handle->clear = impl_clear; this = (struct impl *) handle;
View file
pipewire-0.3.52.tar.gz/spa/plugins/ffmpeg/ffmpeg-enc.c -> pipewire-0.3.53.tar.gz/spa/plugins/ffmpeg/ffmpeg-enc.c
Changed
@@ -37,6 +37,8 @@ #include <spa/param/video/format-utils.h> #include <spa/pod/filter.h> +#include "ffmpeg.h" + #define IS_VALID_PORT(this,d,id) ((id) == 0) #define GET_IN_PORT(this,p) (&this->in_portsp) #define GET_OUT_PORT(this,p) (&this->out_portsp) @@ -435,6 +437,20 @@ return 0; } +static int +impl_clear(struct spa_handle *handle) +{ + spa_return_val_if_fail(handle != NULL, -EINVAL); + + return 0; +} + +size_t +spa_ffmpeg_enc_get_size(const struct spa_handle_factory *factory, const struct spa_dict *params) +{ + return sizeof(struct impl); +} + int spa_ffmpeg_enc_init(struct spa_handle *handle, const struct spa_dict *info, @@ -444,6 +460,7 @@ struct port *port; handle->get_interface = impl_get_interface; + handle->clear = impl_clear; this = (struct impl *) handle;
View file
pipewire-0.3.52.tar.gz/spa/plugins/ffmpeg/ffmpeg.c -> pipewire-0.3.53.tar.gz/spa/plugins/ffmpeg/ffmpeg.c
Changed
@@ -30,10 +30,7 @@ #include <libavcodec/avcodec.h> -int spa_ffmpeg_dec_init(struct spa_handle *handle, const struct spa_dict *info, - const struct spa_support *support, uint32_t n_support); -int spa_ffmpeg_enc_init(struct spa_handle *handle, const struct spa_dict *info, - const struct spa_support *support, uint32_t n_support); +#include "ffmpeg.h" static int ffmpeg_dec_init(const struct spa_handle_factory *factory, @@ -130,8 +127,12 @@ SPA_EXPORT int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index) { - static struct spa_handle_factory f; static char name128; + static struct spa_handle_factory f = { + SPA_VERSION_HANDLE_FACTORY, + .name = name, + .enum_interface_info = ffmpeg_enum_interface_info, + }; #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 10, 100) avcodec_register_all(); @@ -144,16 +145,14 @@ if (av_codec_is_encoder(c)) { snprintf(name, sizeof(name), "encoder.%s", c->name); + f.get_size = spa_ffmpeg_enc_get_size; f.init = ffmpeg_enc_init; } else { snprintf(name, sizeof(name), "decoder.%s", c->name); + f.get_size = spa_ffmpeg_dec_get_size; f.init = ffmpeg_dec_init; } - f.name = name; - f.info = NULL; - f.enum_interface_info = ffmpeg_enum_interface_info; - *factory = &f; (*index)++;
View file
pipewire-0.3.53.tar.gz/spa/plugins/ffmpeg/ffmpeg.h
Added
@@ -0,0 +1,20 @@ +#ifndef SPA_FFMPEG_H +#define SPA_FFMPEG_H + +#include <stdint.h> +#include <stddef.h> + +struct spa_dict; +struct spa_handle; +struct spa_support; +struct spa_handle_factory; + +int spa_ffmpeg_dec_init(struct spa_handle *handle, const struct spa_dict *info, + const struct spa_support *support, uint32_t n_support); +int spa_ffmpeg_enc_init(struct spa_handle *handle, const struct spa_dict *info, + const struct spa_support *support, uint32_t n_support); + +size_t spa_ffmpeg_dec_get_size(const struct spa_handle_factory *factory, const struct spa_dict *params); +size_t spa_ffmpeg_enc_get_size(const struct spa_handle_factory *factory, const struct spa_dict *params); + +#endif
View file
pipewire-0.3.52.tar.gz/spa/plugins/support/cpu.c -> pipewire-0.3.53.tar.gz/spa/plugins/support/cpu.c
Changed
@@ -30,7 +30,7 @@ #include <sched.h> #include <fcntl.h> -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__MidnightBSD__) #include <sys/sysctl.h> #endif
View file
pipewire-0.3.52.tar.gz/spa/plugins/support/logger.c -> pipewire-0.3.53.tar.gz/spa/plugins/support/logger.c
Changed
@@ -42,7 +42,7 @@ #include "log-patterns.h" -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__MidnightBSD__) #define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC #endif
View file
pipewire-0.3.52.tar.gz/spa/plugins/v4l2/v4l2-udev.c -> pipewire-0.3.53.tar.gz/spa/plugins/v4l2/v4l2-udev.c
Changed
@@ -278,15 +278,9 @@ if ((str = udev_device_get_property_value(dev, "SUBSYSTEM")) && *str) { itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_SUBSYSTEM, str); } - if ((str = udev_device_get_property_value(dev, "ID_VENDOR_ID")) && *str) { - char *dec = alloca(6); /* 65535 is max */ - int32_t val; + if ((str = udev_device_get_property_value(dev, "ID_VENDOR_ID")) && *str) + itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_VENDOR_ID, str); - if (spa_atoi32(str, &val, 16)) { - snprintf(dec, 6, "%d", val); - itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_VENDOR_ID, dec); - } - } str = udev_device_get_property_value(dev, "ID_VENDOR_FROM_DATABASE"); if (!(str && *str)) { str = udev_device_get_property_value(dev, "ID_VENDOR_ENC"); @@ -301,15 +295,8 @@ if (str && *str) { itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_VENDOR_NAME, str); } - if ((str = udev_device_get_property_value(dev, "ID_MODEL_ID")) && *str) { - char *dec = alloca(6); /* 65535 is max */ - int32_t val; - - if (spa_atoi32(str, &val, 16)) { - snprintf(dec, 6, "%d", val); - itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_PRODUCT_ID, dec); - } - } + if ((str = udev_device_get_property_value(dev, "ID_MODEL_ID")) && *str) + itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_PRODUCT_ID, str); str = udev_device_get_property_value(dev, "ID_MODEL_FROM_DATABASE"); if (!(str && *str)) {
View file
pipewire-0.3.52.tar.gz/spa/plugins/v4l2/v4l2-utils.c -> pipewire-0.3.53.tar.gz/spa/plugins/v4l2/v4l2-utils.c
Changed
@@ -1107,6 +1107,8 @@ spa_log_debug(this->log, "test control %08x", queryctrl.id); if (query_ext_ctrl_ioctl(port, &queryctrl) != 0) { + if (errno == ENOTTY) + goto enum_end; if (errno == EINVAL) { if (queryctrl.id != next_fl) goto enum_end; @@ -1123,6 +1125,7 @@ } res = -errno; spa_log_error(this->log, "'%s' VIDIOC_QUERYCTRL: %m", this->props.device); + spa_v4l2_close(dev); return res; } if (result.next & next_fl)
View file
pipewire-0.3.52.tar.gz/spa/plugins/vulkan/vulkan-utils.c -> pipewire-0.3.53.tar.gz/spa/plugins/vulkan/vulkan-utils.c
Changed
@@ -6,7 +6,7 @@ #include <sys/mman.h> #include <fcntl.h> #include <string.h> -#ifndef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__MidnightBSD__) #include <alloca.h> #endif #include <errno.h>
View file
pipewire-0.3.52.tar.gz/spa/tests/stress-ringbuffer.c -> pipewire-0.3.53.tar.gz/spa/tests/stress-ringbuffer.c
Changed
@@ -11,10 +11,10 @@ #define ARRAY_SIZE 63 #define MAX_VALUE 0x10000 -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__MidnightBSD__) #include <sys/param.h> #if (__FreeBSD_version >= 1400000 && __FreeBSD_version < 1400043) \ - || (__FreeBSD_version < 1300523) + || (__FreeBSD_version < 1300523) || defined(__MidnightBSD__) static int sched_getcpu(void) { return -1; }; #endif #endif
View file
pipewire-0.3.52.tar.gz/spa/tools/spa-inspect.c -> pipewire-0.3.53.tar.gz/spa/tools/spa-inspect.c
Changed
@@ -232,7 +232,7 @@ if ((res = spa_handle_factory_init(factory, handle, NULL, data->support, data->n_support)) < 0) { printf("can't make factory instance: %d\n", res); - return; + goto out; } printf("factory instance:\n"); @@ -256,6 +256,12 @@ else printf("skipping unknown interface\n"); } + + if ((res = spa_handle_clear(handle)) < 0) + printf("failed to clear handle: %s\n", spa_strerror(res)); + +out: + free(handle); } static const struct spa_loop_methods impl_loop = {
View file
pipewire-0.3.52.tar.gz/src/daemon/client-rt.conf.in -> pipewire-0.3.53.tar.gz/src/daemon/client-rt.conf.in
Changed
@@ -82,7 +82,7 @@ #node.autoconnect = true #resample.quality = 4 #channelmix.normalize = false - #channelmix.mix-lfe = true + #channelmix.mix-lfe = false #channelmix.upmix = true #channelmix.upmix-method = psd # none, simple #channelmix.lfe-cutoff = 150 @@ -90,4 +90,5 @@ #channelmix.rear-delay = 12.0 #channelmix.stereo-widen = 0.0 #channelmix.hilbert-taps = 0 + #dither.noise = 0 }
View file
pipewire-0.3.52.tar.gz/src/daemon/client.conf.in -> pipewire-0.3.53.tar.gz/src/daemon/client.conf.in
Changed
@@ -80,4 +80,5 @@ #channelmix.rear-delay = 12.0 #channelmix.stereo-widen = 0.0 #channelmix.hilbert-taps = 0 + #dither.noise = 0 }
View file
pipewire-0.3.52.tar.gz/src/daemon/jack.conf.in -> pipewire-0.3.53.tar.gz/src/daemon/jack.conf.in
Changed
@@ -81,7 +81,8 @@ # ignore-all: Ignore all self connect requests #jack.self-connect-mode = allow #jack.locked-process = true - #jack.default-as-system = false + #jack.default-as-system = false + #jack.fix-midi-events = true } # client specific properties
View file
pipewire-0.3.52.tar.gz/src/daemon/minimal.conf.in -> pipewire-0.3.53.tar.gz/src/daemon/minimal.conf.in
Changed
@@ -27,7 +27,7 @@ ## Properties for the DSP configuration. #default.clock.rate = 48000 - #default.clock.allowed-rates = 44100 48000 + #default.clock.allowed-rates = 48000 #default.clock.quantum = 1024 #default.clock.min-quantum = 32 #default.clock.max-quantum = 2048 @@ -212,6 +212,7 @@ #channelmix.stereo-widen = 0.0 #channelmix.hilbert-taps = 0 channelmix.disable = true + #dither.noise = 0 #node.param.Props = { # params = # audio.channels 6 @@ -220,6 +221,7 @@ adapter.auto-port-config = { mode = dsp monitor = false + control = false position = unknown # aux, preserve } #node.param.PortConfig = { @@ -272,6 +274,7 @@ #channelmix.stereo-widen = 0.0 #channelmix.hilbert-taps = 0 channelmix.disable = true + #dither.noise = 0 #node.param.Props = { # params = # audio.format S16 @@ -280,6 +283,7 @@ adapter.auto-port-config = { mode = dsp monitor = false + control = false position = unknown # aux, preserve } #node.param.PortConfig = {
View file
pipewire-0.3.52.tar.gz/src/daemon/pipewire-pulse.conf.in -> pipewire-0.3.53.tar.gz/src/daemon/pipewire-pulse.conf.in
Changed
@@ -66,6 +66,7 @@ #channelmix.rear-delay = 12.0 #channelmix.stereo-widen = 0.0 #channelmix.hilbert-taps = 0 + #dither.noise = 0 } pulse.properties = {
View file
pipewire-0.3.52.tar.gz/src/daemon/pipewire.conf.in -> pipewire-0.3.53.tar.gz/src/daemon/pipewire.conf.in
Changed
@@ -27,7 +27,7 @@ ## Properties for the DSP configuration. #default.clock.rate = 48000 - #default.clock.allowed-rates = 44100 48000 + #default.clock.allowed-rates = 48000 #default.clock.quantum = 1024 default.clock.min-quantum = 16 #default.clock.max-quantum = 2048
View file
pipewire-0.3.52.tar.gz/src/gst/gstpipewiresrc.c -> pipewire-0.3.53.tar.gz/src/gst/gstpipewiresrc.c
Changed
@@ -44,6 +44,7 @@ #include <unistd.h> #include <spa/pod/builder.h> +#include <spa/utils/result.h> #include <gst/net/gstnetclientclock.h> #include <gst/allocators/gstfdmemory.h> @@ -443,6 +444,7 @@ { GstPipeWireSrc *src; GstPipeWirePoolData *data; + int res; data = gst_pipewire_pool_get_data (GST_BUFFER_CAST(obj)); @@ -466,8 +468,11 @@ data->queued = TRUE; - GST_LOG_OBJECT (src, "recycle buffer %p", obj); - pw_stream_queue_buffer (src->stream, data->b); + if ((res = pw_stream_queue_buffer (src->stream, data->b)) < 0) + GST_WARNING_OBJECT (src, "can't queue recycled buffer %p, %s", obj, spa_strerror(res)); + else + GST_LOG_OBJECT (src, "recycle buffer %p", obj); + pw_thread_loop_unlock (src->core->loop); GST_OBJECT_UNLOCK (data->pool); @@ -481,9 +486,9 @@ GstPipeWireSrc *pwsrc = _data; GstPipeWirePoolData *data; - GST_DEBUG_OBJECT (pwsrc, "add buffer"); gst_pipewire_pool_wrap_buffer (pwsrc->pool, b); data = b->user_data; + GST_DEBUG_OBJECT (pwsrc, "add buffer %p", data->buf); data->owner = pwsrc; data->queued = TRUE; GST_MINI_OBJECT_CAST (data->buf)->dispose = buffer_recycle; @@ -495,15 +500,18 @@ GstPipeWireSrc *pwsrc = _data; GstPipeWirePoolData *data = b->user_data; GstBuffer *buf = data->buf; + int res; GST_DEBUG_OBJECT (pwsrc, "remove buffer %p", buf); GST_MINI_OBJECT_CAST (buf)->dispose = NULL; - if (data->queued) + if (data->queued) { gst_buffer_unref (buf); - else - pw_stream_queue_buffer (pwsrc->stream, b); + } else { + if ((res = pw_stream_queue_buffer (pwsrc->stream, b)) < 0) + GST_WARNING_OBJECT (pwsrc, "can't queue removed buffer %p, %s", buf, spa_strerror(res)); + } } static GstBuffer *dequeue_buffer(GstPipeWireSrc *pwsrc) @@ -1026,10 +1034,10 @@ pwsrc = GST_PIPEWIRE_SRC (psrc); + pw_thread_loop_lock (pwsrc->core->loop); if (!pwsrc->negotiated) goto not_negotiated; - pw_thread_loop_lock (pwsrc->core->loop); while (TRUE) { enum pw_stream_state state; @@ -1126,6 +1134,7 @@ not_negotiated: { + pw_thread_loop_unlock (pwsrc->core->loop); return GST_FLOW_NOT_NEGOTIATED; } streaming_eos: @@ -1348,7 +1357,9 @@ case GST_STATE_CHANGE_PLAYING_TO_PAUSED: break; case GST_STATE_CHANGE_PAUSED_TO_READY: + pw_thread_loop_lock (this->core->loop); this->negotiated = FALSE; + pw_thread_loop_unlock (this->core->loop); break; case GST_STATE_CHANGE_READY_TO_NULL: gst_pipewire_src_close (this);
View file
pipewire-0.3.52.tar.gz/src/modules/module-adapter/adapter.c -> pipewire-0.3.53.tar.gz/src/modules/module-adapter/adapter.c
Changed
@@ -95,7 +95,7 @@ struct pw_properties *new; const char *str, *path, *desc, *nick, *name, *node_name, *media_class; char position8, *prefix; - bool is_monitor, is_device, is_duplex, is_virtual; + bool is_monitor, is_device, is_duplex, is_virtual, is_control = false; direction = pw_impl_port_get_direction(port); @@ -105,6 +105,9 @@ if (!is_monitor && direction != n->direction) return; + if ((str = pw_properties_get(old, PW_KEY_FORMAT_DSP)) != NULL) + is_control = spa_streq(str, "8 bit raw midi"); + path = pw_properties_get(n->props, PW_KEY_OBJECT_PATH); media_class = pw_properties_get(n->props, PW_KEY_MEDIA_CLASS); @@ -120,7 +123,10 @@ new = pw_properties_new(NULL, NULL); - if (is_duplex) + if (is_control) + prefix = direction == PW_DIRECTION_INPUT ? + "control" : "notify"; + else if (is_duplex) prefix = direction == PW_DIRECTION_INPUT ? "playback" : "capture"; else if (is_virtual) @@ -156,13 +162,20 @@ pw_properties_setf(new, PW_KEY_OBJECT_PATH, "%s:%s_%d", path ? path : node_name, prefix, pw_impl_port_get_id(port)); - pw_properties_setf(new, PW_KEY_PORT_NAME, "%s_%s", prefix, str); + if (is_control) + pw_properties_setf(new, PW_KEY_PORT_NAME, "%s", prefix); + else + pw_properties_setf(new, PW_KEY_PORT_NAME, "%s_%s", prefix, str); if ((node_name = nick) == NULL && (node_name = desc) == NULL && (node_name = name) == NULL) node_name = "node"; - pw_properties_setf(new, PW_KEY_PORT_ALIAS, "%s:%s_%s", + if (is_control) + pw_properties_setf(new, PW_KEY_PORT_ALIAS, "%s:%s", + node_name, prefix); + else + pw_properties_setf(new, PW_KEY_PORT_ALIAS, "%s:%s_%s", node_name, prefix, str); pw_impl_port_update_properties(port, &new->dict); @@ -240,7 +253,7 @@ int res, position = POSITION_PRESERVE; struct spa_pod *param; uint32_t media_type, media_subtype; - bool have_format = false, monitor = false; + bool have_format = false, monitor = false, control = false; struct spa_audio_info format = { 0, }; enum spa_param_port_config_mode mode = SPA_PARAM_PORT_CONFIG_MODE_none; struct spa_json it2; @@ -260,6 +273,8 @@ mode = SPA_PARAM_PORT_CONFIG_MODE_none; } else if (spa_streq(key, "monitor")) { monitor = spa_atob(val); + } else if (spa_streq(key, "control")) { + control = spa_atob(val); } else if (spa_streq(key, "position")) { if (spa_streq(val, "unknown")) position = POSITION_UNKNOWN; @@ -331,6 +346,7 @@ SPA_PARAM_PORT_CONFIG_direction, SPA_POD_Id(n->direction), SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(mode), SPA_PARAM_PORT_CONFIG_monitor, SPA_POD_Bool(monitor), + SPA_PARAM_PORT_CONFIG_control, SPA_POD_Bool(control), SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param)); pw_impl_node_set_param(n->node, SPA_PARAM_PortConfig, 0, param);
View file
pipewire-0.3.52.tar.gz/src/modules/module-echo-cancel.c -> pipewire-0.3.53.tar.gz/src/modules/module-echo-cancel.c
Changed
@@ -80,6 +80,7 @@ * * - \ref PW_KEY_AUDIO_RATE * - \ref PW_KEY_AUDIO_CHANNELS + * - \ref SPA_KEY_AUDIO_POSITION * - \ref PW_KEY_MEDIA_CLASS * - \ref PW_KEY_NODE_LATENCY * - \ref PW_KEY_NODE_NAME @@ -89,7 +90,6 @@ * - \ref PW_KEY_NODE_VIRTUAL * - \ref PW_KEY_NODE_LATENCY * - \ref PW_KEY_REMOTE_NAME - * - \ref SPA_KEY_AUDIO_POSITION * * ## Example configuration *\code{.unparsed} @@ -125,6 +125,10 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); #define PW_LOG_TOPIC_DEFAULT mod_topic +#define DEFAULT_RATE 48000 +#define DEFAULT_CHANNELS 2 +#define DEFAULT_POSITION " FL FR " + /* Hopefully this is enough for any combination of AEC engine and resampler * input requirement for rate matching */ #define MAX_BUFSIZE_MS 100 @@ -859,9 +863,15 @@ *info = SPA_AUDIO_INFO_RAW_INIT( .format = SPA_AUDIO_FORMAT_F32P); info->rate = pw_properties_get_uint32(props, PW_KEY_AUDIO_RATE, info->rate); + if (info->rate == 0) + info->rate = DEFAULT_RATE; + info->channels = pw_properties_get_uint32(props, PW_KEY_AUDIO_CHANNELS, info->channels); + info->channels = SPA_MIN(info->channels, SPA_AUDIO_MAX_CHANNELS); if ((str = pw_properties_get(props, SPA_KEY_AUDIO_POSITION)) != NULL) parse_position(info, str, strlen(str)); + if (info->channels == 0) + parse_position(info, DEFAULT_POSITION, strlen(DEFAULT_POSITION)); } static void copy_props(struct impl *impl, struct pw_properties *props, const char *key) @@ -927,14 +937,6 @@ parse_audio_info(props, &impl->info); - if (impl->info.channels == 0) { - impl->info.channels = 2; - impl->info.position0 = SPA_AUDIO_CHANNEL_FL; - impl->info.position1 = SPA_AUDIO_CHANNEL_FR; - } - if (impl->info.rate == 0) - impl->info.rate = 48000; - if ((str = pw_properties_get(props, "source.props")) != NULL) pw_properties_update_string(impl->source_props, str, strlen(str)); if ((str = pw_properties_get(props, "sink.props")) != NULL)
View file
pipewire-0.3.52.tar.gz/src/modules/module-example-sink.c -> pipewire-0.3.53.tar.gz/src/modules/module-example-sink.c
Changed
@@ -64,6 +64,7 @@ * Options with well-known behavior. * * - \ref PW_KEY_REMOTE_NAME + * - \ref PW_KEY_AUDIO_FORMAT * - \ref PW_KEY_AUDIO_RATE * - \ref PW_KEY_AUDIO_CHANNELS * - \ref SPA_KEY_AUDIO_POSITION @@ -107,7 +108,7 @@ " node.description=<description of the nodes> " \ " audio.format=<format, default:"DEFAULT_FORMAT"> " \ " audio.rate=<sample rate, default: "SPA_STRINGIFY(DEFAULT_RATE)"> " \ - " audio.channels=<number of channels, default:"SPA_STRINGIFY(EFAULT_CHANNELS) "> " \ + " audio.channels=<number of channels, default:"SPA_STRINGIFY(DEFAULT_CHANNELS) "> " \ " audio.position=<channel map, default:"DEFAULT_POSITION"> " \ " stream.props=<properties> " @@ -340,56 +341,59 @@ } } -static int parse_audio_info(struct impl *impl) +static void parse_audio_info(const struct pw_properties *props, struct spa_audio_info_raw *info) { - struct pw_properties *props = impl->stream_props; - struct spa_audio_info_raw *info = &impl->info; const char *str; spa_zero(*info); - if ((str = pw_properties_get(props, PW_KEY_AUDIO_FORMAT)) == NULL) str = DEFAULT_FORMAT; info->format = format_from_name(str, strlen(str)); + + info->rate = pw_properties_get_uint32(props, PW_KEY_AUDIO_RATE, info->rate); + if (info->rate == 0) + info->rate = DEFAULT_RATE; + + info->channels = pw_properties_get_uint32(props, PW_KEY_AUDIO_CHANNELS, info->channels); + info->channels = SPA_MIN(info->channels, SPA_AUDIO_MAX_CHANNELS); + if ((str = pw_properties_get(props, SPA_KEY_AUDIO_POSITION)) != NULL) + parse_position(info, str, strlen(str)); + if (info->channels == 0) + parse_position(info, DEFAULT_POSITION, strlen(DEFAULT_POSITION)); +} + +static int calc_frame_size(const struct spa_audio_info_raw *info) +{ + int res = info->channels; switch (info->format) { - case SPA_AUDIO_FORMAT_S8: case SPA_AUDIO_FORMAT_U8: - impl->frame_size = 1; - break; + case SPA_AUDIO_FORMAT_S8: + case SPA_AUDIO_FORMAT_ALAW: + case SPA_AUDIO_FORMAT_ULAW: + return res; case SPA_AUDIO_FORMAT_S16: - impl->frame_size = 2; - break; + case SPA_AUDIO_FORMAT_S16_OE: + case SPA_AUDIO_FORMAT_U16: + return res * 2; case SPA_AUDIO_FORMAT_S24: - impl->frame_size = 3; - break; + case SPA_AUDIO_FORMAT_S24_OE: + case SPA_AUDIO_FORMAT_U24: + return res * 3; case SPA_AUDIO_FORMAT_S24_32: + case SPA_AUDIO_FORMAT_S24_32_OE: case SPA_AUDIO_FORMAT_S32: + case SPA_AUDIO_FORMAT_S32_OE: + case SPA_AUDIO_FORMAT_U32: + case SPA_AUDIO_FORMAT_U32_OE: case SPA_AUDIO_FORMAT_F32: - impl->frame_size = 4; - break; + case SPA_AUDIO_FORMAT_F32_OE: + return res * 4; case SPA_AUDIO_FORMAT_F64: - impl->frame_size = 8; - break; + case SPA_AUDIO_FORMAT_F64_OE: + return res * 8; default: - pw_log_error("unsupported format '%s'", str); - return -EINVAL; - } - info->rate = pw_properties_get_uint32(props, PW_KEY_AUDIO_RATE, DEFAULT_RATE); - if (info->rate == 0) { - pw_log_error("invalid rate '%s'", str); - return -EINVAL; + return 0; } - info->channels = pw_properties_get_uint32(props, PW_KEY_AUDIO_CHANNELS, DEFAULT_CHANNELS); - if ((str = pw_properties_get(props, SPA_KEY_AUDIO_POSITION)) == NULL) - str = DEFAULT_POSITION; - parse_position(info, str, strlen(str)); - if (info->channels == 0) { - pw_log_error("invalid channels '%s'", str); - return -EINVAL; - } - impl->frame_size *= info->channels; - - return 0; } static void copy_props(struct impl *impl, struct pw_properties *props, const char *key) @@ -467,7 +471,11 @@ copy_props(impl, props, PW_KEY_NODE_VIRTUAL); copy_props(impl, props, PW_KEY_MEDIA_CLASS); - if ((res = parse_audio_info(impl)) < 0) { + parse_audio_info(impl->stream_props, &impl->info); + + impl->frame_size = calc_frame_size(&impl->info); + if (impl->frame_size == 0) { + res = -EINVAL; pw_log_error( "can't parse audio format"); goto error; }
View file
pipewire-0.3.52.tar.gz/src/modules/module-example-source.c -> pipewire-0.3.53.tar.gz/src/modules/module-example-source.c
Changed
@@ -64,6 +64,7 @@ * Options with well-known behavior. * * - \ref PW_KEY_REMOTE_NAME + * - \ref PW_KEY_AUDIO_FORMAT * - \ref PW_KEY_AUDIO_RATE * - \ref PW_KEY_AUDIO_CHANNELS * - \ref SPA_KEY_AUDIO_POSITION @@ -107,7 +108,7 @@ " node.description=<description of the nodes> " \ " audio.format=<format, default:"DEFAULT_FORMAT"> " \ " audio.rate=<sample rate, default: "SPA_STRINGIFY(DEFAULT_RATE)"> " \ - " audio.channels=<number of channels, default:"SPA_STRINGIFY(EFAULT_CHANNELS) "> " \ + " audio.channels=<number of channels, default:"SPA_STRINGIFY(DEFAULT_CHANNELS) "> " \ " audio.position=<channel map, default:"DEFAULT_POSITION"> " \ " stream.props=<properties> " @@ -344,56 +345,59 @@ } } -static int parse_audio_info(struct impl *impl) +static void parse_audio_info(const struct pw_properties *props, struct spa_audio_info_raw *info) { - struct pw_properties *props = impl->stream_props; - struct spa_audio_info_raw *info = &impl->info; const char *str; spa_zero(*info); - if ((str = pw_properties_get(props, PW_KEY_AUDIO_FORMAT)) == NULL) str = DEFAULT_FORMAT; info->format = format_from_name(str, strlen(str)); + + info->rate = pw_properties_get_uint32(props, PW_KEY_AUDIO_RATE, info->rate); + if (info->rate == 0) + info->rate = DEFAULT_RATE; + + info->channels = pw_properties_get_uint32(props, PW_KEY_AUDIO_CHANNELS, info->channels); + info->channels = SPA_MIN(info->channels, SPA_AUDIO_MAX_CHANNELS); + if ((str = pw_properties_get(props, SPA_KEY_AUDIO_POSITION)) != NULL) + parse_position(info, str, strlen(str)); + if (info->channels == 0) + parse_position(info, DEFAULT_POSITION, strlen(DEFAULT_POSITION)); +} + +static int calc_frame_size(const struct spa_audio_info_raw *info) +{ + int res = info->channels; switch (info->format) { - case SPA_AUDIO_FORMAT_S8: case SPA_AUDIO_FORMAT_U8: - impl->frame_size = 1; - break; + case SPA_AUDIO_FORMAT_S8: + case SPA_AUDIO_FORMAT_ALAW: + case SPA_AUDIO_FORMAT_ULAW: + return res; case SPA_AUDIO_FORMAT_S16: - impl->frame_size = 2; - break; + case SPA_AUDIO_FORMAT_S16_OE: + case SPA_AUDIO_FORMAT_U16: + return res * 2; case SPA_AUDIO_FORMAT_S24: - impl->frame_size = 3; - break; + case SPA_AUDIO_FORMAT_S24_OE: + case SPA_AUDIO_FORMAT_U24: + return res * 3; case SPA_AUDIO_FORMAT_S24_32: + case SPA_AUDIO_FORMAT_S24_32_OE: case SPA_AUDIO_FORMAT_S32: + case SPA_AUDIO_FORMAT_S32_OE: + case SPA_AUDIO_FORMAT_U32: + case SPA_AUDIO_FORMAT_U32_OE: case SPA_AUDIO_FORMAT_F32: - impl->frame_size = 4; - break; + case SPA_AUDIO_FORMAT_F32_OE: + return res * 4; case SPA_AUDIO_FORMAT_F64: - impl->frame_size = 8; - break; + case SPA_AUDIO_FORMAT_F64_OE: + return res * 8; default: - pw_log_error("unsupported format '%s'", str); - return -EINVAL; - } - info->rate = pw_properties_get_uint32(props, PW_KEY_AUDIO_RATE, DEFAULT_RATE); - if (info->rate == 0) { - pw_log_error("invalid rate '%s'", str); - return -EINVAL; + return 0; } - info->channels = pw_properties_get_uint32(props, PW_KEY_AUDIO_CHANNELS, DEFAULT_CHANNELS); - if ((str = pw_properties_get(props, SPA_KEY_AUDIO_POSITION)) == NULL) - str = DEFAULT_POSITION; - parse_position(info, str, strlen(str)); - if (info->channels == 0) { - pw_log_error("invalid channels '%s'", str); - return -EINVAL; - } - impl->frame_size *= info->channels; - - return 0; } static void copy_props(struct impl *impl, struct pw_properties *props, const char *key) @@ -471,7 +475,11 @@ copy_props(impl, props, PW_KEY_NODE_VIRTUAL); copy_props(impl, props, PW_KEY_MEDIA_CLASS); - if ((res = parse_audio_info(impl)) < 0) { + parse_audio_info(impl->stream_props, &impl->info); + + impl->frame_size = calc_frame_size(&impl->info); + if (impl->frame_size == 0) { + res = -EINVAL; pw_log_error( "can't parse audio format"); goto error; }
View file
pipewire-0.3.52.tar.gz/src/modules/module-filter-chain.c -> pipewire-0.3.53.tar.gz/src/modules/module-filter-chain.c
Changed
@@ -1690,15 +1690,29 @@ * graph n_hndl times when needed. */ n_hndl = impl->capture_info.channels / n_input; if (n_hndl != impl->playback_info.channels / n_output) { - pw_log_error("invalid channels"); + pw_log_error("invalid channels. The capture stream has %1$d channels and " + "the filter has %2$d inputs. The playback stream has %3$d channels " + "and the filter has %4$d outputs. capture:%1$d / input:%2$d != " + "playback:%3$d / output:%4$d. Check inputs and outputs objects.", + impl->capture_info.channels, n_input, + impl->playback_info.channels, n_output); res = -EINVAL; goto error; } if (n_hndl > MAX_HNDL) { - pw_log_error("too many channels"); + pw_log_error("too many channels. %d > %d", n_hndl, MAX_HNDL); res = -EINVAL; goto error; } + if (n_hndl == 0) { + n_hndl = 1; + pw_log_warn("The capture stream has %1$d channels and " + "the filter has %2$d inputs. The playback stream has %3$d channels " + "and the filter has %4$d outputs. Some filter ports will be " + "unconnected..", + impl->capture_info.channels, n_input, + impl->playback_info.channels, n_output); + } pw_log_info("using %d instances %d %d", n_hndl, n_input, n_output); /* now go over all nodes and create instances. */ @@ -2083,8 +2097,9 @@ *info = SPA_AUDIO_INFO_RAW_INIT( .format = SPA_AUDIO_FORMAT_F32P); - info->rate = pw_properties_get_int32(props, PW_KEY_AUDIO_RATE, 0); - info->channels = pw_properties_get_int32(props, PW_KEY_AUDIO_CHANNELS, 0); + info->rate = pw_properties_get_int32(props, PW_KEY_AUDIO_RATE, info->rate); + info->channels = pw_properties_get_int32(props, PW_KEY_AUDIO_CHANNELS, info->channels); + info->channels = SPA_MIN(info->channels, SPA_AUDIO_MAX_CHANNELS); if ((str = pw_properties_get(props, SPA_KEY_AUDIO_POSITION)) != NULL) parse_position(info, str, strlen(str)); }
View file
pipewire-0.3.52.tar.gz/src/modules/module-filter-chain/ladspa_plugin.c -> pipewire-0.3.53.tar.gz/src/modules/module-filter-chain/ladspa_plugin.c
Changed
@@ -167,7 +167,7 @@ desc->desc.free = ladspa_free; desc->desc.name = d->Label; - desc->desc.flags = d->Properties; + desc->desc.flags = 0; desc->desc.n_ports = d->PortCount; desc->desc.ports = calloc(desc->desc.n_ports, sizeof(struct fc_port));
View file
pipewire-0.3.52.tar.gz/src/modules/module-loopback.c -> pipewire-0.3.53.tar.gz/src/modules/module-loopback.c
Changed
@@ -453,6 +453,7 @@ .format = SPA_AUDIO_FORMAT_F32P); info->rate = pw_properties_get_int32(props, PW_KEY_AUDIO_RATE, 0); info->channels = pw_properties_get_uint32(props, PW_KEY_AUDIO_CHANNELS, 0); + info->channels = SPA_MIN(info->channels, SPA_AUDIO_MAX_CHANNELS); if ((str = pw_properties_get(props, SPA_KEY_AUDIO_POSITION)) != NULL) parse_position(info, str, strlen(str)); }
View file
pipewire-0.3.52.tar.gz/src/modules/module-pipe-tunnel.c -> pipewire-0.3.53.tar.gz/src/modules/module-pipe-tunnel.c
Changed
@@ -84,6 +84,7 @@ * Options with well-known behavior. * * - \ref PW_KEY_REMOTE_NAME + * - \ref PW_KEY_AUDIO_FORMAT * - \ref PW_KEY_AUDIO_RATE * - \ref PW_KEY_AUDIO_CHANNELS * - \ref SPA_KEY_AUDIO_POSITION @@ -107,6 +108,7 @@ * tunnel.mode = playback * # Set the pipe name to tunnel to * pipe.filename = "/tmp/fifo_output" + * #audio.format=<sample format> * #audio.rate=<sample rate> * #audio.channels=<number of channels> * #audio.position=<channel map> @@ -125,6 +127,11 @@ #define DEFAULT_CAPTURE_FILENAME "/tmp/fifo_input" #define DEFAULT_PLAYBACK_FILENAME "/tmp/fifo_output" +#define DEFAULT_FORMAT "S16" +#define DEFAULT_RATE 48000 +#define DEFAULT_CHANNELS 2 +#define DEFAULT_POSITION " FL FR " + PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); #define PW_LOG_TOPIC_DEFAULT mod_topic @@ -133,6 +140,7 @@ " node.name=<name of the nodes> " \ " node.description=<description of the nodes> " \ " node.target=<remote node target name> " \ + " audio.format=<sample format> " \ " audio.rate=<sample rate> " \ " audio.channels=<number of channels> " \ " audio.position=<channel map> " \ @@ -377,7 +385,7 @@ do_unlink_fifo = true; } - if ((fd = open(filename, O_RDWR | O_CLOEXEC | O_NONBLOCK, 0)) <= 0) { + if ((fd = open(filename, O_RDWR | O_CLOEXEC | O_NONBLOCK, 0)) < 0) { res = -errno; pw_log_error("open('%s'): %s", filename, spa_strerror(res)); goto error; @@ -408,7 +416,7 @@ error: if (do_unlink_fifo) unlink(filename); - if (fd > 0) + if (fd >= 0) close(fd); return res; } @@ -453,7 +461,7 @@ unlink(impl->filename); free(impl->filename); } - if (impl->fd > 0) + if (impl->fd >= 0) close(impl->fd); pw_properties_free(impl->stream_props); @@ -511,31 +519,28 @@ return SPA_AUDIO_FORMAT_UNKNOWN; } -static void parse_audio_info(struct pw_properties *props, struct spa_audio_info_raw *info) +static void parse_audio_info(const struct pw_properties *props, struct spa_audio_info_raw *info) { const char *str; - *info = SPA_AUDIO_INFO_RAW_INIT( - .rate = 48000, - .channels = 2, - .format = SPA_AUDIO_FORMAT_S16); - - if ((str = pw_properties_get(props, PW_KEY_AUDIO_FORMAT)) != NULL) { - uint32_t id; - - id = format_from_name(str, strlen(str)); - if (id != SPA_AUDIO_FORMAT_UNKNOWN) - info->format = id; - } + spa_zero(*info); + if ((str = pw_properties_get(props, PW_KEY_AUDIO_FORMAT)) == NULL) + str = DEFAULT_FORMAT; + info->format = format_from_name(str, strlen(str)); info->rate = pw_properties_get_uint32(props, PW_KEY_AUDIO_RATE, info->rate); + if (info->rate == 0) + info->rate = DEFAULT_RATE; + info->channels = pw_properties_get_uint32(props, PW_KEY_AUDIO_CHANNELS, info->channels); + info->channels = SPA_MIN(info->channels, SPA_AUDIO_MAX_CHANNELS); if ((str = pw_properties_get(props, SPA_KEY_AUDIO_POSITION)) != NULL) parse_position(info, str, strlen(str)); - + if (info->channels == 0) + parse_position(info, DEFAULT_POSITION, strlen(DEFAULT_POSITION)); } -static int calc_frame_size(struct spa_audio_info_raw *info) +static int calc_frame_size(const struct spa_audio_info_raw *info) { int res = info->channels; switch (info->format) { @@ -662,13 +667,6 @@ parse_audio_info(impl->stream_props, &impl->info); - if (impl->info.rate != 0 && - pw_properties_get(props, PW_KEY_NODE_RATE) == NULL) - pw_properties_setf(props, PW_KEY_NODE_RATE, - "1/%u", impl->info.rate), - - copy_props(impl, props, PW_KEY_NODE_RATE); - impl->frame_size = calc_frame_size(&impl->info); if (impl->frame_size == 0) { pw_log_error("unsupported audio format:%d channels:%d", @@ -676,6 +674,13 @@ res = -EINVAL; goto error; } + if (impl->info.rate != 0 && + pw_properties_get(props, PW_KEY_NODE_RATE) == NULL) + pw_properties_setf(props, PW_KEY_NODE_RATE, + "1/%u", impl->info.rate), + + copy_props(impl, props, PW_KEY_NODE_RATE); + impl->leftover = calloc(1, impl->frame_size); if (impl->leftover == NULL) { res = -errno;
View file
pipewire-0.3.52.tar.gz/src/modules/module-protocol-native.c -> pipewire-0.3.53.tar.gz/src/modules/module-protocol-native.c
Changed
@@ -38,7 +38,7 @@ #ifdef HAVE_PWD_H #include <pwd.h> #endif -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__MidnightBSD__) #include <sys/ucred.h> #endif @@ -534,7 +534,7 @@ struct pw_impl_client *client; struct pw_protocol *protocol = s->this.protocol; socklen_t len; -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__MidnightBSD__) struct xucred xucred; #else struct ucred ucred; @@ -583,7 +583,7 @@ (int)len, buffer); } } -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__MidnightBSD__) len = sizeof(xucred); if (getsockopt(fd, 0, LOCAL_PEERCRED, &xucred, &len) < 0) { pw_log_warn("server %p: no peercred: %m", s);
View file
pipewire-0.3.52.tar.gz/src/modules/module-protocol-pulse.c -> pipewire-0.3.53.tar.gz/src/modules/module-protocol-pulse.c
Changed
@@ -214,14 +214,16 @@ * VMs usually can't support the low latency settings that are possible on real * hardware. * - * ## Application settings (Rules) - * - * The pulse protocol module supports generic config rules. It provides a `quirks` - * and an `update-props` action. + * ## Stream settings and rules * * Streams created by module-protocol-pulse will use the stream.properties * section and stream.rules sections as usual. * + * ## Application settings (Rules) + * + * The pulse protocol module supports generic config rules. It supports a pulse.rules + * section with a `quirks` and an `update-props` action. + * *\code{.unparsed} * pulse.rules = * {
View file
pipewire-0.3.52.tar.gz/src/modules/module-protocol-pulse/client.c -> pipewire-0.3.53.tar.gz/src/modules/module-protocol-pulse/client.c
Changed
@@ -159,10 +159,10 @@ pending_sample_free(p); if (client->message) - message_free(impl, client->message, false, false); + message_free(client->message, false, false); spa_list_consume(msg, &client->out_messages, link) - message_free(impl, msg, true, false); + message_free(msg, true, false); spa_list_consume(o, &client->operations, link) operation_free(o); @@ -220,14 +220,12 @@ return 0; error: - message_free(impl, msg, false, false); + message_free(msg, false, false); return res; } static int client_try_flush_messages(struct client *client) { - struct impl *impl = client->impl; - pw_log_trace("client %p: flushing", client); spa_assert(!client->disconnect); @@ -254,7 +252,7 @@ } else { if (debug_messages && m->channel == SPA_ID_INVALID) message_dump(SPA_LOG_LEVEL_INFO, m); - message_free(impl, m, true, false); + message_free(m, true, false); client->out_index = 0; continue; } @@ -307,7 +305,7 @@ if (m == first && client->out_index > 0) return false; - message_free(client->impl, m, true, false); + message_free(m, true, false); return true; }
View file
pipewire-0.3.52.tar.gz/src/modules/module-protocol-pulse/client.h -> pipewire-0.3.53.tar.gz/src/modules/module-protocol-pulse/client.h
Changed
@@ -56,7 +56,7 @@ struct server *server; int ref; - const char *name; + const char *name; /* owned by `client::props` */ struct spa_source *source;
View file
pipewire-0.3.52.tar.gz/src/modules/module-protocol-pulse/message.c -> pipewire-0.3.53.tar.gz/src/modules/module-protocol-pulse/message.c
Changed
@@ -390,6 +390,9 @@ uint32_t alloc, diff; void *data; + if (m->length > m->allocated) + return -ENOMEM; + if (m->length + size <= m->allocated) return size; @@ -397,12 +400,13 @@ diff = alloc - m->allocated; if ((data = realloc(m->data, alloc)) == NULL) { free(m->data); - m->stat->allocated -= m->allocated; + m->data = NULL; + m->impl->stat.allocated -= m->allocated; m->allocated = 0; return -errno; } - m->stat->allocated += diff; - m->stat->accumulated += diff; + m->impl->stat.allocated += diff; + m->impl->stat.accumulated += diff; m->data = data; m->allocated = alloc; return size; @@ -826,18 +830,20 @@ msg = spa_list_first(&impl->free_messages, struct message, link); spa_list_remove(&msg->link); pw_log_trace("using recycled message %p size:%d", msg, size); + + spa_assert(msg->impl == impl); } else { if ((msg = calloc(1, sizeof(*msg))) == NULL) return NULL; pw_log_trace("new message %p size:%d", msg, size); - msg->stat = &impl->stat; - msg->stat->n_allocated++; - msg->stat->n_accumulated++; + msg->impl = impl; + msg->impl->stat.n_allocated++; + msg->impl->stat.n_accumulated++; } if (ensure_size(msg, size) < 0) { - message_free(impl, msg, false, true); + message_free(msg, false, true); return NULL; } @@ -849,23 +855,23 @@ return msg; } -void message_free(struct impl *impl, struct message *msg, bool dequeue, bool destroy) +void message_free(struct message *msg, bool dequeue, bool destroy) { if (dequeue) spa_list_remove(&msg->link); - if (msg->stat->allocated > MAX_ALLOCATED || msg->allocated > MAX_SIZE) + if (msg->impl->stat.allocated > MAX_ALLOCATED || msg->allocated > MAX_SIZE) destroy = true; if (destroy) { pw_log_trace("destroy message %p size:%d", msg, msg->allocated); - msg->stat->n_allocated--; - msg->stat->allocated -= msg->allocated; + msg->impl->stat.n_allocated--; + msg->impl->stat.allocated -= msg->allocated; free(msg->data); free(msg); } else { pw_log_trace("recycle message %p size:%d/%d", msg, msg->length, msg->allocated); - spa_list_append(&impl->free_messages, &msg->link); + spa_list_append(&msg->impl->free_messages, &msg->link); msg->length = 0; } }
View file
pipewire-0.3.52.tar.gz/src/modules/module-protocol-pulse/message.h -> pipewire-0.3.53.tar.gz/src/modules/module-protocol-pulse/message.h
Changed
@@ -32,12 +32,10 @@ #include <spa/support/log.h> struct impl; -struct client; -struct stats; struct message { struct spa_list link; - struct stats *stat; + struct impl *impl; uint32_t extra4; uint32_t channel; uint32_t allocated; @@ -69,7 +67,7 @@ }; struct message *message_alloc(struct impl *impl, uint32_t channel, uint32_t size); -void message_free(struct impl *impl, struct message *msg, bool dequeue, bool destroy); +void message_free(struct message *msg, bool dequeue, bool destroy); int message_get(struct message *m, ...); int message_put(struct message *m, ...); int message_dump(enum spa_log_level level, struct message *m);
View file
pipewire-0.3.52.tar.gz/src/modules/module-protocol-pulse/pulse-server.c -> pipewire-0.3.53.tar.gz/src/modules/module-protocol-pulse/pulse-server.c
Changed
@@ -87,9 +87,6 @@ #define DEFAULT_POSITION " FL FR " #define MAX_FORMATS 32 -/* The max amount of data we send in one block when capturing. In PulseAudio this - * size is derived from the mempool PA_MEMPOOL_SLOT_SIZE */ -#define MAX_FRAGSIZE (64*1024) #define TEMPORARY_MOVE_TIMEOUT (SPA_NSEC_PER_SEC) @@ -455,6 +452,10 @@ if (frame_size == 0) frame_size = 4; + pw_log_info("%s maxlength:%u tlength:%u minreq:%u prebuf:%u", + s->client->name, attr->maxlength, attr->tlength, + attr->minreq, attr->prebuf); + minreq = frac_to_bytes_round_up(s->min_req, &s->ss); max_latency = defs->quantum_limit * frame_size; @@ -651,6 +652,9 @@ if (frame_size == 0) frame_size = 4; + pw_log_info("%s maxlength:%u fragsize:%u", + s->client->name, attr->maxlength, attr->fragsize); + if (attr->maxlength == (uint32_t) -1 || attr->maxlength > MAXLENGTH) attr->maxlength = MAXLENGTH; attr->maxlength -= attr->maxlength % frame_size; @@ -660,12 +664,9 @@ if (attr->fragsize == (uint32_t) -1 || attr->fragsize == 0) attr->fragsize = frac_to_bytes_round_up(s->default_frag, &s->ss); - attr->fragsize -= attr->fragsize % frame_size; + attr->fragsize = SPA_MIN(attr->fragsize, attr->maxlength); + attr->fragsize = SPA_ROUND_UP(attr->fragsize, frame_size); attr->fragsize = SPA_MAX(attr->fragsize, minfrag); - attr->fragsize = SPA_MAX(attr->fragsize, frame_size); - - if (attr->fragsize > attr->maxlength) - attr->fragsize = attr->maxlength; attr->tlength = attr->minreq = attr->prebuf = 0; @@ -676,6 +677,9 @@ } else { latency = attr->fragsize; } + /* make sure can queue at least to fragsize without overruns */ + if (attr->maxlength < attr->fragsize * 2) + attr->maxlength = attr->fragsize * 2; pw_log_info("%s maxlength:%u fragsize:%u minfrag:%u latency:%u", s->client->name, attr->maxlength, attr->fragsize, minfrag, @@ -748,13 +752,12 @@ peer = find_linked(manager, peer->id, PW_DIRECTION_OUTPUT); if (peer && pw_manager_object_is_source_or_monitor(peer)) { name = pw_properties_get(peer->props, PW_KEY_NODE_NAME); + peer_index = peer->index; if (!pw_manager_object_is_source(peer)) { size_t len = (name ? strlen(name) : 5) + 10; - peer_index = peer->index; peer_name = tmp = alloca(len); snprintf(tmp, len, "%s.monitor", name ? name : "sink"); } else { - peer_index = peer->index; peer_name = name; } } else { @@ -849,6 +852,13 @@ s->peer_index = peer->index; peer_name = pw_properties_get(peer->props, PW_KEY_NODE_NAME); + if (peer_name && s->direction == PW_DIRECTION_INPUT && + pw_manager_object_is_monitor(peer)) { + int len = strlen(peer_name) + 10; + char *tmp = alloca(len); + snprintf(tmp, len, "%s.monitor", peer_name); + peer_name = tmp; + } if (peer_name != NULL) stream_send_moved(s, peer->index, peer_name); } @@ -1024,12 +1034,12 @@ changed++; } + client_update_quirks(client); + client->name = pw_properties_get(client->props, PW_KEY_APP_NAME); pw_log_info("%s %s tag:%d", client->name, commandscommand.name, tag); - client_update_quirks(client); - if (client->core == NULL) { client->core = pw_context_connect(impl->context, pw_properties_copy(client->props), 0); @@ -1320,8 +1330,7 @@ } while ((uint32_t)avail >= stream->attr.fragsize) { - towrite = SPA_MIN(avail, MAX_FRAGSIZE); - towrite = SPA_ROUND_DOWN(towrite, stream->frame_size); + towrite = SPA_MIN((uint32_t)avail, stream->attr.fragsize); msg = message_alloc(impl, stream->channel, towrite); if (msg == NULL) @@ -3236,6 +3245,7 @@ } else { if (pw_properties_update(client->props, &props->dict) > 0) { client_update_quirks(client); + client->name = pw_properties_get(client->props, PW_KEY_APP_NAME); pw_core_update_properties(client->core, &client->props->dict); } } @@ -4313,7 +4323,7 @@ goto error; error: if (reply) - message_free(impl, reply, false, false); + message_free(reply, false, false); return res; } @@ -4389,7 +4399,7 @@ error: if (reply) - message_free(impl, reply, false, false); + message_free(reply, false, false); return res; } @@ -5353,7 +5363,7 @@ client_free(c); spa_list_consume(msg, &impl->free_messages, link) - message_free(impl, msg, true, true); + message_free(msg, true, true); pw_map_for_each(&impl->samples, impl_free_sample, impl); pw_map_clear(&impl->samples);
View file
pipewire-0.3.52.tar.gz/src/modules/module-protocol-pulse/remap.c -> pipewire-0.3.53.tar.gz/src/modules/module-protocol-pulse/remap.c
Changed
@@ -43,6 +43,7 @@ const struct str_map props_key_map = { { PW_KEY_DEVICE_BUS_PATH, "device.bus_path" }, + { PW_KEY_DEVICE_SYSFS_PATH, "sysfs.path" }, { PW_KEY_DEVICE_FORM_FACTOR, "device.form_factor" }, { PW_KEY_DEVICE_ICON_NAME, "device.icon_name" }, { PW_KEY_DEVICE_INTENDED_ROLES, "device.intended_roles" },
View file
pipewire-0.3.52.tar.gz/src/modules/module-protocol-pulse/server.c -> pipewire-0.3.53.tar.gz/src/modules/module-protocol-pulse/server.c
Changed
@@ -66,7 +66,6 @@ static int handle_packet(struct client *client, struct message *msg) { - struct impl * const impl = client->impl; uint32_t command, tag; int res = 0; @@ -110,7 +109,7 @@ res = cmd->run(client, command, tag, msg); finish: - message_free(impl, msg, false, false); + message_free(msg, false, false); if (res < 0) reply_error(client, command, tag, res); @@ -119,7 +118,6 @@ static int handle_memblock(struct client *client, struct message *msg) { - struct impl * const impl = client->impl; struct stream *stream; uint32_t channel, flags, index; int64_t offset, diff; @@ -190,7 +188,7 @@ stream_send_request(stream); finish: - message_free(impl, msg, false, false); + message_free(msg, false, false); return res; } @@ -264,7 +262,7 @@ } if (client->message) - message_free(impl, client->message, false, false); + message_free(client->message, false, false); client->message = message_alloc(impl, channel, length); } else if (client->message && @@ -460,7 +458,7 @@ if (address0 != '/') { char runtime_dirPATH_MAX; - if ((res = get_runtime_dir(runtime_dir, sizeof(runtime_dir), "pulse")) < 0) + if ((res = get_runtime_dir(runtime_dir, sizeof(runtime_dir))) < 0) return res; res = snprintf(addr.sun_path, sizeof(addr.sun_path),
View file
pipewire-0.3.52.tar.gz/src/modules/module-protocol-pulse/utils.c -> pipewire-0.3.53.tar.gz/src/modules/module-protocol-pulse/utils.c
Changed
@@ -50,27 +50,30 @@ #include "log.h" #include "utils.h" -int get_runtime_dir(char *buf, size_t buflen, const char *dir) +int get_runtime_dir(char *buf, size_t buflen) { - const char *runtime_dir; + const char *runtime_dir, *dir = NULL; struct stat stat_buf; int res, size; runtime_dir = getenv("PULSE_RUNTIME_PATH"); - if (runtime_dir == NULL) + if (runtime_dir == NULL) { runtime_dir = getenv("XDG_RUNTIME_DIR"); - + dir = "pulse"; + } if (runtime_dir == NULL) { pw_log_error("could not find a suitable runtime directory in" "$PULSE_RUNTIME_PATH and $XDG_RUNTIME_DIR"); return -ENOENT; } - size = snprintf(buf, buflen, "%s/%s", runtime_dir, dir); + size = snprintf(buf, buflen, "%s%s%s", runtime_dir, + dir ? "/" : "", dir ? dir : ""); if (size < 0) return -errno; if ((size_t) size >= buflen) { - pw_log_error("path %s/%s too long", runtime_dir, dir); + pw_log_error("path %s%s%s too long", runtime_dir, + dir ? "/" : "", dir ? dir : ""); return -ENAMETOOLONG; } @@ -149,7 +152,7 @@ pw_log_warn("client %p: no peercred: %m", client); } else return ucred.pid; -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__MidnightBSD__) struct xucred xucred; len = sizeof(xucred); if (getsockopt(client_fd, 0, LOCAL_PEERCRED, &xucred, &len) < 0) { @@ -182,7 +185,7 @@ FILE *f; int res; - if ((res = get_runtime_dir(pid_file, sizeof(pid_file), "pulse")) < 0) + if ((res = get_runtime_dir(pid_file, sizeof(pid_file))) < 0) return res; if (strlen(pid_file) > PATH_MAX - sizeof("/pid")) {
View file
pipewire-0.3.52.tar.gz/src/modules/module-protocol-pulse/utils.h -> pipewire-0.3.53.tar.gz/src/modules/module-protocol-pulse/utils.h
Changed
@@ -31,7 +31,7 @@ struct client; struct pw_context; -int get_runtime_dir(char *buf, size_t buflen, const char *dir); +int get_runtime_dir(char *buf, size_t buflen); int check_flatpak(struct client *client, pid_t pid); pid_t get_client_pid(struct client *client, int client_fd); const char *get_server_name(struct pw_context *context);
View file
pipewire-0.3.52.tar.gz/src/modules/module-pulse-tunnel.c -> pipewire-0.3.53.tar.gz/src/modules/module-pulse-tunnel.c
Changed
@@ -80,6 +80,7 @@ * Options with well-known behavior. * * - \ref PW_KEY_REMOTE_NAME + * - \ref PW_KEY_AUDIO_FORMAT * - \ref PW_KEY_AUDIO_RATE * - \ref PW_KEY_AUDIO_CHANNELS * - \ref SPA_KEY_AUDIO_POSITION @@ -118,11 +119,17 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME); #define PW_LOG_TOPIC_DEFAULT mod_topic +#define DEFAULT_FORMAT "S16" +#define DEFAULT_RATE 48000 +#define DEFAULT_CHANNELS 2 +#define DEFAULT_POSITION " FL FR " + #define MODULE_USAGE " remote.name=<remote> " \ " node.latency=<latency as fraction> " \ " node.name=<name of the nodes> " \ " node.description=<description of the nodes> " \ " node.target=<remote node target name> " \ + " audio.format=<sample format> " \ " audio.rate=<sample rate> " \ " audio.channels=<number of channels> " \ " audio.position=<channel map> " \ @@ -823,28 +830,25 @@ return SPA_AUDIO_FORMAT_UNKNOWN; } -static void parse_audio_info(struct pw_properties *props, struct spa_audio_info_raw *info) +static void parse_audio_info(const struct pw_properties *props, struct spa_audio_info_raw *info) { const char *str; - *info = SPA_AUDIO_INFO_RAW_INIT( - .rate = 48000, - .channels = 2, - .format = SPA_AUDIO_FORMAT_S16); - - if ((str = pw_properties_get(props, PW_KEY_AUDIO_FORMAT)) != NULL) { - uint32_t id; - - id = format_from_name(str, strlen(str)); - if (id != SPA_AUDIO_FORMAT_UNKNOWN) - info->format = id; - } + spa_zero(*info); + if ((str = pw_properties_get(props, PW_KEY_AUDIO_FORMAT)) == NULL) + str = DEFAULT_FORMAT; + info->format = format_from_name(str, strlen(str)); info->rate = pw_properties_get_uint32(props, PW_KEY_AUDIO_RATE, info->rate); + if (info->rate == 0) + info->rate = DEFAULT_RATE; + info->channels = pw_properties_get_uint32(props, PW_KEY_AUDIO_CHANNELS, info->channels); + info->channels = SPA_MIN(info->channels, SPA_AUDIO_MAX_CHANNELS); if ((str = pw_properties_get(props, SPA_KEY_AUDIO_POSITION)) != NULL) parse_position(info, str, strlen(str)); - + if (info->channels == 0) + parse_position(info, DEFAULT_POSITION, strlen(DEFAULT_POSITION)); } static int calc_frame_size(struct spa_audio_info_raw *info)
View file
pipewire-0.3.52.tar.gz/src/modules/module-raop-sink.c -> pipewire-0.3.53.tar.gz/src/modules/module-raop-sink.c
Changed
@@ -110,7 +110,7 @@ " node.name=<name of the nodes> " \ " node.description=<description of the nodes> " \ " audio.format=<format, default:"DEFAULT_FORMAT"> " \ - " audio.rate=<sample rate, default: "SPA_STRINGIFY(DEFAuLT_RATE)"> " \ + " audio.rate=<sample rate, default: "SPA_STRINGIFY(DEFAULT_RATE)"> " \ " audio.channels=<number of channels, default:"SPA_STRINGIFY(DEFAULT_CHANNELS)"> " \ " audio.position=<channel map, default:"DEFAULT_POSITION"> " \ " stream.props=<properties> " @@ -1143,7 +1143,7 @@ DEFAULT_USER_NAME, realm, nonce, resp); } else - return -EINVAL; + goto error; pw_properties_setf(impl->headers, "Authorization", "%s %s", tokens0, auth); @@ -1484,56 +1484,59 @@ } } -static int parse_audio_info(struct impl *impl) +static void parse_audio_info(const struct pw_properties *props, struct spa_audio_info_raw *info) { - struct pw_properties *props = impl->stream_props; - struct spa_audio_info_raw *info = &impl->info; const char *str; spa_zero(*info); - if ((str = pw_properties_get(props, PW_KEY_AUDIO_FORMAT)) == NULL) str = DEFAULT_FORMAT; info->format = format_from_name(str, strlen(str)); + + info->rate = pw_properties_get_uint32(props, PW_KEY_AUDIO_RATE, info->rate); + if (info->rate == 0) + info->rate = DEFAULT_RATE; + + info->channels = pw_properties_get_uint32(props, PW_KEY_AUDIO_CHANNELS, info->channels); + info->channels = SPA_MIN(info->channels, SPA_AUDIO_MAX_CHANNELS); + if ((str = pw_properties_get(props, SPA_KEY_AUDIO_POSITION)) != NULL) + parse_position(info, str, strlen(str)); + if (info->channels == 0) + parse_position(info, DEFAULT_POSITION, strlen(DEFAULT_POSITION)); +} + +static int calc_frame_size(struct spa_audio_info_raw *info) +{ + int res = info->channels; switch (info->format) { - case SPA_AUDIO_FORMAT_S8: case SPA_AUDIO_FORMAT_U8: - impl->frame_size = 1; - break; + case SPA_AUDIO_FORMAT_S8: + case SPA_AUDIO_FORMAT_ALAW: + case SPA_AUDIO_FORMAT_ULAW: + return res; case SPA_AUDIO_FORMAT_S16: - impl->frame_size = 2; - break; + case SPA_AUDIO_FORMAT_S16_OE: + case SPA_AUDIO_FORMAT_U16: + return res * 2; case SPA_AUDIO_FORMAT_S24: - impl->frame_size = 3; - break; + case SPA_AUDIO_FORMAT_S24_OE: + case SPA_AUDIO_FORMAT_U24: + return res * 3; case SPA_AUDIO_FORMAT_S24_32: + case SPA_AUDIO_FORMAT_S24_32_OE: case SPA_AUDIO_FORMAT_S32: + case SPA_AUDIO_FORMAT_S32_OE: + case SPA_AUDIO_FORMAT_U32: + case SPA_AUDIO_FORMAT_U32_OE: case SPA_AUDIO_FORMAT_F32: - impl->frame_size = 4; - break; + case SPA_AUDIO_FORMAT_F32_OE: + return res * 4; case SPA_AUDIO_FORMAT_F64: - impl->frame_size = 8; - break; + case SPA_AUDIO_FORMAT_F64_OE: + return res * 8; default: - pw_log_error("unsupported format '%s'", str); - return -EINVAL; - } - info->rate = pw_properties_get_uint32(props, PW_KEY_AUDIO_RATE, DEFAULT_RATE); - if (info->rate == 0) { - pw_log_error("invalid rate '%s'", str); - return -EINVAL; - } - info->channels = pw_properties_get_uint32(props, PW_KEY_AUDIO_CHANNELS, DEFAULT_CHANNELS); - if ((str = pw_properties_get(props, SPA_KEY_AUDIO_POSITION)) == NULL) - str = DEFAULT_POSITION; - parse_position(info, str, strlen(str)); - if (info->channels == 0) { - pw_log_error("invalid channels '%s'", str); - return -EINVAL; + return 0; } - impl->frame_size *= info->channels; - - return 0; } static void copy_props(struct impl *impl, struct pw_properties *props, const char *key) @@ -1617,8 +1620,13 @@ copy_props(impl, props, PW_KEY_NODE_VIRTUAL); copy_props(impl, props, PW_KEY_MEDIA_CLASS); - if ((res = parse_audio_info(impl)) < 0) { - pw_log_error( "can't parse audio format"); + parse_audio_info(impl->stream_props, &impl->info); + + impl->frame_size = calc_frame_size(&impl->info); + if (impl->frame_size == 0) { + pw_log_error("unsupported audio format:%d channels:%d", + impl->info.format, impl->info.channels); + res = -EINVAL; goto error; } @@ -1630,6 +1638,7 @@ impl->protocol = PROTO_TCP; else { pw_log_error( "can't handle transport %s", str); + res = -EINVAL; goto error; } @@ -1641,6 +1650,7 @@ impl->encryption = CRYPTO_RSA; else { pw_log_error( "can't handle encryption type %s", str); + res = -EINVAL; goto error; } @@ -1650,6 +1660,7 @@ impl->codec = CODEC_PCM; else { pw_log_error( "can't handle codec type %s", str); + res = -EINVAL; goto error; } str = pw_properties_get(props, "raop.password");
View file
pipewire-0.3.52.tar.gz/src/modules/module-roc-sink.c -> pipewire-0.3.53.tar.gz/src/modules/module-roc-sink.c
Changed
@@ -316,7 +316,7 @@ /* Fixed to be the same as ROC sender config above */ info.rate = 44100; info.channels = 2; - info.format = SPA_AUDIO_FORMAT_F32_LE; + info.format = SPA_AUDIO_FORMAT_F32; info.position0 = SPA_AUDIO_CHANNEL_FL; info.position1 = SPA_AUDIO_CHANNEL_FR;
View file
pipewire-0.3.52.tar.gz/src/modules/module-roc-source.c -> pipewire-0.3.53.tar.gz/src/modules/module-roc-source.c
Changed
@@ -337,7 +337,7 @@ /* Fixed to be the same as ROC receiver config above */ info.rate = 44100; info.channels = 2; - info.format = SPA_AUDIO_FORMAT_F32_LE; + info.format = SPA_AUDIO_FORMAT_F32; info.position0 = SPA_AUDIO_CHANNEL_FL; info.position1 = SPA_AUDIO_CHANNEL_FR; data->stride = info.channels * sizeof(float);
View file
pipewire-0.3.52.tar.gz/src/modules/module-rt.c -> pipewire-0.3.53.tar.gz/src/modules/module-rt.c
Changed
@@ -52,7 +52,7 @@ #include <stdio.h> #include <errno.h> #include <sys/stat.h> -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__MidnightBSD__) #include <sys/thr.h> #endif #include <fcntl.h> @@ -205,7 +205,7 @@ return (pid_t) gettid(); #elif defined(__linux__) return syscall(SYS_gettid); -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__MidnightBSD__) long pid; thr_self(&pid); return (pid_t)pid;
View file
pipewire-0.3.52.tar.gz/src/pipewire/conf.c -> pipewire-0.3.53.tar.gz/src/pipewire/conf.c
Changed
@@ -38,7 +38,7 @@ #ifdef HAVE_PWD_H #include <pwd.h> #endif -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__MidnightBSD__) #define O_PATH 0 #endif
View file
pipewire-0.3.52.tar.gz/src/pipewire/data-loop.c -> pipewire-0.3.53.tar.gz/src/pipewire/data-loop.c
Changed
@@ -40,11 +40,11 @@ int res; while (true) { - if (!this->running) { + if (SPA_UNLIKELY(!this->running)) { res = -ECANCELED; break; } - if ((res = pw_loop_iterate(this->loop, timeout)) < 0) { + if (SPA_UNLIKELY((res = pw_loop_iterate(this->loop, timeout)) < 0)) { if (res == -EINTR) continue; } @@ -77,8 +77,8 @@ pthread_cleanup_push(thread_cleanup, this); - while (this->running) { - if ((res = pw_loop_iterate(this->loop, -1)) < 0) { + while (SPA_LIKELY(this->running)) { + if (SPA_UNLIKELY((res = pw_loop_iterate(this->loop, -1)) < 0)) { if (res == -EINTR) continue; pw_log_error("%p: iterate error %d (%s)",
View file
pipewire-0.3.52.tar.gz/src/pipewire/keys.h -> pipewire-0.3.53.tar.gz/src/pipewire/keys.h
Changed
@@ -249,6 +249,7 @@ * "isa", "pci", "usb", "firewire", * "bluetooth" */ #define PW_KEY_DEVICE_SUBSYSTEM "device.subsystem" /**< device subsystem */ +#define PW_KEY_DEVICE_SYSFS_PATH "device.sysfs.path" /**< device sysfs path */ #define PW_KEY_DEVICE_ICON "device.icon" /**< icon for the device. A base64 blob * containing PNG image data */ #define PW_KEY_DEVICE_ICON_NAME "device.icon-name" /**< an XDG icon name for the device.
View file
pipewire-0.3.52.tar.gz/src/pipewire/mem.c -> pipewire-0.3.53.tar.gz/src/pipewire/mem.c
Changed
@@ -44,7 +44,7 @@ PW_LOG_TOPIC_EXTERN(log_mem); #define PW_LOG_TOPIC_DEFAULT log_mem -#if !defined(__FreeBSD__) && !defined(HAVE_MEMFD_CREATE) +#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) && !defined(HAVE_MEMFD_CREATE) /* * No glibc wrappers exist for memfd_create(2), so provide our own. * @@ -61,7 +61,7 @@ #define HAVE_MEMFD_CREATE 1 #endif -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__MidnightBSD__) #define MAP_LOCKED 0 #endif @@ -491,7 +491,7 @@ pw_log_error("%p: Failed to create memfd: %m", pool); goto error_free; } -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__MidnightBSD__) b->this.fd = shm_open(SHM_ANON, O_CREAT | O_RDWR | O_CLOEXEC, 0); if (b->this.fd == -1) { res = -errno;
View file
pipewire-0.3.52.tar.gz/src/pipewire/meson.build -> pipewire-0.3.53.tar.gz/src/pipewire/meson.build
Changed
@@ -94,7 +94,7 @@ '-DOLD_MEDIA_SESSION_WORKAROUND=1' -if build_machine.system() != 'freebsd' +if build_machine.system() != 'freebsd' and build_machine.system() != 'midnightbsd' libpipewire_c_args += '-D_POSIX_C_SOURCE'
View file
pipewire-0.3.52.tar.gz/src/pipewire/pipewire.c -> pipewire-0.3.53.tar.gz/src/pipewire/pipewire.c
Changed
@@ -27,7 +27,7 @@ #include <unistd.h> #include <limits.h> #include <stdio.h> -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) #include <sys/prctl.h> #endif #include <pwd.h> @@ -746,7 +746,7 @@ static char namePATH_MAX; spa_memzero(name, sizeof(name)); -#if defined(__linux__) || defined(__FreeBSD_kernel__) +#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__MidnightBSD_kernel__) { if (readlink("/proc/self/exe", name, sizeof(name)-1) > 0) { prgname = strrchr(name, '/') + 1; @@ -754,7 +754,7 @@ } } #endif -#if defined __FreeBSD__ +#if defined __FreeBSD__ || defined(__MidnightBSD__) { ssize_t len; @@ -764,7 +764,7 @@ } } #endif -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) { if (prctl(PR_GET_NAME, (unsigned long) name, 0, 0, 0) == 0) { prgname = name;
View file
pipewire-0.3.52.tar.gz/src/pipewire/private.h -> pipewire-0.3.53.tar.gz/src/pipewire/private.h
Changed
@@ -40,7 +40,7 @@ #include <spa/utils/result.h> #include <spa/utils/type-info.h> -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__MidnightBSD__) struct ucred { }; #endif
View file
pipewire-0.3.52.tar.gz/src/pipewire/settings.c -> pipewire-0.3.53.tar.gz/src/pipewire/settings.c
Changed
@@ -41,7 +41,7 @@ #define NAME "settings" #define DEFAULT_CLOCK_RATE 48000u -#define DEFAULT_CLOCK_RATES " 44100 48000 " +#define DEFAULT_CLOCK_RATES " 48000 " #define DEFAULT_CLOCK_QUANTUM 1024u #define DEFAULT_CLOCK_MIN_QUANTUM 32u #define DEFAULT_CLOCK_MAX_QUANTUM 2048u
View file
pipewire-0.3.52.tar.gz/src/pipewire/stream.c -> pipewire-0.3.53.tar.gz/src/pipewire/stream.c
Changed
@@ -1182,8 +1182,6 @@ return -EINVAL; } - spa_list_append(&stream->controls, &c->link); - pod = spa_pod_get_values(type, &n_vals, &choice); c->type = SPA_POD_TYPE(pod); @@ -1204,22 +1202,28 @@ vals0 = SPA_POD_VALUE(struct spa_pod_bool, pod); n_vals = 3; } - else + else { + free(c); return -ENOTSUP; + } c->container = container != SPA_ID_INVALID ? container : c->type; switch (choice) { case SPA_CHOICE_None: - if (n_vals < 1) + if (n_vals < 1) { + free(c); return -EINVAL; + } c->control.n_values = 1; c->control.max_values = 1; c->control.values0 = c->control.def = c->control.min = c->control.max = vals0; break; case SPA_CHOICE_Range: - if (n_vals < 3) + if (n_vals < 3) { + free(c); return -EINVAL; + } c->control.n_values = 1; c->control.max_values = 1; c->control.values0 = vals0; @@ -1228,10 +1232,12 @@ c->control.max = vals2; break; default: + free(c); return -ENOTSUP; } c->id = iid; + spa_list_append(&stream->controls, &c->link); pw_log_debug("%p: add control %d (%s) container:%d (def:%f min:%f max:%f)", stream, c->id, c->control.name, c->container, c->control.def, c->control.min, c->control.max);
View file
pipewire-0.3.52.tar.gz/src/pipewire/stream.h -> pipewire-0.3.53.tar.gz/src/pipewire/stream.h
Changed
@@ -161,6 +161,15 @@ * \section sec_stream_disconnect Disconnect * * Use \ref pw_stream_disconnect() to disconnect a stream after use. + * + * \section sec_stream_configuration Configuration + * + * \subsection ssec_config_properties Stream Properties + * + * \subsection ssec_config_rules Stream Rules + * + * \section sec_stream_environment Environment Variables + * */ /** \defgroup pw_stream Stream *
View file
pipewire-0.3.52.tar.gz/src/pipewire/thread.c -> pipewire-0.3.53.tar.gz/src/pipewire/thread.c
Changed
@@ -62,9 +62,9 @@ return NULL; } -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__MidnightBSD__) #include <sys/param.h> -#if __FreeBSD_version < 1202000 +#if __FreeBSD_version < 1202000 || defined(__MidnightBSD__) int pthread_setname_np(pthread_t thread, const char *name) { pthread_set_name_np(thread, name);
View file
pipewire-0.3.52.tar.gz/src/tools/meson.build -> pipewire-0.3.53.tar.gz/src/tools/meson.build
Changed
@@ -17,13 +17,11 @@ ) endforeach -if readline_dep.found() - executable('pw-cli', - 'pw-cli.c', - install: true, - dependencies: pipewire_dep, readline_dep - ) -endif +executable('pw-cli', + 'pw-cli.c', + install: true, + dependencies: pipewire_dep, readline_dep +) if ncurses_dep.found() executable('pw-top',
View file
pipewire-0.3.52.tar.gz/src/tools/pw-cat.c -> pipewire-0.3.53.tar.gz/src/tools/pw-cat.c
Changed
@@ -126,7 +126,6 @@ unsigned int rate; int channels; struct channelmap channelmap; - unsigned int samplesize; unsigned int stride; enum unit latency_unit; unsigned int latency_value; @@ -154,125 +153,42 @@ } dsf; }; -static inline int -sf_str_to_fmt(const char *str) -{ - if (!str) - return -1; - - if (spa_streq(str, "s8")) - return SF_FORMAT_PCM_S8; - if (spa_streq(str, "u8")) - return SF_FORMAT_PCM_U8; - if (spa_streq(str, "s16")) - return SF_FORMAT_PCM_16; - if (spa_streq(str, "s24")) - return SF_FORMAT_PCM_24; - if (spa_streq(str, "s32")) - return SF_FORMAT_PCM_32; - if (spa_streq(str, "f32")) - return SF_FORMAT_FLOAT; - if (spa_streq(str, "f64")) - return SF_FORMAT_DOUBLE; - - return -1; -} - -static inline const char * -sf_fmt_to_str(int format) -{ - int sub_type = (format & SF_FORMAT_SUBMASK); - - if (sub_type == SF_FORMAT_PCM_U8) - return "u8"; - if (sub_type == SF_FORMAT_PCM_S8) - return "s8"; - if (sub_type == SF_FORMAT_PCM_16) - return "s16"; - if (sub_type == SF_FORMAT_PCM_24) - return "s24"; - if (sub_type == SF_FORMAT_PCM_32) - return "s32"; - if (sub_type == SF_FORMAT_FLOAT) - return "f32"; - if (sub_type == SF_FORMAT_DOUBLE) - return "f64"; - return "(invalid)"; -} +#define STR_FMTS "(ulaw|alaw|u8|s8|s16|s32|f32|f64)" -#define STR_FMTS "(u8|s8|s16|s32|f32|f64)" - -/* 0 = native, 1 = le, 2 = be */ -static inline int -sf_format_endianess(int format) -{ - return 0; /* native */ -} +static const struct format_info { + const char *name; + int sf_format; + uint32_t spa_format; + uint32_t width; +} format_info = { + { "ulaw", SF_FORMAT_ULAW, SPA_AUDIO_FORMAT_ULAW, 1 }, + { "alaw", SF_FORMAT_ULAW, SPA_AUDIO_FORMAT_ALAW, 1 }, + { "s8", SF_FORMAT_PCM_S8, SPA_AUDIO_FORMAT_S8, 1 }, + { "u8", SF_FORMAT_PCM_U8, SPA_AUDIO_FORMAT_U8, 1 }, + { "s16", SF_FORMAT_PCM_16, SPA_AUDIO_FORMAT_S16, 2 }, + { "s24", SF_FORMAT_PCM_24, SPA_AUDIO_FORMAT_S24, 3 }, + { "s32", SF_FORMAT_PCM_32, SPA_AUDIO_FORMAT_S32, 4 }, + { "f32", SF_FORMAT_FLOAT, SPA_AUDIO_FORMAT_F32, 4 }, + { "f64", SF_FORMAT_DOUBLE, SPA_AUDIO_FORMAT_F32, 8 }, +}; -static inline enum spa_audio_format -sf_format_to_pw(int format) +static const struct format_info *format_info_by_name(const char *str) { - int endianness; - - endianness = sf_format_endianess(format); - if (endianness < 0) - return SPA_AUDIO_FORMAT_UNKNOWN; - - switch (format & SF_FORMAT_SUBMASK) { - case SF_FORMAT_PCM_U8: - return SPA_AUDIO_FORMAT_U8; - case SF_FORMAT_PCM_S8: - return SPA_AUDIO_FORMAT_S8; - case SF_FORMAT_ULAW: - return SPA_AUDIO_FORMAT_ULAW; - case SF_FORMAT_ALAW: - return SPA_AUDIO_FORMAT_ALAW; - case SF_FORMAT_PCM_16: - return endianness == 1 ? SPA_AUDIO_FORMAT_S16_LE : - endianness == 2 ? SPA_AUDIO_FORMAT_S16_BE : - SPA_AUDIO_FORMAT_S16; - case SF_FORMAT_PCM_24: - case SF_FORMAT_PCM_32: - return endianness == 1 ? SPA_AUDIO_FORMAT_S32_LE : - endianness == 2 ? SPA_AUDIO_FORMAT_S32_BE : - SPA_AUDIO_FORMAT_S32; - case SF_FORMAT_DOUBLE: - return endianness == 1 ? SPA_AUDIO_FORMAT_F64_LE : - endianness == 2 ? SPA_AUDIO_FORMAT_F64_BE : - SPA_AUDIO_FORMAT_F64; - case SF_FORMAT_FLOAT: - default: - return endianness == 1 ? SPA_AUDIO_FORMAT_F32_LE : - endianness == 2 ? SPA_AUDIO_FORMAT_F32_BE : - SPA_AUDIO_FORMAT_F32; - break; - } - - return SPA_AUDIO_FORMAT_UNKNOWN; + uint32_t i; + for (i = 0; i < SPA_N_ELEMENTS(format_info); i++) + if (spa_streq(str, format_infoi.name)) + return &format_infoi; + return NULL; } -static inline int -sf_format_samplesize(int format) +static const struct format_info *format_info_by_sf_format(int format) { + uint32_t i; int sub_type = (format & SF_FORMAT_SUBMASK); - - switch (sub_type) { - case SF_FORMAT_PCM_S8: - case SF_FORMAT_PCM_U8: - case SF_FORMAT_ULAW: - case SF_FORMAT_ALAW: - return 1; - case SF_FORMAT_PCM_16: - return 2; - case SF_FORMAT_PCM_32: - return 4; - case SF_FORMAT_DOUBLE: - return 8; - case SF_FORMAT_FLOAT: - default: - return 4; - } - return -1; + for (i = 0; i < SPA_N_ELEMENTS(format_info); i++) + if (format_infoi.sf_format == sub_type) + return &format_infoi; + return NULL; } static int sf_playback_fill_x8(struct data *d, void *dest, unsigned int n_frames) @@ -280,7 +196,7 @@ sf_count_t rn; rn = sf_read_raw(d->file, dest, n_frames * d->stride); - return (int)rn; + return (int)rn / d->stride; } static int sf_playback_fill_s16(struct data *d, void *dest, unsigned int n_frames) @@ -320,10 +236,8 @@ } static inline fill_fn -sf_fmt_playback_fill_fn(int format) +playback_fill_fn(uint32_t fmt) { - enum spa_audio_format fmt = sf_format_to_pw(format); - switch (fmt) { case SPA_AUDIO_FORMAT_S8: case SPA_AUDIO_FORMAT_U8: @@ -364,7 +278,7 @@ sf_count_t rn; rn = sf_write_raw(d->file, src, n_frames * d->stride); - return (int)rn; + return (int)rn / d->stride; } static int sf_record_fill_s16(struct data *d, void *src, unsigned int n_frames) @@ -404,10 +318,8 @@ } static inline fill_fn -sf_fmt_record_fill_fn(int format) +record_fill_fn(uint32_t fmt) {
View file
pipewire-0.3.52.tar.gz/src/tools/pw-cli.c -> pipewire-0.3.53.tar.gz/src/tools/pw-cli.c
Changed
@@ -22,19 +22,23 @@ * DEALINGS IN THE SOFTWARE. */ +#include "config.h" + #include <unistd.h> #include <errno.h> #include <stdio.h> #include <signal.h> #include <string.h> #include <ctype.h> -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) #include <alloca.h> #endif #include <getopt.h> #include <fnmatch.h> +#ifdef HAVE_READLINE #include <readline/readline.h> #include <readline/history.h> +#endif #include <locale.h> #if !defined(FNM_EXTMATCH) @@ -307,7 +311,12 @@ static void set_prompt(struct remote_data *rd) { snprintf(prompt, sizeof(prompt), "%s>> ", rd->name); +#ifdef HAVE_READLINE rl_set_prompt(prompt); +#else + printf("%s", prompt); + fflush(stdout); +#endif } static void on_core_done(void *_data, uint32_t id, int seq) @@ -3040,18 +3049,20 @@ } /* We need a global variable, readline doesn't have a closure arg */ -static struct data *readline_dataptr; +static struct data *input_dataptr; -static void readline_process_line(char *line) +static void input_process_line(char *line) { - struct data *d = readline_dataptr; + struct data *d = input_dataptr; char *error; if (!line) line = strdup("quit"); if (line0 != '\0') { +#ifdef HAVE_READLINE add_history(line); +#endif if (!parse(d, line, &error)) { fprintf(stderr, "Error: \"%s\"\n", error); free(error); @@ -3065,8 +3076,21 @@ struct data *d = data; if (mask & SPA_IO_IN) { - readline_dataptr = d; + input_dataptr = d; +#ifdef HAVE_READLINE rl_callback_read_char(); +#else + { + char *line = NULL; + size_t s = 0; + + if (getline(&line, &s, stdin) < 0) { + free(line); + line = NULL; + } + input_process_line(line); + } +#endif if (d->current == NULL) pw_main_loop_quit(d->loop); @@ -3078,6 +3102,7 @@ } } +#ifdef HAVE_READLINE static char * readline_match_command(const char *text, int state) { @@ -3119,13 +3144,14 @@ static void readline_init() { rl_attempted_completion_function = readline_command_completion; - rl_callback_handler_install(">> ", readline_process_line); + rl_callback_handler_install(">> ", input_process_line); } static void readline_cleanup() { rl_callback_handler_remove(); } +#endif static void do_quit_on_signal(void *data, int signal_number) { @@ -3152,13 +3178,14 @@ struct pw_loop *l; char *opt_remote = NULL; char *error; - bool daemon = false; + bool daemon = false, monitor = false; struct remote_data *rd; static const struct option long_options = { - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'V' }, - { "daemon", no_argument, NULL, 'd' }, - { "remote", required_argument, NULL, 'r' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + { "monitor", no_argument, NULL, 'm' }, + { "daemon", no_argument, NULL, 'd' }, + { "remote", required_argument, NULL, 'r' }, { NULL, 0, NULL, 0} }; int c, i; @@ -3168,7 +3195,7 @@ setlocale(LC_ALL, ""); pw_init(&argc, &argv); - while ((c = getopt_long(argc, argv, "hVdr:", long_options, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "hVmdr:", long_options, NULL)) != -1) { switch (c) { case 'h': show_help(&data, argv0, false); @@ -3184,6 +3211,9 @@ case 'd': daemon = true; break; + case 'm': + monitor = true; + break; case 'r': opt_remote = optarg; break; @@ -3228,13 +3258,17 @@ printf("Welcome to PipeWire version %s. Type 'help' for usage.\n", pw_get_library_version()); +#ifdef HAVE_READLINE readline_init(); +#endif pw_loop_add_io(l, STDIN_FILENO, SPA_IO_IN|SPA_IO_HUP, false, do_input, &data); pw_main_loop_run(data.loop); +#ifdef HAVE_READLINE readline_cleanup(); +#endif } else { char buf4096, *p, *error; @@ -3250,9 +3284,11 @@ fprintf(stderr, "Error: \"%s\"\n", error); free(error); } - if (!data.quit && data.current) { + while (!data.quit && data.current) { data.current->prompt_pending = pw_core_sync(data.current->core, 0, 0); pw_main_loop_run(data.loop); + if (!monitor) + break; } } spa_list_consume(rd, &data.remotes, link)
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.