Hello community,

here is the log from the commit of package madplay for openSUSE:Factory checked 
in at 2019-07-22 12:20:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/madplay (Old)
 and      /work/SRC/openSUSE:Factory/.madplay.new.4126 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "madplay"

Mon Jul 22 12:20:56 2019 rev:2 rq:717332 version:0.15.2b

Changes:
--------
--- /work/SRC/openSUSE:Factory/madplay/madplay.changes  2017-08-28 
15:04:16.809443993 +0200
+++ /work/SRC/openSUSE:Factory/.madplay.new.4126/madplay.changes        
2019-07-22 12:20:57.627655393 +0200
@@ -1,0 +2,6 @@
+Sat Jul 20 14:59:22 UTC 2019 - Luigi Baldoni <[email protected]>
+
+- Added madplay-switch-to-new-alsa-api.patch to fix Factory build
+- Spec cleanup
+
+-------------------------------------------------------------------

New:
----
  madplay-switch-to-new-alsa-api.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ madplay.spec ++++++
--- /var/tmp/diff_new_pack.9jry6g/_old  2019-07-22 12:20:58.259655227 +0200
+++ /var/tmp/diff_new_pack.9jry6g/_new  2019-07-22 12:20:58.263655226 +0200
@@ -1,8 +1,7 @@
-# vim: set sw=4 ts=4 et nu:
 #
 # spec file for package madplay
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -13,24 +12,26 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           madplay
 Version:        0.15.2b
-Release:        0.pm.1
+Release:        0
 Summary:        MPEG audio decoder and player
-License:        GPL-2.0+
+License:        GPL-2.0-or-later
 Group:          Productivity/Multimedia/Sound/Players
-Url:            http://www.underbit.com/products/mad/
+URL:            http://www.underbit.com/products/mad/
 Source:         ftp://ftp.mars.org/pub/mpeg/madplay-%{version}.tar.gz
+# PATCH-FIX-OPENSUSE madplay-switch-to-new-alsa-api.patch
+Patch0:         madplay-switch-to-new-alsa-api.patch
 BuildRequires:  gcc-c++
 BuildRequires:  glibc-devel
-BuildRequires:  pkgconfig(mad)
 BuildRequires:  pkgconfig
 BuildRequires:  pkgconfig(alsa)
 BuildRequires:  pkgconfig(id3tag)
+BuildRequires:  pkgconfig(mad)
 BuildRequires:  pkgconfig(zlib)
 Recommends:     %{name}-lang
 
@@ -51,6 +52,7 @@
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 %configure \
@@ -64,16 +66,15 @@
 %find_lang %{name}
 
 %files 
-%defattr(-,root,root)
-%doc CHANGES CREDITS COPYING COPYRIGHT README TODO
+%license COPYING COPYRIGHT
+%doc CHANGES CREDITS README TODO
 %{_bindir}/madplay
-%{_mandir}/man1/madplay.1%{ext_man}
+%{_mandir}/man1/madplay.1%{?ext_man}
 
 %files lang -f %{name}.lang
 
 %files -n abxtest
-%defattr(-,root,root)
 %{_bindir}/abxtest
-%{_mandir}/man1/abxtest.1%{ext_man}
+%{_mandir}/man1/abxtest.1%{?ext_man}
 
 %changelog

++++++ madplay-switch-to-new-alsa-api.patch ++++++
Switch madplay to the new API. This is done thanks to a patch written
by Micha Nelissen <[email protected]> and available at
http://article.gmane.org/gmane.comp.audio.mad.devel/729.

--- madplay-0.15.2b/audio_alsa.c        2008-10-18 15:10:16.000000000 +0200
+++ madplay-0.15.2b/audio_alsa.c.new    2008-10-18 15:03:27.000000000 +0200
@@ -28,31 +28,30 @@

 #include <errno.h>

-#define ALSA_PCM_OLD_HW_PARAMS_API
-#define ALSA_PCM_OLD_SW_PARAMS_API
 #include <alsa/asoundlib.h>

 #include <mad.h>

 #include "audio.h"

-char *buf      = NULL;
-int paused     = 0;
+#define BUFFER_TIME_MAX     500000

-int rate       = -1;
-int channels   = -1;
-int bitdepth   = -1;
-int sample_size        = -1;
-
-int buffer_time                = 500000;
-int period_time                = 100000;
-char *defaultdev       = "plughw:0,0";
+unsigned char *buf  = NULL;
+int paused         = 0;
+
+unsigned int rate           = 0;
+unsigned int channels      = -1;
+unsigned int bitdepth      = -1;
+unsigned int sample_size    = -1;
+
+unsigned int buffer_time;
+unsigned int period_time;
+char *defaultdev           = "plughw:0,0";

 snd_pcm_hw_params_t *alsa_hwparams;
 snd_pcm_sw_params_t *alsa_swparams;

-snd_pcm_sframes_t buffer_size;
-snd_pcm_sframes_t period_size;
+snd_pcm_uframes_t buffer_size;

 snd_pcm_format_t  alsa_format = -1;
 snd_pcm_access_t  alsa_access = SND_PCM_ACCESS_MMAP_INTERLEAVED;
@@ -66,14 +65,20 @@
                 snd_pcm_hw_params_t *params,
                 snd_pcm_access_t access)
 {
-       int err, dir;
-       
+       int err;
+
        /* choose all parameters */
        err = snd_pcm_hw_params_any(handle,params);
        if (err < 0) {
                printf("Access type not available for playback: %s\n", 
snd_strerror(err));
                return err;
        }
+       /* set the access type */
+       err = snd_pcm_hw_params_set_access(handle, params, alsa_access);
+       if (err < 0) {
+               printf("Sample format not available for playback: %s\n", 
snd_strerror(err));
+               return err;
+       }
        /* set the sample format */
        err = snd_pcm_hw_params_set_format(handle, params, alsa_format);
        if (err < 0) {
@@ -87,29 +92,38 @@
                return err;
        }
        /* set the stream rate */
-       err = snd_pcm_hw_params_set_rate_near(handle, params, rate, 0);
+       err = snd_pcm_hw_params_set_rate(handle, params, rate, 0);
        if (err < 0) {
                printf("Rate %iHz not available for playback: %s\n", rate, 
snd_strerror(err));
                return err;
        }
-       if (err != rate) {
-               printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, 
err);
-               return -EINVAL;
-       }
+       err = snd_pcm_hw_params_get_buffer_time_max(params, &buffer_time, NULL);
+        if (err < 0) {
+                printf("Unable to retrieve buffer time: %s\n", 
snd_strerror(err));
+                return err;
+        }
+        if (buffer_time > BUFFER_TIME_MAX)
+                buffer_time = BUFFER_TIME_MAX;
        /* set buffer time */
-       err = snd_pcm_hw_params_set_buffer_time_near(handle, params, 
buffer_time, &dir);
+       err = snd_pcm_hw_params_set_buffer_time_near(handle, params, 
&buffer_time, 0);
        if (err < 0) {
                printf("Unable to set buffer time %i for playback: %s\n", 
buffer_time, snd_strerror(err));
                return err;
        }
-       buffer_size = snd_pcm_hw_params_get_buffer_size(params);
+        if (period_time * 4 > buffer_time)
+                period_time = buffer_time / 4;
        /* set period time */
-       err = snd_pcm_hw_params_set_period_time_near(handle, params, 
period_time, &dir);
+       err = snd_pcm_hw_params_set_period_time_near(handle, params, 
&period_time, NULL);
        if (err < 0) {
                printf("Unable to set period time %i for playback: %s\n", 
period_time, snd_strerror(err));
                return err;
        }
-       period_size = snd_pcm_hw_params_get_period_size(params, &dir);
+        /* retrieve buffer size */
+       err = snd_pcm_hw_params_get_buffer_size(params, &buffer_size);
+        if (err < 0) {
+                printf("Unable to retrieve buffer size: %s\n", 
snd_strerror(err));
+                return err;
+        }
        /* write the parameters to device */
        err = snd_pcm_hw_params(handle, params);
        if (err < 0) {
@@ -123,6 +137,7 @@
 int set_swparams(snd_pcm_t *handle,
                 snd_pcm_sw_params_t *params)
 {
+        unsigned int start_threshold;
        int err;

         /* get current swparams */
@@ -136,13 +151,7 @@
         if (err < 0) {
                 printf("Unable to set start threshold mode for playback: 
%s\n", snd_strerror(err));
                 return err;
-                                                                               
        }
-        /* allow transfer when at least period_size samples can be processed */
-        err = snd_pcm_sw_params_set_avail_min(handle, params, period_size);
-        if (err < 0) {
-                printf("Unable to set avail min for playback: %s\n", 
snd_strerror(err));
-                return err;
-                                                                               
                        }
+       }
         /* align all transfers to 1 samples */
         err = snd_pcm_sw_params_set_xfer_align(handle, params, 1);
         if (err < 0) {
@@ -190,7 +199,7 @@
        rate            = config->speed;

        if ( bitdepth == 0 )
-               config->precision = bitdepth = 32;
+               config->precision = bitdepth = 16;

        switch (bitdepth)
        {
@@ -241,7 +250,7 @@
                return -1;
        }

-       buf = malloc(buffer_size);
+       buf = malloc(buffer_size * sample_size);
        if (buf == NULL) {
                audio_error="unable to allocate output buffer table";
                return -1;
@@ -279,7 +288,7 @@
 int play(struct audio_play *play)
 {
        int err, len;
-       char *ptr;
+       unsigned char *ptr;

        ptr = buf;
        len = play->nsamples;


Reply via email to