Commit 51f6a078 authored by sletz's avatar sletz
Browse files

D-Bus access for jackctl_server_add_slave/jackctl_server_remove_slave API.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3530 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 23f85f98
......@@ -27,7 +27,8 @@ Paul Davis
2009-05-06 Stephane Letz <letz@grame.fr>
* Fix transport callback (timebase master, sync) issue when used after jack_activate (RT thread was not running).
* Fix transport callback (timebase master, sync) issue when used after jack_activate (RT thread was not running).
* D-Bus access for jackctl_server_add_slave/jackctl_server_remove_slave API.
2009-05-05 Stephane Letz <letz@grame.fr>
......
......@@ -391,6 +391,44 @@ fail:
return NULL;
}
bool
jack_controller_add_slave(
struct jack_controller *controller_ptr,
const char * driver_name)
{
jackctl_driver_t *driver;
driver = jack_controller_find_driver(controller_ptr->server, driver_name);
if (driver == NULL)
{
return false;
}
jack_info("driver \"%s\" selected", driver_name);
return jackctl_server_add_slave(controller_ptr->server, driver);
}
bool
jack_controller_remove_slave(
struct jack_controller *controller_ptr,
const char * driver_name)
{
jackctl_driver_t *driver;
driver = jack_controller_find_driver(controller_ptr->server, driver_name);
if (driver == NULL)
{
return false;
}
jack_info("driver \"%s\" selected", driver_name);
return jackctl_server_remove_slave(controller_ptr->server, driver);
}
bool
jack_controller_load_internal(
struct jack_controller *controller_ptr,
......
......@@ -215,6 +215,44 @@ jack_control_run_method(
"jack_controller_load_internal failed for internal (%s)", internal_name);
}
}
else if (strcmp (call->method_name, "AddSlave") == 0)
{
const char *driver_name;
if (!jack_dbus_get_method_args(call, DBUS_TYPE_STRING, &driver_name, DBUS_TYPE_INVALID))
{
/* The method call had invalid arguments meaning that
* get_method_args() has constructed an error for us.
*/
goto exit;
}
if (!jack_controller_add_slave(controller_ptr, driver_name)) {
jack_dbus_error(
call,
JACK_DBUS_ERROR_GENERIC,
"jack_controller_add_slave failed for driver (%s)", driver_name);
}
}
else if (strcmp (call->method_name, "RemoveSlave") == 0)
{
const char *driver_name;
if (!jack_dbus_get_method_args(call, DBUS_TYPE_STRING, &driver_name, DBUS_TYPE_INVALID))
{
/* The method call had invalid arguments meaning that
* get_method_args() has constructed an error for us.
*/
goto exit;
}
if (!jack_controller_remove_slave(controller_ptr, driver_name)) {
jack_dbus_error(
call,
JACK_DBUS_ERROR_GENERIC,
"jack_controller_remove_slave failed for driver (%s)", driver_name);
}
}
else if (strcmp (call->method_name, "UnloadInternal") == 0)
{
const char *internal_name;
......@@ -234,6 +272,7 @@ jack_control_run_method(
"jack_controller_unload_internal failed for internal (%s)", internal_name);
}
}
else
{
return false;
......@@ -305,6 +344,14 @@ JACK_DBUS_METHOD_ARGUMENTS_BEGIN(UnlooadInternal)
JACK_DBUS_METHOD_ARGUMENT("internal", "s", false)
JACK_DBUS_METHOD_ARGUMENTS_END
JACK_DBUS_METHOD_ARGUMENTS_BEGIN(AddSlave)
JACK_DBUS_METHOD_ARGUMENT("internal", "s", false)
JACK_DBUS_METHOD_ARGUMENTS_END
JACK_DBUS_METHOD_ARGUMENTS_BEGIN(RemoveSlave)
JACK_DBUS_METHOD_ARGUMENT("internal", "s", false)
JACK_DBUS_METHOD_ARGUMENTS_END
JACK_DBUS_METHODS_BEGIN
JACK_DBUS_METHOD_DESCRIBE(IsStarted, NULL)
JACK_DBUS_METHOD_DESCRIBE(StartServer, NULL)
......@@ -320,6 +367,8 @@ JACK_DBUS_METHODS_BEGIN
JACK_DBUS_METHOD_DESCRIBE(ResetXruns, NULL)
JACK_DBUS_METHOD_DESCRIBE(LoadInternal, NULL)
JACK_DBUS_METHOD_DESCRIBE(UnlooadInternal, NULL)
JACK_DBUS_METHOD_DESCRIBE(AddSlave, NULL)
JACK_DBUS_METHOD_DESCRIBE(RemoveSlave, NULL)
JACK_DBUS_METHODS_END
JACK_DBUS_SIGNAL_ARGUMENTS_BEGIN(ServerStarted)
......
......@@ -85,6 +85,16 @@ bool
jack_controller_switch_master(
struct jack_controller *controller_ptr,
void *dbus_call_context_ptr);
bool
jack_controller_add_slave(
struct jack_controller *controller_ptr,
const char * driver_name);
bool
jack_controller_remove_slave(
struct jack_controller *controller_ptr,
const char * driver_name);
bool
jack_controller_select_driver(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment