ext/alsa/Makefile.am: There is no GST_PLUGINS_BASE_LIBS defined.

Original commit message from CVS:
* ext/alsa/Makefile.am:
There is no GST_PLUGINS_BASE_LIBS defined.
* ext/alsa/gstalsa.c:
* ext/alsa/gstalsasink.c: (gst_alsasink_delay):
* ext/alsa/gstalsasrc.c: (gst_alsasrc_delay):
Add support for ALSA 24-bit formats.
snd_pcm_delay can return an error code, especially
during XRUNS. In that case, the best we can do is assume
delay = 0.
* gst/audioconvert/Makefile.am:
Add flags from -base before any more-remote dependencies.
This commit is contained in:
Jan Schmidt 2007-08-24 15:28:33 +00:00
parent bad084b01e
commit fc50d2dc64
6 changed files with 78 additions and 14 deletions

View File

@ -1,6 +1,22 @@
2007-08-24 Jan Schmidt <thaytan@mad.scientist.com>
* ext/alsa/Makefile.am:
There is no GST_PLUGINS_BASE_LIBS defined.
* ext/alsa/gstalsa.c:
* ext/alsa/gstalsasink.c: (gst_alsasink_delay):
* ext/alsa/gstalsasrc.c: (gst_alsasrc_delay):
Add support for ALSA 24-bit formats.
snd_pcm_delay can return an error code, especially
during XRUNS. In that case, the best we can do is assume
delay = 0.
* gst/audioconvert/Makefile.am:
Add flags from -base before any more-remote dependencies.
2007-08-23 Sebastian Dröge <slomo@circular-chaos.org> 2007-08-23 Sebastian Dröge <slomo@circular-chaos.org>
Based on a patch by: Davyd <davyd at madeley dot id dot au> Based on a patch by: Davyd Madeley <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func), * gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume), (volume_update_real_volume), (gst_volume_set_volume),

View File

@ -17,7 +17,6 @@ libgstalsa_la_CFLAGS = \
$(GST_CFLAGS) \ $(GST_CFLAGS) \
$(ALSA_CFLAGS) $(ALSA_CFLAGS)
libgstalsa_la_LIBADD = \ libgstalsa_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \ $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-$(GST_MAJORMINOR).la \ $(top_builddir)/gst-libs/gst/audio/libgstaudio-$(GST_MAJORMINOR).la \
$(GST_BASE_LIBS) \ $(GST_BASE_LIBS) \

View File

@ -84,14 +84,21 @@ max_rate_err:
static const struct static const struct
{ {
const int width;
const int depth;
const int sformat; const int sformat;
const int uformat; const int uformat;
} pcmformats[4] = { } pcmformats[] = {
{ {
SND_PCM_FORMAT_S8, SND_PCM_FORMAT_U8}, { 8, 8, SND_PCM_FORMAT_S8, SND_PCM_FORMAT_U8}, {
SND_PCM_FORMAT_S16, SND_PCM_FORMAT_U16}, { 16, 16, SND_PCM_FORMAT_S16, SND_PCM_FORMAT_U16}, {
SND_PCM_FORMAT_UNKNOWN, SND_PCM_FORMAT_UNKNOWN}, { 32, 24, SND_PCM_FORMAT_S24, SND_PCM_FORMAT_U24}, {
SND_PCM_FORMAT_S32, SND_PCM_FORMAT_U32} #if (G_BYTE_ORDER == G_LITTLE_ENDIAN) /* no endian-unspecific enum available */
24, 24, SND_PCM_FORMAT_S24_3LE, SND_PCM_FORMAT_U24_3LE}, {
#else
24, 24, SND_PCM_FORMAT_S24_3BE, SND_PCM_FORMAT_U24_3BE},}
#endif
32, 32, SND_PCM_FORMAT_S32, SND_PCM_FORMAT_U32}
}; };
static GstCaps * static GstCaps *
@ -110,16 +117,24 @@ gst_alsa_detect_formats (GstObject * obj, snd_pcm_hw_params_t * hw_params,
for (i = 0; i < gst_caps_get_size (in_caps); ++i) { for (i = 0; i < gst_caps_get_size (in_caps); ++i) {
GstStructure *scopy; GstStructure *scopy;
gint w, width = 0; gint w, width = 0, depth = 0;
s = gst_caps_get_structure (in_caps, i); s = gst_caps_get_structure (in_caps, i);
if (!gst_structure_has_name (s, "audio/x-raw-int")) { if (!gst_structure_has_name (s, "audio/x-raw-int")) {
GST_WARNING_OBJECT (obj, "skipping non-int format"); GST_WARNING_OBJECT (obj, "skipping non-int format");
continue; continue;
} }
gst_structure_get_int (s, "width", &width); if (!gst_structure_get_int (s, "width", &width) ||
g_assert (width != 0 && (width % 8) == 0); !gst_structure_get_int (s, "depth", &depth))
w = (width / 8) - 1; continue;
if (width == 0 || (width % 8) != 0)
continue; /* Only full byte widths are valid */
for (w = 0; w < G_N_ELEMENTS (pcmformats); w++)
if (pcmformats[w].width == width && pcmformats[w].depth == depth)
break;
if (w == G_N_ELEMENTS (pcmformats))
continue; /* Unknown format */
if (snd_pcm_format_mask_test (mask, pcmformats[w].sformat) && if (snd_pcm_format_mask_test (mask, pcmformats[w].sformat) &&
snd_pcm_format_mask_test (mask, pcmformats[w].uformat)) { snd_pcm_format_mask_test (mask, pcmformats[w].uformat)) {
/* template contains { true, false } or just one, leave it as it is */ /* template contains { true, false } or just one, leave it as it is */

View File

@ -122,6 +122,18 @@ static GstStaticPadTemplate alsasink_sink_factory =
"audio/x-raw-int, " "audio/x-raw-int, "
"endianness = (int) { " ALSA_SINK_FACTORY_ENDIANNESS " }, " "endianness = (int) { " ALSA_SINK_FACTORY_ENDIANNESS " }, "
"signed = (boolean) { TRUE, FALSE }, " "signed = (boolean) { TRUE, FALSE }, "
"width = (int) 24, "
"depth = (int) 24, "
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
"audio/x-raw-int, "
"endianness = (int) { " ALSA_SINK_FACTORY_ENDIANNESS " }, "
"signed = (boolean) { TRUE, FALSE }, "
"width = (int) 32, "
"depth = (int) 24, "
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
"audio/x-raw-int, "
"endianness = (int) { " ALSA_SINK_FACTORY_ENDIANNESS " }, "
"signed = (boolean) { TRUE, FALSE }, "
"width = (int) 16, " "width = (int) 16, "
"depth = (int) 16, " "depth = (int) 16, "
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; " "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
@ -815,10 +827,15 @@ gst_alsasink_delay (GstAudioSink * asink)
{ {
GstAlsaSink *alsa; GstAlsaSink *alsa;
snd_pcm_sframes_t delay; snd_pcm_sframes_t delay;
int res;
alsa = GST_ALSA_SINK (asink); alsa = GST_ALSA_SINK (asink);
snd_pcm_delay (alsa->handle, &delay); res = snd_pcm_delay (alsa->handle, &delay);
if (G_UNLIKELY (res < 0)) {
GST_DEBUG_OBJECT (alsa, "snd_pcm_delay returned %d", res);
delay = 0;
}
return delay; return delay;
} }

View File

@ -122,6 +122,18 @@ static GstStaticPadTemplate alsasrc_src_factory =
"audio/x-raw-int, " "audio/x-raw-int, "
"endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, " "endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, "
"signed = (boolean) { TRUE, FALSE }, " "signed = (boolean) { TRUE, FALSE }, "
"width = (int) 32, "
"depth = (int) 24, "
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
"audio/x-raw-int, "
"endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, "
"signed = (boolean) { TRUE, FALSE }, "
"width = (int) 24, "
"depth = (int) 24, "
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
"audio/x-raw-int, "
"endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, "
"signed = (boolean) { TRUE, FALSE }, "
"width = (int) 16, " "width = (int) 16, "
"depth = (int) 16, " "depth = (int) 16, "
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; " "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
@ -792,10 +804,15 @@ gst_alsasrc_delay (GstAudioSrc * asrc)
{ {
GstAlsaSrc *alsa; GstAlsaSrc *alsa;
snd_pcm_sframes_t delay; snd_pcm_sframes_t delay;
int res;
alsa = GST_ALSA_SRC (asrc); alsa = GST_ALSA_SRC (asrc);
snd_pcm_delay (alsa->handle, &delay); res = snd_pcm_delay (alsa->handle, &delay);
if (G_UNLIKELY (res < 0)) {
GST_DEBUG_OBJECT (alsa, "snd_pcm_delay returned %d", res);
delay = 0;
}
return CLAMP (delay, 0, alsa->buffer_size); return CLAMP (delay, 0, alsa->buffer_size);
} }

View File

@ -11,7 +11,7 @@ libgstaudioconvert_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(G
libgstaudioconvert_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstaudioconvert_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstaudioconvert_la_LIBADD = \ libgstaudioconvert_la_LIBADD = \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \ $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
$(GST_LIBS) $(GST_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS)
noinst_HEADERS = \ noinst_HEADERS = \
gstaudioconvert.h \ gstaudioconvert.h \