All of lore.kernel.org
 help / color / mirror / Atom feed
* Salsa-lib  : _snd_pcm_hw_param_test is not defined
@ 2008-10-13  9:49 Matthieu CASTET
  2008-10-13 10:05 ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Matthieu CASTET @ 2008-10-13  9:49 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: ALSA devel

Hi,

it seems there is a missing implementation of _snd_pcm_hw_param_test
function in src/pcm_params.c .

It is used in pcm_macros.h by snd_pcm_hw_params_test_xxx functions.

Thanks

Matthieu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Salsa-lib : _snd_pcm_hw_param_test is not defined
  2008-10-13  9:49 Salsa-lib : _snd_pcm_hw_param_test is not defined Matthieu CASTET
@ 2008-10-13 10:05 ` Takashi Iwai
  2008-10-13 14:01   ` Matthieu CASTET
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2008-10-13 10:05 UTC (permalink / raw)
  To: Matthieu CASTET; +Cc: ALSA devel

At Mon, 13 Oct 2008 11:49:03 +0200,
Matthieu CASTET wrote:
> 
> Hi,
> 
> it seems there is a missing implementation of _snd_pcm_hw_param_test
> function in src/pcm_params.c .
> 
> It is used in pcm_macros.h by snd_pcm_hw_params_test_xxx functions.

Thanks for reporting.  Does the patch below works?


Takashi

diff -r f481dcc66eae src/pcm_params.c
--- a/src/pcm_params.c	Tue Sep 30 15:38:29 2008 +0200
+++ b/src/pcm_params.c	Mon Oct 13 12:04:54 2008 +0200
@@ -754,6 +754,15 @@
 	return err;
 }
 
+int _snd_pcm_hw_param_test(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+			   int var, unsigned int val, int *dir)
+{
+	snd_pcm_hw_params_t save = *params;
+	int err = _snd_pcm_hw_param_set(pcm, params, var, val, dir);
+	*params = save;
+	return err;
+}
+
 int _snd_pcm_hw_param_set_integer(snd_pcm_t *pcm, 
 				  snd_pcm_hw_params_t *params,
 				  int var)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Salsa-lib : _snd_pcm_hw_param_test is not defined
  2008-10-13 10:05 ` Takashi Iwai
@ 2008-10-13 14:01   ` Matthieu CASTET
  2008-10-13 14:24     ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Matthieu CASTET @ 2008-10-13 14:01 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: ALSA devel

Hi,

Takashi Iwai a écrit :
> At Mon, 13 Oct 2008 11:49:03 +0200,
> Matthieu CASTET wrote:
>> Hi,
>>
>> it seems there is a missing implementation of _snd_pcm_hw_param_test
>> function in src/pcm_params.c .
>>
>> It is used in pcm_macros.h by snd_pcm_hw_params_test_xxx functions.
> 
> Thanks for reporting.  
Thanks for your quick reply.

> Does the patch below works?
Hum,

dir is a pointer, but _snd_pcm_hw_param_set want a integer.


BTW, some application expect snd_config (from cards.c) to be not null
after a call to snd_config_update.

Matthieu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Salsa-lib : _snd_pcm_hw_param_test is not defined
  2008-10-13 14:01   ` Matthieu CASTET
@ 2008-10-13 14:24     ` Takashi Iwai
  2008-10-14  7:46       ` Matthieu CASTET
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2008-10-13 14:24 UTC (permalink / raw)
  To: Matthieu CASTET; +Cc: ALSA devel

At Mon, 13 Oct 2008 16:01:07 +0200,
Matthieu CASTET wrote:
> 
> Hi,
> 
> Takashi Iwai a écrit :
> > At Mon, 13 Oct 2008 11:49:03 +0200,
> > Matthieu CASTET wrote:
> >> Hi,
> >>
> >> it seems there is a missing implementation of _snd_pcm_hw_param_test
> >> function in src/pcm_params.c .
> >>
> >> It is used in pcm_macros.h by snd_pcm_hw_params_test_xxx functions.
> > 
> > Thanks for reporting.  
> Thanks for your quick reply.
> 
> > Does the patch below works?
> Hum,
> 
> dir is a pointer, but _snd_pcm_hw_param_set want a integer.

Oops, the fixed patch is below.

> 
> BTW, some application expect snd_config (from cards.c) to be not null
> after a call to snd_config_update.

Hm, which apps?

Basically the non-null pointer isn't guaranteed even in the API
definition, so it's not necessarily to implement.  But, if many apps 
assume it, it becomes as a de facto standard, and we need to give a
workaround...


thanks,

Takashi

diff -r f481dcc66eae src/pcm_params.c
--- a/src/pcm_params.c	Tue Sep 30 15:38:29 2008 +0200
+++ b/src/pcm_params.c	Mon Oct 13 16:22:35 2008 +0200
@@ -754,6 +754,15 @@
 	return err;
 }
 
+int _snd_pcm_hw_param_test(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+			   int var, unsigned int val, int *dir)
+{
+	snd_pcm_hw_params_t save = *params;
+	int err = _snd_pcm_hw_param_set(pcm, params, var, val, dir ? *dir : 0);
+	*params = save;
+	return err;
+}
+
 int _snd_pcm_hw_param_set_integer(snd_pcm_t *pcm, 
 				  snd_pcm_hw_params_t *params,
 				  int var)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Salsa-lib : _snd_pcm_hw_param_test is not defined
  2008-10-13 14:24     ` Takashi Iwai
@ 2008-10-14  7:46       ` Matthieu CASTET
  2008-10-14  8:10         ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Matthieu CASTET @ 2008-10-14  7:46 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: ALSA devel

Takashi Iwai a écrit :
> At Mon, 13 Oct 2008 16:01:07 +0200,
> Matthieu CASTET wrote:
>> Hi,
>>
>> Takashi Iwai a écrit :
>>> At Mon, 13 Oct 2008 11:49:03 +0200,
>>> Matthieu CASTET wrote:
>>>> Hi,
>>>>
>>>> it seems there is a missing implementation of _snd_pcm_hw_param_test
>>>> function in src/pcm_params.c .
>>>>
>>>> It is used in pcm_macros.h by snd_pcm_hw_params_test_xxx functions.
>>> Thanks for reporting.  
>> Thanks for your quick reply.
>>
>>> Does the patch below works?
>> Hum,
>>
>> dir is a pointer, but _snd_pcm_hw_param_set want a integer.
> 
> Oops, the fixed patch is below.
> 
Ok sound better.
But why _snd_pcm_hw_param_test take a pointer and not a integer. All
snd_pcm_hw_params_test_xxx seems to take a dir as integer.

>> BTW, some application expect snd_config (from cards.c) to be not null
>> after a call to snd_config_update.
> 
> Hm, which apps?
> 
portaudio.


Matthieu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Salsa-lib : _snd_pcm_hw_param_test is not defined
  2008-10-14  7:46       ` Matthieu CASTET
@ 2008-10-14  8:10         ` Takashi Iwai
  2008-10-16 15:12           ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2008-10-14  8:10 UTC (permalink / raw)
  To: Matthieu CASTET; +Cc: ALSA devel

At Tue, 14 Oct 2008 09:46:16 +0200,
Matthieu CASTET wrote:
> 
> Takashi Iwai a écrit :
> > At Mon, 13 Oct 2008 16:01:07 +0200,
> > Matthieu CASTET wrote:
> >> Hi,
> >>
> >> Takashi Iwai a écrit :
> >>> At Mon, 13 Oct 2008 11:49:03 +0200,
> >>> Matthieu CASTET wrote:
> >>>> Hi,
> >>>>
> >>>> it seems there is a missing implementation of _snd_pcm_hw_param_test
> >>>> function in src/pcm_params.c .
> >>>>
> >>>> It is used in pcm_macros.h by snd_pcm_hw_params_test_xxx functions.
> >>> Thanks for reporting.  
> >> Thanks for your quick reply.
> >>
> >>> Does the patch below works?
> >> Hum,
> >>
> >> dir is a pointer, but _snd_pcm_hw_param_set want a integer.
> > 
> > Oops, the fixed patch is below.
> > 
> Ok sound better.
> But why _snd_pcm_hw_param_test take a pointer and not a integer. All
> snd_pcm_hw_params_test_xxx seems to take a dir as integer.

When you pass a pointer pointing the integer value 0, it returns the
direction it goes in return.

> >> BTW, some application expect snd_config (from cards.c) to be not null
> >> after a call to snd_config_update.
> > 
> > Hm, which apps?
> > 
> portaudio.

One app isn't always enough to change the thing :)
OTOH, if just faking a pointer (i.e. passing any non-null) fixes the
problem, it might be a reasonable workaround...


Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Salsa-lib : _snd_pcm_hw_param_test is not defined
  2008-10-14  8:10         ` Takashi Iwai
@ 2008-10-16 15:12           ` Takashi Iwai
  0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2008-10-16 15:12 UTC (permalink / raw)
  To: Matthieu CASTET; +Cc: ALSA devel

At Tue, 14 Oct 2008 10:10:36 +0200,
I wrote:
> 
> At Tue, 14 Oct 2008 09:46:16 +0200,
> Matthieu CASTET wrote:
> > 
> > Takashi Iwai a écrit :
> > > At Mon, 13 Oct 2008 16:01:07 +0200,
> > > Matthieu CASTET wrote:
> > >> Hi,
> > >>
> > >> Takashi Iwai a écrit :
> > >>> At Mon, 13 Oct 2008 11:49:03 +0200,
> > >>> Matthieu CASTET wrote:
> > >>>> Hi,
> > >>>>
> > >>>> it seems there is a missing implementation of _snd_pcm_hw_param_test
> > >>>> function in src/pcm_params.c .
> > >>>>
> > >>>> It is used in pcm_macros.h by snd_pcm_hw_params_test_xxx functions.
> > >>> Thanks for reporting.  
> > >> Thanks for your quick reply.
> > >>
> > >>> Does the patch below works?
> > >> Hum,
> > >>
> > >> dir is a pointer, but _snd_pcm_hw_param_set want a integer.
> > > 
> > > Oops, the fixed patch is below.
> > > 
> > Ok sound better.
> > But why _snd_pcm_hw_param_test take a pointer and not a integer. All
> > snd_pcm_hw_params_test_xxx seems to take a dir as integer.
> 
> When you pass a pointer pointing the integer value 0, it returns the
> direction it goes in return.

I released version 0.0.20 just including this fix now.

However...

> > >> BTW, some application expect snd_config (from cards.c) to be not null
> > >> after a call to snd_config_update.
> > > 
> > > Hm, which apps?
> > > 
> > portaudio.
> 
> One app isn't always enough to change the thing :)
> OTOH, if just faking a pointer (i.e. passing any non-null) fixes the
> problem, it might be a reasonable workaround...

... this problem still remains.
Can you check the patch like below could work around the problem?


thanks,

Takashi

diff -r 590f5dd3cd39 src/cards.c
--- a/src/cards.c	Thu Oct 16 17:08:49 2008 +0200
+++ b/src/cards.c	Thu Oct 16 17:11:55 2008 +0200
@@ -174,4 +174,7 @@
 	return 0;
 }
 
-snd_config_t *snd_config; /* placeholder */
+/* This is just a placeholder, but contains non-NULL value for apps
+ * that check the value by some reason
+ */
+snd_config_t *snd_config = (snd_config_t*)1;

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-10-16 15:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-13  9:49 Salsa-lib : _snd_pcm_hw_param_test is not defined Matthieu CASTET
2008-10-13 10:05 ` Takashi Iwai
2008-10-13 14:01   ` Matthieu CASTET
2008-10-13 14:24     ` Takashi Iwai
2008-10-14  7:46       ` Matthieu CASTET
2008-10-14  8:10         ` Takashi Iwai
2008-10-16 15:12           ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.