alsa-lib patches
Hi,
there are some patches for alsa-lib (1.0.9rc2), we use them in Fedora 4. About mixer patch - some user had a problem with ICH6 and this patch helped.
Otherwise, we try to use dmix as the default pcm device in FC4, we have experimental ainit tool for run-time creation of ~/.asoundrc file with safely generated IPC keys for dmix/dsnoop/dshare plugins. Every feedback is welcome...
Ma.
include/alsa-symbols.h renamed from include/alsa-symbols.h.orig +6 -0
@@ -57,10 +57,16 @@ __asm__ (".set " #name "," #real); \ __asm__ (".set ." #name ",." #real)#else +#ifdef __alpha__ +#define use_default_symbol_version (real, name, version) \ + __asm__ (".weak " #name); \ + __asm__ (#name " = " #real) +#else #define use_default_symbol_version (real, name, version) \ __asm__ (".weak " #name); \ __asm__ (".set " #name "," #real)#endif #endif +#endif #endif /* __ALSA_SYMBOLS_H */
src/control/control.c renamed from src/control/control.c.gcc4 +1 -1
@@ -560,7 +560,7 @@int snd_ctl_read (snd_ctl_t *ctl,snd_ctl_event_t *event) {assert (ctl && event); -return ctl->ops->read (ctl, event); +return (ctl->ops->read)(ctl, event); }/**
src/timer/timer.c renamed from src/timer/timer.c.gcc4 +1 -1
@@ -876,7 +876,7 @@assert (timer);assert (((timer->mode &O_ACCMODE ) ==O_RDONLY ) || ((timer->mode &O_ACCMODE ) ==O_RDWR ));assert (buffer || size ==0 ); -return timer->ops->read (timer, buffer, size); +return (timer->ops->read)(timer, buffer, size); }/**
src/conf.c renamed from src/conf.c.gcc4 +5 -2
@@ -2506,9 +2506,11 @@* specified by \p result. * \return Zero if successful, otherwise a negative error code. */ + +static int snd_config_hooks (snd_config_t *config,snd_config_t *private_data); +int snd_config_search_hooks (snd_config_t *config,const char *key,snd_config_t **result) { -static int snd_config_hooks (snd_config_t *config,snd_config_t *private_data);SND_CONFIG_SEARCH (config, key, result, \ err = snd_config_hooks(config, NULL); \if (err <0 ) \
@@ -2526,9 +2528,10 @@* specified by \p result. * \return Zero if successful, otherwise a negative error code. */ +static int snd_config_hooks (snd_config_t *config,snd_config_t *private_data); +int snd_config_searcha_hooks (snd_config_t *root,snd_config_t *config,const char *key,snd_config_t **result) { -static int snd_config_hooks (snd_config_t *config,snd_config_t *private_data);SND_CONFIG_SEARCHA (root, config, key, result, snd_config_searcha_hooks, err = snd_config_hooks(config, NULL); \
src/pcm/pcm_dmix_generic.c renamed from src/pcm/pcm_dmix_generic.c.gcc4 +6 -6
@@ -72,9 +72,9 @@ }while (*sum != old_sample);if (!--size)return ; - src += src_step; - dst += dst_step; - sum += sum_step; + src = (signed short *) ((char *)src + src_step); + dst = (signed short *) ((char *)dst + dst_step); + sum = (signed int *) ((char *)sum + sum_step); } }
@@ -106,9 +106,9 @@ }while (*sum != old_sample);if (!--size)return ; - src += src_step; - dst += dst_step; - sum += sum_step; + src = (signed int *) ((char *)src + src_step); + dst = (signed int *) ((char *)dst + dst_step); + sum = (signed int *) ((char *)sum + sum_step); } }
src/pcm/pcm_plugin.c renamed from src/pcm/pcm_plugin.c.gcc4 +2 -2
@@ -316,7 +316,7 @@snd_pcm_mmap_begin (slave, &slave_areas, &slave_offset, &slave_frames);if (slave_frames ==0 )break ; - frames = plugin->read (pcm, areas, offset, frames, + frames = (plugin->read)(pcm, areas, offset, frames, slave_areas, slave_offset, &slave_frames);if (CHECK_SANITY (slave_frames >snd_pcm_mmap_capture_avail (slave))) { SNDMSG("read overflow %ld > %ld", slave_frames,
@@ -488,7 +488,7 @@return xfer >0 ? (snd_pcm_sframes_t )xfer : err;if (frames > cont) frames = cont; - frames = plugin->read (pcm, areas, hw_offset, frames, + frames = (plugin->read)(pcm, areas, hw_offset, frames, slave_areas, slave_offset, &slave_frames);snd_atomic_write_begin (&plugin->watom);snd_pcm_mmap_hw_forward (pcm, frames);
src/hwdep/hwdep.c renamed from src/hwdep/hwdep.c.gcc4 +1 -1
@@ -485,7 +485,7 @@assert (hwdep);assert (((hwdep->mode &O_ACCMODE ) ==O_RDONLY ) || ((hwdep->mode &O_ACCMODE ) ==O_RDWR ));assert (buffer || size ==0 ); -return hwdep->ops->read (hwdep, buffer, size); +return (hwdep->ops->read)(hwdep, buffer, size); }/**
src/rawmidi/rawmidi.c renamed from src/rawmidi/rawmidi.c.gcc4 +1 -1
@@ -987,5 +987,5 @@assert (rawmidi);assert (rawmidi->stream ==SND_RAWMIDI_STREAM_INPUT );assert (buffer || size ==0 ); -return rawmidi->ops->read (rawmidi, buffer, size); +return (rawmidi->ops->read)(rawmidi, buffer, size); }
src/seq/seq.c renamed from src/seq/seq.c.gcc4 +1 -1
@@ -3914,7 +3914,7 @@static ssize_t snd_seq_event_read_buffer (snd_seq_t *seq) {ssize_t len; - len = seq->ops->read (seq, seq->ibuf, seq->ibufsize *sizeof (snd_seq_event_t)); + len = (seq->ops->read)(seq, seq->ibuf, seq->ibufsize *sizeof (snd_seq_event_t));if (len <0 )return len; seq->ibuflen = len /sizeof (snd_seq_event_t);
src/mixer/mixer.c renamed from src/mixer/mixer.c.old +9 -1
@@ -520,14 +520,22 @@return c1->class->compare (c1, c2); } +static snd_mixer_t *qsort_mixer;typedef int (*qsort_func )(const void *,const void *); + +static int compar (const void *a,const void *b) { +return qsort_mixer->compare (*(const snd_mixer_elem_t *const *) a, + *(const snd_mixer_elem_t *const *) b); +} +static int snd_mixer_sort (snd_mixer_t *mixer) {unsigned int k;assert (mixer);assert (mixer->compare);INIT_LIST_HEAD (&mixer->elems); -qsort (mixer->pelems, mixer->count,sizeof (snd_mixer_elem_t *), (qsort_func )mixer->compare); + qsort_mixer = mixer; +qsort (mixer->pelems, mixer->count,sizeof (snd_mixer_elem_t *), compar);for (k =0 ; k < mixer->count; k++)list_add_tail (&mixer->pelems[k]->list, &mixer->elems);return 0 ;
Quoted 4 lines · Martin Stransky
Hi,
there are some patches for alsa-lib (1.0.9rc2), we use them in Fedora 4. About mixer patch - some user had a problem with ICH6 and this patch helped.
Please give a more detailed description of the patches. What kind of problem? How about a bugzilla link?
Lee
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
Bugzilla link:
https://bugzilla.redhat.com/bugzilla-old/show_bug.cgi?id=146607
We had old patch (it's attached) and it's very similar to your current code. It causes some problems, so i changed the patch and it works.
Ma.
Quoted 4 lines
Please give a more detailed description of the patches. What kind of problem? How about a bugzilla link?
Lee
src/mixer/mixer.c renamed from src/mixer/mixer.c.org +2 -5
@@ -520,17 +520,14 @@return c1->class->compare (c1, c2); } +typedef int (*qsort_func )(const void *,const void *);static int snd_mixer_sort (snd_mixer_t *mixer) {unsigned int k; -int compar (const void *a,const void *b) { -return mixer->compare (*(const snd_mixer_elem_t *const *) a, - *(const snd_mixer_elem_t *const *) b); - }assert (mixer);assert (mixer->compare);INIT_LIST_HEAD (&mixer->elems); -qsort (mixer->pelems, mixer->count,sizeof (snd_mixer_elem_t *), compar); +qsort (mixer->pelems, mixer->count,sizeof (snd_mixer_elem_t *), (qsort_func )mixer->compare);for (k =0 ; k < mixer->count; k++)list_add_tail (&mixer->pelems[k]->list, &mixer->elems);return 0 ;
Quoted 3 lines · Martin Stransky
About mixer patch - some user had a problem with ICH6 and this patch helped.
+static
snd_mixer_t*qsort_mixer;
This will break with multithreading.
src/mixer/mixer.c line 529
Quoted 4 lines
src/mixer/mixer.c renamed from src/mixer/mixer.c.old +4
-0+static int compar (const void *a,const void *b) { +return qsort_mixer->compare (*(const snd_mixer_elem_t *const *) a, + *(const snd_mixer_elem_t *const *) b); +}
So the actual problem is that qsort() calls us with a pointer to a pointer to the mixer_elem_t, but the compare function takes a single pointer.
If we don't want to change the mixer API, we have to use some pthread_mutex to protext qsort_mixer.
Regards,
Clemens
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20