pulse/ext-device-restore.h \
pulse/ext-stream-restore.h \
pulse/ext-node-manager.h \
+ pulse/ext-echo-cancel.h \
pulse/format.h \
pulse/gccmacro.h \
pulse/introspect.h \
pulse/ext-device-restore.c pulse/ext-device-restore.h \
pulse/ext-stream-restore.c pulse/ext-stream-restore.h \
pulse/ext-node-manager.c pulse/ext-node-manager.h \
+ pulse/ext-echo-cancel.c pulse/ext-echo-cancel.h \
pulse/format.c pulse/format.h \
pulse/gccmacro.h \
pulse/internal.h \
modules/echo-cancel/null.c \
modules/echo-cancel/echo-cancel.h
module_echo_cancel_la_LDFLAGS = $(MODULE_LDFLAGS)
-module_echo_cancel_la_LIBADD = $(MODULE_LIBADD) $(LIBSPEEX_LIBS)
+module_echo_cancel_la_LIBADD = libprotocol-native.la $(MODULE_LIBADD) $(LIBSPEEX_LIBS)
module_echo_cancel_la_CFLAGS = $(AM_CFLAGS) $(SERVER_CFLAGS) $(LIBSPEEX_CFLAGS)
if HAVE_ADRIAN_EC
module_echo_cancel_la_SOURCES += \
pa_ext_stream_restore_subscribe;
pa_ext_stream_restore_test;
pa_ext_stream_restore_write;
+pa_ext_echo_cancel_set_volume;
+pa_ext_echo_cancel_set_device;
pa_ext_node_manager_test;
pa_ext_node_manager_read_nodes;
pa_ext_node_manager_connect_nodes;
#include <pulsecore/sample-util.h>
#include <pulsecore/ltdl-helper.h>
+#include <pulsecore/protocol-native.h>
+#include <pulsecore/pstream-util.h>
+
#include "module-echo-cancel-symdef.h"
PA_MODULE_AUTHOR("Wim Taymans");
#endif
} pa_echo_canceller_method_t;
+enum {
+ AEC_SET_VOLUME,
+ AEC_SET_DEVICE,
+};
+
#ifdef HAVE_WEBRTC
#define DEFAULT_ECHO_CANCELLER "webrtc"
#else
struct {
pa_cvolume current_volume;
} thread_info;
+
+ pa_native_protocol *protocol;
};
static void source_output_snapshot_within_thread(struct userdata *u, struct snapshot *snapshot);
return PA_ECHO_CANCELLER_INVALID;
}
+static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connection *c, uint32_t tag, pa_tagstruct *t) {
+ uint32_t command;
+ uint32_t value;
+ struct userdata *u = NULL;
+ pa_tagstruct *reply = NULL;
+ pa_assert(p);
+ pa_assert(m);
+ pa_assert(c);
+ pa_assert(t);
+
+ u = m->userdata;
+
+ if (pa_tagstruct_getu32(t, &command) < 0)
+ goto fail;
+
+ reply = pa_tagstruct_new(NULL, 0);
+ pa_tagstruct_putu32(reply, PA_COMMAND_REPLY);
+ pa_tagstruct_putu32(reply, tag);
+
+ switch (command) {
+ case AEC_SET_VOLUME: {
+ pa_tagstruct_getu32(t,&value);
+ pa_log_debug("AEC_SET_VOLUME in echo cancel = %d",value);
+ break;
+ }
+ case AEC_SET_DEVICE: {
+ pa_tagstruct_getu32(t,&value);
+ pa_log_debug("AEC_SET_DEVICE in echo cancel = %d",value);
+ break;
+ }
+ default:
+ goto fail;
+ }
+ pa_pstream_send_tagstruct(pa_native_connection_get_pstream(c), reply);
+ return 0;
+
+fail:
+ return -1;
+}
+
/* Common initialisation bits between module-echo-cancel and the standalone
* test program.
*
u->thread_info.current_volume = u->source->reference_volume;
+ u->protocol = pa_native_protocol_get(m->core);
+ pa_native_protocol_install_ext(u->protocol, m, extension_cb);
+
pa_sink_put(u->sink);
pa_source_put(u->source);
pa_xfree(u->ec);
}
+ if (u->protocol) {
+ pa_native_protocol_remove_ext(u->protocol, m);
+ pa_native_protocol_unref(u->protocol);
+ }
+
if (u->asyncmsgq)
pa_asyncmsgq_unref(u->asyncmsgq);
--- /dev/null
+/***
+ This file is part of PulseAudio.
+
+ PulseAudio is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <pulse/context.h>
+#include <pulse/gccmacro.h>
+#include <pulse/xmalloc.h>
+
+#include <pulsecore/macro.h>
+#include <pulsecore/pstream-util.h>
+#include <pulsecore/log.h>
+#include "internal.h"
+#include "operation.h"
+#include "fork-detect.h"
+
+#include "ext-echo-cancel.h"
+
+enum {
+ AEC_SET_VOLUME,
+ AEC_SET_DEVICE,
+};
+
+pa_operation *pa_ext_echo_cancel_set_device (
+ pa_context *c,
+ int device,
+ pa_context_success_cb_t cb,
+ void *userdata) {
+
+ uint32_t tag;
+ pa_operation *o = NULL;
+ pa_tagstruct *t = NULL;
+
+ pa_assert(c);
+ pa_assert(PA_REFCNT_VALUE(c) >= 1);
+ PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
+ PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
+ PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 14, PA_ERR_NOTSUPPORTED);
+
+ o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
+
+ t = pa_tagstruct_command(c, PA_COMMAND_EXTENSION, &tag);
+ pa_tagstruct_putu32(t, PA_INVALID_INDEX);
+ pa_tagstruct_puts(t, "module-echo-cancel");
+ pa_tagstruct_putu32(t, AEC_SET_DEVICE);
+ pa_tagstruct_putu32(t, device);
+
+ pa_pstream_send_tagstruct(c->pstream, t);
+ pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
+ return o;
+}
+
+
+pa_operation *pa_ext_echo_cancel_set_volume (
+ pa_context *c,
+ int volume,
+ pa_context_success_cb_t cb,
+ void *userdata) {
+
+ uint32_t tag;
+ pa_operation *o = NULL;
+ pa_tagstruct *t = NULL;
+
+ pa_assert(c);
+ pa_assert(PA_REFCNT_VALUE(c) >= 1);
+ PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
+ PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
+ PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 14, PA_ERR_NOTSUPPORTED);
+
+ o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
+
+ t = pa_tagstruct_command(c, PA_COMMAND_EXTENSION, &tag);
+ pa_tagstruct_putu32(t, PA_INVALID_INDEX);
+ pa_tagstruct_puts(t, "module-echo-cancel");
+ pa_tagstruct_putu32(t, AEC_SET_VOLUME);
+ pa_tagstruct_putu32(t, volume);
+
+ pa_pstream_send_tagstruct(c->pstream, t);
+ pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
+
+ return o;
+}
--- /dev/null
+#ifndef foopulseechocancelfoo
+#define foopulseechocancelfoo
+
+/***
+ This file is part of PulseAudio.
+
+ PulseAudio is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License,
+ or (at your option) any later version.
+
+ PulseAudio is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with PulseAudio; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA.
+***/
+
+#include <pulse/context.h>
+#include <pulse/version.h>
+
+/** \file
+ *
+ * Routines for controlling module-echo-cancel
+ */
+
+PA_C_DECL_BEGIN
+
+/** Set volume to AEC module */
+pa_operation *pa_ext_echo_cancel_set_volume (
+ pa_context *c,
+ int volume,
+ pa_context_success_cb_t cb,
+ void *userdata);
+
+pa_operation *pa_ext_echo_cancel_set_device (
+ pa_context *c,
+ int device,
+ pa_context_success_cb_t cb,
+ void *userdata);
+
+
+PA_C_DECL_END
+
+#endif