Source-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/multimedia/mpv mpv: ao_netbsd changes...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/56af41ae3d66
branches:  trunk
changeset: 428694:56af41ae3d66
user:      nia <nia%pkgsrc.org@localhost>
date:      Thu Apr 09 20:53:39 2020 +0000

description:
mpv: ao_netbsd changes...

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

diffstat:

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

diffs (187 lines):

diff -r 447c8856e274 -r 56af41ae3d66 multimedia/mpv/Makefile
--- a/multimedia/mpv/Makefile   Thu Apr 09 19:25:39 2020 +0000
+++ b/multimedia/mpv/Makefile   Thu Apr 09 20:53:39 2020 +0000
@@ -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}
diff -r 447c8856e274 -r 56af41ae3d66 multimedia/mpv/distinfo
--- a/multimedia/mpv/distinfo   Thu Apr 09 19:25:39 2020 +0000
+++ b/multimedia/mpv/distinfo   Thu Apr 09 20:53:39 2020 +0000
@@ -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 @@
 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
diff -r 447c8856e274 -r 56af41ae3d66 multimedia/mpv/patches/patch-audio_out_ao__netbsd.c
--- a/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c       Thu Apr 09 19:25:39 2020 +0000
+++ b/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c       Thu Apr 09 20:53:39 2020 +0000
@@ -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 @@
 +#include "ao.h"
 +#include "internal.h"
 +
++#ifndef NETBSD_MAX_CHANNELS
++#define NETBSD_MAX_CHANNELS (12)
++#endif
++
 +#ifndef NETBSD_MAX_DEVS
 +#define NETBSD_MAX_DEVS (8)
 +#endif
 +
-+#ifndef NETBSD_BUF_SIZE
-+#define NETBSD_BUF_SIZE (1024)
-+#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 @@
 +    }
 +
 +    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 @@
 +
 +    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 @@
 +        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 @@
 +{
 +    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 @@
 +{
 +    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));
++    if (ioctl(p->fd, AUDIO_GETBUFINFO, &info) == -1) {
++        MP_ERR(ao, "AUDIO_GETBUFINFO 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));
-+        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 @@
 +        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