virtual sink: Factor out common code

This patch moves the code for the virtual sink callbacks and initialization to
a separate file. The code is re-factored, extended and built as library, so that
it can be used by other virtual sinks as well. The suspend-virtual-on-master-suspend
fix for the ladspa sink (!68) was incorporated into the common code as well as the
sink part of !78 which fixes a crash with stacked virtual sinks. !68 has a bug
which leaves a virtual sink unavailable when the master sink disappears. This bug
is also fixed.

Additionally, fixed block size filters, fixed window size filters  and updating filter
parameters are supported by the library. Fixed window size filters always deliver the
same number of frames to the filter, padding new data with history frames if necessary.
Rewinding can be disabled or or limited to the number of frames that the virtual sink
supports. Thanks to Alexander E. Patrakov for pointing out how to rewind fixed block
size filters.

The library implements following command line arguments if they are enabled in
valid_modargs: sink_name, sink_properties, sink_input_properties, force_flat_volume,
remix, resample_method and autoloaded.
This commit is contained in:
Georg Chini 2021-01-01 15:56:58 +01:00
parent d18756fda9
commit 1edc7eb655
6 changed files with 1532 additions and 527 deletions

View file

@ -2,6 +2,17 @@ if host_machine.system() != 'windows'
subdir('rtp')
endif
libvirtual_sink = shared_library('virtual_sink',
'virtual-sink-common.c',
'virtual-sink-common.h',
c_args : [pa_c_args, server_c_args],
include_directories : [configinc, topinc],
dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep],
install_rpath : privlibdir,
install : true,
install_dir : modlibexecdir
)
# module name, sources, [headers, extra flags, extra deps, extra libs]
all_modules = [
[ 'module-allow-passthrough', 'module-allow-passthrough.c' ],
@ -55,7 +66,7 @@ all_modules = [
[ 'module-tunnel-sink-new', ['module-tunnel-sink-new.c', 'restart-module.c'] ],
[ 'module-tunnel-source', ['module-tunnel.c', 'restart-module.c'], [], [], [x11_dep] ],
[ 'module-tunnel-source-new', ['module-tunnel-source-new.c', 'restart-module.c'] ],
[ 'module-virtual-sink', 'module-virtual-sink.c' ],
[ 'module-virtual-sink', 'module-virtual-sink.c', [], [], [], libvirtual_sink ],
[ 'module-virtual-source', 'module-virtual-source.c' ],
[ 'module-volume-restore', 'module-volume-restore.c' ],
]