diff options
author | nia <nia@pkgsrc.org> | 2020-03-16 20:58:18 +0000 |
---|---|---|
committer | nia <nia@pkgsrc.org> | 2020-03-16 20:58:18 +0000 |
commit | a90eecdcc7eb100d84b84418abafe2c62aac157b (patch) | |
tree | 261574f591fda21853afbfc552326ca01a732d34 /multimedia/mpv | |
parent | f66f0c6fee33f5759164bb5a88ae6f9596fba492 (diff) | |
download | pkgsrc-a90eecdcc7eb100d84b84418abafe2c62aac157b.tar.gz |
mpv: Simplify NetBSD audio implementation
Diffstat (limited to 'multimedia/mpv')
-rw-r--r-- | multimedia/mpv/Makefile | 4 | ||||
-rw-r--r-- | multimedia/mpv/distinfo | 4 | ||||
-rw-r--r-- | multimedia/mpv/patches/patch-audio_out_ao__netbsd.c | 47 |
3 files changed, 21 insertions, 34 deletions
diff --git a/multimedia/mpv/Makefile b/multimedia/mpv/Makefile index 1a04e97e442..47d26eb595e 100644 --- a/multimedia/mpv/Makefile +++ b/multimedia/mpv/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.99 2020/03/16 20:31:44 nia Exp $ +# $NetBSD: Makefile,v 1.100 2020/03/16 20:58:18 nia Exp $ DISTNAME= mpv-0.32.0 -PKGREVISION= 4 +PKGREVISION= 5 CATEGORIES= multimedia MASTER_SITES= ${MASTER_SITE_GITHUB:=mpv-player/} GITHUB_TAG= v${PKGVERSION_NOREV} diff --git a/multimedia/mpv/distinfo b/multimedia/mpv/distinfo index 5521bb40747..bb8ab1f0609 100644 --- a/multimedia/mpv/distinfo +++ b/multimedia/mpv/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.60 2020/03/16 20:31:44 nia Exp $ +$NetBSD: distinfo,v 1.61 2020/03/16 20:58:18 nia Exp $ SHA1 (mpv-0.32.0.tar.gz) = 5b69ea34dd5f8d209acd5266415c7bc00ab83341 RMD160 (mpv-0.32.0.tar.gz) = d1e399fce8985a0399fe627248b87d8537cfefd7 @@ -7,7 +7,7 @@ Size (mpv-0.32.0.tar.gz) = 3148730 bytes SHA1 (patch-DOCS_man_ao.rst) = 5940fe1ad4d4328c03b9e6e5265c517762cfe2d0 SHA1 (patch-audio_out_ao.c) = 1527c818d0f50801485ad3b90c5d86b30b2ca6f1 SHA1 (patch-audio_out_ao__alsa.c) = c4661d0d22550d6e4eb2b7a42dd04dbcc58123b0 -SHA1 (patch-audio_out_ao__netbsd.c) = 137cd9da82108adc02848954fa72c057a9de7a1e +SHA1 (patch-audio_out_ao__netbsd.c) = a0cdd3c10cf2320c738ff88a51f380675b123022 SHA1 (patch-options_options.c) = c75fb27140ad21e0a11c6ded976116c544661f56 SHA1 (patch-player_main.c) = 7d1d62091c327fca698844004ddb9a7871e15fce SHA1 (patch-video_out_drm__common.c) = a545a8aec29f1b3c44d26aacbc59b86d3333a0b9 diff --git a/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c b/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c index 3cdf8dbc5d5..e12423feb75 100644 --- a/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c +++ b/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c @@ -1,10 +1,10 @@ -$NetBSD: patch-audio_out_ao__netbsd.c,v 1.1 2020/03/16 20:31:44 nia Exp $ +$NetBSD: patch-audio_out_ao__netbsd.c,v 1.2 2020/03/16 20:58:18 nia Exp $ NetBSD audio support. ---- audio/out/ao_netbsd.c.orig 2020-03-16 20:20:16.030655720 +0000 +--- audio/out/ao_netbsd.c.orig 2020-03-16 20:38:28.287433271 +0000 +++ audio/out/ao_netbsd.c -@@ -0,0 +1,276 @@ +@@ -0,0 +1,263 @@ +/* + * Copyright (c) 2020 Nia Alarie <nia@NetBSD.org> + * All rights reserved. @@ -46,8 +46,16 @@ NetBSD audio support. +#include "ao.h" +#include "internal.h" + -+#ifndef NETBSD_MAXDEVS -+#define NETBSD_MAXDEVS (8) ++#ifndef NETBSD_MAX_DEVS ++#define NETBSD_MAX_DEVS (8) ++#endif ++ ++#ifndef NETBSD_MAX_CHANNELS ++#define NETBSD_MAX_CHANNELS (12) ++#endif ++ ++#ifndef NETBSD_BUF_FRAMES ++#define NETBSD_BUF_FRAMES (32) +#endif + +struct priv { @@ -81,7 +89,7 @@ NetBSD audio support. + + info.mode = AUMODE_PLAY; + -+ for (int n = 1; n <= 12; n++) { ++ for (int n = 1; n <= NETBSD_MAX_CHANNELS; n++) { + struct mp_chmap map; + + mp_chmap_from_channels(&map, n); @@ -108,6 +116,7 @@ NetBSD audio support. + default: + pinfo->precision = 32; + pinfo->encoding = AUDIO_ENCODING_SLINEAR; ++ ao->format = AF_FORMAT_S32; + break; + } + @@ -123,21 +132,6 @@ NetBSD audio support. + + ao->samplerate = pinfo->sample_rate; + -+ switch (pinfo->precision) { -+ case 8: -+ ao->format = AF_FORMAT_U8; -+ break; -+ case 16: -+ ao->format = AF_FORMAT_S16; -+ break; -+ case 32: -+ ao->format = AF_FORMAT_S32; -+ break; -+ default: -+ MP_ERR(ao, "Unsupported precision %d\n", pinfo->precision); -+ goto fail; -+ } -+ + return 0; + +fail: @@ -174,14 +168,7 @@ NetBSD audio support. + +static int get_space(struct ao *ao) +{ -+ struct priv *p = ao->priv; -+ struct audio_info info; -+ -+ if (ioctl(p->fd, AUDIO_GETINFO, &info) == -1) { -+ MP_ERR(ao, "AUDIO_GETINFO failed: %s\n", mp_strerror(errno)); -+ return 0; -+ } -+ return (info.blocksize - info.play.seek) / ao->sstride; ++ return NETBSD_BUF_FRAMES * ao->sstride; +} + +static void audio_pause(struct ao *ao) @@ -255,7 +242,7 @@ NetBSD audio support. + struct audio_device dev; + int fd; + -+ for (int i = 0; 0 < NETBSD_MAXDEVS; ++i) { ++ for (int i = 0; 0 < NETBSD_MAX_DEVS; ++i) { + (void)snprintf(name, sizeof(name), "/dev/audio%d", i); + fd = open(name, O_WRONLY); + if (fd == -1 || ioctl(fd, AUDIO_GETDEV, &dev) == -1) { |