mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 03:00:35 +00:00
ext/alsa/: Change alsa alloca's to malloc to fix warnings on gcc-4.2.
Original commit message from CVS: * ext/alsa/gstalsa.c: * ext/alsa/gstalsadeviceprobe.c: * ext/alsa/gstalsamixer.c: * ext/alsa/gstalsasink.c: * ext/alsa/gstalsasrc.c: Change alsa alloca's to malloc to fix warnings on gcc-4.2.
This commit is contained in:
parent
5dc2aebdee
commit
1beb98e6dc
6 changed files with 59 additions and 9 deletions
|
@ -1,3 +1,12 @@
|
|||
2007-09-15 David Schleef <ds@schleef.org>
|
||||
|
||||
* ext/alsa/gstalsa.c:
|
||||
* ext/alsa/gstalsadeviceprobe.c:
|
||||
* ext/alsa/gstalsamixer.c:
|
||||
* ext/alsa/gstalsasink.c:
|
||||
* ext/alsa/gstalsasrc.c:
|
||||
Change alsa alloca's to malloc to fix warnings on gcc-4.2.
|
||||
|
||||
2007-09-15 Wim Taymans <wim.taymans@gmail.com>
|
||||
|
||||
* gst-libs/gst/rtp/gstbasertppayload.c:
|
||||
|
|
|
@ -110,7 +110,7 @@ gst_alsa_detect_formats (GstObject * obj, snd_pcm_hw_params_t * hw_params,
|
|||
GstCaps *caps;
|
||||
gint i;
|
||||
|
||||
snd_pcm_format_mask_alloca (&mask);
|
||||
snd_pcm_format_mask_malloc (&mask);
|
||||
snd_pcm_hw_params_get_format_mask (hw_params, mask);
|
||||
|
||||
caps = gst_caps_new_empty ();
|
||||
|
@ -157,6 +157,7 @@ gst_alsa_detect_formats (GstObject * obj, snd_pcm_hw_params_t * hw_params,
|
|||
}
|
||||
}
|
||||
|
||||
snd_pcm_format_mask_free (mask);
|
||||
gst_caps_unref (in_caps);
|
||||
return caps;
|
||||
}
|
||||
|
@ -375,7 +376,7 @@ gst_alsa_probe_supported_formats (GstObject * obj, snd_pcm_t * handle,
|
|||
GstCaps *caps;
|
||||
gint err;
|
||||
|
||||
snd_pcm_hw_params_alloca (&hw_params);
|
||||
snd_pcm_hw_params_malloc (&hw_params);
|
||||
if ((err = snd_pcm_hw_params_any (handle, hw_params)) < 0)
|
||||
goto error;
|
||||
|
||||
|
@ -390,17 +391,20 @@ gst_alsa_probe_supported_formats (GstObject * obj, snd_pcm_t * handle,
|
|||
if (!(caps = gst_alsa_detect_channels (obj, hw_params, caps)))
|
||||
goto subroutine_error;
|
||||
|
||||
snd_pcm_hw_params_free (hw_params);
|
||||
return caps;
|
||||
|
||||
/* ERRORS */
|
||||
error:
|
||||
{
|
||||
GST_ERROR_OBJECT (obj, "failed to query formats: %s", snd_strerror (err));
|
||||
snd_pcm_hw_params_free (hw_params);
|
||||
return NULL;
|
||||
}
|
||||
subroutine_error:
|
||||
{
|
||||
GST_ERROR_OBJECT (obj, "failed to query formats");
|
||||
snd_pcm_hw_params_free (hw_params);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,8 +61,8 @@ gst_alsa_get_device_list (snd_pcm_stream_t stream)
|
|||
if (stream == -1)
|
||||
stream = 0;
|
||||
|
||||
snd_ctl_card_info_alloca (&info);
|
||||
snd_pcm_info_alloca (&pcminfo);
|
||||
snd_ctl_card_info_malloc (&info);
|
||||
snd_pcm_info_malloc (&pcminfo);
|
||||
card = -1;
|
||||
|
||||
if (snd_card_next (&card) < 0 || card < 0) {
|
||||
|
@ -111,6 +111,9 @@ gst_alsa_get_device_list (snd_pcm_stream_t stream)
|
|||
}
|
||||
}
|
||||
|
||||
snd_ctl_card_info_free (info);
|
||||
snd_pcm_info_free (pcminfo);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ gst_alsa_mixer_open (GstAlsaMixer * mixer)
|
|||
goto no_card_name;
|
||||
}
|
||||
|
||||
snd_ctl_card_info_alloca (&card_info);
|
||||
snd_ctl_card_info_malloc (&card_info);
|
||||
if ((err = snd_ctl_card_info (ctl, card_info)) < 0) {
|
||||
GST_WARNING ("Cannot get card info: %s", snd_strerror (err));
|
||||
snd_ctl_close (ctl);
|
||||
|
@ -99,6 +99,7 @@ gst_alsa_mixer_open (GstAlsaMixer * mixer)
|
|||
|
||||
mixer->cardname = g_strdup (snd_ctl_card_info_get_name (card_info));
|
||||
GST_DEBUG ("Card name = %s", GST_STR_NULL (mixer->cardname));
|
||||
snd_ctl_card_info_free (card_info);
|
||||
snd_ctl_close (ctl);
|
||||
|
||||
no_card_name:
|
||||
|
|
|
@ -333,7 +333,7 @@ set_hwparams (GstAlsaSink * alsa)
|
|||
snd_pcm_hw_params_t *params;
|
||||
guint period_time, buffer_time;
|
||||
|
||||
snd_pcm_hw_params_alloca (¶ms);
|
||||
snd_pcm_hw_params_malloc (¶ms);
|
||||
|
||||
GST_DEBUG_OBJECT (alsa, "Negotiating to %d channels @ %d Hz (format = %s)",
|
||||
alsa->channels, alsa->rate, snd_pcm_format_name (alsa->format));
|
||||
|
@ -423,6 +423,7 @@ retry:
|
|||
GST_DEBUG_OBJECT (alsa, "buffer size %lu, period size %lu", alsa->buffer_size,
|
||||
alsa->period_size);
|
||||
|
||||
snd_pcm_hw_params_free (params);
|
||||
return 0;
|
||||
|
||||
/* ERRORS */
|
||||
|
@ -431,18 +432,21 @@ no_config:
|
|||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Broken configuration for playback: no configurations available: %s",
|
||||
snd_strerror (err)));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
wrong_access:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Access type not available for playback: %s", snd_strerror (err)));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
no_sample_format:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Sample format not available for playback: %s", snd_strerror (err)));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
no_channels:
|
||||
|
@ -460,6 +464,7 @@ no_channels:
|
|||
alsa->channels);
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (msg), (snd_strerror (err)));
|
||||
g_free (msg);
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
no_rate:
|
||||
|
@ -473,24 +478,28 @@ rate_match:
|
|||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Rate doesn't match (requested %iHz, get %iHz)", alsa->rate, err));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return -EINVAL;
|
||||
}
|
||||
buffer_size:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to get buffer size for playback: %s", snd_strerror (err)));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
period_size:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to get period size for playback: %s", snd_strerror (err)));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
set_hw_params:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to set hw params for playback: %s", snd_strerror (err)));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
@ -501,7 +510,7 @@ set_swparams (GstAlsaSink * alsa)
|
|||
int err;
|
||||
snd_pcm_sw_params_t *params;
|
||||
|
||||
snd_pcm_sw_params_alloca (¶ms);
|
||||
snd_pcm_sw_params_malloc (¶ms);
|
||||
|
||||
/* get the current swparams */
|
||||
CHECK (snd_pcm_sw_params_current (alsa->handle, params), no_config);
|
||||
|
@ -520,6 +529,7 @@ set_swparams (GstAlsaSink * alsa)
|
|||
/* write the parameters to the playback device */
|
||||
CHECK (snd_pcm_sw_params (alsa->handle, params), set_sw_params);
|
||||
|
||||
snd_pcm_sw_params_free (params);
|
||||
return 0;
|
||||
|
||||
/* ERRORS */
|
||||
|
@ -528,6 +538,7 @@ no_config:
|
|||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to determine current swparams for playback: %s",
|
||||
snd_strerror (err)));
|
||||
snd_pcm_sw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
start_threshold:
|
||||
|
@ -535,24 +546,28 @@ start_threshold:
|
|||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to set start threshold mode for playback: %s",
|
||||
snd_strerror (err)));
|
||||
snd_pcm_sw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
set_avail:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to set avail min for playback: %s", snd_strerror (err)));
|
||||
snd_pcm_sw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
set_align:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to set transfer align for playback: %s", snd_strerror (err)));
|
||||
snd_pcm_sw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
set_sw_params:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to set sw params for playback: %s", snd_strerror (err)));
|
||||
snd_pcm_sw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -348,7 +348,7 @@ set_hwparams (GstAlsaSrc * alsa)
|
|||
gint err, dir;
|
||||
snd_pcm_hw_params_t *params;
|
||||
|
||||
snd_pcm_hw_params_alloca (¶ms);
|
||||
snd_pcm_hw_params_malloc (¶ms);
|
||||
|
||||
/* choose all parameters */
|
||||
CHECK (snd_pcm_hw_params_any (alsa->handle, params), no_config);
|
||||
|
@ -388,6 +388,7 @@ set_hwparams (GstAlsaSrc * alsa)
|
|||
CHECK (snd_pcm_hw_params_get_period_size (params, &alsa->period_size, &dir),
|
||||
period_size);
|
||||
|
||||
snd_pcm_hw_params_free (params);
|
||||
return 0;
|
||||
|
||||
/* ERRORS */
|
||||
|
@ -396,18 +397,21 @@ no_config:
|
|||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Broken configuration for recording: no configurations available: %s",
|
||||
snd_strerror (err)));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
wrong_access:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Access type not available for recording: %s", snd_strerror (err)));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
no_sample_format:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Sample format not available for recording: %s", snd_strerror (err)));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
no_channels:
|
||||
|
@ -425,6 +429,7 @@ no_channels:
|
|||
alsa->channels);
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (msg), (snd_strerror (err)));
|
||||
g_free (msg);
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
no_rate:
|
||||
|
@ -432,12 +437,14 @@ no_rate:
|
|||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Rate %iHz not available for recording: %s",
|
||||
alsa->rate, snd_strerror (err)));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
rate_match:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Rate doesn't match (requested %iHz, get %iHz)", alsa->rate, err));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return -EINVAL;
|
||||
}
|
||||
buffer_time:
|
||||
|
@ -445,12 +452,14 @@ buffer_time:
|
|||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to set buffer time %i for recording: %s",
|
||||
alsa->buffer_time, snd_strerror (err)));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
buffer_size:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to get buffer size for recording: %s", snd_strerror (err)));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
period_time:
|
||||
|
@ -458,18 +467,21 @@ period_time:
|
|||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to set period time %i for recording: %s", alsa->period_time,
|
||||
snd_strerror (err)));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
period_size:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to get period size for recording: %s", snd_strerror (err)));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
set_hw_params:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to set hw params for recording: %s", snd_strerror (err)));
|
||||
snd_pcm_hw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
@ -480,7 +492,7 @@ set_swparams (GstAlsaSrc * alsa)
|
|||
int err;
|
||||
snd_pcm_sw_params_t *params;
|
||||
|
||||
snd_pcm_sw_params_alloca (¶ms);
|
||||
snd_pcm_sw_params_malloc (¶ms);
|
||||
|
||||
/* get the current swparams */
|
||||
CHECK (snd_pcm_sw_params_current (alsa->handle, params), no_config);
|
||||
|
@ -496,6 +508,7 @@ set_swparams (GstAlsaSrc * alsa)
|
|||
/* write the parameters to the recording device */
|
||||
CHECK (snd_pcm_sw_params (alsa->handle, params), set_sw_params);
|
||||
|
||||
snd_pcm_sw_params_free (params);
|
||||
return 0;
|
||||
|
||||
/* ERRORS */
|
||||
|
@ -504,6 +517,7 @@ no_config:
|
|||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to determine current swparams for playback: %s",
|
||||
snd_strerror (err)));
|
||||
snd_pcm_sw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
start_threshold:
|
||||
|
@ -511,24 +525,28 @@ start_threshold:
|
|||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to set start threshold mode for playback: %s",
|
||||
snd_strerror (err)));
|
||||
snd_pcm_sw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
set_avail:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to set avail min for playback: %s", snd_strerror (err)));
|
||||
snd_pcm_sw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
set_align:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to set transfer align for playback: %s", snd_strerror (err)));
|
||||
snd_pcm_sw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
set_sw_params:
|
||||
{
|
||||
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
|
||||
("Unable to set sw params for playback: %s", snd_strerror (err)));
|
||||
snd_pcm_sw_params_free (params);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue