tags 385844 + pending thanks Hi,
Gergely Nagy wrote: > at this point in the freeze, it's probably better to go with the esd patch > instead of a whole new upstream version. I agree. > I'll try to get around to do an upload in the next couple of days. I've prepared an NMU for libmikmod (versioned as 3.1.12-4.1) and uploaded it to DELAYED/7. Please feel free to tell me if I should cancel it or delay it longer. I attach an nmudiff, but you'll probably find this git repository more useful. I branched yours and tried to follow your packaging style: git+ssh://git.debian.org/git/users/smcv/qa/libmikmod.git http://anonscm.debian.org/gitweb/?p=users/smcv/qa/libmikmod.git;a=commitdiff;h=bf3a4898d9248ef4366f0c2f6695e8c31432f2fc http://anonscm.debian.org/gitweb/?p=users/smcv/qa/libmikmod.git;a=shortlog;h=refs/heads/patch-queue/master Tested with mikmod and bb, using wheezy's pulseaudio version. Changes since Pantelis' patch: * adapted to (what I infer from your git repository to be) your workflow * git-format-patch-style headers for the new patches * Recommends: pulseaudio-esound-compat | oss-compat because I noticed the failure mode is pretty bad if you don't have one of those: libmikmod falls through to one of its "disk writer" drivers, which is pretty useless for audio output! (I'll open a bug) One problem with the packaging style used in your git repository is that the master branch (and its tags) don't track which patches were applied: there's no way to see which patches were in a particular Debian release, except rummaging in snapshot.debian.org. Obviously, it's your choice as maintainer what packaging style you want to use, but I would suggest either applying the patches to the Debian branch and using merges to incorporate new upstream releases (like the Debian X maintainers do), or using the documented gbp-pq workflow and living with the fact that the patch series gets committed to the repository (like pkg-telepathy and pkg-utopia do). Regards, S
diffstat for libmikmod-3.1.12 libmikmod-3.1.12 changelog | 11 control | 4 patches/0001-Drop-LIBOBJS-from-configure.in.patch | 3 patches/0002-dlopen-libesd.so.0-rather-than-libesd.so.patch | 3 patches/0003-Use-_LP64-to-detect-64bit-arches.patch | 1 patches/0004-CVE-2009-0179.patch | 1 patches/0005-CVE-2007-6720.patch | 3 patches/0006-CVE-2009-3995f.patch | 3 patches/0007-CVE-2010-2546.patch | 3 patches/0008-Fix-libmikmod-Makefile.in.patch | 3 patches/0009-libmikmod-Makefile.in-Respect-CPPFLAGS-and-LDFLAGS.patch | 3 patches/0010-libmikmod-config-manual-page-fix.patch | 3 patches/0011-Disable-ALSA-by-default.patch | 31 + patches/0011-Disable-ESD-and-ALSA-by-default.patch | 38 - patches/0012-fix-ESD.patch | 259 ++++++++++ patches/0013-fix-building-of-ESD.patch | 133 +++++ patches/series | 4 rules | 2 18 files changed, 448 insertions(+), 60 deletions(-) diff -Nru libmikmod-3.1.12/debian/changelog libmikmod-3.1.12/debian/changelog --- libmikmod-3.1.12/debian/changelog 2012-04-05 17:31:57.000000000 +0100 +++ libmikmod-3.1.12/debian/changelog 2012-10-19 09:41:58.000000000 +0100 @@ -1,3 +1,14 @@ +libmikmod (3.1.12-4.1) unstable; urgency=low + + * Non-maintainer upload. + * Apply patches from Hans de Goede and Pantelis Koukousoulas to enable + the ESD driver, so we can interoperate with PulseAudio (Closes: #385844) + * Recommend pulseaudio-esound-compat | oss-compat because if we don't have + one of those, the fallback path is to write output to ./music.raw, which + is unlikely to be what you want! + + -- Simon McVittie <s...@debian.org> Fri, 19 Oct 2012 09:12:08 +0100 + libmikmod (3.1.12-4) unstable; urgency=low * Drop the dependency on oss-compat. Programs that use libmikmod should diff -Nru libmikmod-3.1.12/debian/control libmikmod-3.1.12/debian/control --- libmikmod-3.1.12/debian/control 2012-04-05 17:28:36.000000000 +0100 +++ libmikmod-3.1.12/debian/control 2012-10-19 09:15:49.000000000 +0100 @@ -2,7 +2,7 @@ Section: libs Priority: optional Maintainer: Gergely Nagy <alger...@madhouse-project.org> -Build-Depends: debhelper (>= 9~), dh-autoreconf, texinfo +Build-Depends: debhelper (>= 9~), dh-autoreconf, texinfo, libesd0-dev Standards-Version: 3.9.3 Homepage: http://mikmod.raphnet.net/ Vcs-Git: git://git.madhouse-project.org/debian/libmikmod.git @@ -32,7 +32,7 @@ Multi-Arch: same Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, ${misc:Depends} -Suggests: oss-compat +Suggests: pulseaudio-esound-compat | oss-compat Description: Portable sound library This library is capable of playing samples as well as module files and was originally written by Jean-Paul Mikkers (MikMak) for DOS. It has diff -Nru libmikmod-3.1.12/debian/patches/0001-Drop-LIBOBJS-from-configure.in.patch libmikmod-3.1.12/debian/patches/0001-Drop-LIBOBJS-from-configure.in.patch --- libmikmod-3.1.12/debian/patches/0001-Drop-LIBOBJS-from-configure.in.patch 2012-02-09 09:16:09.000000000 +0000 +++ libmikmod-3.1.12/debian/patches/0001-Drop-LIBOBJS-from-configure.in.patch 2012-10-19 09:11:45.000000000 +0100 @@ -8,7 +8,7 @@ Closes: #263527 --- configure.in | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) + 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index f38461c..3f8b6b6 100644 @@ -23,4 +23,3 @@ AC_HEADER_EGREP(srandom,math.h,AC_DEFINE(SRANDOM_IN_MATH_H)) --- diff -Nru libmikmod-3.1.12/debian/patches/0002-dlopen-libesd.so.0-rather-than-libesd.so.patch libmikmod-3.1.12/debian/patches/0002-dlopen-libesd.so.0-rather-than-libesd.so.patch --- libmikmod-3.1.12/debian/patches/0002-dlopen-libesd.so.0-rather-than-libesd.so.patch 2012-02-09 09:16:09.000000000 +0000 +++ libmikmod-3.1.12/debian/patches/0002-dlopen-libesd.so.0-rather-than-libesd.so.patch 2012-10-19 09:11:45.000000000 +0100 @@ -6,7 +6,7 @@ depend on libesd0-dev. Probably this should be integrated into autoconf? --- drivers/drv_esd.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) + 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/drv_esd.c b/drivers/drv_esd.c index 4fa13fe..5fee86c 100644 @@ -21,4 +21,3 @@ if (!libesd) return 1; /* resolve function references */ --- diff -Nru libmikmod-3.1.12/debian/patches/0003-Use-_LP64-to-detect-64bit-arches.patch libmikmod-3.1.12/debian/patches/0003-Use-_LP64-to-detect-64bit-arches.patch --- libmikmod-3.1.12/debian/patches/0003-Use-_LP64-to-detect-64bit-arches.patch 2012-02-09 09:16:09.000000000 +0000 +++ libmikmod-3.1.12/debian/patches/0003-Use-_LP64-to-detect-64bit-arches.patch 2012-10-19 09:11:45.000000000 +0100 @@ -64,4 +64,3 @@ /* 64 bit architectures */ typedef signed char SBYTE; /* 1 byte, signed */ --- diff -Nru libmikmod-3.1.12/debian/patches/0004-CVE-2009-0179.patch libmikmod-3.1.12/debian/patches/0004-CVE-2009-0179.patch --- libmikmod-3.1.12/debian/patches/0004-CVE-2009-0179.patch 2012-02-09 09:16:09.000000000 +0000 +++ libmikmod-3.1.12/debian/patches/0004-CVE-2009-0179.patch 2012-10-19 09:11:45.000000000 +0100 @@ -44,4 +44,3 @@ } else ok = 0; --- diff -Nru libmikmod-3.1.12/debian/patches/0005-CVE-2007-6720.patch libmikmod-3.1.12/debian/patches/0005-CVE-2007-6720.patch --- libmikmod-3.1.12/debian/patches/0005-CVE-2007-6720.patch 2012-02-09 09:16:09.000000000 +0000 +++ libmikmod-3.1.12/debian/patches/0005-CVE-2007-6720.patch 2012-10-19 09:11:45.000000000 +0100 @@ -6,7 +6,7 @@ files with varying number of channels. --- playercode/mplayer.c | 27 +++++++++++++++++---------- - 1 files changed, 17 insertions(+), 10 deletions(-) + 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/playercode/mplayer.c b/playercode/mplayer.c index ee3a65b..13a8ab4 100644 @@ -119,4 +119,3 @@ Voice_Stop_internal(t); pf->voice[t].main.i=NULL; pf->voice[t].main.s=NULL; --- diff -Nru libmikmod-3.1.12/debian/patches/0006-CVE-2009-3995f.patch libmikmod-3.1.12/debian/patches/0006-CVE-2009-3995f.patch --- libmikmod-3.1.12/debian/patches/0006-CVE-2009-3995f.patch 2012-02-09 09:16:09.000000000 +0000 +++ libmikmod-3.1.12/debian/patches/0006-CVE-2009-3995f.patch 2012-10-19 09:11:45.000000000 +0100 @@ -6,7 +6,7 @@ --- loaders/load_it.c | 4 ++++ loaders/load_ult.c | 3 +++ - 2 files changed, 7 insertions(+), 0 deletions(-) + 2 files changed, 7 insertions(+) diff --git a/loaders/load_it.c b/loaders/load_it.c index de40bb6..c6094fb 100644 @@ -37,4 +37,3 @@ /* read pan position table for v1.5 and higher */ if(mh.id[14]>='3') { --- diff -Nru libmikmod-3.1.12/debian/patches/0007-CVE-2010-2546.patch libmikmod-3.1.12/debian/patches/0007-CVE-2010-2546.patch --- libmikmod-3.1.12/debian/patches/0007-CVE-2010-2546.patch 2012-02-09 09:16:09.000000000 +0000 +++ libmikmod-3.1.12/debian/patches/0007-CVE-2010-2546.patch 2012-10-19 09:11:45.000000000 +0100 @@ -4,7 +4,7 @@ --- loaders/load_it.c | 8 ++++---- - 1 files changed, 4 insertions(+), 4 deletions(-) + 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/loaders/load_it.c b/loaders/load_it.c index c6094fb..ca82613 100644 @@ -39,4 +39,3 @@ for(u=0;u<ih.volpts;u++) d->volenv[u].val=(ih.volnode[u]<<2); --- diff -Nru libmikmod-3.1.12/debian/patches/0008-Fix-libmikmod-Makefile.in.patch libmikmod-3.1.12/debian/patches/0008-Fix-libmikmod-Makefile.in.patch --- libmikmod-3.1.12/debian/patches/0008-Fix-libmikmod-Makefile.in.patch 2012-02-09 09:16:09.000000000 +0000 +++ libmikmod-3.1.12/debian/patches/0008-Fix-libmikmod-Makefile.in.patch 2012-10-19 09:11:45.000000000 +0100 @@ -6,7 +6,7 @@ use install -d instead of the mkinstalldirs script. --- libmikmod/Makefile.in | 6 ++++-- - 1 files changed, 4 insertions(+), 2 deletions(-) + 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libmikmod/Makefile.in b/libmikmod/Makefile.in index 634acf4..bb12574 100644 @@ -31,4 +31,3 @@ LIB = libmikmod.la OBJ = $(LIBOBJS) $(DLOBJS) \ --- diff -Nru libmikmod-3.1.12/debian/patches/0009-libmikmod-Makefile.in-Respect-CPPFLAGS-and-LDFLAGS.patch libmikmod-3.1.12/debian/patches/0009-libmikmod-Makefile.in-Respect-CPPFLAGS-and-LDFLAGS.patch --- libmikmod-3.1.12/debian/patches/0009-libmikmod-Makefile.in-Respect-CPPFLAGS-and-LDFLAGS.patch 2012-02-09 09:16:09.000000000 +0000 +++ libmikmod-3.1.12/debian/patches/0009-libmikmod-Makefile.in-Respect-CPPFLAGS-and-LDFLAGS.patch 2012-10-19 09:11:45.000000000 +0100 @@ -4,7 +4,7 @@ --- libmikmod/Makefile.in | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) + 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmikmod/Makefile.in b/libmikmod/Makefile.in index bb12574..ee6e1b6 100644 @@ -28,4 +28,3 @@ dl_hpux.lo: $(top_srcdir)/dlapi/dl_hpux.c \ $(top_srcdir)/dlapi/dlfcn.h --- diff -Nru libmikmod-3.1.12/debian/patches/0010-libmikmod-config-manual-page-fix.patch libmikmod-3.1.12/debian/patches/0010-libmikmod-config-manual-page-fix.patch --- libmikmod-3.1.12/debian/patches/0010-libmikmod-config-manual-page-fix.patch 2012-02-09 09:16:09.000000000 +0000 +++ libmikmod-3.1.12/debian/patches/0010-libmikmod-config-manual-page-fix.patch 2012-10-19 09:11:45.000000000 +0100 @@ -6,7 +6,7 @@ manual page. --- docs/libmikmod-config.1.in | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) + 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/libmikmod-config.1.in b/docs/libmikmod-config.1.in index e0ef761..854e225 100644 @@ -21,4 +21,3 @@ \fIlibmikmod-config\fP accepts the following options: .TP 8 .B \-\-version --- diff -Nru libmikmod-3.1.12/debian/patches/0011-Disable-ALSA-by-default.patch libmikmod-3.1.12/debian/patches/0011-Disable-ALSA-by-default.patch --- libmikmod-3.1.12/debian/patches/0011-Disable-ALSA-by-default.patch 1970-01-01 01:00:00.000000000 +0100 +++ libmikmod-3.1.12/debian/patches/0011-Disable-ALSA-by-default.patch 2012-10-19 09:11:45.000000000 +0100 @@ -0,0 +1,31 @@ +From: Pantelis Koukousoulas <pkt...@gmail.com> +Date: Sun, 9 Sep 2012 11:54:09 +0300 +Subject: Disable ALSA by default + +Based on a patch from Gergely Nagy who writes: + +> The configure script is broken in many, many ways, so it's best to +> just disable ESD and ALSA in the beginning.. + +but reduced to just disabling ALSA, since we want to use the ESD protocol +to talk to PulseAudio's ESD emulation. + +[commit message added -smcv] +Reviewed-by: Simon McVittie <s...@debian.org> +--- + configure.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.in b/configure.in +index 3f8b6b6..2a6a86c 100644 +--- a/configure.in ++++ b/configure.in +@@ -22,7 +22,7 @@ AM_MAINTAINER_MODE + + libmikmod_driver_af=yes + libmikmod_driver_aix=no +-libmikmod_driver_alsa=yes ++libmikmod_driver_alsa=no + libmikmod_driver_esd=yes + libmikmod_driver_hp=no + libmikmod_driver_oss=yes diff -Nru libmikmod-3.1.12/debian/patches/0011-Disable-ESD-and-ALSA-by-default.patch libmikmod-3.1.12/debian/patches/0011-Disable-ESD-and-ALSA-by-default.patch --- libmikmod-3.1.12/debian/patches/0011-Disable-ESD-and-ALSA-by-default.patch 2012-02-09 09:16:09.000000000 +0000 +++ libmikmod-3.1.12/debian/patches/0011-Disable-ESD-and-ALSA-by-default.patch 1970-01-01 01:00:00.000000000 +0100 @@ -1,38 +0,0 @@ -From: Gergely Nagy <alger...@madhouse-project.org> -Date: Sat, 29 Oct 2011 17:19:05 +0200 -Subject: Disable ESD and ALSA by default. - -The configure script is broken in many, many ways, so it's best to -just disable ESD and ALSA in the beginning.. - -Also disable AM_PATH_ESD, because we're not going to build with it -anyway. ---- - configure.in | 6 +++--- - 1 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/configure.in b/configure.in -index 3f8b6b6..0d70250 100644 ---- a/configure.in -+++ b/configure.in -@@ -22,8 +22,8 @@ AM_MAINTAINER_MODE - - libmikmod_driver_af=yes - libmikmod_driver_aix=no --libmikmod_driver_alsa=yes --libmikmod_driver_esd=yes -+libmikmod_driver_alsa=no -+libmikmod_driver_esd=no - libmikmod_driver_hp=no - libmikmod_driver_oss=yes - libmikmod_driver_sam9407=yes -@@ -271,7 +271,7 @@ fi - if test $libmikmod_driver_esd = yes - then - libmikmod_driver_esd=no -- AM_PATH_ESD(0.2.6,libmikmod_driver_esd=yes) -+ dnl AM_PATH_ESD(0.2.6,libmikmod_driver_esd=yes) - # We also need to know if esd is compiled with alsa support - if test $libmikmod_driver_esd = yes - then --- diff -Nru libmikmod-3.1.12/debian/patches/0012-fix-ESD.patch libmikmod-3.1.12/debian/patches/0012-fix-ESD.patch --- libmikmod-3.1.12/debian/patches/0012-fix-ESD.patch 1970-01-01 01:00:00.000000000 +0100 +++ libmikmod-3.1.12/debian/patches/0012-fix-ESD.patch 2012-10-19 09:11:45.000000000 +0100 @@ -0,0 +1,259 @@ +From: Pantelis Koukousoulas <pkt...@gmail.com> +Date: Sun, 9 Sep 2012 11:54:09 +0300 +Subject: fix ESD + +This patch comes from Fedora and was written by Hans de Goede. +I 've only slightly adapted it for debian. +--- + drivers/drv_esd.c | 164 +++++++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 133 insertions(+), 31 deletions(-) + +diff --git a/drivers/drv_esd.c b/drivers/drv_esd.c +index 5fee86c..601a2e9 100644 +--- a/drivers/drv_esd.c ++++ b/drivers/drv_esd.c +@@ -81,7 +81,6 @@ static void* libesd=NULL; + + static int sndfd=-1; + static esd_format_t format; +-static SBYTE *audiobuffer=NULL; + static CHAR *espeaker=NULL; + + #ifdef MIKMOD_DYNAMIC +@@ -124,23 +123,89 @@ static void ESD_Unlink(void) + } + #endif + ++/* A simple chunk fifo buffer, as we cannot query to ask how much free space ++ there is with esd, we keep a fifo filled and try to write the entire fifo ++ non blocking, stopping when we get -EAGAIN */ ++ ++#define AUDIO_BUF_SIZE (ESD_BUF_SIZE * 4) ++ ++static SBYTE audiobuffer[AUDIO_BUF_SIZE]; ++static int audiobuffer_start, audiobuffer_end, audiobuffer_empty; ++ ++static void audiobuffer_init(void) ++{ ++ audiobuffer_empty = 1; ++ audiobuffer_start = audiobuffer_end = 0; ++} ++ ++/* Get a free chunk of the fifo, the caller is expected to use all of it, so ++ all of it gets marked filled */ ++static SBYTE *audiobuffer_get_free_chunk(int *size) ++{ ++ int end = audiobuffer_end; ++ ++ if (audiobuffer_empty) ++ { ++ audiobuffer_empty = 0; ++ *size = AUDIO_BUF_SIZE; ++ } ++ else if (audiobuffer_end > audiobuffer_start) ++ { ++ *size = AUDIO_BUF_SIZE - audiobuffer_end; ++ audiobuffer_end = 0; ++ } ++ else ++ { ++ *size = audiobuffer_start - audiobuffer_end; ++ audiobuffer_end = audiobuffer_start; ++ } ++ ++ return audiobuffer + end; ++} ++ ++/* Get a filled chunk from the fifo, the caller must call audiobuffer_mark_free ++ to tell the fifo how much of the chunk it has consumed */ ++static SBYTE *audiobuffer_get_filled_chunk(int *size) ++{ ++ if (audiobuffer_empty) ++ { ++ *size = 0; ++ } ++ else if (audiobuffer_end > audiobuffer_start) ++ { ++ *size = audiobuffer_end - audiobuffer_start; ++ } ++ else ++ { ++ *size = AUDIO_BUF_SIZE - audiobuffer_start; ++ } ++ ++ return audiobuffer + audiobuffer_start; ++} ++ ++/* Tell the fifo to mark size bytes as free starting from the current head of ++ the fifo */ ++static void audiobuffer_mark_free(int size) ++{ ++ audiobuffer_start = (audiobuffer_start + size) % AUDIO_BUF_SIZE; ++ if (audiobuffer_start == audiobuffer_end) ++ { ++ audiobuffer_empty = 1; ++ audiobuffer_start = audiobuffer_end = 0; ++ } ++} ++ ++ + /* I hope to have this function integrated into libesd someday...*/ + static ssize_t esd_writebuf(int fd,const void *buffer,size_t count) + { +- ssize_t start=0; +- +- while (start<count) { +- ssize_t res; +- +- res=write(fd,(char*)buffer+start,count-start); +- if (res<0) { +- /* connection lost */ +- if (errno==EPIPE) +- return -1-start; +- } else +- start+=res; +- } +- return start; ++ ssize_t res; ++ ++ res = write(fd, (char*)buffer, count); ++ if (res < 0 && errno == EAGAIN) ++ return 0; ++ ++ return res; + } + + static void ESD_CommandLine(CHAR *cmdline) +@@ -193,13 +258,14 @@ static BOOL ESD_Init_internal(void) + _mm_errno=MMERR_OPENING_AUDIO; + return 1; + } ++ fcntl(sndfd, F_SETFL, fcntl(sndfd, F_GETFL) | O_NONBLOCK); + } else { + _mm_errno=MMERR_OUT_OF_MEMORY; + return 1; + } + +- if (!(audiobuffer=(SBYTE*)_mm_malloc(ESD_BUF_SIZE*sizeof(char)))) +- return 1; ++ /* Initialize the audiobuffer */ ++ audiobuffer_init(); + + return VC_Init(); + } +@@ -218,7 +284,6 @@ static BOOL ESD_Init(void) + static void ESD_Exit_internal(void) + { + VC_Exit(); +- _mm_free(audiobuffer); + if (sndfd>=0) { + esd_closestream(sndfd); + sndfd=-1; +@@ -234,18 +299,49 @@ static void ESD_Exit(void) + #endif + } + +-static void ESD_Update_internal(int count) ++typedef ULONG (*VC_WriteBytesFunc)(SBYTE*, ULONG); ++ ++static void ESD_Update_internal(VC_WriteBytesFunc WriteBytes) + { + static time_t losttime; + + if (sndfd>=0) { +- if (esd_writebuf(sndfd,audiobuffer,count)<0) { +- /* if we lost our connection with esd, clean up and work as the +- nosound driver until we can reconnect */ +- esd_closestream(sndfd); +- sndfd=-1; +- signal(SIGPIPE,SIG_DFL); +- losttime=time(NULL); ++ SBYTE *chunk; ++ int size; ++ ssize_t written; ++ ++ /* Fill fifo */ ++ chunk = audiobuffer_get_free_chunk(&size); ++ while (size) ++ { ++ WriteBytes(chunk, size); ++ chunk = audiobuffer_get_free_chunk(&size); ++ } ++ ++ /* And write untill fifo empty, or we would block */ ++ chunk = audiobuffer_get_filled_chunk(&size); ++ while (size) ++ { ++ written = esd_writebuf(sndfd, chunk, size); ++ if (written < 0) ++ { ++ /* if we lost our connection with esd, clean up ++ and work as the nosound driver until we can ++ reconnect */ ++ esd_closestream(sndfd); ++ sndfd = -1; ++ signal(SIGPIPE, SIG_DFL); ++ losttime = time(NULL); ++ break; ++ } ++ ++ /* Stop if the buffer is full */ ++ if (written == 0) ++ break; ++ ++ audiobuffer_mark_free(written); ++ ++ chunk = audiobuffer_get_filled_chunk(&size); + } + } else { + /* an alarm would be better, but then the library user could not use +@@ -255,8 +351,11 @@ static void ESD_Update_internal(int count) + /* Attempt to reconnect every 5 seconds */ + if (!(SETENV)) + if ((sndfd=esd_playstream(format,md_mixfreq,espeaker,"libmikmod"))>=0) { +- VC_SilenceBytes(audiobuffer,ESD_BUF_SIZE); +- esd_writebuf(sndfd,audiobuffer,ESD_BUF_SIZE); ++ /* reconnected, clear fifo (contains old sound) and recurse ++ to play sound */ ++ audiobuffer_init(); ++ fcntl(sndfd, F_SETFL, fcntl(sndfd, F_GETFL) | O_NONBLOCK); ++ ESD_Update_internal(WriteBytes); + } + } + } +@@ -264,22 +363,24 @@ static void ESD_Update_internal(int count) + + static void ESD_Update(void) + { +- ESD_Update_internal(VC_WriteBytes(audiobuffer,ESD_BUF_SIZE)); ++ ESD_Update_internal(VC_WriteBytes); + } + + static void ESD_Pause(void) + { +- ESD_Update_internal(VC_SilenceBytes(audiobuffer,ESD_BUF_SIZE)); ++ ESD_Update_internal(VC_SilenceBytes); + } + + static BOOL ESD_PlayStart(void) + { + if (sndfd<0) +- if (!(SETENV)) ++ if (!(SETENV)) { + if ((sndfd=esd_playstream(format,md_mixfreq,espeaker,"libmikmod"))<0) { + _mm_errno=MMERR_OPENING_AUDIO; + return 1; + } ++ fcntl(sndfd, F_SETFL, fcntl(sndfd, F_GETFL) | O_NONBLOCK); ++ } + /* since the default behaviour of SIGPIPE on most Unices is to kill the + program, we'll prefer handle EPIPE ourselves should the esd die - recent + esdlib use a do-nothing handler, which prevents us from receiving EPIPE, +@@ -289,6 +390,7 @@ static BOOL ESD_PlayStart(void) + /* silence buffers */ + VC_SilenceBytes(audiobuffer,ESD_BUF_SIZE); + esd_writebuf(sndfd,audiobuffer,ESD_BUF_SIZE); ++ audiobuffer_init(); + + return VC_PlayStart(); + } diff -Nru libmikmod-3.1.12/debian/patches/0013-fix-building-of-ESD.patch libmikmod-3.1.12/debian/patches/0013-fix-building-of-ESD.patch --- libmikmod-3.1.12/debian/patches/0013-fix-building-of-ESD.patch 1970-01-01 01:00:00.000000000 +0100 +++ libmikmod-3.1.12/debian/patches/0013-fix-building-of-ESD.patch 2012-10-19 09:11:45.000000000 +0100 @@ -0,0 +1,133 @@ +From: Pantelis Koukousoulas <pkt...@gmail.com> +Date: Sun, 9 Sep 2012 11:54:09 +0300 +Subject: fix building of ESD + +--- + configure.in | 86 ++++------------------------------------------------------ + 1 file changed, 6 insertions(+), 80 deletions(-) + +diff --git a/configure.in b/configure.in +index 2a6a86c..26c74e7 100644 +--- a/configure.in ++++ b/configure.in +@@ -62,15 +62,6 @@ else + libmikmod_driver_alsa=no + fi]) + +-AC_ARG_ENABLE(esd, +-[ --enable-esd include Enlightened sound daemon driver [guessed]], +-[if test "$enableval" = "yes" +-then +- libmikmod_driver_esd=yes +-else +- libmikmod_driver_esd=no +-fi]) +- + AC_ARG_ENABLE(oss, + [ --enable-oss include OSS driver [guessed]], + [if test "$enableval" = "yes" +@@ -266,27 +257,6 @@ else + libmikmod_driver_alsa=no + fi + +-# esd +-# --- +-if test $libmikmod_driver_esd = yes +-then +- libmikmod_driver_esd=no +- AM_PATH_ESD(0.2.6,libmikmod_driver_esd=yes) +-# We also need to know if esd is compiled with alsa support +- if test $libmikmod_driver_esd = yes +- then +- AC_CACHE_CHECK([if esd requires alsa],libmikmod_cv_esd_needs_alsa, +- if (esd-config --libs 2>&1 |grep asound >/dev/null) 2>/dev/null +- then +- libmikmod_cv_esd_needs_alsa=yes +- else +- libmikmod_cv_esd_needs_alsa=no +- fi) +- else +- libmikmod_cv_esd_needs_alsa=no +- fi +-fi +- + # sgi audio - IRIX only + # --------------------- + case `uname` in +@@ -456,23 +426,6 @@ then + fi + fi + +-if test $libmikmod_driver_esd = yes +-then +- libmikmod_driverlist="$libmikmod_driverlist esd" +- AC_DEFINE(DRV_ESD) +- CFLAGS="$CFLAGS $ESD_CFLAGS" +- +- # Under Solaris and perhaps other systems, we have to forward esd +- # dependencies to libmikmod's dependency list. +- # However, no need to keep libraries we won't require (libossaudio on BSD +- # systems, libaudiofile, libasound on Linux) +- if test $libmikmod_dynload != no +- then +- ESD_LIBS="`echo $ESD_LIBS|sed -e 's/-lesd//'|sed -e 's/-lasound//'|sed -e 's/-laudiofile//'|sed -e 's/-lossaudio//'`" +- fi +- LIBRARY_LIB="$ESD_LIBS $LIBRARY_LIB" +-fi +- + if test $libmikmod_driver_hp = yes + then + libmikmod_driverlist="hp $libmikmod_driverlist" +@@ -508,6 +461,12 @@ then + fi + fi + ++if test $libmikmod_driver_esd = yes ++then ++ libmikmod_driverlist="esd $libmikmod_driverlist" ++ AC_DEFINE(DRV_ESD) ++fi ++ + if test $libmikmod_driver_sam9407 = yes + then + libmikmod_driverlist="sam9407 $libmikmod_driverlist" +@@ -545,39 +504,6 @@ fi + if test $libmikmod_dynload != no + then + AC_DEFINE(MIKMOD_DYNAMIC) +- if test "`uname`" = "Linux" && \ +- test $libmikmod_cv_esd_needs_alsa = yes && \ +- test $libmikmod_driver_esd = yes +- then +- # @#!$ libmikmod_dynloading esd requires us to define and make visible +- # extra symbols (at least for 0.2.6 to 0.2.8) +- AC_CACHE_CHECK([if libmikmod_dynloading esd causes problems], +- libmikmod_cv_esd_broken, +- libmikmod_oldlibs=$LIBS +- LIBS="$LIBS $ESD_LIBS" +- AC_TRY_LINK([ +-#include <esd.h> +-extern void *handle;], +- [void *p = handle;], +- libmikmod_cv_esd_broken=no,libmikmod_cv_esd_broken=yes) +- LIBS=$libmikmod_oldlibs) +- if test $libmikmod_cv_esd_broken = yes +- then +- AC_DEFINE(MIKMOD_DYNAMIC_ESD_NEEDS_ALSA) +- LIB_LDADD="$LIB_LDADD -rdynamic" +- echo " +-*** This means your version of EsounD defines some public symbols, +-*** which should have been defined static or weak. The compiled +-*** libmikmod will try to take care of the problem, but you'll have to +-*** use the '-rdynamic' option when linking an application which uses +-*** libmikmod with gcc. If you use another compiler, or -rdynamic is not +-*** available on your platform, you might not be able to use libmikmod's +-*** EsounD driver. +-*** In this case, consider recompiling libmikmod specifying +-*** '--disable-dl' in the configure script options. +-" >&2 +- fi +- fi + + LIBRARY_LIB="$libmikmod_dllib $LIBRARY_LIB" + if test $libmikmod_dynload = sun diff -Nru libmikmod-3.1.12/debian/patches/series libmikmod-3.1.12/debian/patches/series --- libmikmod-3.1.12/debian/patches/series 2012-02-09 09:16:09.000000000 +0000 +++ libmikmod-3.1.12/debian/patches/series 2012-10-19 09:11:45.000000000 +0100 @@ -8,4 +8,6 @@ 0008-Fix-libmikmod-Makefile.in.patch 0009-libmikmod-Makefile.in-Respect-CPPFLAGS-and-LDFLAGS.patch 0010-libmikmod-config-manual-page-fix.patch -0011-Disable-ESD-and-ALSA-by-default.patch +0011-Disable-ALSA-by-default.patch +0012-fix-ESD.patch +0013-fix-building-of-ESD.patch diff -Nru libmikmod-3.1.12/debian/rules libmikmod-3.1.12/debian/rules --- libmikmod-3.1.12/debian/rules 2012-02-09 09:12:53.000000000 +0000 +++ libmikmod-3.1.12/debian/rules 2012-10-19 09:13:38.000000000 +0100 @@ -6,7 +6,7 @@ dh_auto_configure -- \ --enable-threads \ --disable-alsa \ - --disable-esd \ + --enable-esd \ $(shell dpkg-buildflags --export=configure) override_dh_installinfo:
signature.asc
Description: Digital signature