Merge ~mkukri/ubuntu/+source/sidplay:merge into ubuntu/+source/sidplay:debian/sid

Proposed by Mate Kukri
Status: Merged
Merge reported by: Mate Kukri
Merged at revision: fb865838050b1690d41bd5834480c654b2d74695
Proposed branch: ~mkukri/ubuntu/+source/sidplay:merge
Merge into: ubuntu/+source/sidplay:debian/sid
Diff against target: 577 lines (+527/-2)
5 files modified
debian/changelog (+50/-0)
debian/control (+3/-2)
debian/patches/alsa_support.patch (+470/-0)
debian/patches/series (+1/-0)
debian/rules (+3/-0)
Reviewer Review Type Date Requested Status
Simon Quigley (community) Approve
Erich Eickmeyer (community) Approve
Review via email: mp+458075@code.launchpad.net

Description of the change

Merge with Debian unstable:
* Debian merge removes reliance on outdated debhelper
* Retained ALSA API update; converted ugly upstream source changes to quilt patch

PPA testbuild: https://launchpad.net/~mkukri/+archive/ubuntu/dev/+packages

To post a comment you must log in.
Revision history for this message
Erich Eickmeyer (eeickmeyer) wrote :

LGTM, and with the ppa build, looks good.

review: Approve
Revision history for this message
Simon Quigley (tsimonq2) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 22937fd..172bde8 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,12 @@
6+sidplay (2.0.9-7ubuntu1) noble; urgency=medium
7+
8+ * Merge with Debian unstable. Remaining changes:
9+ - Backport portions of patch from Cybjit resolving failure to play
10+ audio due to missing /dev/dsp. This patch adds ALSA support.
11+ (LP: #727573)
12+
13+ -- Mate Kukri <mate.kukri@canonical.com> Fri, 05 Jan 2024 11:17:52 +0000
14+
15 sidplay (2.0.9-7) unstable; urgency=medium
16
17 * Switch to short debhelper rules format (closes: #999210).
18@@ -6,6 +15,47 @@ sidplay (2.0.9-7) unstable; urgency=medium
19
20 -- Laszlo Boszormenyi (GCS) <gcs@debian.org> Sat, 15 Jan 2022 08:37:32 +0100
21
22+sidplay (2.0.9-6ubuntu6) groovy; urgency=medium
23+
24+ * Fix ftbfs with current alsa.
25+ * Bump debhelper version.
26+
27+ -- Matthias Klose <doko@ubuntu.com> Thu, 21 May 2020 16:23:06 +0200
28+
29+sidplay (2.0.9-6ubuntu5) focal; urgency=medium
30+
31+ * No-change rebuild for libgcc-s1 package name change.
32+
33+ -- Matthias Klose <doko@ubuntu.com> Mon, 23 Mar 2020 08:58:32 +0100
34+
35+sidplay (2.0.9-6ubuntu4) eoan; urgency=medium
36+
37+ * No-change upload with strops.h and sys/strops.h removed in glibc.
38+
39+ -- Matthias Klose <doko@ubuntu.com> Thu, 05 Sep 2019 11:08:56 +0000
40+
41+sidplay (2.0.9-6ubuntu3) wily; urgency=medium
42+
43+ * No-change rebuild against libsidplay2v5
44+
45+ -- Martin Pitt <martin.pitt@ubuntu.com> Wed, 12 Aug 2015 10:56:34 +0200
46+
47+sidplay (2.0.9-6ubuntu2) utopic; urgency=medium
48+
49+ * Use autotools-dev to update config.{sub,guess} for new arches.
50+ * Remove config.{sub,guess} from root.
51+
52+ -- Logan Rosen <logan@ubuntu.com> Mon, 06 Oct 2014 21:38:56 -0400
53+
54+sidplay (2.0.9-6ubuntu1) oneiric; urgency=low
55+
56+ * Backport portions of patch from Cybjit resolving failure to play
57+ audio due to missing /dev/dsp. This patch adds ALSA support.
58+ (LP: #727573)
59+ * Update configure.ac; run autoconf.
60+
61+ -- Daniel T Chen <crimsun@ubuntu.com> Sun, 14 Aug 2011 11:59:35 -0400
62+
63 sidplay (2.0.9-6) unstable; urgency=low
64
65 * Fix invalid conversion from 'const char*' to 'char*' compilation errors
66diff --git a/debian/control b/debian/control
67index 636da9e..b479ed5 100644
68--- a/debian/control
69+++ b/debian/control
70@@ -1,8 +1,9 @@
71 Source: sidplay
72 Section: sound
73 Priority: optional
74-Maintainer: Laszlo Boszormenyi (GCS) <gcs@debian.org>
75-Build-Depends: debhelper-compat (= 13), libsidplay2-dev (>= 2.1.1-4), libresid-builder-dev (>= 2.1.1), libsidutils-dev, libtool-bin, pkg-config
76+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
77+XSBC-Original-Maintainer: Laszlo Boszormenyi (GCS) <gcs@debian.org>
78+Build-Depends: debhelper-compat (= 13), libsidplay2-dev (>= 2.1.1-4), libresid-builder-dev (>= 2.1.1), libsidutils-dev, libtool-bin, pkg-config, libasound2-dev
79 Homepage: http://sidplay2.sourceforge.net/
80 Standards-Version: 4.6.0.1
81
82diff --git a/debian/patches/alsa_support.patch b/debian/patches/alsa_support.patch
83new file mode 100644
84index 0000000..73f2d58
85--- /dev/null
86+++ b/debian/patches/alsa_support.patch
87@@ -0,0 +1,470 @@
88+Description: Update outdated ALSA API usage
89+Author: Daniel T Chen <crimsun@ubuntu.com>
90+Last-Update: 2024-01-05
91+---
92+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
93+--- a/src/audio/alsa/audiodrv.cpp
94++++ b/src/audio/alsa/audiodrv.cpp
95+@@ -3,6 +3,9 @@
96+ // --------------------------------------------------------------------------
97+ /***************************************************************************
98+ * $Log: audiodrv.cpp,v $
99++ * Revision 1.8 2008/07/19 13:58:04 wnd
100++ * Almost complete rewrite to support new ALSA API.
101++ *
102+ * Revision 1.7 2002/03/04 19:07:48 s_a_white
103+ * Fix C++ use of nothrow.
104+ *
105+@@ -29,171 +32,277 @@
106+ ***************************************************************************/
107+
108+ #include "audiodrv.h"
109+-#ifdef HAVE_ALSA
110++#ifdef HAVE_ALSA
111+
112+ #include <stdio.h>
113+ #ifdef HAVE_EXCEPTIONS
114+-# include <new>
115++#include <new>
116+ #endif
117+
118++#include <alsa/asoundlib.h>
119++#include <string.h>
120++
121++#define ALSA_DEFAULT "default"
122++
123+ Audio_ALSA::Audio_ALSA()
124+ {
125+- // Reset everything.
126+- outOfOrder();
127++ // Reset everything.
128++ outOfOrder();
129++}
130++
131++Audio_ALSA::~Audio_ALSA()
132++{
133++ close ();
134+ }
135+
136+-Audio_ALSA::~Audio_ALSA ()
137++void
138++Audio_ALSA::outOfOrder()
139+ {
140+- close ();
141++ // Reset everything.
142++ _swapEndian = false;
143++ _bufShift = 0;
144++ _errorString = "None";
145++ _audioHandle = NULL;
146+ }
147+
148+-void Audio_ALSA::outOfOrder ()
149+-{
150+- // Reset everything.
151+- _errorString = "None";
152+- _audioHandle = NULL;
153+-}
154+-
155+-void *Audio_ALSA::open (AudioConfig &cfg, const char *)
156+-{
157+- AudioConfig tmpCfg;
158+- int mask, wantedFormat, format;
159+- int rtn;
160+- int card = -1, dev = 0;
161+-
162+- if (_audioHandle != NULL)
163+- {
164+- _errorString = "ERROR: Device already in use";
165+- return NULL;
166+- }
167+-
168+- if ((rtn = snd_pcm_open_preferred (&_audioHandle, &card, &dev, SND_PCM_OPEN_PLAYBACK)))
169+- {
170+- _errorString = "ERROR: Could not open audio device.";
171+- goto open_error;
172+- }
173+-
174+- // Transfer input parameters to this object.
175+- // May later be replaced with driver defaults.
176+- tmpCfg = cfg;
177+-
178+- snd_pcm_channel_params_t pp;
179+- snd_pcm_channel_setup_t setup;
180+-
181+- snd_pcm_channel_info_t pi;
182+-
183+- memset (&pi, 0, sizeof (pi));
184+- pi.channel = SND_PCM_CHANNEL_PLAYBACK;
185+- if ((rtn = snd_pcm_plugin_info (_audioHandle, &pi)))
186+- {
187+- _errorString = "ALSA: snd_pcm_plugin_info failed.";
188+- goto open_error;
189+- }
190+-
191+- memset(&pp, 0, sizeof (pp));
192++bool
193++Audio_ALSA::fmt(AudioConfig &cfg, snd_pcm_hw_params_t *hw)
194++{
195++ struct precinfo {
196++ snd_pcm_format_t format;
197++ int encoding;
198++ int precision;
199++ int swap;
200++ };
201++ struct precinfo info[] = {
202++#if defined(WORDS_BIGENDIAN)
203++ { SND_PCM_FORMAT_S16_BE, AUDIO_SIGNED_PCM, 16, false },
204++ { SND_PCM_FORMAT_U16_BE, AUDIO_UNSIGNED_PCM, 16, false },
205++ { SND_PCM_FORMAT_S16_LE, AUDIO_SIGNED_PCM, 16, true },
206++ { SND_PCM_FORMAT_U16_LE, AUDIO_UNSIGNED_PCM, 16, true },
207++#else
208++ { SND_PCM_FORMAT_S16_LE, AUDIO_SIGNED_PCM, 16, false },
209++ { SND_PCM_FORMAT_U16_LE, AUDIO_UNSIGNED_PCM, 16, false },
210++ { SND_PCM_FORMAT_S16_BE, AUDIO_SIGNED_PCM, 16, true },
211++ { SND_PCM_FORMAT_U16_BE, AUDIO_UNSIGNED_PCM, 16, true },
212++#endif
213++ { SND_PCM_FORMAT_S8, AUDIO_SIGNED_PCM, 8, false },
214++ { SND_PCM_FORMAT_U8, AUDIO_UNSIGNED_PCM, 8, false }
215++ };
216++
217++ switch (cfg.precision) {
218++ case 8:
219++ for (int i = 0; i < 2; i++) {
220++ struct precinfo t;
221++ memcpy(&t, &info[i], sizeof(t));
222++ memcpy(&info[i + 4], &info[i], sizeof(t));
223++ memcpy(&info[i], &t, sizeof(t));
224++ }
225++ break;
226++ case 16:
227++ break;
228++ default:
229++ fprintf(stderr, "Unsupported precision: %d bits\n",
230++ cfg.precision);
231++ return false;
232++ }
233++
234++ int err;
235++ for (int i = 0; i < 6; i++) {
236++ err = snd_pcm_hw_params_set_format(_audioHandle, hw,
237++ info[i].format);
238++ if (err < 0) {
239++ continue;
240++ }
241++
242++ cfg.precision = info[i].precision;
243++ cfg.encoding = info[i].encoding;
244++ _swapEndian = info[i].swap;
245++ _bufShift = info[i].precision == 8 ? 0 : 1;
246++ return true;
247++ }
248+
249+- pp.mode = SND_PCM_MODE_BLOCK;
250+- pp.channel = SND_PCM_CHANNEL_PLAYBACK;
251+- pp.start_mode = SND_PCM_START_FULL;
252+- pp.stop_mode = SND_PCM_STOP_STOP;
253+-
254+- pp.buf.block.frag_size = pi.max_fragment_size;
255+-
256+- pp.buf.block.frags_max = 1;
257+- pp.buf.block.frags_min = 1;
258+-
259+- pp.format.interleave = 1;
260+- pp.format.rate = tmpCfg.frequency;
261+- pp.format.voices = tmpCfg.channels;
262+-
263+- // Set sample precision and type of encoding.
264+- if ( tmpCfg.precision == 8 )
265+- {
266+- tmpCfg.encoding = AUDIO_UNSIGNED_PCM;
267+- pp.format.format = SND_PCM_SFMT_U8;
268+- }
269+- if ( tmpCfg.precision == 16 )
270+- {
271+- tmpCfg.encoding = AUDIO_SIGNED_PCM;
272+- pp.format.format = SND_PCM_SFMT_S16_LE;
273+- }
274+-
275+- if ((rtn = snd_pcm_plugin_params (_audioHandle, &pp)) < 0)
276+- {
277+- _errorString = "ALSA: snd_pcm_plugin_params failed.";
278+- goto open_error;
279+- }
280+-
281+- if ((rtn = snd_pcm_plugin_prepare (_audioHandle, SND_PCM_CHANNEL_PLAYBACK)) < 0)
282+- {
283+- _errorString = "ALSA: snd_pcm_plugin_prepare failed.";
284+- goto open_error;
285+- }
286+-
287+- memset (&setup, 0, sizeof (setup));
288+- setup.channel = SND_PCM_CHANNEL_PLAYBACK;
289+- if ((rtn = snd_pcm_plugin_setup (_audioHandle, &setup)) < 0)
290+- {
291+- _errorString = "ALSA: snd_pcm_plugin_setup failed.";
292+- goto open_error;
293+- }
294++ fprintf(stderr, "Cannot set sample format: %s\n", snd_strerror(err));
295++ return false;
296++}
297++
298++
299++
300++bool
301++Audio_ALSA::init(AudioConfig &cfg, snd_pcm_hw_params_t *hw)
302++{
303++ int err;
304++
305++ err = snd_pcm_hw_params_any(_audioHandle, hw);
306++ if (err < 0) {
307++ fprintf(stderr, "Cannot initialize hardware "
308++ "parameter structure: %s\n",
309++ snd_strerror(err));
310++ return false;
311++ }
312++
313++ err = snd_pcm_hw_params_set_access(_audioHandle, hw,
314++ SND_PCM_ACCESS_RW_INTERLEAVED);
315++ if (err < 0) {
316++ fprintf(stderr, "Cannot set access type: %s\n",
317++ snd_strerror(err));
318++ return false;
319++ }
320++
321++ /* try to find supported format/precision */
322++ if (! fmt(cfg, hw)) {
323++ return false;
324++ }
325++
326++ /* use closest frequency */
327++ unsigned int realFreq = (unsigned int) cfg.frequency;
328++ err = snd_pcm_hw_params_set_rate_near(_audioHandle, hw, &realFreq, 0);
329++ if (err < 0) {
330++ fprintf(stderr, "Cannot set sample rate: %s\n",
331++ snd_strerror(err));
332++ return false;
333++ }
334++ cfg.frequency = realFreq;
335++
336++ switch (cfg.channels) {
337++ case 2:
338++ _bufShift++;
339++ break;
340++ case 1:
341++ break;
342++ default:
343++ fprintf(stderr, "Unsupported channel count: %d\n",
344++ cfg.channels);
345++ return false;
346++ }
347++ err = snd_pcm_hw_params_set_channels(_audioHandle, hw,
348++ cfg.channels);
349++ if (err < 0) {
350++ fprintf(stderr, "Cannot set channel count: %s\n",
351++ snd_strerror(err));
352++ return false;
353++ }
354++
355++ err = snd_pcm_hw_params(_audioHandle, hw);
356++ if (err < 0) {
357++ fprintf(stdout, "Cannot set parameters: %s\n",
358++ snd_strerror(err));
359++ return false;
360++ }
361+
362+- tmpCfg.bufSize = setup.buf.block.frag_size;
363++ return true;
364++}
365++
366++
367++
368++void *
369++Audio_ALSA::open(AudioConfig &cfg, const char *name)
370++{
371++ AudioConfig tmpCfg = cfg;
372++ snd_pcm_hw_params_t *hw;
373++ int err;
374++
375++ if (_audioHandle != NULL) {
376++ _errorString = "ERROR: Device already in use";
377++ return NULL;
378++ }
379++
380++ err = snd_pcm_open(&_audioHandle, ALSA_DEFAULT,
381++ SND_PCM_STREAM_PLAYBACK, 0);
382++ if (err < 0) {
383++ _errorString = "ERROR: Could not open audio device.";
384++ fprintf(stderr, "Cannot open audio device: %s\n",
385++ snd_strerror(err));
386++ return NULL;
387++ }
388++
389++ err = snd_pcm_hw_params_malloc(&hw);
390++ if (err < 0) {
391++ _errorString = "ERROR: Cannot initialise ALSA";
392++ fprintf(stderr, "Cannot allocate hardware "
393++ "parameter structure: %s\n",
394++ snd_strerror(err));
395++ return NULL;
396++ }
397++
398++ bool init_ok = init(tmpCfg, hw);
399++ snd_pcm_hw_params_free(hw);
400++ if (! init_ok) {
401++ _errorString = "ERROR: Cannot initialise ALSA";
402++ return NULL;
403++ }
404++
405++ err = snd_pcm_prepare(_audioHandle);
406++ if (err < 0) {
407++ _errorString = "Cannot initialise ALSA";
408++ fprintf(stderr, "cannot prepare audio interface for use: %s\n",
409++ snd_strerror(err));
410++ return NULL;
411++ }
412++
413++ tmpCfg.bufSize = 4096;
414+ #ifdef HAVE_EXCEPTIONS
415+- _sampleBuffer = new(std::nothrow) int_least8_t[tmpCfg.bufSize];
416++ _sampleBuffer = new(std::nothrow) int_least8_t[tmpCfg.bufSize];
417+ #else
418+- _sampleBuffer = new int_least8_t[tmpCfg.bufSize];
419++ _sampleBuffer = new int_least8_t[tmpCfg.bufSize];
420+ #endif
421+
422+- if (!_sampleBuffer)
423+- {
424+- _errorString = "AUDIO: Unable to allocate memory for sample buffers.";
425+- goto open_error;
426+- }
427+-
428+- // Setup internal Config
429+- _settings = tmpCfg;
430+- // Update the users settings
431+- getConfig (cfg);
432+- return _sampleBuffer;
433+-
434+-open_error:
435+- if (_audioHandle != NULL)
436+- {
437+- close ();
438+- }
439+-
440+- perror ("ALSA");
441+-return NULL;
442++ if (!_sampleBuffer) {
443++ _errorString = "Unable to allocate memory for sample buffers";
444++ return NULL;
445++ }
446++
447++ // Setup internal Config
448++ _settings = tmpCfg;
449++ // Update the users settings
450++ getConfig (cfg);
451++ return _sampleBuffer;
452+ }
453+
454++
455++
456+ // Close an opened audio device, free any allocated buffers and
457+ // reset any variables that reflect the current state.
458+-void Audio_ALSA::close ()
459++void
460++Audio_ALSA::close()
461+ {
462+- if (_audioHandle != NULL )
463+- {
464+- snd_pcm_close(_audioHandle);
465+- delete [] _sampleBuffer;
466+- outOfOrder ();
467+- }
468++ if (_audioHandle != NULL) {
469++ snd_pcm_close(_audioHandle);
470++ delete [] _sampleBuffer;
471++ outOfOrder ();
472++ }
473+ }
474+
475+-void *Audio_ALSA::reset ()
476++
477++
478++void *
479++Audio_ALSA::reset ()
480+ {
481+- return (void *) _sampleBuffer;
482++ return (void *) _sampleBuffer;
483+ }
484+
485+-void *Audio_ALSA::write ()
486+-{
487+- if (_audioHandle == NULL)
488+- {
489+- _errorString = "ERROR: Device not open.";
490+- return NULL;
491+- }
492+
493+- snd_pcm_plugin_write (_audioHandle, _sampleBuffer, _settings.bufSize);
494+- return (void *) _sampleBuffer;
495++
496++void *
497++Audio_ALSA::write()
498++{
499++ if (_audioHandle == NULL)
500++ {
501++ _errorString = "ERROR: Device not open.";
502++ return NULL;
503++ }
504++
505++ if (_swapEndian) {
506++ for (int n = 0; n < _settings.bufSize; n += 2) {
507++ char t = ((char *) _sampleBuffer)[n];
508++ ((char *) _sampleBuffer)[n] =
509++ ((char *) _sampleBuffer)[n + 1];
510++ ((char *) _sampleBuffer)[n + 1] = t;
511++ }
512++ }
513++ snd_pcm_writei(_audioHandle, _sampleBuffer,
514++ _settings.bufSize >> _bufShift);
515++ return (void *) _sampleBuffer;
516+ }
517+
518+ #endif // HAVE_ALSA
519+--- a/src/audio/alsa/audiodrv.h
520++++ b/src/audio/alsa/audiodrv.h
521+@@ -3,6 +3,9 @@
522+ // --------------------------------------------------------------------------
523+ /***************************************************************************
524+ * $Log: audiodrv.h,v $
525++ * Revision 1.6 2008/07/19 13:58:04 wnd
526++ * Update to new ALSA API.
527++ *
528+ * Revision 1.5 2002/01/10 19:04:00 s_a_white
529+ * Interface changes for audio drivers.
530+ *
531+@@ -36,7 +39,7 @@
532+ #include <fcntl.h>
533+ #include <unistd.h>
534+ #include <sys/ioctl.h>
535+-#include <sys/asoundlib.h>
536++#include <alsa/asoundlib.h>
537+ #include "../AudioBase.h"
538+
539+
540+@@ -44,6 +47,8 @@
541+ {
542+ private: // ------------------------------------------------------- private
543+ snd_pcm_t * _audioHandle;
544++ bool _swapEndian;
545++ int _bufShift;
546+
547+ void outOfOrder ();
548+
549+@@ -51,6 +56,8 @@
550+ Audio_ALSA();
551+ ~Audio_ALSA();
552+
553++ bool fmt (AudioConfig &cfg, snd_pcm_hw_params_t *hw);
554++ bool init (AudioConfig &cfg, snd_pcm_hw_params_t *hw);
555+ void *open (AudioConfig &cfg, const char *name);
556+ void close ();
557+ // Rev 1.2 (saw) - Changed, see AudioBase.h
558diff --git a/debian/patches/series b/debian/patches/series
559index 6f838cd..84f2f5f 100644
560--- a/debian/patches/series
561+++ b/debian/patches/series
562@@ -3,3 +3,4 @@ code_update.patch
563 manpage_spelling.patch
564 modernize.patch
565 #use_alsa.patch
566+alsa_support.patch
567diff --git a/debian/rules b/debian/rules
568index 218df65..a71d69b 100755
569--- a/debian/rules
570+++ b/debian/rules
571@@ -6,3 +6,6 @@
572
573 %:
574 dh $@
575+
576+override_dh_auto_configure:
577+ dh_auto_configure -- --with-alsa

Subscribers

People subscribed via source and target branches

to all changes: