On Tue, Dec 07, 2021 at 07:07:08PM -0500, Brad Smith wrote:
> Here is another attempt at a sndio backend for mpv.
>
> Looking for some testers.
OK kn if anyone wants to commit.
> Index: Makefile
> ===================================================================
> RCS file: /home/cvs/ports/multimedia/mpv/Makefile,v
> retrieving revision 1.77
> diff -u -p -u -p -r1.77 Makefile
> --- Makefile 16 Nov 2021 21:30:22 -0000 1.77
> +++ Makefile 7 Dec 2021 23:58:30 -0000
> @@ -5,7 +5,7 @@ COMMENT = movie player based on MPlayer
> GH_ACCOUNT = mpv-player
> GH_PROJECT = mpv
> GH_TAGNAME = v0.34.0
> -REVISION = 0
> +REVISION = 1
>
> SHARED_LIBS += mpv 0.2 # 1.109
>
> @@ -26,8 +26,8 @@ WANTLIB += Xrandr Xrender Xss Xv Xxf86vm
> WANTLIB += avfilter avformat avresample avutil bluray c cdio cdio_cdda
> WANTLIB += cdio_paranoia drm dvdnav dvdread epoxy expat fontconfig
> WANTLIB += freetype fribidi gbm glib-2.0 graphite2 harfbuzz iconv
> -WANTLIB += intl jpeg lcms2 ${MODLUA_WANTLIB} m pcre placebo postproc pthread
> -WANTLIB += swresample swscale xcb xcb-dri2 xcb-glx xml2 z
> +WANTLIB += intl jpeg lcms2 ${MODLUA_WANTLIB} m pcre placebo postproc
> +WANTLIB += pthread sndio swresample swscale xcb xcb-dri2 xcb-glx xml2 z
>
> MODULES = lang/lua \
> lang/python
> @@ -66,6 +66,7 @@ CONFIGURE_ARGS = --confloaddir=${SYSCONF
> --enable-dvdnav \
> --enable-libmpv-shared \
> --enable-sdl2 \
> + --enable-sndio \
> --disable-alsa \
> --disable-caca \
> --disable-cuda-hwaccel \
> @@ -77,6 +78,7 @@ CONFIGURE_ARGS = --confloaddir=${SYSCONF
> --disable-optimize \
> --disable-pulse \
> --disable-sixel \
> + --disable-sdl2-audio \
> --disable-uchardet \
> --disable-vaapi \
> --disable-vaapi-drm \
> Index: patches/patch-audio_out_ao_c
> ===================================================================
> RCS file: /home/cvs/ports/multimedia/mpv/patches/patch-audio_out_ao_c,v
> retrieving revision 1.2
> diff -u -p -u -p -r1.2 patch-audio_out_ao_c
> --- patches/patch-audio_out_ao_c 7 Nov 2021 18:47:37 -0000 1.2
> +++ patches/patch-audio_out_ao_c 7 Dec 2021 23:13:33 -0000
> @@ -1,8 +1,8 @@
> $OpenBSD: patch-audio_out_ao_c,v 1.2 2021/11/07 18:47:37 kn Exp $
>
> -ao_sndio: add this audio output again
> +Another attempt to return ao_sndio to mpv
>
> -https://github.com/mpv-player/mpv/pull/8314
> +https://github.com/mpv-player/mpv/pull/9298
>
> Index: audio/out/ao.c
> --- audio/out/ao.c.orig
> Index: patches/patch-audio_out_ao_sndio_c
> ===================================================================
> RCS file: /home/cvs/ports/multimedia/mpv/patches/patch-audio_out_ao_sndio_c,v
> retrieving revision 1.3
> diff -u -p -u -p -r1.3 patch-audio_out_ao_sndio_c
> --- patches/patch-audio_out_ao_sndio_c 22 Aug 2021 06:59:18 -0000 1.3
> +++ patches/patch-audio_out_ao_sndio_c 7 Dec 2021 23:12:44 -0000
> @@ -1,13 +1,13 @@
> $OpenBSD: patch-audio_out_ao_sndio_c,v 1.3 2021/08/22 06:59:18 rsadowski Exp $
>
> -ao_sndio: add this audio output again
> +Another attempt to return ao_sndio to mpv
>
> -https://github.com/mpv-player/mpv/pull/8314
> +https://github.com/mpv-player/mpv/pull/9298
>
> Index: audio/out/ao_sndio.c
> --- audio/out/ao_sndio.c.orig
> +++ audio/out/ao_sndio.c
> -@@ -0,0 +1,317 @@
> +@@ -0,0 +1,322 @@
> +/*
> + * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
> + * Copyright (c) 2013 Christian Neukirchen <chneukirchen@gmail.com>
> @@ -51,7 +51,7 @@ Index: audio/out/ao_sndio.c
> +};
> +
> +
> -+static const struct mp_chmap sndio_layouts[MP_NUM_CHANNELS + 1] = {
> ++static const struct mp_chmap sndio_layouts[] = {
> + {0}, /* empty */
> + {1, {MP_SPEAKER_ID_FL}}, /* mono */
> + MP_CHMAP2(FL, FR), /* stereo */
> @@ -74,11 +74,9 @@ Index: audio/out/ao_sndio.c
> +static void process_events(struct ao *ao)
> +{
> + struct priv *p = ao->priv;
> -+
> -+ if (!p->playing)
> -+ return;
> ++
> + int n = sio_pollfd(p->hdl, p->pfd, POLLOUT);
> -+ while (poll(p->pfd, n, 0) < 0 && errno == EINTR) {}
> ++ while (poll(p->pfd, n, 0) < 0 && errno == EINTR);
> +
> + sio_revents(p->hdl, p->pfd);
> +}
> @@ -129,21 +127,15 @@ Index: audio/out/ao_sndio.c
> +
> + /* Selecting sound format. */
> + ao->format = af_fmt_from_planar(ao->format);
> -+ for (i = 0, ap = af_to_par;; i++, ap++) {
> -+ if (i == MP_ARRAY_SIZE(af_to_par)) {
> -+ MP_VERBOSE(ao, "unsupported format\n");
> -+ p->par.bits = 16;
> -+ p->par.sig = 1;
> -+ p->par.le = SIO_LE_NATIVE;
> -+ break;
> -+ }
> ++
> ++ p->par.bits = 16;
> ++ p->par.sig = 1;
> ++ p->par.le = SIO_LE_NATIVE;
> ++ for (i = 0; i < MP_ARRAY_SIZE(af_to_par); i++) {
> ++ ap = &af_to_par[i];
> + if (ap->format == ao->format) {
> + p->par.bits = ap->bits;
> + p->par.sig = ap->sig;
> -+ if (ap->bits > 8)
> -+ p->par.le = SIO_LE_NATIVE;
> -+ if (ap->bits != SIO_BPS(ap->bits))
> -+ p->par.bps = ap->bits / 8;
> + break;
> + }
> + }
> @@ -161,7 +153,11 @@ Index: audio/out/ao_sndio.c
> +#ifdef __FreeBSD__
> + /* OSS wrapper have bad defaults, overwrite it. */
> + p->par.appbufsz = ((p->par.rate * 25) / 1000); /* 25 ms. */
> ++#else
> ++ p->par.appbufsz = p->par.rate * 250 / 1000; /* 250ms buffer */
> +
No comments:
Post a Comment