pkgsrc-Changes archive

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

CVS commit: pkgsrc/multimedia/mpv



Module Name:    pkgsrc
Committed By:   nia
Date:           Thu Apr  9 20:53:40 UTC 2020

Modified Files:
        pkgsrc/multimedia/mpv: Makefile distinfo
        pkgsrc/multimedia/mpv/patches: patch-audio_out_ao__netbsd.c

Log Message:
mpv: ao_netbsd changes...

- Implement get_space properly and use AUDIO_GETBUFINFO more
- Simplify implemention of get_delay and set period_size


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 pkgsrc/multimedia/mpv/Makefile
cvs rdiff -u -r1.64 -r1.65 pkgsrc/multimedia/mpv/distinfo
cvs rdiff -u -r1.4 -r1.5 \
    pkgsrc/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/multimedia/mpv/Makefile
diff -u pkgsrc/multimedia/mpv/Makefile:1.106 pkgsrc/multimedia/mpv/Makefile:1.107
--- pkgsrc/multimedia/mpv/Makefile:1.106        Wed Apr  8 12:17:02 2020
+++ pkgsrc/multimedia/mpv/Makefile      Thu Apr  9 20:53:39 2020
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.106 2020/04/08 12:17:02 nia Exp $
+# $NetBSD: Makefile,v 1.107 2020/04/09 20:53:39 nia Exp $
 
 DISTNAME=      mpv-0.32.0
-PKGREVISION=   8
+PKGREVISION=   9
 CATEGORIES=    multimedia
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=mpv-player/}
 GITHUB_TAG=    v${PKGVERSION_NOREV}

Index: pkgsrc/multimedia/mpv/distinfo
diff -u pkgsrc/multimedia/mpv/distinfo:1.64 pkgsrc/multimedia/mpv/distinfo:1.65
--- pkgsrc/multimedia/mpv/distinfo:1.64 Wed Apr  8 12:17:02 2020
+++ pkgsrc/multimedia/mpv/distinfo      Thu Apr  9 20:53:39 2020
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.64 2020/04/08 12:17:02 nia Exp $
+$NetBSD: distinfo,v 1.65 2020/04/09 20:53:39 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) = 1a88957a89dd8ebffaeadb14463c16796eb444d3
+SHA1 (patch-audio_out_ao__netbsd.c) = 6e3eee552499d61daee79e4b15a67e403dfafe9e
 SHA1 (patch-options_options.c) = c75fb27140ad21e0a11c6ded976116c544661f56
 SHA1 (patch-player_main.c) = 7d1d62091c327fca698844004ddb9a7871e15fce
 SHA1 (patch-video_out_drm__common.c) = a545a8aec29f1b3c44d26aacbc59b86d3333a0b9

Index: pkgsrc/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c
diff -u pkgsrc/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c:1.4 pkgsrc/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c:1.5
--- pkgsrc/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c:1.4      Wed Apr  8 12:17:02 2020
+++ pkgsrc/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c  Thu Apr  9 20:53:39 2020
@@ -1,8 +1,8 @@
-$NetBSD: patch-audio_out_ao__netbsd.c,v 1.4 2020/04/08 12:17:02 nia Exp $
+$NetBSD: patch-audio_out_ao__netbsd.c,v 1.5 2020/04/09 20:53:39 nia Exp $
 
 NetBSD audio support.
 
---- audio/out/ao_netbsd.c.orig 2020-04-08 12:06:20.470592603 +0000
+--- audio/out/ao_netbsd.c.orig 2020-04-09 20:51:23.971921857 +0000
 +++ audio/out/ao_netbsd.c
 @@ -0,0 +1,276 @@
 +/*
@@ -46,18 +46,16 @@ NetBSD audio support.
 +#include "ao.h"
 +#include "internal.h"
 +
-+#ifndef NETBSD_MAX_DEVS
-+#define NETBSD_MAX_DEVS (8)
++#ifndef NETBSD_MAX_CHANNELS
++#define NETBSD_MAX_CHANNELS (12)
 +#endif
 +
-+#ifndef NETBSD_BUF_SIZE
-+#define NETBSD_BUF_SIZE (1024)
++#ifndef NETBSD_MAX_DEVS
++#define NETBSD_MAX_DEVS (8)
 +#endif
 +
 +struct priv {
 +    int fd;
-+    uint64_t total_blocks; /* audio blocks output */
-+    uint64_t total_bytes; /* bytes sent to the queue */
 +};
 +
 +static int init(struct ao *ao)
@@ -79,7 +77,7 @@ NetBSD audio support.
 +    }
 +
 +    MP_ERR(ao, "Opening device %s\n", device);
-+    if ((p->fd = open(device, O_WRONLY)) == -1) {
++    if ((p->fd = open(device, O_WRONLY | O_NONBLOCK)) == -1) {
 +        MP_ERR(ao, "Can't open audio device %s: %s\n",
 +               device, mp_strerror(errno));
 +        goto fail;
@@ -92,7 +90,7 @@ NetBSD audio support.
 +
 +    info.mode = AUMODE_PLAY;
 +
-+    for (int n = 1; n <= hw_info.play.channels; n++) {
++    for (int n = 1; n <= NETBSD_MAX_CHANNELS; n++) {
 +        struct mp_chmap map;
 +
 +        mp_chmap_from_channels(&map, n);
@@ -127,6 +125,15 @@ NetBSD audio support.
 +        MP_ERR(ao, "AUDIO_SETINFO failed: %s\n", mp_strerror(errno));
 +        goto fail;
 +    }
++
++    if (ioctl(p->fd, AUDIO_GETINFO, &info) == -1) {
++        MP_ERR(ao, "AUDIO_GETINFO failed: %s\n", mp_strerror(errno));
++        goto fail;
++    }
++
++    ao->period_size = info.blocksize / (pinfo->precision / 8) / pinfo->channels;
++    ao->device_buffer = info.play.buffer_size / (pinfo->precision / 8) / pinfo->channels;
++
 +    return 0;
 +
 +fail:
@@ -149,38 +156,40 @@ NetBSD audio support.
 +{
 +    struct priv *p = ao->priv;
 +    struct audio_info info;
-+    struct audio_offset offset;
 +
-+    if (ioctl(p->fd, AUDIO_GETINFO, &info) == -1) {
-+        MP_ERR(ao, "AUDIO_GETINFO failed: %s\n", mp_strerror(errno));
++    if (ioctl(p->fd, AUDIO_GETBUFINFO, &info) == -1) {
++        MP_ERR(ao, "AUDIO_GETBUFINFO failed: %s\n", mp_strerror(errno));
 +        return;
 +    }
 +
 +    (void)ioctl(p->fd, AUDIO_FLUSH, NULL);
-+    (void)ioctl(p->fd, AUDIO_GETOOFFS, &offset); /* reset deltablks */
-+    p->total_blocks = p->total_bytes / info.blocksize;
 +}
 +
 +static void drain(struct ao *ao)
 +{
 +    struct priv *p = ao->priv;
 +    struct audio_info info;
-+    struct audio_offset offset;
 +
-+    if (ioctl(p->fd, AUDIO_GETINFO, &info) == -1) {
-+        MP_ERR(ao, "AUDIO_GETINFO failed: %s\n", mp_strerror(errno));
++    if (ioctl(p->fd, AUDIO_GETBUFINFO, &info) == -1) {
++        MP_ERR(ao, "AUDIO_GETBUFINFO failed: %s\n", mp_strerror(errno));
 +        return;
 +    }
 +
 +    (void)ioctl(p->fd, AUDIO_DRAIN, NULL);
-+    (void)ioctl(p->fd, AUDIO_FLUSH, NULL);
-+    (void)ioctl(p->fd, AUDIO_GETOOFFS, &offset); /* reset deltablks */
-+    p->total_blocks = p->total_bytes / info.blocksize;
 +}
 +
 +static int get_space(struct ao *ao)
 +{
-+    return NETBSD_BUF_SIZE;
++    struct priv *p = ao->priv;
++    struct audio_info info;
++    unsigned int nblk;
++
++    if (ioctl(p->fd, AUDIO_GETBUFINFO, &info) == -1) {
++        MP_ERR(ao, "AUDIO_GETBUFINFO failed: %s\n", mp_strerror(errno));
++        return 0;
++    }
++    nblk = info.hiwat - (info.play.seek / info.blocksize);
++    return nblk * ao->period_size;
 +}
 +
 +static void audio_pause(struct ao *ao)
@@ -214,20 +223,12 @@ NetBSD audio support.
 +{
 +    struct priv *p = ao->priv;
 +    struct audio_info info;
-+    struct audio_offset offset;
-+    uint64_t transfer_len;
 +
-+    if (ioctl(p->fd, AUDIO_GETINFO, &info) == -1) {
-+        MP_ERR(ao, "AUDIO_GETINFO failed: %s\n", mp_strerror(errno));
-+        return 0;
-+    }
-+    if (ioctl(p->fd, AUDIO_GETOOFFS, &offset) == -1) {
-+        MP_ERR(ao, "AUDIO_GETOOFFS failed: %s\n", mp_strerror(errno));
++    if (ioctl(p->fd, AUDIO_GETBUFINFO, &info) == -1) {
++        MP_ERR(ao, "AUDIO_GETBUFINFO failed: %s\n", mp_strerror(errno));
 +        return 0;
 +    }
-+    p->total_blocks += offset.deltablks;
-+    transfer_len = p->total_bytes - (p->total_blocks * info.blocksize);
-+    return transfer_len / (double)ao->bps;
++    return (info.blocksize + info.play.seek) / (double)ao->bps;
 +}
 +
 +static int play(struct ao *ao, void **data, int samples, int flags)
@@ -244,7 +245,6 @@ NetBSD audio support.
 +        MP_ERR(ao, "audio write failed: %s\n", mp_strerror(errno));
 +        return 0;
 +    }
-+    p->total_bytes += ret;
 +    return ret / ao->sstride;
 +}
 +



Home | Main Index | Thread Index | Old Index