Commit graph

245 commits

Author SHA1 Message Date
Wim Taymans
4381e79632 control: clean up some control includes
Remove control from channelmix, it's not used
Add control metadata
Add OSC control type
Improve some docs
2019-09-16 15:49:46 +02:00
Wim Taymans
8b85cc225e rename HAVE/NEED_BUFFER -> HAVE/NEED_DATA
It is more generic and works with control-only ports as well
2019-09-16 12:55:23 +02:00
Wim Taymans
a232e67dd8 resample: completely fill resampler
start with a completely filled resampler so that the first
input byte immediately gives an output sample. When then have
n_taps/2 leading (almost) 0 samples.

Also make the passthrough resampler act like the real resampler
by introducing an n_taps/2 delay.
2019-09-05 13:13:20 +02:00
Wim Taymans
b1bfc900d6 improve: debug 2019-09-05 13:09:01 +02:00
Wim Taymans
73628c91de audioconvert: refuse invalid channels and rate 2019-09-03 13:49:38 +02:00
Wim Taymans
0d35f44fd9 tests: add channelmix test 2019-08-29 14:05:02 +02:00
Wim Taymans
b356c83d32 node: add support for transport
Move some things around. Move the duration of the current cycle
to the clock. Also add the estimated next timeout to the clock.
Add a generic media specific counter to the clock.

Clean up the position_bar info. We can do with only a double beat
value and make the signature in floats.

Flesh out the io_position info. This has now the information needed
to convert a raw clock time into a stream time. It basically has
the same kind of features as GStreamer segments such as looping,
variable rate playback etc.. It also contains the state of the
timeline (paused/playing) and it can be used to update the position
and state from clients.

There is also extended information in the position field that
clients can update when they can.

Plugins basically only update the clock info they get (and use
the position info to check if they are slaved or not).

Before each cycle, check if there is a pending position update and
apply it.
2019-08-27 14:41:47 +02:00
Wim Taymans
6ad4adc194 node: add xrun callback
Let alsa emit xrun callbacks.
Write the xrun stats to the activation area of the node so all
clients can read it.
2019-08-22 13:25:38 +02:00
Wim Taymans
8ed3cfe679 audioconvert: be more careful when clearing buffers
clean_convert() removes the internally negotiated formats but
it does not set the format (or buffers) of the externally visible
ports. Therefore, don't clear the buffers_set flags.

Instead, clear the buffers_set flag when we explicitly reconfigure
the ports, when we also clear the format.

Also clear the port buffers when we set a NULL format.

Fixes #178
2019-08-21 19:52:53 +02:00
Wim Taymans
954c96632c channelmix: try to handle 1 channel as MONO/FC 2019-08-16 15:03:16 +02:00
Wim Taymans
87ae7a8011 channelmix: apply channel volumes correctly 2019-08-14 14:56:16 +02:00
Wim Taymans
fa792a91a0 fmtconvert: always prefer just 1 buffer 2019-08-13 18:42:40 +02:00
Wim Taymans
697976f416 audioconvert: only emit node_info once in add_listener 2019-08-13 18:42:21 +02:00
Wim Taymans
c6a7b3eedb channelmix: implement per channel volume
Implement per channel volume on channelmix. Extend control on stream to
take an array of values when possible.

Remove name argument from pw_node_new and pw_device_new. We can pass
this as a property instead.

Improve properties on nodes to more closely match what pulseaudio does.
Don't let the monitor do too much with the udev properties but let the
session manager set the description and icon-names.

Remove some change_mask flags for things that don't change in
introspect. Use the flags to mark changes in -cli and -monitor.
2019-08-12 15:14:39 +02:00
Wim Taymans
b8b2e494bd audioconvert: improve proxy of internal params 2019-08-12 15:14:39 +02:00
Wim Taymans
4449cf61ad audioadapter: filter filtering 2019-08-12 15:14:39 +02:00
Wim Taymans
6f8268df40 audioconvert: remove speex resampler
It's slower and less accurate then the native one.
2019-08-07 13:06:14 +02:00
Wim Taymans
06446e0d64 port: simplify buffer allocation
Use just one function to do buffer allocation on a port.

Remove some unused variables.
2019-08-07 12:56:57 +02:00
Wim Taymans
003076ffc7 splitter: always fill up all dst pointers 2019-08-06 17:03:53 +02:00
Wim Taymans
f41720e7db Add PortConfig parameter
Add a new PortConfig parameter to configure ports of elements that
are marked with the SPA_NODE_FLAG_*_PORT_CONFIG. This is used to
configure the operation of the audioconver/audioadapter nodes and
how it should convert the internal format. We want to use the
Profile parameter only for cases where there is an enumeration of
values, like with device configuration.

Add unit tests for audioconvert and adapter to check if they handle
PortConfig correctly.

Make the media session use the PortConfig to dynamically configure
the device nodes.

Remove audio-dsp, it is not used anymore and can/should be implemented
with a simple audioconvert spa node now and some PortConfig.
2019-08-06 12:45:20 +02:00
Wim Taymans
acf931abc5 audioadapter: Format param is write only 2019-08-01 10:57:25 +02:00
George Kiagiadakis
30576fcff8 audioconvert/fmtconvert: assume F32 on the other port when listing formats
This allows picking F32LE as the default format on links that have
no restriction and it avoids failing negotiation when the restricted
end cannot handle S16/F32/F32P

For instance this pipeline would previously fail:

  audio-dsp mode=merge ! audio-dsp mode=convert ! alsa-sink
old negotiation:     S16LE                   S24_32LE
new negotiation:     F32LE                   S24_32LE

The link between the audio-dsp nodes has no restriction, so previously
it would negotiate S16LE, which would then fail to negotiate with alsa-sink
because fmtconvert does not know how to convert S16LE to S24_32LE directly.

With this change, the middle link negotiates to F32LE, which can be
converted to anything.
2019-07-30 11:11:57 +02:00
Wim Taymans
deb6c52f76 node: remove port_alloc_buffers
Remove the now obsolete port_alloc_buffer, rework to use the
port_use_buffers with the ALLOC flag.
2019-07-25 14:08:43 +02:00
Wim Taymans
8590ac158b node: add flags to port_use_buffer
Remove the CAN_USE_BUFFERS flag, it is redundant. We can know this
because of the IO params and buffer params.

Add flags to the port_use_buffer call. We also want this call to
replace port_alloc_buffer. Together with a new result event we can
ask the node to (a)synchronously fill up the buffer data for us. This
is part of a plan to let remote nodes provide buffer data.
2019-07-25 13:19:39 +02:00
Wim Taymans
22b67cc95d adapter: remove slave hooks 2019-07-17 15:23:19 +02:00
Wim Taymans
6b82163e94 audioadapter: don't fail if the slave can't provide a filter
When the slave can't provide a format or buffer suggestion, just
continue without any filter.
2019-07-16 10:05:39 +02:00
Wim Taymans
453e75a23e improve some debug 2019-07-15 17:09:44 +02:00
Wim Taymans
93006d6d90 resample-native: only do full resample when rate == 1.0
Otherwise choose the interpollating resampler.
2019-07-15 17:06:07 +02:00
Wim Taymans
80face4b92 audioadapter: handle set_io errors better 2019-07-15 17:05:13 +02:00
Wim Taymans
10426790b0 audioconvert: clear buffer allocation state as well 2019-07-12 14:36:49 +02:00
George Kiagiadakis
129ccd3a3e audioconvert: do setup internal links and buffers also in convert mode 2019-07-12 14:30:31 +02:00
Wim Taymans
6fc02ca5e0 move some debug to trace 2019-07-12 10:26:44 +02:00
Wim Taymans
1acefc00a6 audioadapter: implement reuse_buffer on the slave 2019-07-12 09:51:49 +02:00
Wim Taymans
0e765de519 props: remove pointers in property values in protocol
Mark pointers in property values with pointer: and remove them
when sending the properties over the wire to avoid errors.
2019-07-11 12:52:55 +02:00
Wim Taymans
00c2f6fe4f adapter: produce output when we have a monitor 2019-07-11 11:28:26 +02:00
Wim Taymans
a6ce5e7eeb merger: respect DYNAMIC_DATA flag when copy pointers 2019-07-11 11:19:09 +02:00
Wim Taymans
afd6e578a8 audioadapter: we don't need to clear the dynamic flag 2019-07-11 11:15:47 +02:00
Wim Taymans
a9bce3803a cleanups and debug improvements 2019-07-11 11:15:24 +02:00
Wim Taymans
a07fb58a21 adapter: set driver property
Pass the node.driver property from the slave to the adapter.
Set the media-class on the adapter.
2019-07-10 19:18:53 +02:00
Wim Taymans
9364f64b10 adapter: move to SPA plugin
Move the adapter code to a SPA plugin and make the adapter module
use the plugin instead.
2019-07-10 18:04:59 +02:00
Wim Taymans
c7d7058896 Improve rate matching and clock slaving
Use a new rate_match io area to exhange rate matching info between
sink/source and resampler.
Compensate for the rate match delay when scheduling timeouts.
Let the resampler notify the source of how many samples it needs to
produce the desired quantum. Make sure we keep an extra buffer in
the device to be able to make this possible.
Let the adapter directly call the slave node process function.
2019-07-09 17:44:07 +02:00
Wim Taymans
595dc0ab5b resample: fix phase calculation 2019-07-09 16:54:52 +02:00
Wim Taymans
a6a7b3ab54 resample: add functions to calculate in/out length
Add test for this as well
2019-07-08 18:26:08 +02:00
Wim Taymans
0154e6eaac small cleanups
resample: remove unused index variable
2019-07-08 18:23:22 +02:00
Wim Taymans
0726a608df Improve debug and small cleanups 2019-07-02 17:11:45 +02:00
Wim Taymans
170c3e4d6c small cleanups 2019-07-01 09:31:15 +02:00
Wim Taymans
6720ded529 names: add standard factory name definitions
Define a set of standard factory names and document what they
contain. This makes it possible to change the implementation by
mapping the factory-name to a different shared library.
2019-06-21 13:31:34 +02:00
Wim Taymans
8cda0dd962 test: clear resample struct before use 2019-06-07 17:25:28 +02:00
Wim Taymans
497a8364c5 printf format fixes 2019-06-07 17:16:02 +02:00
Wim Taymans
d46c239ab0 some printf fixes 2019-06-07 16:37:08 +02:00