Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28477
b: refs/heads/master
c: 2f4ca8e
h: refs/heads/master
i:
  28475: 8fd2c10
v: v3
  • Loading branch information
Takashi Iwai authored and Jaroslav Kysela committed Jun 22, 2006
1 parent f4960b8 commit 057d7f3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 45 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e88e8ae639a4908b903d9406c54e99a729b01a28
refs/heads/master: 2f4ca8e5c7cf6a6f7935483d8ee4aa8b039bdd7d
70 changes: 26 additions & 44 deletions trunk/sound/core/pcm_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1163,12 +1163,6 @@ int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime,

EXPORT_SYMBOL(snd_pcm_hw_constraint_pow2);

/* To use the same code we have in alsa-lib */
#define assert(i) snd_assert((i), return -EINVAL)
#ifndef INT_MIN
#define INT_MIN ((int)((unsigned int)INT_MAX+1))
#endif

static void _snd_pcm_hw_param_any(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var)
{
Expand Down Expand Up @@ -1228,7 +1222,6 @@ int snd_pcm_hw_param_value(const struct snd_pcm_hw_params *params,
*dir = i->openmin;
return snd_interval_value(i);
}
assert(0);
return -EINVAL;
}

Expand Down Expand Up @@ -1260,10 +1253,8 @@ static int _snd_pcm_hw_param_first(struct snd_pcm_hw_params *params,
changed = snd_mask_refine_first(hw_param_mask(params, var));
else if (hw_is_interval(var))
changed = snd_interval_refine_first(hw_param_interval(params, var));
else {
assert(0);
else
return -EINVAL;
}
if (changed) {
params->cmask |= 1 << var;
params->rmask |= 1 << var;
Expand Down Expand Up @@ -1292,7 +1283,7 @@ int snd_pcm_hw_param_first(struct snd_pcm_substream *pcm,
return changed;
if (params->rmask) {
int err = snd_pcm_hw_refine(pcm, params);
assert(err >= 0);
snd_assert(err >= 0, return err);
}
return snd_pcm_hw_param_value(params, var, dir);
}
Expand All @@ -1307,10 +1298,8 @@ static int _snd_pcm_hw_param_last(struct snd_pcm_hw_params *params,
changed = snd_mask_refine_last(hw_param_mask(params, var));
else if (hw_is_interval(var))
changed = snd_interval_refine_last(hw_param_interval(params, var));
else {
assert(0);
else
return -EINVAL;
}
if (changed) {
params->cmask |= 1 << var;
params->rmask |= 1 << var;
Expand Down Expand Up @@ -1339,7 +1328,7 @@ int snd_pcm_hw_param_last(struct snd_pcm_substream *pcm,
return changed;
if (params->rmask) {
int err = snd_pcm_hw_refine(pcm, params);
assert(err >= 0);
snd_assert(err >= 0, return err);
}
return snd_pcm_hw_param_value(params, var, dir);
}
Expand All @@ -1356,39 +1345,32 @@ EXPORT_SYMBOL(snd_pcm_hw_param_last);
* first access, first format, first subformat, min channels,
* min rate, min period time, max buffer size, min tick time
*/
int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params)
{
int err;

err = snd_pcm_hw_param_first(pcm, params, SNDRV_PCM_HW_PARAM_ACCESS, NULL);
assert(err >= 0);

err = snd_pcm_hw_param_first(pcm, params, SNDRV_PCM_HW_PARAM_FORMAT, NULL);
assert(err >= 0);

err = snd_pcm_hw_param_first(pcm, params, SNDRV_PCM_HW_PARAM_SUBFORMAT, NULL);
assert(err >= 0);

err = snd_pcm_hw_param_first(pcm, params, SNDRV_PCM_HW_PARAM_CHANNELS, NULL);
assert(err >= 0);

err = snd_pcm_hw_param_first(pcm, params, SNDRV_PCM_HW_PARAM_RATE, NULL);
assert(err >= 0);

err = snd_pcm_hw_param_first(pcm, params, SNDRV_PCM_HW_PARAM_PERIOD_TIME, NULL);
assert(err >= 0);

err = snd_pcm_hw_param_last(pcm, params, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, NULL);
assert(err >= 0);

err = snd_pcm_hw_param_first(pcm, params, SNDRV_PCM_HW_PARAM_TICK_TIME, NULL);
assert(err >= 0);
int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm,
struct snd_pcm_hw_params *params)
{
static int vars[] = {
SNDRV_PCM_HW_PARAM_ACCESS,
SNDRV_PCM_HW_PARAM_FORMAT,
SNDRV_PCM_HW_PARAM_SUBFORMAT,
SNDRV_PCM_HW_PARAM_CHANNELS,
SNDRV_PCM_HW_PARAM_RATE,
SNDRV_PCM_HW_PARAM_PERIOD_TIME,
SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
SNDRV_PCM_HW_PARAM_TICK_TIME,
-1
};
int err, *v;

for (v = vars; *v != -1; v++) {
if (*v != SNDRV_PCM_HW_PARAM_BUFFER_SIZE)
err = snd_pcm_hw_param_first(pcm, params, *v, NULL);
else
err = snd_pcm_hw_param_last(pcm, params, *v, NULL);
snd_assert(err >= 0, return err);
}
return 0;
}

#undef assert

static int snd_pcm_lib_ioctl_reset(struct snd_pcm_substream *substream,
void *arg)
{
Expand Down

0 comments on commit 057d7f3

Please sign in to comment.