pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/multimedia/mpv Close audio device on pausing; allows m...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/da22e3d4bbd4
branches:  trunk
changeset: 639532:da22e3d4bbd4
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Mon Sep 15 17:31:18 2014 +0000

description:
Close audio device on pausing; allows multiple parallel mpv (or mplayer
or whatever) instances if only one of them is playing, like mplayer does.

Patch from Nat Sloss <nat%NetBSD.org@localhost>, thank you!

Sent upstream to
https://github.com/mpv-player/mpv/issues/1080

Bump PKGREVISION.

diffstat:

 multimedia/mpv/Makefile                          |   3 +-
 multimedia/mpv/distinfo                          |   4 +-
 multimedia/mpv/patches/patch-audio_out_ao__oss.c |  93 ++++++++++++++++++++++++
 multimedia/mpv/patches/patch-audio_out_push.c    |  15 +++
 4 files changed, 113 insertions(+), 2 deletions(-)

diffs (140 lines):

diff -r f964bf08d70c -r da22e3d4bbd4 multimedia/mpv/Makefile
--- a/multimedia/mpv/Makefile   Mon Sep 15 16:48:21 2014 +0000
+++ b/multimedia/mpv/Makefile   Mon Sep 15 17:31:18 2014 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.2 2014/09/08 12:12:22 wiz Exp $
+# $NetBSD: Makefile,v 1.3 2014/09/15 17:31:18 wiz Exp $
 
 DISTNAME=      mpv-0.5.1
+PKGREVISION=   1
 CATEGORIES=    multimedia
 MASTER_SITES=  -https://github.com/mpv-player/mpv/archive/v${PKGVERSION_NOREV}${EXTRACT_SUFX}
 
diff -r f964bf08d70c -r da22e3d4bbd4 multimedia/mpv/distinfo
--- a/multimedia/mpv/distinfo   Mon Sep 15 16:48:21 2014 +0000
+++ b/multimedia/mpv/distinfo   Mon Sep 15 17:31:18 2014 +0000
@@ -1,5 +1,7 @@
-$NetBSD: distinfo,v 1.1 2014/09/08 11:38:17 wiz Exp $
+$NetBSD: distinfo,v 1.2 2014/09/15 17:31:18 wiz Exp $
 
 SHA1 (mpv-0.5.1.tar.gz) = a72be602156497545eeb78ee6adfe98720650f27
 RMD160 (mpv-0.5.1.tar.gz) = f341e4647257cc35b902c3fe1787840f82a4052e
 Size (mpv-0.5.1.tar.gz) = 2578630 bytes
+SHA1 (patch-audio_out_ao__oss.c) = ee387e66cafe3122dadabbd8246a2dbce90ed18d
+SHA1 (patch-audio_out_push.c) = bde00289d2490fcfe839e6d7c80d65e4f72dd482
diff -r f964bf08d70c -r da22e3d4bbd4 multimedia/mpv/patches/patch-audio_out_ao__oss.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/multimedia/mpv/patches/patch-audio_out_ao__oss.c  Mon Sep 15 17:31:18 2014 +0000
@@ -0,0 +1,93 @@
+$NetBSD: patch-audio_out_ao__oss.c,v 1.1 2014/09/15 17:31:18 wiz Exp $
+
+https://github.com/mpv-player/mpv/issues/1080
+
+--- audio/out/ao_oss.c.orig    2014-08-26 08:27:40.000000000 +0000
++++ audio/out/ao_oss.c
+@@ -450,7 +450,7 @@ static void drain(struct ao *ao)
+ #endif
+ }
+ 
+-#ifndef SNDCTL_DSP_RESET
++#if !defined(SNDCTL_DSP_RESET) || defined(__NetBSD__) 
+ static void close_device(struct ao *ao)
+ {
+     struct priv *p = ao->priv;
+@@ -464,7 +464,7 @@ static void reset(struct ao *ao)
+ {
+     struct priv *p = ao->priv;
+     int oss_format;
+-#ifdef SNDCTL_DSP_RESET
++#if defined(SNDCTL_DSP_RESET) && !defined(__NetBSD__)
+     ioctl(p->audio_fd, SNDCTL_DSP_RESET, NULL);
+ #else
+     close_device(ao);
+@@ -502,6 +502,9 @@ static int get_space(struct ao *ao)
+     struct priv *p = ao->priv;
+     int playsize = p->outburst;
+ 
++    if (p->audio_fd < 0)
++      return p->outburst / ao->sstride;
++
+ #ifdef SNDCTL_DSP_GETOSPACE
+     if (ioctl(p->audio_fd, SNDCTL_DSP_GETOSPACE, &p->zz) != -1) {
+         // calculate exact buffer space:
+@@ -531,8 +534,12 @@ static int get_space(struct ao *ao)
+ static void audio_pause(struct ao *ao)
+ {
+     struct priv *p = ao->priv;
++
++    if (p->audio_fd < 0)
++      return;
++
+     p->prepause_space = get_space(ao) * ao->sstride;
+-#ifdef SNDCTL_DSP_RESET
++#if defined(SNDCTL_DSP_RESET) && !defined(__NetBSD__)
+     ioctl(p->audio_fd, SNDCTL_DSP_RESET, NULL);
+ #else
+     close_device(ao);
+@@ -548,11 +555,18 @@ static int play(struct ao *ao, void **da
+     int len = samples * ao->sstride;
+     if (len == 0)
+         return len;
++
+     if (len > p->outburst || !(flags & AOPLAY_FINAL_CHUNK)) {
+         len /= p->outburst;
+         len *= p->outburst;
+     }
+-    len = write(p->audio_fd, data[0], len);
++
++    if (p->audio_fd < 0) {
++      usleep((1000000 * samples) / (ao->bps + 1));
++      return samples;
++    } else
++        len = write(p->audio_fd, data[0], len);
++
+     return len / ao->sstride;
+ }
+ 
+@@ -560,9 +574,12 @@ static int play(struct ao *ao, void **da
+ static void audio_resume(struct ao *ao)
+ {
+     struct priv *p = ao->priv;
+-#ifndef SNDCTL_DSP_RESET
++#if !defined (SNDCTL_DSP_RESET) || defined(__NetBSD__)
+     reset(ao);
+ #endif
++    if (p->audio_fd < 0)
++      return;
++
+     int fillframes = get_space(ao) - p->prepause_space / ao->sstride;
+     if (fillframes > 0)
+         ao_play_silence(ao, fillframes);
+@@ -572,6 +589,10 @@ static void audio_resume(struct ao *ao)
+ static float get_delay(struct ao *ao)
+ {
+     struct priv *p = ao->priv;
++
++    if (p->audio_fd < 0)
++      return 1.0;
++
+     /* Calculate how many bytes/second is sent out */
+     if (p->audio_delay_method == 2) {
+ #ifdef SNDCTL_DSP_GETODELAY
diff -r f964bf08d70c -r da22e3d4bbd4 multimedia/mpv/patches/patch-audio_out_push.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/multimedia/mpv/patches/patch-audio_out_push.c     Mon Sep 15 17:31:18 2014 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-audio_out_push.c,v 1.1 2014/09/15 17:31:18 wiz Exp $
+
+https://github.com/mpv-player/mpv/issues/1080
+
+--- audio/out/push.c.orig      2014-08-26 08:27:40.000000000 +0000
++++ audio/out/push.c
+@@ -296,7 +296,7 @@ static void *playthread(void *arg)
+         // Request new data from decoder if buffer goes below "full".
+         // Allow a small margin of missing data for AOs that use timeouts.
+         double margin = ao->driver->wait ? 0 : ao->device_buffer / 8;
+-        if (!p->buffers_full && unlocked_get_space(ao) > margin) {
++        if (!p->paused && !p->buffers_full && unlocked_get_space(ao) > margin) {
+             if (!p->requested_data)
+                 mp_input_wakeup(ao->input_ctx);
+             p->requested_data = true;



Home | Main Index | Thread Index | Old Index