Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add commandline switch to client and server to set dbus timeout #138

Merged
merged 1 commit into from Jan 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion tools/gstswitchclient.c
Expand Up @@ -95,6 +95,7 @@ static const gchar introspection_xml[] =
" </interface>" "</node>";

extern gboolean verbose;
gint gst_switch_client_dbus_timeout = 5000;

/**
* @brief Initialize instances of GstSwitchClient.
Expand Down Expand Up @@ -141,7 +142,7 @@ gst_switch_client_call_controller (GstSwitchClient * client,
//INFO ("calling: %s/%s", SWITCH_CONTROLLER_OBJECT_NAME, method_name);

value = g_dbus_connection_call_sync (client->controller, NULL, /* bus_name */
SWITCH_CONTROLLER_OBJECT_PATH, SWITCH_CONTROLLER_OBJECT_NAME, method_name, parameters, reply_type, G_DBUS_CALL_FLAGS_NONE, 5000, /* timeout_msec */
SWITCH_CONTROLLER_OBJECT_PATH, SWITCH_CONTROLLER_OBJECT_NAME, method_name, parameters, reply_type, G_DBUS_CALL_FLAGS_NONE, gst_switch_client_dbus_timeout, /* timeout_msec */
NULL /* TODO: cancellable */ ,
&error);

Expand Down
2 changes: 2 additions & 0 deletions tools/gstswitchclient.h
Expand Up @@ -131,4 +131,6 @@ gboolean gst_switch_client_new_record (GstSwitchClient * client);
guint gst_switch_client_adjust_pip (GstSwitchClient * client, gint dx,
gint dy, gint dw, gint dh);

extern gint gst_switch_client_dbus_timeout;

#endif //__GST_SWITCH_CLIENT_H__
4 changes: 3 additions & 1 deletion tools/gstswitchcontroller.c
Expand Up @@ -115,6 +115,8 @@ static const gchar introspection_xml[] =
" <property type='i' name='Num' access='read'/>"
*/

gint gst_switch_controller_dbus_timeout = 5000;

/**
* @brief Helper function for matching remoting method names.
* @memberof GstSwitchController
Expand Down Expand Up @@ -569,7 +571,7 @@ gst_switch_controller_call_client (GstSwitchController * controller,
}

value = g_dbus_connection_call_sync (connection, NULL, /* bus_name */
path, name, method_name, parameters, reply_type, G_DBUS_CALL_FLAGS_NONE, 5000, /* timeout_msec */
path, name, method_name, parameters, reply_type, G_DBUS_CALL_FLAGS_NONE, gst_switch_controller_dbus_timeout, /* timeout_msec */
NULL /* TODO: cancellable */ ,
&error);

Expand Down
2 changes: 2 additions & 0 deletions tools/gstswitchcontroller.h
Expand Up @@ -106,4 +106,6 @@ void gst_switch_controller_show_face_marker (GstSwitchController *controller,
void gst_switch_controller_show_track_marker (GstSwitchController *controller,
GVariant *faces);

extern gint gst_switch_controller_dbus_timeout;

#endif //__GST_SWITCH_CONTROLLER_H__
3 changes: 3 additions & 0 deletions tools/gstswitchserver.c
Expand Up @@ -196,6 +196,9 @@ static GOptionEntry entries[] = {
"Prompt more messages", NULL},
{"test-switch", 't', 0, G_OPTION_ARG_STRING, &opts.test_switch,
"Perform switch test", "OUTPUT"},
{"dbus-timeout", 'd', 0, G_OPTION_ARG_INT,
&gst_switch_controller_dbus_timeout,
"DBus timeout in msec (default 5000)"},
{"record", 'r', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK,
(gpointer) gparse_record_filename,
"Enable recorder and record into the specified FILENAME"},
Expand Down
32 changes: 16 additions & 16 deletions tools/gstswitchui.c
Expand Up @@ -53,6 +53,8 @@ gboolean verbose;

static GOptionEntry entries[] = {
{"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL},
{"dbus-timeout", 'd', 0, G_OPTION_ARG_INT, &gst_switch_client_dbus_timeout,
"DBus timeout in ms (default 5000)", NULL},
{NULL}
};

Expand Down Expand Up @@ -282,8 +284,7 @@ gst_switch_ui_init (GstSwitchUI * ui)
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_widget_set_size_request (scrollwin, 130, -1);
gtk_widget_set_vexpand (scrollwin, TRUE);
gtk_container_add (GTK_CONTAINER (scrollwin),
ui->preview_box);
gtk_container_add (GTK_CONTAINER (scrollwin), ui->preview_box);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, whitespace changes due to indent side-effects. Even more in last file below.


gtk_container_add (GTK_CONTAINER (overlay), ui->compose_view);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), ui->compose_overlay);
Expand Down Expand Up @@ -1078,13 +1079,12 @@ gst_switch_ui_switch (GstSwitchUI * ui, gint key)
static void
gst_switch_ui_next_compose (GstSwitchUI * ui, GstCompositeMode mode)
{
gboolean ok = gst_switch_client_set_composite_mode(
GST_SWITCH_CLIENT(ui), mode);
gboolean ok =
gst_switch_client_set_composite_mode (GST_SWITCH_CLIENT (ui), mode);

INFO("set composite mode: new %s (%d), previous %s",
gst_composite_mode_to_string(mode),
ok,
gst_composite_mode_to_string(ui->compose_mode));
INFO ("set composite mode: new %s (%d), previous %s",
gst_composite_mode_to_string (mode),
ok, gst_composite_mode_to_string (ui->compose_mode));

if (ok)
ui->compose_mode = mode;
Expand All @@ -1102,7 +1102,7 @@ gst_switch_ui_next_compose_mode (GstSwitchUI * ui)
if (next_mode > COMPOSE_MODE__LAST)
next_mode = 0;

gst_switch_ui_next_compose(ui, next_mode);
gst_switch_ui_next_compose (ui, next_mode);
}

/**
Expand Down Expand Up @@ -1212,35 +1212,35 @@ gst_switch_ui_key_event (GtkWidget * w, GdkEvent * event, GstSwitchUI * ui)
gst_switch_ui_new_record (ui);
break;

// Keys to change the compose mode
// ---------------------------------------------------------------
// None
// Keys to change the compose mode
// ---------------------------------------------------------------
// None
case GDK_KEY_Escape:
gst_switch_ui_next_compose (ui, COMPOSE_MODE_NONE);
break;

// Picture-in-Picture
// Picture-in-Picture
case GDK_KEY_F1:
case GDK_KEY_P:
case GDK_KEY_p:
gst_switch_ui_next_compose (ui, COMPOSE_MODE_PIP);
break;

// Side-by-side (preview)
// Side-by-side (preview)
case GDK_KEY_F2:
case GDK_KEY_D:
case GDK_KEY_d:
gst_switch_ui_next_compose (ui, COMPOSE_MODE_DUAL_PREVIEW);
break;

// Side-by-side (equal)
// Side-by-side (equal)
case GDK_KEY_F3:
case GDK_KEY_S:
case GDK_KEY_s:
gst_switch_ui_next_compose (ui, COMPOSE_MODE_DUAL_EQUAL);
break;

// Cycle through the modes
// Cycle through the modes
case GDK_KEY_Tab:
{
// Cycle through them slowly....
Expand Down