summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3260438)
This adds a new generic error code "invalid mixer channel", which is
returned from both ALSA and OSS in case the specified mixer channel
could not be set.
Prior to this patch, ALSA would return a bad channel error also when
the given value was out of range. This is fixed by replacing the now
unused ALSA_MIX_BAD_ELEM error code by the new ALSA_MIX_RANGE code.
Finally, para_fade is changed to no longer print the list of available
channels after it failed to set the initial mode.
PARA_NOTICE_LOG("unable to find simple control '%s',%i\n",
snd_mixer_selem_id_get_name(sid),
snd_mixer_selem_id_get_index(sid));
PARA_NOTICE_LOG("unable to find simple control '%s',%i\n",
snd_mixer_selem_id_get_name(sid),
snd_mixer_selem_id_get_index(sid));
- return -E_ALSA_MIX_BAD_ELEM;
}
ret = snd_mixer_selem_get_playback_volume_range(h->elem,
&h->pmin, &h->pmax);
if (ret < 0) {
PARA_NOTICE_LOG("unable to get %s range (%s): %s\n",
mixer_channel, h->card, snd_strerror(ret));
}
ret = snd_mixer_selem_get_playback_volume_range(h->elem,
&h->pmin, &h->pmax);
if (ret < 0) {
PARA_NOTICE_LOG("unable to get %s range (%s): %s\n",
mixer_channel, h->card, snd_strerror(ret));
- return -E_ALSA_MIX_BAD_ELEM;
+ return -E_ALSA_MIX_RANGE;
}
if (h->pmin < 0 || h->pmax < 0 || h->pmin >= h->pmax) {
PARA_NOTICE_LOG("alsa reported %s range %ld-%ld (%s)\n",
mixer_channel, h->pmin, h->pmax, h->card);
}
if (h->pmin < 0 || h->pmax < 0 || h->pmin >= h->pmax) {
PARA_NOTICE_LOG("alsa reported %s range %ld-%ld (%s)\n",
mixer_channel, h->pmin, h->pmax, h->card);
- return -E_ALSA_MIX_BAD_ELEM;
+ return -E_ALSA_MIX_RANGE;
#define GGO_ERRORS
#define COLOR_ERRORS
#define SIGNAL_ERRORS
#define GGO_ERRORS
#define COLOR_ERRORS
#define SIGNAL_ERRORS
#define STDOUT_ERRORS
#define FILE_WRITE_ERRORS
#define STDIN_ERRORS
#define STDOUT_ERRORS
#define FILE_WRITE_ERRORS
#define STDIN_ERRORS
extern const char **para_errlist[];
extern const char **para_errlist[];
-#define OSS_MIX_ERRORS \
- PARA_ERROR(OSS_MIXER_CHANNEL, "invalid mixer channel"), \
-
-
#define ALSA_MIX_ERRORS \
PARA_ERROR(ALSA_MIX_OPEN, "could not open mixer"), \
#define ALSA_MIX_ERRORS \
PARA_ERROR(ALSA_MIX_OPEN, "could not open mixer"), \
- PARA_ERROR(ALSA_MIX_BAD_ELEM, "invalid/unsupported control element"), \
PARA_ERROR(ALSA_MIX_GET_VAL, "could not read control element state"), \
PARA_ERROR(ALSA_MIX_SET_VAL, "could not set control element state"), \
PARA_ERROR(ALSA_MIX_GET_VAL, "could not read control element state"), \
PARA_ERROR(ALSA_MIX_SET_VAL, "could not set control element state"), \
+ PARA_ERROR(ALSA_MIX_RANGE, "value control element out of range"), \
#define RESAMPLE_FILTER_ERRORS \
#define RESAMPLE_FILTER_ERRORS \
PARA_ERROR(NO_VALID_FILES, "no valid file found in playlist"), \
PARA_ERROR(BAD_PLAY_CMD, "invalid command"), \
PARA_ERROR(NO_VALID_FILES, "no valid file found in playlist"), \
PARA_ERROR(BAD_PLAY_CMD, "invalid command"), \
+#define FADE_ERRORS \
+ PARA_ERROR(BAD_CHANNEL, "invalid channel"), \
#define FLACDEC_FILTER_ERRORS \
PARA_ERROR(FLACDEC_DECODER_ALLOC, "could not allocate stream decoder"), \
#define FLACDEC_FILTER_ERRORS \
PARA_ERROR(FLACDEC_DECODER_ALLOC, "could not allocate stream decoder"), \
static int set_channel(struct mixer *m, struct mixer_handle *h, const char *channel)
{
static int set_channel(struct mixer *m, struct mixer_handle *h, const char *channel)
{
- char *channels;
- int ret;
- ret = m->set_channel(h, channel);
- if (ret >= 0) {
- PARA_NOTICE_LOG("using %s mixer channel\n",
- channel? channel : "default");
- return ret;
- }
- channels = m->get_channels(h);
- printf("Available channels: %s\n", channels);
- free(channels);
- return ret;
+ PARA_NOTICE_LOG("using %s mixer channel\n", channel?
+ channel : "default");
+ return m->set_channel(h, channel);
}
/* Fade to new volume in fade_time seconds. */
}
/* Fade to new volume in fade_time seconds. */
if (ret < 0)
goto out;
ret = set_channel(m, h, conf.mixer_channel_arg);
if (ret < 0)
goto out;
ret = set_channel(m, h, conf.mixer_channel_arg);
+ if (ret == -E_BAD_CHANNEL) {
+ char *channels = m->get_channels(h);
+ printf("Available channels: %s\n", channels);
+ free(channels);
+ }
if (ret < 0)
goto out;
switch (conf.mode_arg) {
if (ret < 0)
goto out;
switch (conf.mode_arg) {
handle->id = i;
return 1;
}
handle->id = i;
return 1;
}
- return -E_OSS_MIXER_CHANNEL;
}
static int oss_mix_get(struct mixer_handle *handle)
}
static int oss_mix_get(struct mixer_handle *handle)