Ejemplo n.º 1
0
int hfp_info_stop(struct hfp_info *info)
{
	if (!info->started)
		return 0;

	audio_thread_rm_callback_sync(
		cras_iodev_list_get_audio_thread(),
		info->fd);

	close(info->fd);
	info->fd = 0;
	info->started = 0;

	return 0;
}
Ejemplo n.º 2
0
static DBusHandlerResult handle_set_global_output_channel_remix(
	DBusConnection *conn,
	DBusMessage *message,
	void *arg)
{
	dbus_int32_t num_channels;
	double *coeff_array;
	dbus_int32_t count;
	DBusError dbus_error;
	float *coefficient;
	int i;

	dbus_error_init(&dbus_error);

	if (!dbus_message_get_args(message, &dbus_error,
			DBUS_TYPE_INT32, &num_channels,
			DBUS_TYPE_ARRAY,
			      DBUS_TYPE_DOUBLE, &coeff_array, &count,
			      DBUS_TYPE_INVALID)) {
		syslog(LOG_WARNING, "Set global output channel remix error: %s",
			dbus_error.message);
		dbus_error_free(&dbus_error);
		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
	}

	coefficient = (float *)calloc(count, sizeof(*coefficient));
	if (!coefficient)
		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;

	for (i = 0; i < count; i++)
		coefficient[i] = coeff_array[i];

	audio_thread_config_global_remix(
			cras_iodev_list_get_audio_thread(),
			num_channels,
			coefficient);

	send_empty_reply(conn, message);
	free(coefficient);
	return DBUS_HANDLER_RESULT_HANDLED;
}