alsa: remove 'dir' out variable

Alsa seems to expect that we initialize it. Remove the variable and pass NULL
as we actually don't use it. In alsasink also #ifdef one section that is
grabing diagnostics to be disabled, when logging is disabled (the code was
using the out parameter as well).

Fixes #626125
This commit is contained in:
Stefan Kost 2010-08-12 15:26:08 +03:00
parent 2dab0a8928
commit 0fee4ed3d0
2 changed files with 16 additions and 14 deletions

View file

@ -319,7 +319,7 @@ static int
set_hwparams (GstAlsaSink * alsa) set_hwparams (GstAlsaSink * alsa)
{ {
guint rrate; guint rrate;
gint err, dir; gint err;
snd_pcm_hw_params_t *params; snd_pcm_hw_params_t *params;
guint period_time, buffer_time; guint period_time, buffer_time;
@ -363,34 +363,36 @@ retry:
if (rrate != alsa->rate) if (rrate != alsa->rate)
goto rate_match; goto rate_match;
#ifndef GST_DISABLE_GST_DEBUG
/* get and dump some limits */ /* get and dump some limits */
{ {
guint min, max; guint min, max;
snd_pcm_hw_params_get_buffer_time_min (params, &min, &dir); snd_pcm_hw_params_get_buffer_time_min (params, &min, NULL);
snd_pcm_hw_params_get_buffer_time_max (params, &max, &dir); snd_pcm_hw_params_get_buffer_time_max (params, &max, NULL);
GST_DEBUG_OBJECT (alsa, "buffer time %u, min %u, max %u", GST_DEBUG_OBJECT (alsa, "buffer time %u, min %u, max %u",
alsa->buffer_time, min, max); alsa->buffer_time, min, max);
snd_pcm_hw_params_get_period_time_min (params, &min, &dir); snd_pcm_hw_params_get_period_time_min (params, &min, NULL);
snd_pcm_hw_params_get_period_time_max (params, &max, &dir); snd_pcm_hw_params_get_period_time_max (params, &max, NULL);
GST_DEBUG_OBJECT (alsa, "period time %u, min %u, max %u", GST_DEBUG_OBJECT (alsa, "period time %u, min %u, max %u",
alsa->period_time, min, max); alsa->period_time, min, max);
snd_pcm_hw_params_get_periods_min (params, &min, &dir); snd_pcm_hw_params_get_periods_min (params, &min, NULL);
snd_pcm_hw_params_get_periods_max (params, &max, &dir); snd_pcm_hw_params_get_periods_max (params, &max, NULL);
GST_DEBUG_OBJECT (alsa, "periods min %u, max %u", min, max); GST_DEBUG_OBJECT (alsa, "periods min %u, max %u", min, max);
} }
#endif
/* now try to configure the buffer time and period time, if one /* now try to configure the buffer time and period time, if one
* of those fail, we fall back to the defaults and emit a warning. */ * of those fail, we fall back to the defaults and emit a warning. */
if (buffer_time != -1 && !alsa->iec958) { if (buffer_time != -1 && !alsa->iec958) {
/* set the buffer time */ /* set the buffer time */
if ((err = snd_pcm_hw_params_set_buffer_time_near (alsa->handle, params, if ((err = snd_pcm_hw_params_set_buffer_time_near (alsa->handle, params,
&buffer_time, &dir)) < 0) { &buffer_time, NULL)) < 0) {
GST_ELEMENT_WARNING (alsa, RESOURCE, SETTINGS, (NULL), GST_ELEMENT_WARNING (alsa, RESOURCE, SETTINGS, (NULL),
("Unable to set buffer time %i for playback: %s", ("Unable to set buffer time %i for playback: %s",
buffer_time, snd_strerror (err))); buffer_time, snd_strerror (err)));
@ -403,7 +405,7 @@ retry:
if (period_time != -1 && !alsa->iec958) { if (period_time != -1 && !alsa->iec958) {
/* set the period time */ /* set the period time */
if ((err = snd_pcm_hw_params_set_period_time_near (alsa->handle, params, if ((err = snd_pcm_hw_params_set_period_time_near (alsa->handle, params,
&period_time, &dir)) < 0) { &period_time, NULL)) < 0) {
GST_ELEMENT_WARNING (alsa, RESOURCE, SETTINGS, (NULL), GST_ELEMENT_WARNING (alsa, RESOURCE, SETTINGS, (NULL),
("Unable to set period time %i for playback: %s", ("Unable to set period time %i for playback: %s",
period_time, snd_strerror (err))); period_time, snd_strerror (err)));
@ -431,7 +433,7 @@ retry:
/* now get the configured values */ /* now get the configured values */
CHECK (snd_pcm_hw_params_get_buffer_size (params, &alsa->buffer_size), CHECK (snd_pcm_hw_params_get_buffer_size (params, &alsa->buffer_size),
buffer_size); buffer_size);
CHECK (snd_pcm_hw_params_get_period_size (params, &alsa->period_size, &dir), CHECK (snd_pcm_hw_params_get_period_size (params, &alsa->period_size, NULL),
period_size); period_size);
GST_DEBUG_OBJECT (alsa, "buffer size %lu, period size %lu", alsa->buffer_size, GST_DEBUG_OBJECT (alsa, "buffer size %lu, period size %lu", alsa->buffer_size,

View file

@ -331,7 +331,7 @@ static int
set_hwparams (GstAlsaSrc * alsa) set_hwparams (GstAlsaSrc * alsa)
{ {
guint rrate; guint rrate;
gint err, dir; gint err;
snd_pcm_hw_params_t *params; snd_pcm_hw_params_t *params;
snd_pcm_hw_params_malloc (&params); snd_pcm_hw_params_malloc (&params);
@ -357,12 +357,12 @@ set_hwparams (GstAlsaSrc * alsa)
if (alsa->buffer_time != -1) { if (alsa->buffer_time != -1) {
/* set the buffer time */ /* set the buffer time */
CHECK (snd_pcm_hw_params_set_buffer_time_near (alsa->handle, params, CHECK (snd_pcm_hw_params_set_buffer_time_near (alsa->handle, params,
&alsa->buffer_time, &dir), buffer_time); &alsa->buffer_time, NULL), buffer_time);
} }
if (alsa->period_time != -1) { if (alsa->period_time != -1) {
/* set the period time */ /* set the period time */
CHECK (snd_pcm_hw_params_set_period_time_near (alsa->handle, params, CHECK (snd_pcm_hw_params_set_period_time_near (alsa->handle, params,
&alsa->period_time, &dir), period_time); &alsa->period_time, NULL), period_time);
} }
/* write the parameters to device */ /* write the parameters to device */
@ -371,7 +371,7 @@ set_hwparams (GstAlsaSrc * alsa)
CHECK (snd_pcm_hw_params_get_buffer_size (params, &alsa->buffer_size), CHECK (snd_pcm_hw_params_get_buffer_size (params, &alsa->buffer_size),
buffer_size); buffer_size);
CHECK (snd_pcm_hw_params_get_period_size (params, &alsa->period_size, &dir), CHECK (snd_pcm_hw_params_get_period_size (params, &alsa->period_size, NULL),
period_size); period_size);
snd_pcm_hw_params_free (params); snd_pcm_hw_params_free (params);