Hello community,
here is the log from the commit of package alsa-plugins for openSUSE:Factory
checked in at Tue Sep 1 22:50:27 CEST 2009.
--------
--- alsa-plugins/alsa-plugins.changes 2009-08-07 17:54:25.000000000 +0200
+++ alsa-plugins/alsa-plugins.changes 2009-08-31 16:26:31.000000000 +0200
@@ -1,0 +2,6 @@
+Mon Aug 31 16:22:11 CEST 2009 - tiwai@suse.de
+
+- updated to version 1.0.21:
+ just a version bump including previous fixes
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
alsa-plugins-1.0.20.tar.bz2
alsa-plugins-git-fixes.diff
New:
----
alsa-plugins-1.0.21.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ alsa-plugins.spec ++++++
--- /var/tmp/diff_new_pack.GmgeZh/_old 2009-09-01 22:50:16.000000000 +0200
+++ /var/tmp/diff_new_pack.GmgeZh/_new 2009-09-01 22:50:16.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package alsa-plugins (Version 1.0.20)
+# spec file for package alsa-plugins (Version 1.0.21)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -34,18 +34,18 @@
%if %build_speex
BuildRequires: speex-devel
%endif
-%define package_version 1.0.20
+%define package_version 1.0.21
Url: http://www.alsa-project.org/
Summary: Extra Plug-Ins for the ALSA Library
-Version: 1.0.20
-Release: 7
+Version: 1.0.21
+Release: 1
License: BSD 3-clause (or similar) ; GPL v2 or later ; LGPL v2.1 or later
Group: System/Libraries
AutoReqProv: on
Source: ftp://ftp.alsa-project.org/pub/plugins/alsa-plugins-%{package_version}.tar.bz2
Source1: asound-pulse.conf
Source2: alsa-pulse.conf
-Patch: alsa-plugins-git-fixes.diff
+# Patch: alsa-plugins-git-fixes.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@@ -148,7 +148,7 @@
%prep
%setup -q -n %{name}-%{package_version}
-%patch -p1
+# %patch -p1
%build
autoreconf -fi
++++++ alsa-plugins-1.0.20.tar.bz2 -> alsa-plugins-1.0.21.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/alsa-plugins-1.0.20/configure new/alsa-plugins-1.0.21/configure
--- old/alsa-plugins-1.0.20/configure 2009-05-06 09:16:57.000000000 +0200
+++ new/alsa-plugins-1.0.21/configure 2009-08-31 15:16:47.000000000 +0200
@@ -2302,7 +2302,7 @@
# Define the identity of the package.
PACKAGE=alsa-plugins
- VERSION=1.0.20
+ VERSION=1.0.21
cat >>confdefs.h <<_ACEOF
@@ -20460,12 +20460,12 @@
pkg_cv_pulseaudio_CFLAGS="$pulseaudio_CFLAGS"
else
if test -n "$PKG_CONFIG" && \
- { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libpulse >= 0.9.2\"") >&5
- ($PKG_CONFIG --exists --print-errors "libpulse >= 0.9.2") 2>&5
+ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libpulse >= 0.9.11\"") >&5
+ ($PKG_CONFIG --exists --print-errors "libpulse >= 0.9.11") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- pkg_cv_pulseaudio_CFLAGS=`$PKG_CONFIG --cflags "libpulse >= 0.9.2" 2>/dev/null`
+ pkg_cv_pulseaudio_CFLAGS=`$PKG_CONFIG --cflags "libpulse >= 0.9.11" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -20478,12 +20478,12 @@
pkg_cv_pulseaudio_LIBS="$pulseaudio_LIBS"
else
if test -n "$PKG_CONFIG" && \
- { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libpulse >= 0.9.2\"") >&5
- ($PKG_CONFIG --exists --print-errors "libpulse >= 0.9.2") 2>&5
+ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libpulse >= 0.9.11\"") >&5
+ ($PKG_CONFIG --exists --print-errors "libpulse >= 0.9.11") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- pkg_cv_pulseaudio_LIBS=`$PKG_CONFIG --libs "libpulse >= 0.9.2" 2>/dev/null`
+ pkg_cv_pulseaudio_LIBS=`$PKG_CONFIG --libs "libpulse >= 0.9.11" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -20502,9 +20502,9 @@
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- pulseaudio_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libpulse >= 0.9.2"`
+ pulseaudio_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libpulse >= 0.9.11"`
else
- pulseaudio_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libpulse >= 0.9.2"`
+ pulseaudio_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libpulse >= 0.9.11"`
fi
# Put the nasty error message in config.log where it belongs
echo "$pulseaudio_PKG_ERRORS" >&5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/alsa-plugins-1.0.20/configure.in new/alsa-plugins-1.0.21/configure.in
--- old/alsa-plugins-1.0.20/configure.in 2009-05-06 09:07:28.000000000 +0200
+++ new/alsa-plugins-1.0.21/configure.in 2009-08-31 15:09:41.000000000 +0200
@@ -1,6 +1,6 @@
AC_PREREQ(2.59)
AC_INIT(oss/pcm_oss.c)
-AM_INIT_AUTOMAKE(alsa-plugins, 1.0.20)
+AM_INIT_AUTOMAKE(alsa-plugins, 1.0.21)
AC_PREFIX_DEFAULT(/usr)
AC_CONFIG_HEADERS(config.h)
@@ -30,7 +30,7 @@
AS_HELP_STRING([--disable-pulseaudio], [Disable building of pulseaudio plugin]))
if test "x$enable_pulseaudio" != "xno"; then
- PKG_CHECK_MODULES(pulseaudio, [libpulse >= 0.9.2], [HAVE_PULSE=yes], [HAVE_PULSE=no])
+ PKG_CHECK_MODULES(pulseaudio, [libpulse >= 0.9.11], [HAVE_PULSE=yes], [HAVE_PULSE=no])
fi
AM_CONDITIONAL(HAVE_PULSE, test x$HAVE_PULSE = xyes)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/alsa-plugins-1.0.20/doc/speexdsp.txt new/alsa-plugins-1.0.21/doc/speexdsp.txt
--- old/alsa-plugins-1.0.20/doc/speexdsp.txt 2009-05-06 09:07:28.000000000 +0200
+++ new/alsa-plugins-1.0.21/doc/speexdsp.txt 2009-08-31 15:09:41.000000000 +0200
@@ -12,7 +12,7 @@
Then record like
- % arecord -fdat -c1 -Dplug:speex foo.wav
+ % arecord -fdat -c1 -Dplug:my_pcm foo.wav
so that you'll get 48kHz mono stream with the denoising effect.
@@ -44,6 +44,15 @@
A boolean value to enable/disable dereverb function. Default is no.
+* echo
+
+ A boolean value to enable/disable echo-cancellation function.
+ Default is no.
+
+* filter_length
+
+ Number of samples of echo to cancel. As default it's 256.
+
For example, you can enable agc like
pcm.my_pcm {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/alsa-plugins-1.0.20/oss/pcm_oss.c new/alsa-plugins-1.0.21/oss/pcm_oss.c
--- old/alsa-plugins-1.0.20/oss/pcm_oss.c 2009-05-06 09:07:28.000000000 +0200
+++ new/alsa-plugins-1.0.21/oss/pcm_oss.c 2009-08-31 15:09:41.000000000 +0200
@@ -181,6 +181,7 @@
fprintf(stderr, "*** OSS: invalid period size %d\n", (int)io->period_size);
return -EINVAL;
}
+ oss->periods = io->buffer_size / io->period_size;
_retry:
tmp = oss->period_shift | (oss->periods << 16);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/alsa-plugins-1.0.20/pph/rate_speexrate.c new/alsa-plugins-1.0.21/pph/rate_speexrate.c
--- old/alsa-plugins-1.0.20/pph/rate_speexrate.c 2009-05-06 09:07:28.000000000 +0200
+++ new/alsa-plugins-1.0.21/pph/rate_speexrate.c 2009-08-31 15:09:41.000000000 +0200
@@ -116,6 +116,26 @@
free(obj);
}
+#if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
+static int get_supported_rates(void *obj, unsigned int *rate_min,
+ unsigned int *rate_max)
+{
+ *rate_min = *rate_max = 0; /* both unlimited */
+ return 0;
+}
+
+static void dump(void *obj, snd_output_t *out)
+{
+ snd_output_printf(out, "Converter: libspeex "
+#ifdef USE_LIBSPEEX
+ "(external)"
+#else
+ "(builtin)"
+#endif
+ "\n");
+}
+#endif
+
static snd_pcm_rate_ops_t pcm_src_ops = {
.close = pcm_src_close,
.init = pcm_src_init,
@@ -125,6 +145,11 @@
.convert_s16 = pcm_src_convert_s16,
.input_frames = input_frames,
.output_frames = output_frames,
+#if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
+ .version = SND_PCM_RATE_PLUGIN_VERSION,
+ .get_supported_rates = get_supported_rates,
+ .dump = dump,
+#endif
};
static int pcm_src_open(unsigned int version, void **objp,
@@ -132,18 +157,24 @@
{
struct rate_src *rate;
+#if SND_PCM_RATE_PLUGIN_VERSION < 0x010002
if (version != SND_PCM_RATE_PLUGIN_VERSION) {
fprintf(stderr, "Invalid rate plugin version %x\n", version);
return -EINVAL;
}
-
+#endif
rate = calloc(1, sizeof(*rate));
if (! rate)
return -ENOMEM;
rate->quality = quality;
*objp = rate;
- *ops = pcm_src_ops;
+#if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
+ if (version == 0x010001)
+ memcpy(ops, &pcm_src_ops, sizeof(snd_pcm_rate_old_ops_t));
+ else
+#endif
+ *ops = pcm_src_ops;
return 0;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/alsa-plugins-1.0.20/pulse/conf_pulse.c new/alsa-plugins-1.0.21/pulse/conf_pulse.c
--- old/alsa-plugins-1.0.20/pulse/conf_pulse.c 2009-05-06 09:07:28.000000000 +0200
+++ new/alsa-plugins-1.0.21/pulse/conf_pulse.c 2009-08-31 15:09:41.000000000 +0200
@@ -61,15 +61,7 @@
goto out;
do {
- err = pa_mainloop_prepare(loop, -1);
- if (err < 0)
- goto out;
-
- err = pa_mainloop_poll(loop);
- if (err < 0)
- goto out;
-
- err = pa_mainloop_dispatch(loop);
+ err = pa_mainloop_iterate(loop, 1, NULL);
if (err < 0)
goto out;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/alsa-plugins-1.0.20/pulse/ctl_pulse.c new/alsa-plugins-1.0.21/pulse/ctl_pulse.c
--- old/alsa-plugins-1.0.20/pulse/ctl_pulse.c 2009-05-06 09:07:28.000000000 +0200
+++ new/alsa-plugins-1.0.21/pulse/ctl_pulse.c 2009-08-31 15:09:41.000000000 +0200
@@ -125,8 +125,9 @@
pa_operation *o;
assert(ctl);
- assert(ctl->p);
- assert(ctl->p->context);
+
+ if (!ctl->p || !ctl->p->mainloop || !ctl->p->context)
+ return;
o = pa_context_get_sink_info_by_name(ctl->p->context, ctl->sink,
sink_info_cb, ctl);
@@ -148,8 +149,13 @@
pa_operation *o;
assert(ctl);
- assert(ctl->p);
- assert(ctl->p->context);
+
+ if (!ctl->p)
+ return -EBADFD;
+
+ err = pulse_check_connection(ctl->p);
+ if (err < 0)
+ return err;
o = pa_context_get_sink_info_by_name(ctl->p->context, ctl->sink,
sink_info_cb, ctl);
@@ -180,17 +186,27 @@
static int pulse_elem_count(snd_ctl_ext_t * ext)
{
snd_ctl_pulse_t *ctl = ext->private_data;
- int count = 0;
+ int count = 0, err;
assert(ctl);
+ if (!ctl->p || !ctl->p->mainloop)
+ return -EBADFD;
+
pa_threaded_mainloop_lock(ctl->p->mainloop);
+ err = pulse_check_connection(ctl->p);
+ if (err < 0) {
+ count = err;
+ goto finish;
+ }
+
if (ctl->source)
count += 2;
if (ctl->sink)
count += 2;
+finish:
pa_threaded_mainloop_unlock(ctl->p->mainloop);
return count;
@@ -200,13 +216,21 @@
snd_ctl_elem_id_t * id)
{
snd_ctl_pulse_t *ctl = ext->private_data;
+ int err;
assert(ctl);
+ if (!ctl->p || !ctl->p->mainloop)
+ return -EBADFD;
+
snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER);
pa_threaded_mainloop_lock(ctl->p->mainloop);
+ err = pulse_check_connection(ctl->p);
+ if (err < 0)
+ goto finish;
+
if (ctl->source) {
if (offset == 0)
snd_ctl_elem_id_set_name(id, SOURCE_VOL_NAME);
@@ -215,14 +239,19 @@
} else
offset += 2;
+ err = 0;
+
+finish:
pa_threaded_mainloop_unlock(ctl->p->mainloop);
- if (offset == 2)
- snd_ctl_elem_id_set_name(id, SINK_VOL_NAME);
- else if (offset == 3)
- snd_ctl_elem_id_set_name(id, SINK_MUTE_NAME);
+ if (err >= 0) {
+ if (offset == 2)
+ snd_ctl_elem_id_set_name(id, SINK_VOL_NAME);
+ else if (offset == 3)
+ snd_ctl_elem_id_set_name(id, SINK_MUTE_NAME);
+ }
- return 0;
+ return err;
}
static snd_ctl_ext_key_t pulse_find_elem(snd_ctl_ext_t * ext,
@@ -260,7 +289,9 @@
return -EINVAL;
assert(ctl);
- assert(ctl->p);
+
+ if (!ctl->p || !ctl->p->mainloop)
+ return -EBADFD;
pa_threaded_mainloop_lock(ctl->p->mainloop);
@@ -311,7 +342,9 @@
pa_cvolume *vol = NULL;
assert(ctl);
- assert(ctl->p);
+
+ if (!ctl->p || !ctl->p->mainloop)
+ return -EBADFD;
pa_threaded_mainloop_lock(ctl->p->mainloop);
@@ -361,7 +394,9 @@
pa_cvolume *vol = NULL;
assert(ctl);
- assert(ctl->p && ctl->p->context);
+
+ if (!ctl->p || !ctl->p->mainloop)
+ return -EBADFD;
pa_threaded_mainloop_lock(ctl->p->mainloop);
@@ -465,6 +500,9 @@
assert(ctl);
+ if (!ctl->p || !ctl->p->mainloop)
+ return;
+
pa_threaded_mainloop_lock(ctl->p->mainloop);
ctl->subscribed = !!(subscribe & SND_CTL_EVENT_MASK_VALUE);
@@ -477,15 +515,24 @@
{
snd_ctl_pulse_t *ctl = ext->private_data;
int offset;
- int err = -EAGAIN;
+ int err;
assert(ctl);
+ if (!ctl->p || !ctl->p->mainloop)
+ return -EBADFD;
+
pa_threaded_mainloop_lock(ctl->p->mainloop);
- if (!ctl->updated || !ctl->subscribed)
+ err = pulse_check_connection(ctl->p);
+ if (err < 0)
goto finish;
+ if (!ctl->updated || !ctl->subscribed) {
+ err = -EAGAIN;
+ goto finish;
+ }
+
if (ctl->source)
offset = 2;
else
@@ -523,18 +570,28 @@
unsigned short *revents)
{
snd_ctl_pulse_t *ctl = ext->private_data;
- int err = 0;
+ int err;
assert(ctl);
- assert(ctl->p);
+
+ if (!ctl->p || !ctl->p->mainloop)
+ return -EBADFD;
pa_threaded_mainloop_lock(ctl->p->mainloop);
+ err = pulse_check_connection(ctl->p);
+ if (err < 0)
+ goto finish;
+
if (ctl->updated)
*revents = POLLIN;
else
*revents = 0;
+ err = 0;
+
+finish:
+
pa_threaded_mainloop_unlock(ctl->p->mainloop);
return err;
@@ -549,11 +606,8 @@
if (ctl->p)
pulse_free(ctl->p);
- if (ctl->source)
- free(ctl->source);
- if (ctl->sink)
- free(ctl->sink);
-
+ free(ctl->source);
+ free(ctl->sink);
free(ctl);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/alsa-plugins-1.0.20/pulse/pcm_pulse.c new/alsa-plugins-1.0.21/pulse/pcm_pulse.c
--- old/alsa-plugins-1.0.20/pulse/pcm_pulse.c 2009-05-06 09:07:28.000000000 +0200
+++ new/alsa-plugins-1.0.21/pulse/pcm_pulse.c 2009-08-31 15:09:41.000000000 +0200
@@ -49,6 +49,32 @@
pa_buffer_attr buffer_attr;
} snd_pcm_pulse_t;
+static int check_stream(snd_pcm_pulse_t *pcm)
+{
+ int err;
+ pa_stream_state_t state;
+
+ assert(pcm);
+
+ if (!pcm->p)
+ return -EBADFD;
+
+ err = pulse_check_connection(pcm->p);
+ if (err < 0)
+ return err;
+
+ if (!pcm->stream)
+ return -EBADFD;
+
+ state = pa_stream_get_state(pcm->stream);
+ if (!PA_STREAM_IS_GOOD(state))
+ return -EIO;
+
+ err = 0;
+
+ return err;
+}
+
static int update_ptr(snd_pcm_pulse_t *pcm)
{
size_t size;
@@ -106,18 +132,69 @@
assert(pcm);
- ret = check_active(pcm);
+ if (!pcm->p)
+ return -EBADFD;
+
+ ret = check_stream(pcm);
if (ret < 0)
- return ret;
+ goto finish;
+
+ ret = check_active(pcm);
+
+finish:
- if (ret > 0)
+ if (ret != 0) /* On error signal the caller, too */
pulse_poll_activate(pcm->p);
else
pulse_poll_deactivate(pcm->p);
+ return ret;
+}
+
+static int wait_stream_state(snd_pcm_pulse_t *pcm, pa_stream_state_t target)
+{
+ pa_stream_state_t state;
+
+ assert(pcm);
+
+ if (!pcm->p)
+ return -EBADFD;
+
+ for (;;) {
+ int err;
+
+ err = pulse_check_connection(pcm->p);
+ if (err < 0)
+ return err;
+
+ if (!pcm->stream)
+ return -EBADFD;
+
+ state = pa_stream_get_state(pcm->stream);
+ if (state == target)
+ break;
+
+ if (!PA_STREAM_IS_GOOD(state))
+ return -EIO;
+
+ pa_threaded_mainloop_wait(pcm->p->mainloop);
+ }
+
return 0;
}
+static void stream_success_cb(pa_stream * p, int success, void *userdata)
+{
+ snd_pcm_pulse_t *pcm = userdata;
+
+ assert(pcm);
+
+ if (!pcm->p)
+ return;
+
+ pa_threaded_mainloop_signal(pcm->p->mainloop, 0);
+}
+
static int pulse_start(snd_pcm_ioplug_t * io)
{
snd_pcm_pulse_t *pcm = io->private_data;
@@ -125,26 +202,23 @@
int err = 0, err_o = 0, err_u = 0;
assert(pcm);
- assert(pcm->p);
+
+ if (!pcm->p || !pcm->p->mainloop)
+ return -EBADFD;
pa_threaded_mainloop_lock(pcm->p->mainloop);
- err = pulse_check_connection(pcm->p);
+ err = check_stream(pcm);
if (err < 0)
goto finish;
- if (pcm->stream == NULL)
- goto finish;
-
- o = pa_stream_cork(pcm->stream, 0, pulse_stream_success_cb,
- pcm->p);
+ o = pa_stream_cork(pcm->stream, 0, stream_success_cb, pcm);
if (!o) {
err = -EIO;
goto finish;
}
- u = pa_stream_trigger(pcm->stream, pulse_stream_success_cb,
- pcm->p);
+ u = pa_stream_trigger(pcm->stream, stream_success_cb, pcm);
pcm->underrun = 0;
err_o = pulse_wait_operation(pcm->p, o);
@@ -160,7 +234,6 @@
goto finish;
}
-
finish:
pa_threaded_mainloop_unlock(pcm->p->mainloop);
@@ -174,26 +247,23 @@
int err = 0, err_o = 0, err_u = 0;
assert(pcm);
- assert(pcm->p);
+
+ if (!pcm->p || !pcm->p->mainloop)
+ return -EBADFD;
pa_threaded_mainloop_lock(pcm->p->mainloop);
- err = pulse_check_connection(pcm->p);
+ err = check_stream(pcm);
if (err < 0)
goto finish;
- if (pcm->stream == NULL)
- goto finish;
-
- o = pa_stream_cork(pcm->stream, 1, pulse_stream_success_cb,
- pcm->p);
+ o = pa_stream_cork(pcm->stream, 1, stream_success_cb, pcm);
if (!o) {
err = -EIO;
goto finish;
}
- u = pa_stream_flush(pcm->stream, pulse_stream_success_cb,
- pcm->p);
+ u = pa_stream_flush(pcm->stream, stream_success_cb, pcm);
if (!u) {
pa_operation_unref(o);
err = -EIO;
@@ -224,15 +294,17 @@
int err = 0;
assert(pcm);
- assert(pcm->p);
+
+ if (!pcm->p || !pcm->p->mainloop)
+ return -EBADFD;
pa_threaded_mainloop_lock(pcm->p->mainloop);
- err = pulse_check_connection(pcm->p);
+ err = check_stream(pcm);
if (err < 0)
goto finish;
- o = pa_stream_drain(pcm->stream, pulse_stream_success_cb, pcm->p);
+ o = pa_stream_drain(pcm->stream, stream_success_cb, pcm);
if (!o) {
err = -EIO;
goto finish;
@@ -259,7 +331,9 @@
snd_pcm_sframes_t ret = 0;
assert(pcm);
- assert(pcm->p);
+
+ if (!pcm->p || !pcm->p->mainloop)
+ return -EBADFD;
if (io->state == SND_PCM_STATE_XRUN)
return -EPIPE;
@@ -269,9 +343,7 @@
pa_threaded_mainloop_lock(pcm->p->mainloop);
- assert(pcm->stream);
-
- ret = pulse_check_connection(pcm->p);
+ ret = check_stream(pcm);
if (ret < 0)
goto finish;
@@ -305,14 +377,14 @@
pa_usec_t lat = 0;
assert(pcm);
- assert(pcm->p);
- pa_threaded_mainloop_lock(pcm->p->mainloop);
+ if (!pcm->p || !pcm->p->mainloop)
+ return -EBADFD;
- assert(pcm->stream);
+ pa_threaded_mainloop_lock(pcm->p->mainloop);
for (;;) {
- err = pulse_check_connection(pcm->p);
+ err = check_stream(pcm);
if (err < 0)
goto finish;
@@ -354,13 +426,13 @@
snd_pcm_sframes_t ret = 0;
assert(pcm);
- assert(pcm->p);
- pa_threaded_mainloop_lock(pcm->p->mainloop);
+ if (!pcm->p || !pcm->p->mainloop)
+ return -EBADFD;
- assert(pcm->stream);
+ pa_threaded_mainloop_lock(pcm->p->mainloop);
- ret = pulse_check_connection(pcm->p);
+ ret = check_stream(pcm);
if (ret < 0)
goto finish;
@@ -409,13 +481,13 @@
snd_pcm_sframes_t ret = 0;
assert(pcm);
- assert(pcm->p);
- pa_threaded_mainloop_lock(pcm->p->mainloop);
+ if (!pcm->p || !pcm->p->mainloop)
+ return -EBADFD;
- assert(pcm->stream);
+ pa_threaded_mainloop_lock(pcm->p->mainloop);
- ret = pulse_check_connection(pcm->p);
+ ret = check_stream(pcm);
if (ret < 0)
goto finish;
@@ -475,12 +547,31 @@
return ret;
}
+static void stream_state_cb(pa_stream * p, void *userdata)
+{
+ snd_pcm_pulse_t *pcm = userdata;
+ pa_stream_state_t state;
+
+ assert(pcm);
+
+ if (!pcm->p)
+ return;
+
+ state = pa_stream_get_state(p);
+ if (!PA_STREAM_IS_GOOD(state))
+ pulse_poll_activate(pcm->p);
+
+ pa_threaded_mainloop_signal(pcm->p->mainloop, 0);
+}
+
static void stream_request_cb(pa_stream * p, size_t length, void *userdata)
{
snd_pcm_pulse_t *pcm = userdata;
assert(pcm);
- assert(pcm->p);
+
+ if (!pcm->p)
+ return;
update_active(pcm);
}
@@ -490,7 +581,9 @@
snd_pcm_pulse_t *pcm = userdata;
assert(pcm);
- assert(pcm->p);
+
+ if (!pcm->p)
+ return;
pcm->underrun = 1;
}
@@ -499,7 +592,9 @@
snd_pcm_pulse_t *pcm = userdata;
assert(pcm);
- assert(pcm->p);
+
+ if (!pcm->p)
+ return;
pa_threaded_mainloop_signal(pcm->p->mainloop, 0);
}
@@ -512,12 +607,17 @@
snd_pcm_pulse_t *pcm = io->private_data;
assert(pcm);
- assert(pcm->p);
+
+ if (!pcm->p || !pcm->p->mainloop)
+ return -EBADFD;
pa_threaded_mainloop_lock(pcm->p->mainloop);
- err = check_active(pcm);
+ err = check_stream(pcm);
+ if (err < 0)
+ goto finish;
+ err = check_active(pcm);
if (err < 0)
goto finish;
@@ -541,14 +641,15 @@
unsigned c, d;
assert(pcm);
- assert(pcm->p);
+
+ if (!pcm->p || !pcm->p->mainloop)
+ return -EBADFD;
pa_threaded_mainloop_lock(pcm->p->mainloop);
if (pcm->stream) {
pa_stream_disconnect(pcm->stream);
- pulse_wait_stream_state(pcm->p, pcm->stream,
- PA_STREAM_TERMINATED);
+ wait_stream_state(pcm, PA_STREAM_TERMINATED);
pa_stream_unref(pcm->stream);
pcm->stream = NULL;
}
@@ -581,9 +682,7 @@
goto finish;
}
- pa_stream_set_state_callback(pcm->stream, pulse_stream_state_cb,
- pcm->p);
-
+ pa_stream_set_state_callback(pcm->stream, stream_state_cb, pcm);
pa_stream_set_latency_update_callback(pcm->stream, stream_latency_cb, pcm);
if (io->stream == SND_PCM_STREAM_PLAYBACK) {
@@ -620,8 +719,7 @@
goto finish;
}
- err =
- pulse_wait_stream_state(pcm->p, pcm->stream, PA_STREAM_READY);
+ err = wait_stream_state(pcm, PA_STREAM_READY);
if (err < 0) {
SNDERR("PulseAudio: Unable to create stream: %s\n", pa_strerror(pa_context_errno(pcm->p->context)));
pa_stream_unref(pcm->stream);
@@ -645,7 +743,9 @@
int err = 0;
assert(pcm);
- assert(pcm->p);
+
+ if (!pcm->p || !pcm->p->mainloop)
+ return -EBADFD;
pa_threaded_mainloop_lock(pcm->p->mainloop);
@@ -719,26 +819,56 @@
assert(pcm);
- pa_threaded_mainloop_lock(pcm->p->mainloop);
+ if (pcm->p && pcm->p->mainloop) {
- if (pcm->stream) {
- pa_stream_disconnect(pcm->stream);
- pa_stream_unref(pcm->stream);
- }
+ pa_threaded_mainloop_lock(pcm->p->mainloop);
- pa_threaded_mainloop_unlock(pcm->p->mainloop);
+ if (pcm->stream) {
+ pa_stream_disconnect(pcm->stream);
+ pa_stream_unref(pcm->stream);
+ }
+
+ pa_threaded_mainloop_unlock(pcm->p->mainloop);
+ }
if (pcm->p)
pulse_free(pcm->p);
- if (pcm->device)
- free(pcm->device);
-
+ free(pcm->device);
free(pcm);
return 0;
}
+static int pulse_pause(snd_pcm_ioplug_t * io, int enable)
+{
+ snd_pcm_pulse_t *pcm = io->private_data;
+ int err = 0;
+ pa_operation *o;
+
+ assert (pcm);
+
+ if (!pcm->p || !pcm->p->mainloop)
+ return -EBADFD;
+
+ pa_threaded_mainloop_lock(pcm->p->mainloop);
+
+ err = check_stream(pcm);
+ if (err < 0)
+ goto finish;
+
+ o = pa_stream_cork(pcm->stream, enable, NULL, NULL);
+ if (o)
+ pa_operation_unref(o);
+ else
+ err = -EIO;
+
+finish:
+ pa_threaded_mainloop_unlock(pcm->p->mainloop);
+
+ return err;
+}
+
static const snd_pcm_ioplug_callback_t pulse_playback_callback = {
.start = pulse_start,
.stop = pulse_stop,
@@ -750,6 +880,7 @@
.prepare = pulse_prepare,
.hw_params = pulse_hw_params,
.close = pulse_close,
+ .pause = pulse_pause
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/alsa-plugins-1.0.20/pulse/pulse.c new/alsa-plugins-1.0.21/pulse/pulse.c
--- old/alsa-plugins-1.0.20/pulse/pulse.c 2009-05-06 09:07:28.000000000 +0200
+++ new/alsa-plugins-1.0.21/pulse/pulse.c 2009-08-31 15:09:41.000000000 +0200
@@ -32,37 +32,18 @@
pa_context_state_t state;
assert(p);
- assert(p->context);
- assert(p->mainloop);
+
+ if (!p->context || !p->mainloop)
+ return -EBADFD;
state = pa_context_get_state(p->context);
- if (state != PA_CONTEXT_READY)
+ if (!PA_CONTEXT_IS_GOOD(state))
return -EIO;
return 0;
}
-void pulse_stream_state_cb(pa_stream * s, void *userdata)
-{
- snd_pulse_t *p = userdata;
-
- assert(s);
- assert(p);
-
- pa_threaded_mainloop_signal(p->mainloop, 0);
-}
-
-void pulse_stream_success_cb(pa_stream * s, int success, void *userdata)
-{
- snd_pulse_t *p = userdata;
-
- assert(s);
- assert(p);
-
- pa_threaded_mainloop_signal(p->mainloop, 0);
-}
-
void pulse_context_success_cb(pa_context * c, int success, void *userdata)
{
snd_pulse_t *p = userdata;
@@ -77,8 +58,6 @@
{
assert(p);
assert(o);
- assert(p->state == PULSE_STATE_READY);
- assert(p->mainloop);
for (;;) {
int err;
@@ -96,44 +75,19 @@
return 0;
}
-int pulse_wait_stream_state(snd_pulse_t * p, pa_stream * stream,
- pa_stream_state_t target)
-{
- pa_stream_state_t state;
-
- assert(p);
- assert(stream);
- assert(p->state == PULSE_STATE_READY);
- assert(p->mainloop);
-
- for (;;) {
- int err;
-
- err = pulse_check_connection(p);
- if (err < 0)
- return err;
-
- state = pa_stream_get_state(stream);
-
- if (state == target)
- break;
-
- if (state == PA_STREAM_FAILED ||
- state == PA_STREAM_TERMINATED)
- return -EIO;
-
- pa_threaded_mainloop_wait(p->mainloop);
- }
-
- return 0;
-}
-
static void context_state_cb(pa_context * c, void *userdata)
{
+ pa_context_state_t state;
snd_pulse_t *p = userdata;
assert(c);
- switch (pa_context_get_state(c)) {
+ state = pa_context_get_state(c);
+
+ /* When we get disconnected, tell the process */
+ if (!PA_CONTEXT_IS_GOOD(state))
+ pulse_poll_activate(p);
+
+ switch (state) {
case PA_CONTEXT_READY:
case PA_CONTEXT_TERMINATED:
case PA_CONTEXT_FAILED:
@@ -171,8 +125,6 @@
if (!p)
return NULL;
- p->state = PULSE_STATE_INIT;
-
if (pipe(fd)) {
free(p);
return NULL;
@@ -197,7 +149,9 @@
p->context =
pa_context_new(pa_threaded_mainloop_get_api(p->mainloop), buf);
- assert(p->context);
+
+ if (!p->context)
+ goto fail;
pa_context_set_state_callback(p->context, context_state_cb, p);
@@ -207,36 +161,29 @@
return p;
fail:
+ pulse_free(p);
+
+ return NULL;
+}
+
+void pulse_free(snd_pulse_t * p)
+{
if (p->mainloop)
pa_threaded_mainloop_stop(p->mainloop);
- if (p->context)
+ if (p->context) {
+ pa_context_disconnect(p->context);
pa_context_unref(p->context);
+ }
if (p->mainloop)
pa_threaded_mainloop_free(p->mainloop);
- if (p->main_fd >= 0)
- close(p->main_fd);
-
if (p->thread_fd >= 0)
close(p->thread_fd);
- free(p);
-
- return NULL;
-}
-
-void pulse_free(snd_pulse_t * p)
-{
- pa_threaded_mainloop_stop(p->mainloop);
-
- pa_context_disconnect(p->context);
- pa_context_unref(p->context);
- pa_threaded_mainloop_free(p->mainloop);
-
- close(p->thread_fd);
- close(p->main_fd);
+ if (p->main_fd >= 0)
+ close(p->main_fd);
free(p);
}
@@ -244,11 +191,16 @@
int pulse_connect(snd_pulse_t * p, const char *server)
{
int err;
+ pa_context_state_t state;
assert(p);
- assert(p->context);
- assert(p->mainloop);
- assert(p->state == PULSE_STATE_INIT);
+
+ if (!p->context || !p->mainloop)
+ return -EBADFD;
+
+ state = pa_context_get_state(p->context);
+ if (state != PA_CONTEXT_UNCONNECTED)
+ return -EBADFD;
pa_threaded_mainloop_lock(p->mainloop);
@@ -256,14 +208,19 @@
if (err < 0)
goto error;
- pa_threaded_mainloop_wait(p->mainloop);
+ for (;;) {
+ pa_context_state_t state = pa_context_get_state(p->context);
- if (pa_context_get_state(p->context) != PA_CONTEXT_READY)
- goto error;
+ if (!PA_CONTEXT_IS_GOOD(state))
+ goto error;
- pa_threaded_mainloop_unlock(p->mainloop);
+ if (state == PA_CONTEXT_READY)
+ break;
- p->state = PULSE_STATE_READY;
+ pa_threaded_mainloop_wait(p->mainloop);
+ }
+
+ pa_threaded_mainloop_unlock(p->mainloop);
return 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/alsa-plugins-1.0.20/pulse/pulse.h new/alsa-plugins-1.0.21/pulse/pulse.h
--- old/alsa-plugins-1.0.20/pulse/pulse.h 2009-05-06 09:07:28.000000000 +0200
+++ new/alsa-plugins-1.0.21/pulse/pulse.h 2009-08-31 15:09:41.000000000 +0200
@@ -31,23 +31,13 @@
pa_context *context;
int thread_fd, main_fd;
-
- enum {
- PULSE_STATE_INIT,
- PULSE_STATE_READY,
- } state;
-
} snd_pulse_t;
int pulse_check_connection(snd_pulse_t * p);
-void pulse_stream_state_cb(pa_stream * s, void *userdata);
-void pulse_stream_success_cb(pa_stream * s, int success, void *userdata);
void pulse_context_success_cb(pa_context * c, int success, void *userdata);
int pulse_wait_operation(snd_pulse_t * p, pa_operation * o);
-int pulse_wait_stream_state(snd_pulse_t * p, pa_stream * stream,
- pa_stream_state_t target);
snd_pulse_t *pulse_new(void);
void pulse_free(snd_pulse_t * p);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/alsa-plugins-1.0.20/rate/rate_samplerate.c new/alsa-plugins-1.0.21/rate/rate_samplerate.c
--- old/alsa-plugins-1.0.20/rate/rate_samplerate.c 2009-05-06 09:07:28.000000000 +0200
+++ new/alsa-plugins-1.0.21/rate/rate_samplerate.c 2009-08-31 15:09:41.000000000 +0200
@@ -137,6 +137,20 @@
free(obj);
}
+#if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
+static int get_supported_rates(void *obj, unsigned int *rate_min,
+ unsigned int *rate_max)
+{
+ *rate_min = *rate_max = 0; /* both unlimited */
+ return 0;
+}
+
+static void dump(void *obj, snd_output_t *out)
+{
+ snd_output_printf(out, "Converter: libsamplerate\n");
+}
+#endif
+
static snd_pcm_rate_ops_t pcm_src_ops = {
.close = pcm_src_close,
.init = pcm_src_init,
@@ -146,6 +160,11 @@
.convert_s16 = pcm_src_convert_s16,
.input_frames = input_frames,
.output_frames = output_frames,
+#if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
+ .version = SND_PCM_RATE_PLUGIN_VERSION,
+ .get_supported_rates = get_supported_rates,
+ .dump = dump,
+#endif
};
static int pcm_src_open(unsigned int version, void **objp,
@@ -153,18 +172,24 @@
{
struct rate_src *rate;
+#if SND_PCM_RATE_PLUGIN_VERSION < 0x010002
if (version != SND_PCM_RATE_PLUGIN_VERSION) {
fprintf(stderr, "Invalid rate plugin version %x\n", version);
return -EINVAL;
}
-
+#endif
rate = calloc(1, sizeof(*rate));
if (! rate)
return -ENOMEM;
rate->converter = type;
*objp = rate;
- *ops = pcm_src_ops;
+#if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
+ if (version == 0x010001)
+ memcpy(ops, &pcm_src_ops, sizeof(snd_pcm_rate_old_ops_t));
+ else
+#endif
+ *ops = pcm_src_ops;
return 0;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/alsa-plugins-1.0.20/rate-lavc/rate_lavcrate.c new/alsa-plugins-1.0.21/rate-lavc/rate_lavcrate.c
--- old/alsa-plugins-1.0.20/rate-lavc/rate_lavcrate.c 2009-05-06 09:07:28.000000000 +0200
+++ new/alsa-plugins-1.0.21/rate-lavc/rate_lavcrate.c 2009-08-31 15:09:41.000000000 +0200
@@ -202,6 +202,20 @@
pcm_src_free(obj);
}
+#if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
+static int get_supported_rates(void *obj, unsigned int *rate_min,
+ unsigned int *rate_max)
+{
+ *rate_min = *rate_max = 0; /* both unlimited */
+ return 0;
+}
+
+static void dump(void *obj, snd_output_t *out)
+{
+ snd_output_printf(out, "Converter: liblavc\n");
+}
+#endif
+
static snd_pcm_rate_ops_t pcm_src_ops = {
.close = pcm_src_close,
.init = pcm_src_init,
@@ -211,6 +225,11 @@
.convert_s16 = pcm_src_convert_s16,
.input_frames = input_frames,
.output_frames = output_frames,
+#if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
+ .version = SND_PCM_RATE_PLUGIN_VERSION,
+ .get_supported_rates = get_supported_rates,
+ .dump = dump,
+#endif
};
int pcm_src_open(unsigned int version, void **objp, snd_pcm_rate_ops_t *ops)
@@ -218,18 +237,24 @@
{
struct rate_src *rate;
+#if SND_PCM_RATE_PLUGIN_VERSION < 0x010002
if (version != SND_PCM_RATE_PLUGIN_VERSION) {
fprintf(stderr, "Invalid rate plugin version %x\n", version);
return -EINVAL;
}
-
+#endif
rate = calloc(1, sizeof(*rate));
if (!rate)
return -ENOMEM;
*objp = rate;
rate->context = NULL;
- *ops = pcm_src_ops;
+#if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
+ if (version == 0x010001)
+ memcpy(ops, &pcm_src_ops, sizeof(snd_pcm_rate_old_ops_t));
+ else
+#endif
+ *ops = pcm_src_ops;
return 0;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/alsa-plugins-1.0.20/speex/pcm_speex.c new/alsa-plugins-1.0.21/speex/pcm_speex.c
--- old/alsa-plugins-1.0.20/speex/pcm_speex.c 2009-05-06 09:07:28.000000000 +0200
+++ new/alsa-plugins-1.0.21/speex/pcm_speex.c 2009-08-31 15:09:41.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * Speex preprocess plugin
+ * Speex DSP plugin
*
* Copyright (c) 2009 by Takashi Iwai