rpms/libmikmod/devel libmikmod-esd.patch, 1.1, 1.2 libmikmod.spec, 1.5, 1.6
Hans de Goede (jwrdegoede)
fedora-extras-commits at redhat.com
Mon Feb 18 15:50:45 UTC 2008
- Previous message (by thread): rpms/libmusicbrainz/devel libmusicbrainz.spec,1.22,1.23
- Next message (by thread): rpms/quesa/devel quesa-1.8-excess-libs.patch, NONE, 1.1 quesa.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: jwrdegoede
Update of /cvs/extras/rpms/libmikmod/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20365
Modified Files:
libmikmod-esd.patch libmikmod.spec
Log Message:
* Mon Feb 18 2008 Hans de Goede <j.w.r.degoede at hhs.nl> 3.2.0-2.beta2
- Replace completely braindead (hint to author, drink coffee first, then code)
esd non blocking patch with one that actually works. This fixes using mikmod
with pulseaudio (bz 247865)
- Note: this makes the 2 supported output devices oss and esd (and pulseaudio's
esd emulation) alsa is not supported, this requires a rewrite of the mikmod
alsa code which was written for alsa-0.5 and never updated for the new alsa
0.9/1.0 api
libmikmod-esd.patch:
Index: libmikmod-esd.patch
===================================================================
RCS file: /cvs/extras/rpms/libmikmod/devel/libmikmod-esd.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- libmikmod-esd.patch 24 Oct 2007 07:52:21 -0000 1.1
+++ libmikmod-esd.patch 18 Feb 2008 15:50:41 -0000 1.2
@@ -1,6 +1,98 @@
---- libmikmod-3.1.11/drivers/drv_esd.c.esd 2004-08-04 05:04:58.990630968 +0200
-+++ libmikmod-3.1.11/drivers/drv_esd.c 2004-08-04 05:05:32.940469808 +0200
-@@ -127,20 +127,19 @@
+--- libmikmod-3.2.0-beta2/drivers/drv_esd.c 2004-01-31 23:39:40.000000000 +0100
++++ libmikmod-3.2.0-beta2.new/drivers/drv_esd.c 2008-02-18 12:09:07.000000000 +0100
+@@ -81,7 +81,6 @@
+
+ static int sndfd=-1;
+ static esd_format_t format;
+-static SBYTE *audiobuffer=NULL;
+ static CHAR *espeaker=NULL;
+
+ #ifdef MIKMOD_DYNAMIC
+@@ -100,7 +99,7 @@
+ if (libesd) return 0;
+
+ /* load libesd.so */
+- libesd=dlopen("libesd.so",RTLD_LAZY|RTLD_GLOBAL);
++ libesd=dlopen("libesd.so.0",RTLD_LAZY|RTLD_GLOBAL);
+ if (!libesd) return 1;
+
+ /* resolve function references */
+@@ -124,23 +123,88 @@
+ }
+ #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)
{
@@ -9,15 +101,9 @@
- while (start<count) {
- ssize_t res;
-+ res=write(fd,(char*)buffer,count);
-+ if (res<0)
-+ switch (errno) {
-+ case EAGAIN:
-+ return 0;
-+ case EPIPE:
-+ /* connection lost */
-+ return -1-res;
-+ }
++ res = write(fd, (char*)buffer, count);
++ if (res < 0 && errno == EAGAIN)
++ return 0;
- res=write(fd,(char*)buffer+start,count-start);
- if (res<0) {
@@ -32,7 +118,7 @@
}
static void ESD_CommandLine(CHAR *cmdline)
-@@ -193,6 +192,7 @@
+@@ -193,13 +257,14 @@
_mm_errno=MMERR_OPENING_AUDIO;
return 1;
}
@@ -40,62 +126,113 @@
} else {
_mm_errno=MMERR_OUT_OF_MEMORY;
return 1;
-@@ -234,19 +234,22 @@
+ }
+-
+- if (!(audiobuffer=(SBYTE*)_mm_malloc(ESD_BUF_SIZE*sizeof(char))))
+- return 1;
++
++ /* Initialize the audiobuffer */
++ audiobuffer_init();
+
+ return VC_Init();
+ }
+@@ -218,7 +283,6 @@
+ static void ESD_Exit_internal(void)
+ {
+ VC_Exit();
+- _mm_free(audiobuffer);
+ if (sndfd>=0) {
+ esd_closestream(sndfd);
+ sndfd=-1;
+@@ -234,19 +298,50 @@
#endif
}
-static void ESD_Update_internal(int count)
-+static void ESD_Update(void)
++typedef ULONG (*VC_WriteBytesFunc)(SBYTE*, ULONG);
++
++static void ESD_Update_internal(VC_WriteBytesFunc WriteBytes)
{
static time_t losttime;
-+ int done;
if (sndfd>=0) {
- if (esd_writebuf(sndfd,audiobuffer,count)<0) {
-+ done=esd_writebuf(sndfd,audiobuffer,ESD_BUF_SIZE);
-+ if (done<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);
-- }
-+ } else
-+ VC_WriteBytes(audiobuffer,done);
+- /* 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
alarm(2) himself... */
-@@ -255,31 +258,32 @@
+@@ -255,8 +350,11 @@
/* 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);
-+ done=esd_writebuf(sndfd,audiobuffer,ESD_BUF_SIZE);
-+ if(done>0)
-+ VC_SilenceBytes(audiobuffer,done);
++ ESD_Update_internal(WriteBytes);
}
}
}
- }
+@@ -264,22 +362,24 @@
--static void ESD_Update(void)
--{
+ 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));
-+ VC_SilenceBytes(audiobuffer,ESD_BUF_SIZE);
++ ESD_Update_internal(VC_SilenceBytes);
}
static BOOL ESD_PlayStart(void)
{
-+ int done;
-+
if (sndfd<0)
- if (!(SETENV))
+ if (!(SETENV)) {
@@ -108,28 +245,19 @@
/* 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,
-@@ -287,18 +291,20 @@
- signal(SIGPIPE,SIG_IGN);
-
+@@ -289,6 +389,7 @@
/* silence buffers */
-- VC_SilenceBytes(audiobuffer,ESD_BUF_SIZE);
-- esd_writebuf(sndfd,audiobuffer,ESD_BUF_SIZE);
-+ done=esd_writebuf(sndfd,audiobuffer,ESD_BUF_SIZE);
-+ VC_SilenceBytes(audiobuffer,done);
+ VC_SilenceBytes(audiobuffer,ESD_BUF_SIZE);
+ esd_writebuf(sndfd,audiobuffer,ESD_BUF_SIZE);
++ audiobuffer_init();
return VC_PlayStart();
}
-
- static void ESD_PlayStop(void)
- {
-+ int done;
-+
- if (sndfd>=0) {
+@@ -299,6 +400,7 @@
/* silence buffers */
-- VC_SilenceBytes(audiobuffer,ESD_BUF_SIZE);
-- esd_writebuf(sndfd,audiobuffer,ESD_BUF_SIZE);
-+ done=esd_writebuf(sndfd,audiobuffer,ESD_BUF_SIZE);
-+ VC_SilenceBytes(audiobuffer,done);
+ VC_SilenceBytes(audiobuffer,ESD_BUF_SIZE);
+ esd_writebuf(sndfd,audiobuffer,ESD_BUF_SIZE);
++ audiobuffer_init();
signal(SIGPIPE,SIG_DFL);
}
Index: libmikmod.spec
===================================================================
RCS file: /cvs/extras/rpms/libmikmod/devel/libmikmod.spec,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- libmikmod.spec 16 Feb 2008 08:19:45 -0000 1.5
+++ libmikmod.spec 18 Feb 2008 15:50:41 -0000 1.6
@@ -1,7 +1,7 @@
Summary: A MOD music file player library
Name: libmikmod
Version: 3.2.0
-Release: 1%{?dist}
+Release: 2.beta2%{?dist}
License: GPLv2 and LGPLv2+
Group: Applications/Multimedia
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -78,6 +78,15 @@
%{_mandir}/man1/libmikmod-config*
%changelog
+* Mon Feb 18 2008 Hans de Goede <j.w.r.degoede at hhs.nl> 3.2.0-2.beta2
+- Replace completely braindead (hint to author, drink coffee first, then code)
+ esd non blocking patch with one that actually works. This fixes using mikmod
+ with pulseaudio (bz 247865)
+- Note: this makes the 2 supported output devices oss and esd (and pulseaudio's
+ esd emulation) alsa is not supported, this requires a rewrite of the mikmod
+ alsa code which was written for alsa-0.5 and never updated for the new alsa
+ 0.9/1.0 api
+
* Fri Feb 15 2008 Jindrich Novy <jnovy at redhat.com> 3.2.0-1
- update to libmikmod-3.2.0-beta2
- fix playback on 64bit arches
- Previous message (by thread): rpms/libmusicbrainz/devel libmusicbrainz.spec,1.22,1.23
- Next message (by thread): rpms/quesa/devel quesa-1.8-excess-libs.patch, NONE, 1.1 quesa.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list