pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/multimedia/mpv mpv: Simplify NetBSD audio implementation



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d75bccaac934
branches:  trunk
changeset: 413215:d75bccaac934
user:      nia <nia%pkgsrc.org@localhost>
date:      Mon Mar 16 20:58:18 2020 +0000

description:
mpv: Simplify NetBSD audio implementation

diffstat:

 multimedia/mpv/Makefile                             |   4 +-
 multimedia/mpv/distinfo                             |   4 +-
 multimedia/mpv/patches/patch-audio_out_ao__netbsd.c |  47 +++++++-------------
 3 files changed, 21 insertions(+), 34 deletions(-)

diffs (131 lines):

diff -r d5e68d669ed3 -r d75bccaac934 multimedia/mpv/Makefile
--- a/multimedia/mpv/Makefile   Mon Mar 16 20:31:44 2020 +0000
+++ b/multimedia/mpv/Makefile   Mon Mar 16 20:58:18 2020 +0000
@@ -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 -r d5e68d669ed3 -r d75bccaac934 multimedia/mpv/distinfo
--- a/multimedia/mpv/distinfo   Mon Mar 16 20:31:44 2020 +0000
+++ b/multimedia/mpv/distinfo   Mon Mar 16 20:58:18 2020 +0000
@@ -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 @@
 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 -r d5e68d669ed3 -r d75bccaac934 multimedia/mpv/patches/patch-audio_out_ao__netbsd.c
--- a/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c       Mon Mar 16 20:31:44 2020 +0000
+++ b/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c       Mon Mar 16 20:58:18 2020 +0000
@@ -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@localhost>
 + * All rights reserved.
@@ -46,8 +46,16 @@
 +#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 @@
 +
 +    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 @@
 +    default:
 +        pinfo->precision = 32;
 +        pinfo->encoding = AUDIO_ENCODING_SLINEAR;
++        ao->format = AF_FORMAT_S32;
 +        break;
 +    }
 +
@@ -123,21 +132,6 @@
 +
 +    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 @@
 +
 +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 @@
 +    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) {



Home | Main Index | Thread Index | Old Index