Re: Sndio support in MPV

From: Érico Nogueira <>
Date: Tue, 24 Nov 2020 23:04:22 -0300
On Tue Nov 24, 2020 at 10:52 AM -03, Érico Nogueira wrote:
> Hi!
> I don't keep up with MPV [1] development, so I was quite surprised that
> the latest release dropped support for sndio [2]. I was looking into
> whether it would be possible to simply revert the commit, but it turns
> out they made quite a few changes after it, so additional fixes are
> needed. I already "fixed" it enough to at least build successfully, but
> it doesn't yet work, and I will admit that I don't really understand all
> that's going on in that codebase.
> - [1]
> - [2]
> So, in order to avoid repeated work, I was wondering if anyone already
> tried to go this route? I couldn't find any open PRs in their
> repository.
> My hope is that they would consider adding the backend back once someone
> has done the work of porting it over to their new architecture. If
> anyone is pessimisitic about that, let me know too, I guess :P
> Thanks,
> Érico

Quick update, I have a branch for it that works (at least on my machine :).
I don't know if it's the best design for their new AO API, but it's (I
think) a natural evolution from the previous version. Michael Forney has
suggested using their pull API instead of the current push (it uses
callbacks called by the audio library for feeding audio when requested
instead of feeding audio into it ever so often), but I believe that
would require a threaded implementation inside the ao_sndio.c file,
which might not be accepted upstream.

Has there been discussion into providing any such API inside libsndio?
From what I can see, the ao_jack.c and ao_sdl.c backends use this model,
and it seems to result in pretty clean code.

One other thing I found to be "missing" was a `sio_pause()` call; mpv's
AO wants to write() before calling start(), which I worked around by
doing my own buffering and flushing it when start() is called. If
there's some trick or obvious functionality I missed, please let me

The branch is in [1], and since upstream has removed sndio support once
already, I'd like to guarantee that the code is reasonable and that it
works fine before making a PR their way. Therefore, I'd highly
appreciate testing and code review, if anyone's up to it.

- [1]

Received on Wed Nov 25 2020 - 03:04:22 CET

This archive was generated by hypermail 2.3.0 : Tue Aug 09 2022 - 16:23:50 CEST