pkgsrc-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 improvements. Fixes play...
details: https://anonhg.NetBSD.org/pkgsrc/rev/221549881d59
branches: trunk
changeset: 426915:221549881d59
user: nia <nia%pkgsrc.org@localhost>
date: Wed Apr 08 12:17:02 2020 +0000
description:
mpv: ao_netbsd improvements. Fixes playing very small audio files.
- Get the preferred sample rate from the device.
This ensures sample rate conversion is done in user space,
which is a Good Idea and should improve output quality.
This backend is now Even More NetBSD.
- Implement drain().
- Bump up the buffer size.
Bump PKGREVISION
diffstat:
multimedia/mpv/Makefile | 4 +-
multimedia/mpv/distinfo | 4 +-
multimedia/mpv/patches/patch-audio_out_ao__netbsd.c | 53 +++++++++++++-------
3 files changed, 37 insertions(+), 24 deletions(-)
diffs (157 lines):
diff -r 20eb07757244 -r 221549881d59 multimedia/mpv/Makefile
--- a/multimedia/mpv/Makefile Wed Apr 08 11:55:38 2020 +0000
+++ b/multimedia/mpv/Makefile Wed Apr 08 12:17:02 2020 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.105 2020/04/07 13:47:04 ryoon Exp $
+# $NetBSD: Makefile,v 1.106 2020/04/08 12:17:02 nia Exp $
DISTNAME= mpv-0.32.0
-PKGREVISION= 7
+PKGREVISION= 8
CATEGORIES= multimedia
MASTER_SITES= ${MASTER_SITE_GITHUB:=mpv-player/}
GITHUB_TAG= v${PKGVERSION_NOREV}
diff -r 20eb07757244 -r 221549881d59 multimedia/mpv/distinfo
--- a/multimedia/mpv/distinfo Wed Apr 08 11:55:38 2020 +0000
+++ b/multimedia/mpv/distinfo Wed Apr 08 12:17:02 2020 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.63 2020/03/18 11:49:21 leot Exp $
+$NetBSD: distinfo,v 1.64 2020/04/08 12:17:02 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) = 544b976fae4d672a4f99b226b949f5f338712820
+SHA1 (patch-audio_out_ao__netbsd.c) = 1a88957a89dd8ebffaeadb14463c16796eb444d3
SHA1 (patch-options_options.c) = c75fb27140ad21e0a11c6ded976116c544661f56
SHA1 (patch-player_main.c) = 7d1d62091c327fca698844004ddb9a7871e15fce
SHA1 (patch-video_out_drm__common.c) = a545a8aec29f1b3c44d26aacbc59b86d3333a0b9
diff -r 20eb07757244 -r 221549881d59 multimedia/mpv/patches/patch-audio_out_ao__netbsd.c
--- a/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c Wed Apr 08 11:55:38 2020 +0000
+++ b/multimedia/mpv/patches/patch-audio_out_ao__netbsd.c Wed Apr 08 12:17:02 2020 +0000
@@ -1,10 +1,10 @@
-$NetBSD: patch-audio_out_ao__netbsd.c,v 1.3 2020/03/18 11:49:21 leot Exp $
+$NetBSD: patch-audio_out_ao__netbsd.c,v 1.4 2020/04/08 12:17:02 nia Exp $
NetBSD audio support.
---- audio/out/ao_netbsd.c.orig 2020-03-18 11:11:11.484992180 +0000
+--- audio/out/ao_netbsd.c.orig 2020-04-08 12:06:20.470592603 +0000
+++ audio/out/ao_netbsd.c
-@@ -0,0 +1,263 @@
+@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 2020 Nia Alarie <nia%NetBSD.org@localhost>
+ * All rights reserved.
@@ -50,12 +50,8 @@
+#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)
++#ifndef NETBSD_BUF_SIZE
++#define NETBSD_BUF_SIZE (1024)
+#endif
+
+struct priv {
@@ -69,10 +65,12 @@
+ char device[16] = "/dev/audio";
+ struct priv *p = ao->priv;
+ struct audio_info info;
++ struct audio_info hw_info;
+ struct audio_prinfo *pinfo;
+ struct mp_chmap_sel sel = {0};
+
+ AUDIO_INITINFO(&info);
++ AUDIO_INITINFO(&hw_info);
+ pinfo = &info.play;
+
+ if (ao->device != NULL) {
@@ -87,9 +85,14 @@
+ goto fail;
+ }
+
++ if (ioctl(p->fd, AUDIO_GETFORMAT, &hw_info) == -1) {
++ MP_ERR(ao, "AUDIO_GETFORMAT failed: %s\n", mp_strerror(errno));
++ goto fail;
++ }
++
+ info.mode = AUMODE_PLAY;
+
-+ for (int n = 1; n <= NETBSD_MAX_CHANNELS; n++) {
++ for (int n = 1; n <= hw_info.play.channels; n++) {
+ struct mp_chmap map;
+
+ mp_chmap_from_channels(&map, n);
@@ -102,7 +105,7 @@
+ }
+
+ pinfo->channels = ao->channels.num;
-+ pinfo->sample_rate = ao->samplerate;
++ pinfo->sample_rate = ao->samplerate = hw_info.play.sample_rate;
+
+ switch (ao->format) {
+ case AF_FORMAT_U8:
@@ -124,14 +127,6 @@
+ 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->samplerate = pinfo->sample_rate;
-+
+ return 0;
+
+fail:
@@ -161,14 +156,31 @@
+ 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));
++ 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_FRAMES * ao->sstride;
++ return NETBSD_BUF_SIZE;
+}
+
+static void audio_pause(struct ao *ao)
@@ -260,6 +272,7 @@
+ .init = init,
+ .uninit = uninit,
+ .reset = reset,
++ .drain = drain,
+ .pause = audio_pause,
+ .resume = audio_resume,
+ .get_space = get_space,
Home |
Main Index |
Thread Index |
Old Index