Commit Graph

35 Commits

Author SHA1 Message Date
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
wm4 71d218eae4 ao_sndio: remove this audio output
It was always marked as "experimental", and had inherent problems that
were never fixed. It was disabled by default, and I don't think anyone
is using it.
2020-03-28 20:58:56 +01:00
wm4 cde94e83a9 audio/out: rip out old unused app/softvolume reporting
This was all dead code. Commit 995c47da9a (over 3 years ago) removed all
uses of the controls.

It would be nice if AOs could apply a linear gain volume, that only
affects the AO's audio stream for low-latency volume adjust and muting.
AOCONTROL_HAS_SOFT_VOLUME was supposed to signal this, but to use it,
we'd have to thoroughly check whether it really uses the expected
semantics, so there's really nothing useful left in this old code.
2019-10-11 21:05:11 +02:00
wm4 adbb429296 ao_sndio: drop AF_FORMAT_S24 usage
I can't test it, so I'm dropping it without replacement. If anyone is
interested in readding support, it would be done like the ao_alsa.c
change.
2017-07-07 17:56:18 +02:00
wm4 037c37519b audio/out: require AO drivers to report period size and correct buffer
Before this change, AOs could have internal alignment, and play() would
not consume the trailing data if the size passed to it is not aligned.
Change this to require AOs to report their alignment (via period_size),
and make sure to always send aligned data.

The buffer reported by get_space() now always has to be correct and
reliable. If play() does not consume all data provided (which is bounded
by get_space()), an error is printed.

This is preparation for potential further AO changes.

I casually checked alsa/lavc/null/pcm, the other AOs might or might not
work.
2017-06-25 15:57:43 +02:00
wm4 809d160c1e options: remove remaining deprecated audio device selection options 2017-04-23 17:51:55 +02:00
wm4 1a2319f3e4 options: remove deprecated sub-option handling for --vo and --ao
Long planned. Leads to some sanity.

There still are some rather gross things. Especially g_groups is ugly,
and a hack that can hopefully be removed. (There is a plan for it, but
whether it's implemented depends on how much energy is left.)
2016-11-25 21:17:25 +01:00
wm4 13786dc643 audio/out: deprecate device sub-options
We have --audio-device, which can force the device. Also add something
describing to this extent to the manpage.
2016-09-05 21:26:39 +02:00
wm4 69283bc0f8 options: deprecate suboptions for the remaining AO/VOs 2016-09-05 21:26:39 +02:00
wm4 e4e7fade96 ao_sndio: fix comment
So whoever (nobody?) would want to deal with this broken and obscure AO
for an obscure audio API could add support for some more channel
layouts.
2015-06-26 23:03:37 +02:00
wm4 831d7c3c40 audio: remove S8, U16, U24, U32 formats
They are useless. Not only are they actually rarely in use; but
libavcodec doesn't even output them, as libavcodec has no such sample
formats for decoded audio.

Even if it should happen that we actually still need them (e.g. if doing
direct hardware output), there are better solutions. Swapping the sign
is a fast and lossless operation and can be done inplace, so AO actually
needing it could do this directly.

If you wonder why we keep U8 instead of S8: because libavcodec does it.
2015-06-16 21:11:59 +02:00
wm4 b91b4944bd audio: define only a single NA speaker ID
Remove the requirement from mp_chmap that speaker entries must be
unique. Use this to get rid of all the redundant NA speaker IDs.
2015-05-07 23:07:14 +02:00
wm4 cd5ab98ff9 ao_sndio: add notice about padding channels
(I won't do this, but someone else seeing this might.)
2015-05-06 21:48:40 +02:00
Dmitrij D. Czarkoff 58e0292a9f ao_sndio: open device in blocking mode, don't inflate buffer artificially
The code actually uses blocking mode, so opening sound device in non-blocking
mode results in choppy sound.  Also, inflating the buffer isn't necessary in
blocking mode, so the function may simply return without doing anything.
2015-03-26 00:09:15 +01:00
wm4 5db0fbd95e audio/out: consistently use double return type for get_delay
ao_get_delay() returns double, but the get_delay callback still
returned float.
2014-11-09 11:45:04 +01:00
wm4 26bc6b4831 Add some missing "const"s
The one in msg.c was mistakenly removed with commit e99a37f6.

I didn't actually test the change in ao_sndio.c (but obviously "ap"
shouldn't be static).
2014-10-10 13:44:08 +02:00
wm4 387d5f55e6 ao_sndio: print a warning when draining audio
libsndio has absolutely no mechanism to discard already written audio
(other than SIGKILLing the sound server). sio_stop() will always block
until all audio is played. This is a legitimate design bug.

In theory, we could just not stop it at all, so if the player is e.g.
paused, the remaining audio would be played. When resuming, we would
have to do something to ensure get_delay() returns the right value. But
I couldn't get it to work in all cases.
2014-09-26 15:46:39 +02:00
wm4 da1918b894 ao_sndio: update buffer status on get_delay
get_delay needs to report the current audio buffer status. It's
important for A/V sync that this information is current, but functions
which update it were called on play() or get_space() calls only.
2014-09-26 15:46:36 +02:00
wm4 3208f8c445 ao_sndio: change p->delay to samples
This was in bytes, but it's more convenient to use samples (or frames;
in any case the smallest unit of audio that includes all channels).

Remove the ao->bps line too; it will be set after init() returns.
2014-09-26 15:46:33 +02:00
wm4 12d93fdfef ao_sndio: set non-blocking flag
Otherwise the feed thread and the playloop will get randomly blocked.

This seems to fix most A/V sync issues.
2014-09-26 15:46:30 +02:00
wm4 1b1421866d ao_sndio: fix some incorrect comments
The AO API always uses sample counts.
2014-09-26 15:46:23 +02:00
wm4 8a8f65d73d ao_sndio: fix U24 bit width
This was wrong since the initial commit.
2014-09-24 21:32:15 +02:00
wm4 b745c2d005 audio: drop swapped-endian audio formats
Until now, the audio chain could handle both little endian and big
endian formats. This actually doesn't make much sense, since the audio
API and the HW will most likely prefer native formats. Or at the very
least, it should be trivial for audio drivers to do the byte swapping
themselves.

From now on, the audio chain contains native-endian formats only. All
AOs and some filters are adjusted. af_convertsignendian.c is now wrongly
named, but the filter name is adjusted. In some cases, the audio
infrastructure was reused on the demuxer side, but that is relatively
easy to rectify.

This is a quite intrusive and radical change. It's possible that it will
break some things (especially if they're obscure or not Linux), so watch
out for regressions. It's probably still better to do it the bulldozer
way, since slow transition and researching foreign platforms would take
a lot of time and effort.
2014-09-23 23:09:25 +02:00
wm4 769ac6fb7b audio/out: always round get_space on period size
Round get_space() results in the same way play() rounds the input size.
Some audio APIs do this for various reasons.

This affects only "push" based AOs. Some of these need no change,
because they either do it already right (like ao_openal), or they seem
not to have any such requirements (like ao_pulse).

Needed for the following commit.
2014-09-06 12:59:00 +02:00
wm4 d9941e01cc ao_sndio: fix a comment
Whether this code was written with the correct assumptions in mind, I
don't know.
2014-09-06 12:58:57 +02:00
wm4 439a05d8c3 audio/out: remove old things
Remove the unnecessary indirection through ao fields.

Also fix the inverted result of AOCONTROL_HAS_TEMP_VOLUME. Hopefully the
change is equivalent. But actually, it looks like the old code did it
wrong.
2014-09-06 02:30:57 +02:00
wm4 e16c91d07a audio/out: make draining a separate operation
Until now, this was always conflated with uninit. This was ugly, and
also many AOs emulated this manually (or just ignored it). Make draining
an explicit operation, so AOs which support it can provide it, and for
all others generic code will emulate it.

For ao_wasapi, we keep it simple and basically disable the internal
draining implementation (maybe it should be restored later).

Tested on Linux only.
2014-03-09 01:27:41 +01:00
wm4 41f2b26d11 audio/out: make ao struct opaque
We want to move the AO to its own thread. There's no technical reason
for making the ao struct opaque to do this. But it helps us sleep at
night, because we can control access to shared state better.
2014-03-09 00:19:31 +01:00
wm4 0112143fda Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
wm4 eb15151705 Move options/config related files from mpvcore/ to options/
Since m_option.h and options.h are extremely often included, a lot of
files have to be changed.

Moving path.c/h to options/ is a bit questionable, but since this is
mainly about access to config files (which are also handled in
options/), it's probably ok.
2013-12-17 02:07:57 +01:00
wm4 380fc765e4 audio/out: prepare for non-interleaved audio
This comes with two internal AO API changes:

1. ao_driver.play now can take non-interleaved audio. For this purpose,
the data pointer is changed to void **data, where data[0] corresponds to
the pointer in the old API. Also, the len argument as well as the return
value are now in samples, not bytes. "Sample" in this context means the
unit of the smallest possible audio frame, i.e. sample_size * channels.

2. ao_driver.get_space now returns samples instead of bytes. (Similar to
the play function.)

Change all AOs to use the new API.

The AO API as exposed to the rest of the player still uses the old API.
It's emulated in ao.c. This is purely to split the commits changing all
AOs and the commits adding actual support for outputting N-I audio.
2013-11-12 23:27:51 +01:00
wm4 bf60281ffb audio/out: reject non-interleaved formats
No AO can handle these, so it would be a problem if they get added
later, and non-interleaved formats get accepted erroneously. Let them
gracefully fall back to other formats.

Most AOs actually would fall back, but to an unrelated formats. This is
covered by this commit too, and if possible they should pick the
interleaved variant if a non-interleaved format is requested.
2013-11-12 23:16:31 +01:00
wm4 d58d4ec93c audio/out: remove useless info struct and redundant fields 2013-10-23 19:30:02 +02:00
Christian Neukirchen 3289473678 audio/out: add sndio support
Based on an earlier patch for mplayer by Alexandre Ratchov <alex@caoua.org>
2013-10-03 23:14:03 +02:00