Commit Graph

1750 Commits

Author SHA1 Message Date
Thomas Weißschuh c9ecaedc44 ao_pipewire: tell audio server about number of queued samples 2022-08-09 09:24:55 -07:00
Thomas Weißschuh 9add44b11a ao_pipewire: use mpv logging 2022-08-04 09:25:19 -07:00
Christoph Heinrich 490e263529 af_rubberband: add new engine option in rubberband 3.0.0 2022-08-03 15:29:02 +00:00
Thomas Weißschuh 0044c19f0d ao_pipewire: prevent deprecation warning for pw_stream_get_time() 2022-07-08 17:19:23 -07:00
Wim Taymans c7b17beaf1 ao_pipewire: pipewire uses linear volume
Don't use cube root volumes, pipewire uses linear volumes.
2022-07-08 07:45:09 -07:00
Wim Taymans c01bb44e36 ao_pipewire: don't access core after disconnect
pw_core_disconnect frees the core, so accessing it afterward to
destroy the context is not allowed.

Instead, just destroy the context, the first thing it does is disconnect
all cores for us.
2022-07-08 07:45:09 -07:00
Wim Taymans 60ed51008d ao_pipewire: zero listeners
The listeners need to be cleared because removing them might invoke the
removed handler, which could otherwise point to invalid memory.
2022-07-08 07:45:09 -07:00
Alex B d38ff1c958 ao_pipewire: support ao-volume on non-stereo channel layouts
mpv only remembers volume for two channels.
Always apply the same volume to all channels in case of
non-stereo layout similarly to ao_pulse.
Don't try to do anything smart when averaging volumes,
normally they are equal anyway.
2022-07-08 06:39:23 -07:00
Jan Ekström 8123adadbd audio/chmap: add mp_iterate_builtin_layouts
Mostly useful for unit tests in order to access the channel
layouts from chmap which have mapped channels.
2022-06-15 21:19:10 +03:00
Jan Ekström edfd17ab18 ad_lavc: switch to AVChannelLayout when available 2022-06-15 21:19:10 +03:00
Jan Ekström e7483ced5d af_lavcac3enc: switch to AVChannelLayout when available 2022-06-14 22:41:20 +03:00
Jan Ekström 42b58c5698 af_lavcac3enc: refactor chmap adding into its own function
This simplifies ifdeffery with AVChannelLayouts.
2022-06-14 22:19:45 +03:00
Jan Ekström 7a3f9af67f ao_lavc: switch to AVChannelLayout when available 2022-06-12 21:05:59 +03:00
Jan Ekström 302acb27c8 audio/aframe: switch to AVChannelLayout when available 2022-06-12 21:05:59 +03:00
Jan Ekström 1d15a5a059 audio: add AVChannelLayout helpers to convert from/to mp_chmap
This is the new FFmpeg channel layout structure, which now
combines channel count and layout into a single location.

Only unspecified (channel count only) and native (channel layout
mask based) layouts are currently supported for the initial move
towards non-deprecated APIs.
2022-06-12 21:05:59 +03:00
Guido Cella fe9e074752 various: remove trailing whitespace 2022-05-14 14:51:34 +00:00
Cœur bb5b4b1ba6 various: fix typos 2022-04-25 09:07:18 -04:00
Thomas Weißschuh deedc3d418 ao_pipewire: Do not hold thread lock during loop stop
Stopping the thread is done using pw_thread_loop_stop(),
*which must be called without the lock held.*

Fixes #10033
2022-03-31 14:40:21 -07:00
Thomas Weißschuh 84dc9b1a02 ao_pipewire: fix resource lifetimes
We have to destroy the core before destroying the loop.
Also we have to lock the mainloop for operations on its objects.

Fixes #10003
2022-03-30 13:06:33 -07:00
LaserEyess 7ac4b7dfe7 ao_sndio: fix parentheses warning
No change in logic, but wrap the LT operator and the && in parentheses
to silence the compiler warning.
2022-03-11 16:43:31 +01:00
Alex B bc9805c71a ao_pipewire: fix ao-volume handling
Pass channel volumes to `pw_stream_set_control` as array.
This is correct calling conventions and prevents
right channel muting every time ao-volume property is changed.

Terminate `pw_stream_set_control` calls with 0.
2022-02-11 11:27:57 -08:00
Thomas Weißschuh 09343bc86e ao_pipewire: validate pod creation
Our allocated buffers should be big enough, but add some errorhandling
just in case.
2022-02-06 22:44:40 -08:00
Thomas Weißschuh b7a71ea706 ao_pipewire: add support for device selection 2022-02-06 22:44:40 -08:00
Andrew Krasavin b01598510f ao_sndio: bugfix and small refactoring for #8314
Changes:
  * fixed hangups in the loop function and in some other cases
  * refactoring according to @michaelforney's recommendations in #8314
  * a few minor and/or cosmetic changes
  * ability to build ao_sndio using meson
2022-01-22 18:44:34 +00:00
rim adc32e25e0 ao_sndio: add this audio output again
Changes:
- rewrite to use new internal MPV API;
- code refactoring;
- fix buffers size calculations;
- buffer set to auto;
- reset() - clean/reinit device only after errors;
2022-01-22 18:44:34 +00:00
Philip Langdale 22b0bac28e ao/pipewire: Add copyright header
Sometimes the most obvious things can be missed.

Reflects authorship described in the original commit.

* https://github.com/mpv-player/mpv/pull/7902
* fddb143282
* https://github.com/mpv-player/mpv/pull/9587
2022-01-17 13:48:44 -08:00
Thomas Weißschuh 87aba146ed ao_pipewire: Add PipeWire audio backend
The AO provides a way for mpv to directly submit audio to the PipeWire
audio server.
Doing this directly instead of going through the various compatibility
layers provided by PipeWire has the following advantages:

* It reduces complexity of going through the compatibility layers
* It allows a richer integration between mpv and PipeWire
  (for example for metadata)
* Some users report issues with the compatibility layers that to not
  occur with the native AO

For now the AO is ordered after all the other relevant AOs, so it will
most probably not be picked up by default.
This is for the following reasons:

* Currently it is not possible to detect if the PipeWire daemon that mpv
  connects to is actually driving the system audio.
  (https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1835)
* It gives the AO time to stabilize before it is used by everyone.

Based-on-patch-by: Oschowa <oschowa@web.de>
Based-on-patch-by: Andreas Kempf <aakempf@gmail.com>
Helped-by: Ivan <etircopyhdot@gmail.com>
2022-01-17 11:43:02 -08:00
sfan5 429402cb08 af_lavcac3enc: fix some minor things
mark an array as static, a typo and a missing free
2022-01-10 22:56:52 +01:00
sfan5 d28a792c00 af_lavcac3enc: replace deprecated av_init_packet() 2022-01-10 22:56:52 +01:00
Niklas Haas 0bb15c7a13 af_lavcac3enc: fix memory leak on no-op
Simply returning out of this function leaks avpkt, need to always "goto
done".

Rewrite the logic a bit to make it more clear what's going on (IMO).

Fixes #9593
2021-12-14 21:25:02 +01:00
Ivan 87ce3b31a9 ao_openal: enable AL_SOFT_direct_channels_remix extension by default
Prevent audio distortions caused by OpenAL's 3D effects.
2021-11-29 11:27:39 +01:00
Aman Karmani ac3d567bd3 audio: stop corrupting audio on underreads
regression introduced in b74c09efbf

Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-11-20 12:08:32 -08:00
Tom Yan d1e9f4a159 ao_opensles: add guards for sample rate to use
Upstream "Wilhelm" (the Android OpenSLES implementation) supports
only 8000 <= rate <= 192000. Make sure mpv resamples the audio
when necessary.
2021-11-19 14:27:52 +01:00
Emil Velikov 37619c4cf5 options: remove always true m_obj_list::allow_unknown_entries
Ever instance of m_obj_list is a constant and for all of them, the field
is true. Just remove the field all together.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2021-11-15 14:02:08 +00:00
Jan Ekström e6a75075b2 ao_oss: define PATH_DEV_MIXER as it is an internal define
This fixes a mismatch between configure working and build time
failing with Linux + OSSv4, enabling compilation on Debian based
Linux systems with the oss4-dev package.

Fixes #9378
2021-11-10 17:08:16 +01:00
sfan5 6996588254 audio: replace deprecated av_mallocz_array 2021-11-05 23:34:20 +01:00
Aman Karmani 06392e7ec1 ao_audiotrack: change buffer sizing logic
Previously number of channels was being ignored.

The buffer will now be between 75ms and 150ms

Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-10-21 17:20:51 +02:00
Aman Karmani fa691e0f69 ao_audiotrack: allocate chunk buffer based on negotiated size
Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-10-21 17:20:51 +02:00
Aman Karmani 6473711dce ao_audiotrack: support delay up to 2s as normal
Fixes issues streaming to echo speaker pair from firetv devices.

Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-10-21 17:20:51 +02:00
Aman Karmani 432c0255bc ao_audiotrack: set device_buffer based on underlying buffer size when available
Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-10-21 17:20:51 +02:00
Aman Karmani 7356ee5339 ao_audiotrack: use new style initializer for AudioTrack when available
Fixes deprecation warnings printed when using this driver.

Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-10-21 17:20:51 +02:00
sfan5 d2a56227df Revert "audio: fix ao_reset() not clearing paused state leading to stuck AO"
In hindsight this is obviously broken.
This reverts commit fb5d976cb0.
2021-07-18 12:21:15 +02:00
sfan5 fb5d976cb0 audio: fix ao_reset() not clearing paused state leading to stuck AO
This would happen when switching from playback stuck in cache wait
(underrun) to another file.
2021-07-16 20:58:54 +02:00
Niklas Haas ec0006bfa1 af_scaletempo2: use gcc vectors to speed up inner loop
This brings my scaletempo2 benchmark down from ~22s to ~7s on my machine
(-march=native), and down to ~11s with a generic compile.

Guarded behind an appropriate #ifdef to avoid being ableist against
people who have the clinical need to run obscure platforms.

Closes #8848
2021-05-26 17:35:55 +02:00
sfan5 39630dc8b6 build: address AVCodec, AVInputFormat, AVOutputFormat const warnings
FFmpeg recently changed these to be const on their side.
2021-05-01 22:07:31 +02:00
sfan5 aa300f8023 ao/pulse: fix incorrect state reported after reset
fixes #8768
2021-04-29 17:06:29 +02:00
sfan5 3c34e6fec4 audio/aframe: reuse data buffer if less than 8 channels
This fixes audio encoding crashing under ASan.
When extended_data != data, FFmpeg copies more pointers from
extended_data (= the number of channels) than there really
are for non-planar formats (= exactly 1), but that's not our fault.
Regardless, this commit makes it work in all common cases.
2021-04-08 23:47:35 +03:00
rim 1b2e5137e0 ao_oss: add this audio output again
Changes:
- code refactored;
- mixer options removed;
- new mpv sound API used;
- add sound devices detect (mpv --audio-device=help will show all available devices);
- only OSSv4 supported now;

Tested on FreeBSD 12.2 amd64.
2021-03-15 12:42:35 +01:00
Thomas Weißschuh 63d71ba4ec ao/pulse: signal the mainloop when ops are done
Without the explicit signal the call to pa_threaded_mainloop_wait()
will not return as soon as possible.

Fixes 4f07607888
See #8633
2021-03-11 23:37:13 +02:00
Thomas Weißschuh 4f07607888 ao/pulse: wait for command completion when setting volume or mute
This makes the behavior of all control messages consistent,
fixing an inconsistency that has been with us since
4d8266c739 - which is the initial
rework of the polyaudio AO into the pulseaudio AO.

Muting the stream also directly triggers an update to the OSD.
When not waiting for the command completion this read of the mute
property may read the old state. A stale read.

Note that this somehow was not triggered on native Pulseaudio, but it is
an issue on Pipewire.

See https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/868
2021-03-09 23:08:16 +02:00