+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>
- 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),
(volume_update_real_volume), (gst_volume_set_volume),
$(GST_CFLAGS) \
$(ALSA_CFLAGS)
libgstalsa_la_LIBADD = \
- $(GST_PLUGINS_BASE_LIBS) \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-$(GST_MAJORMINOR).la \
$(GST_BASE_LIBS) \
static const struct
{
+ const int width;
+ const int depth;
const int sformat;
const int uformat;
-} pcmformats[4] = {
+} pcmformats[] = {
{
- SND_PCM_FORMAT_S8, SND_PCM_FORMAT_U8}, {
- SND_PCM_FORMAT_S16, SND_PCM_FORMAT_U16}, {
- SND_PCM_FORMAT_UNKNOWN, SND_PCM_FORMAT_UNKNOWN}, {
- SND_PCM_FORMAT_S32, SND_PCM_FORMAT_U32}
+ 8, 8, SND_PCM_FORMAT_S8, SND_PCM_FORMAT_U8}, {
+ 16, 16, SND_PCM_FORMAT_S16, SND_PCM_FORMAT_U16}, {
+ 32, 24, SND_PCM_FORMAT_S24, SND_PCM_FORMAT_U24}, {
+#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 *
for (i = 0; i < gst_caps_get_size (in_caps); ++i) {
GstStructure *scopy;
- gint w, width = 0;
+ gint w, width = 0, depth = 0;
s = gst_caps_get_structure (in_caps, i);
if (!gst_structure_has_name (s, "audio/x-raw-int")) {
GST_WARNING_OBJECT (obj, "skipping non-int format");
continue;
}
- gst_structure_get_int (s, "width", &width);
- g_assert (width != 0 && (width % 8) == 0);
- w = (width / 8) - 1;
+ if (!gst_structure_get_int (s, "width", &width) ||
+ !gst_structure_get_int (s, "depth", &depth))
+ 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) &&
snd_pcm_format_mask_test (mask, pcmformats[w].uformat)) {
/* template contains { true, false } or just one, leave it as it is */
"audio/x-raw-int, "
"endianness = (int) { " ALSA_SINK_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_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, "
"depth = (int) 16, "
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
{
GstAlsaSink *alsa;
snd_pcm_sframes_t delay;
+ int res;
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;
}
"audio/x-raw-int, "
"endianness = (int) { " ALSA_SRC_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_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, "
"depth = (int) 16, "
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
{
GstAlsaSrc *alsa;
snd_pcm_sframes_t delay;
+ int res;
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);
}
libgstaudioconvert_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstaudioconvert_la_LIBADD = \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
- $(GST_LIBS) $(GST_BASE_LIBS)
+ $(GST_BASE_LIBS) $(GST_LIBS)
noinst_HEADERS = \
gstaudioconvert.h \