Commit Graph

2023 Commits

Author SHA1 Message Date
Dudemanguy 838df2c252 ad_lavc: flag options with UPDATE_AD 2025-01-29 15:07:42 +00:00
Dudemanguy be15be3a83 various: expand paths for all file/directory related options
There's several path-related options that do not handle common shortcuts
(like ~/). Fix this by using mp_get_user_path where appropriate which
expands the path so users get more intuitive behavior. Fixes #15598.
2025-01-29 14:49:06 +00:00
nanahi 0903e9fbd4 various: fix range for float options
The range of these options should be capped to FLT_MAX
instead of DBL_MAX.
2025-01-24 04:25:15 +00:00
Kacper Michajłow d66047589a ao_pulse: remove unnecessary casts and use the proper print specifier 2025-01-05 22:32:40 +01:00
Tim Lodemann 31d1defb7a ao_openal: fix null pointer dereference when creating OpenAL context
When the monitor goes to sleep, the OpenAL context was not properly
handled, resulting in a null pointer dereference and a crash. This
fix ensures that the OpenAL context is created and set correctly,
avoiding crashes under these conditions.

Fixes: #15648
2025-01-05 21:22:35 +01:00
Barnabás Pőcze 55f41fd8fa ao/pulse: only print server protocol after connection
The server's protocol version is not available until a connection is
properly established. Currently the value of `PA_INVALID_INDEX` is printed
due to calling `pa_context_get_server_protocol_version()` before connecting.

Fix this by doing the call after the connection has been set up.

Fixes: f744aadb77 ("ao_pulse: dump library version etc.")
2025-01-05 21:21:52 +01:00
Kacper Michajłow 59d1dc43b9 various: fix typos 2025-01-04 15:59:49 +02:00
Kacper Michajłow efcee92d0e various: remove double new line at the end of file 2025-01-04 15:59:49 +02:00
Misaki Kasumi 06fe665b78 ao_coreaudio: set kAudioOutputUnitProperty_ChannelMap
This fixes #15584
2025-01-03 13:44:00 +01:00
Callum Moffat 748fc2b752 ao_audiounit: add --audio-exclusiv support, make non-exclusive default 2024-12-31 13:51:44 +01:00
Dudemanguy d33e54250e ao: correctly set state.playing for non-gapless audio after eof
The problem here is likely ao_alsa specific and has the same symptons as
what the previous commit fixed (audio not playing when the file changes
but the details are a bit different here and the sample rate does not
matter. When using gapless audio (the default), the core player
immediately marks the audio status as EOF after it starts draining and
allows the remaining audio buffers to play while it marches on. This
works fine. When not using gapless audio, it doesn't immediately set EOF
and instead waits for the audio to finish playing before it does
anything else. The problem is that ao_is_playing is always true so the
core waits forever thinking audio is still playing when it actually
isn't.

ao_play_data is what is in charge of setting the mp_pcm_state with it
calling out to the backend for additional help. Unfortunately, this
doesn't work for alsa because it's too dumb to signal the desired states
in this edge case so we have to help it a bit. The main thing to notice
here is that even though we can get EOF from a frame, there can still be
additional valid samples that compe after it. So we can't just
immediately quit after EOF is seen. The approach here is to simply save
if we got eof sometime in the past, wait until we get no more samples,
mark state.playing as false and then jump over to the eof code. This
will set p->playing to false as desired which allows the core code to
set EOF and finally we can go through the reset logic and actually play
audio for the next file.
2024-12-11 17:12:22 +00:00
Kacper Michajłow d673356990 common: ensure MP_HANDLE_OOM is used only on pointers
To make it clear it should be used for memory allocation and not generic
error checking.
2024-11-30 17:08:42 +02:00
Kacper Michajłow 7b114d7d54 ad_lavc: remove unnecesary variable 2024-11-30 17:08:42 +02:00
Kacper Michajłow 4b11f66eb1 various: use avcodec_get_supported_config() to resolve deprecation warn
See: https://github.com/FFmpeg/FFmpeg/commit/3305767560a6303f474fffa3afb10c500059b455
2024-11-20 20:42:33 +01:00
davince 46fe3cded0 ao_audiotrack: make audiotrack jni multi-instance and multi-thread safe
The detailed issue is here:
#15212

problem: Since The AudioTrack is not an mpv instance level but a global object, it cannot support multiple mpv instances at the same time. For example, if you create two instances and then destroy one of them, the other instance may crash.

Add jni usage count to fix this.
2024-11-06 18:54:50 +01:00
der richter 84adbd9d35 ao_coreaudio: fix CoreAudio deprecations 2024-11-05 18:34:15 +01:00
Misaki Kasumi 6fadaf66c8 osdep: remove semaphore-mac
It is only used in one place in ao_coreaudio_utils.c,
and can be replaced by condvar.
Removing it can reduce the maintenance burden.
2024-10-12 17:26:39 +02:00
Kacper Michajłow 7202406fe8 various: remove global.h inclusion where not needed 2024-10-01 12:23:44 +02:00
Misaki Kasumi c3d9243a3e ao_coreaudio: fix nan in ca_get_device_latency_ns 2024-09-28 14:15:55 +02:00
llyyr a44a726301 ao_alsa: assume device lost if we couldn't recover after 10 attempts
ALSA API reports -EPIPE even when the the device is lost, which we
currently always assume to be an XRUN. If we assumed XRUN 10 times and
didn't manage to recover, just consider the device lost and try to
reconnect. Allows ao_alsa to recover from alsa server being killed then
reinitialized. And even in the worst case, this should be better than
the status quo of mpv attempting to prepare a PCM device indefinitely
until the user restarts mpv.

This is admittedly not ideal, and I don't think the -EPIPE hack is
necessary anymore, but I can only test on my setup and removing the
'assume -EPIPE is an XRUN' hack might break some setups for whatever
mysterious reasons.
2024-09-14 14:08:30 +02:00
llyyr 44da754018 ao_alsa: don't early exit out of the loop if we have an error
This would cause us to exit out of the loop with a goto anytime we ran
into XRUN or DRAINING and preparing PCM for use failed.
2024-09-14 14:08:30 +02:00
Kacper Michajłow 24f42acd1d ad_spdif: update list of DTS_HD profiles 2024-08-01 13:27:08 +02:00
llyyr 1fd9389911 ao: don't add buffer length to timeout twice
ao_get_delay already adds this buffer length
2024-07-10 19:32:36 +02:00
llyyr 2559f8874f ao: use the right type for pending samples 2024-07-10 19:32:36 +02:00
llyyr 539e95730a ao_pipewire: bump minimum libpipewire version to 0.3.57
available on debian stable
2024-07-08 13:33:32 +00:00
Kacper Michajłow cd1b63f628 ad_{lavc,spdif}: initialize channel layout
It is not always available for the demuxer, so update it from decoder.
2024-06-23 05:09:13 +02:00
Kacper Michajłow 9e1271260f ad_spdif: fix lavf version check
Fixes: 62b1bad755
2024-06-22 16:12:14 +02:00
Kacper Michajłow 687eb4c875 various: remove no longer needed availability checks
image_writer: remove jpegxl availability check

meson: remove check for lavu vulkan support

image_writer: remove avif availability check

ad_spdif: remove no longer needed definitions

demux_lavf: remove side data extraction compatibility code

demux/packet: remove ITU T.35 availability check

filters/f_lavfi: remove avfilter_filter_pad_count availability check

image_writer: remove PNG cICP support check

mp_image: remove AV_FRAME_DATA_DOVI_METADATA availability check

mp_image: remove AV_FRAME_FLAG_INTERLACED availability check

vd_lavc: remove ctx->pic->duration availability check

sws_utils: remove av_chroma_location_enum_to_pos availability check

vd_lavc: remove AV_CODEC_EXPORT_DATA_FILM_GRAIN availability check

demux_lavf: always use io_close2
2024-06-22 16:12:14 +02:00
Kacper Michajłow 3c5a79300c various: remove av channel layout check 2024-06-22 16:12:14 +02:00
Dudemanguy 157566904f ao_pipewire: fix some stray tabs 2024-06-19 23:04:05 -05:00
der richter bc5ab97d9a ao_avfoundation: guard features only available on macOS 11.3 and 12
build time and runtime checks.
2024-06-18 19:30:07 +02:00
Kacper Michajłow 3b3604e162 ad_spdif: add an assert for lavf_ctx
To suppress forward null warning.
2024-06-16 01:22:30 +02:00
Kacper Michajłow d7ceedbd99 ao_wasapi: don't limit the scope of execution context
May fix broken systems like #12145 or #14314. Probably won't change
anything, but it is the correct context to use anyway.
2024-06-07 19:41:28 +02:00
Kacper Michajłow f394349066 ao_pcm: fix incorrect win32 check 2024-06-05 19:16:35 +02:00
Kacper Michajłow b558b99f67 ao_pipewire: fix access to undefined byte order definitions
spa/param/audio/raw.h on FreeBSD accesses those, so defined them.
Probably should be fixed upstream, but to suppress warnings lets do it
locally.
2024-06-05 19:07:58 +02:00
Kacper Michajłow 8657b20574 ao_coreaudio_chmap: fix shadowed variable 2024-06-05 19:07:58 +02:00
Misaki Kasumi ef026ffdb6 Revert "ao_pipewire: add EOF handling"
This reverts commit 3fc8929caf.
2024-05-28 13:23:17 +00:00
Misaki Kasumi 2938ed5942 Revert "ao_pipewire: wait for draining finishes before restart ao"
This reverts commit 88f20a7011.
2024-05-28 13:23:17 +00:00
Misaki Kasumi 88f20a7011 ao_pipewire: wait for draining finishes before restart ao
When the stream is draining, setting stream to active has no effect.
2024-05-25 22:52:45 +02:00
Misaki Kasumi 3fc8929caf ao_pipewire: add EOF handling 2024-05-25 22:52:45 +02:00
Misaki Kasumi a3a9bc289a ao_avfoundation: use blocking ao_read_data 2024-05-25 22:52:45 +02:00
Misaki Kasumi eb996a13bc ao_avfoundation: add EOF handling 2024-05-25 22:52:45 +02:00
Misaki Kasumi aebe58203b ao: add ao_stop_streaming 2024-05-25 22:52:45 +02:00
Misaki Kasumi bfadd31957 ao: add eof, pad_silence, and blocking arguments for ao_read_data 2024-05-25 22:52:45 +02:00
Misaki Kasumi a791408659 ao_coreaudio: set ao->device_buffer base on hardware latency 2024-05-25 15:35:26 +02:00
Kacper Michajłow 7923a633a0 ad_spdif: check return value of av_parser_parse2 2024-05-22 22:13:54 +02:00
Kacper Michajłow 82ce07d640 ad_spdif: check for AC3 if parser fails to detect profile
c522d0dfbd added parser to avoid opening
decoder and left decoder only for DTS. Since then more audio codec needs
decoder, so open decoder always when it might be needed. Exclude only
AC3, other codec have profile to be extracted.

Fixes: c522d0dfbd
2024-05-22 22:13:54 +02:00
Kacper Michajłow 6eb0f4b27f ad_spdif: set codec params
It seems that we decode small portion of the audio to determine codec
params. We can remember that information.

Fixes: #14178
2024-05-22 22:13:54 +02:00
Misaki Kasumi 4d03efb4b0 ao: don't call driver->set_paused after reset
This commit adds a state `hw_paused` for pull-based AO.
`driver->set_paused(false)` is only called if `hw_paused` is true.
`hw_paused` is cleared after `ao_reset`, so `set_paused` will
not be called after a reset; instead, `driver->start()` will
be called, which properly starts the AO.
2024-05-20 18:22:31 +02:00
Kacper Michajłow e6e0aaa6c6 ad_spdif: add missing codec_desc initialization 2024-05-19 22:09:13 +02:00