ext/alsa/: Don't use snd_pcm_sw_params_set_xfer_align() if we're compiling against libasound >= 1.0.16, since it's be...

Original commit message from CVS:
* ext/alsa/gstalsa.h: (GST_CHECK_ALSA_VERSION):
* ext/alsa/gstalsasink.c: (set_swparams):
* ext/alsa/gstalsasrc.c: (set_swparams), (gst_alsasrc_open):
Don't use snd_pcm_sw_params_set_xfer_align() if we're compiling
against libasound >= 1.0.16, since it's been deprecated in
0.10.16, and alignment is always 1 then, apparently. (#512899)
This commit is contained in:
Tim-Philipp Müller 2008-02-11 20:23:44 +00:00
parent 1d9e1d6a3d
commit 5f1cc19bef
4 changed files with 29 additions and 0 deletions

View file

@ -1,3 +1,12 @@
2008-02-11 Tim-Philipp Müller <tim at centricular dot net>
* ext/alsa/gstalsa.h: (GST_CHECK_ALSA_VERSION):
* ext/alsa/gstalsasink.c: (set_swparams):
* ext/alsa/gstalsasrc.c: (set_swparams), (gst_alsasrc_open):
Don't use snd_pcm_sw_params_set_xfer_align() if we're compiling
against libasound >= 1.0.16, since it's been deprecated in
0.10.16, and alignment is always 1 then, apparently. (#512899)
2008-02-11 Tim-Philipp Müller <tim at centricular dot net>
* gst/playback/gstplaybin.c: (gen_audio_element):

View file

@ -32,6 +32,12 @@
#include <alsa/error.h>
#include <gst/gst.h>
#define GST_CHECK_ALSA_VERSION(major,minor,micro) \
(SND_LIB_MAJOR > (major) || \
(SND_LIB_MAJOR == (major) && SND_LIB_MINOR > (minor)) || \
(SND_LIB_MAJOR == (major) && SND_LIB_MINOR == (minor) && \
SND_LIB_SUBMINOR >= (micro)))
GST_DEBUG_CATEGORY_EXTERN (alsa_debug);
#define GST_CAT_DEFAULT alsa_debug

View file

@ -523,8 +523,13 @@ set_swparams (GstAlsaSink * alsa)
/* allow the transfer when at least period_size samples can be processed */
CHECK (snd_pcm_sw_params_set_avail_min (alsa->handle, params,
alsa->period_size), set_avail);
#if GST_CHECK_ALSA_VERSION(1,0,16)
/* snd_pcm_sw_params_set_xfer_align() is deprecated, alignment is always 1 */
#else
/* align all transfers to 1 sample */
CHECK (snd_pcm_sw_params_set_xfer_align (alsa->handle, params, 1), set_align);
#endif
/* write the parameters to the playback device */
CHECK (snd_pcm_sw_params (alsa->handle, params), set_sw_params);
@ -556,6 +561,7 @@ set_avail:
snd_pcm_sw_params_free (params);
return err;
}
#if !GST_CHECK_ALSA_VERSION(1,0,16)
set_align:
{
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
@ -563,6 +569,7 @@ set_align:
snd_pcm_sw_params_free (params);
return err;
}
#endif
set_sw_params:
{
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),

View file

@ -502,8 +502,13 @@ set_swparams (GstAlsaSrc * alsa)
/* start the transfer on first read */
CHECK (snd_pcm_sw_params_set_start_threshold (alsa->handle, params,
0), start_threshold);
#if GST_CHECK_ALSA_VERSION(1,0,16)
/* snd_pcm_sw_params_set_xfer_align() is deprecated, alignment is always 1 */
#else
/* align all transfers to 1 sample */
CHECK (snd_pcm_sw_params_set_xfer_align (alsa->handle, params, 1), set_align);
#endif
/* write the parameters to the recording device */
CHECK (snd_pcm_sw_params (alsa->handle, params), set_sw_params);
@ -535,6 +540,7 @@ set_avail:
snd_pcm_sw_params_free (params);
return err;
}
#if !GST_CHECK_ALSA_VERSION(1,0,16)
set_align:
{
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
@ -542,6 +548,7 @@ set_align:
snd_pcm_sw_params_free (params);
return err;
}
#endif
set_sw_params:
{
GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),