mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
seek: Make the seek-bar insensitive for DVD menus
This commit is contained in:
parent
e87f71245f
commit
a24c72ccca
1 changed files with 49 additions and 0 deletions
|
@ -1606,6 +1606,7 @@ stop_cb (GtkButton * button, gpointer data)
|
|||
connect_bus_signals (pipeline);
|
||||
}
|
||||
#endif
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (hscale), TRUE);
|
||||
}
|
||||
return;
|
||||
|
||||
|
@ -2648,6 +2649,53 @@ msg_step_done (GstBus * bus, GstMessage * message, GstPipeline * data)
|
|||
message_received (bus, message, data);
|
||||
}
|
||||
|
||||
static void
|
||||
msg (GstBus * bus, GstMessage * message, GstPipeline * data)
|
||||
{
|
||||
GstNavigationMessageType nav_type;
|
||||
|
||||
nav_type = gst_navigation_message_get_type (message);
|
||||
switch (nav_type) {
|
||||
case GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED:{
|
||||
GstQuery *query;
|
||||
gboolean res;
|
||||
|
||||
/* Heuristic to detect if we're dealing with a DVD menu */
|
||||
query = gst_navigation_query_new_commands ();
|
||||
res = gst_element_query (GST_ELEMENT (GST_MESSAGE_SRC (message)), query);
|
||||
|
||||
if (res) {
|
||||
gboolean is_menu = FALSE;
|
||||
guint i, n;
|
||||
|
||||
if (gst_navigation_query_parse_commands_length (query, &n)) {
|
||||
for (i = 0; i < n; i++) {
|
||||
GstNavigationCommand cmd;
|
||||
|
||||
if (!gst_navigation_query_parse_commands_nth (query, i, &cmd))
|
||||
break;
|
||||
|
||||
is_menu |= (cmd == GST_NAVIGATION_COMMAND_ACTIVATE);
|
||||
is_menu |= (cmd == GST_NAVIGATION_COMMAND_LEFT);
|
||||
is_menu |= (cmd == GST_NAVIGATION_COMMAND_RIGHT);
|
||||
is_menu |= (cmd == GST_NAVIGATION_COMMAND_UP);
|
||||
is_menu |= (cmd == GST_NAVIGATION_COMMAND_DOWN);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (hscale), !is_menu);
|
||||
} else {
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
gst_query_unref (query);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
connect_bus_signals (GstElement * pipeline)
|
||||
{
|
||||
|
@ -2692,6 +2740,7 @@ connect_bus_signals (GstElement * pipeline)
|
|||
pipeline);
|
||||
g_signal_connect (bus, "sync-message::step-done",
|
||||
(GCallback) msg_sync_step_done, pipeline);
|
||||
g_signal_connect (bus, "message", (GCallback) msg, pipeline);
|
||||
|
||||
gst_object_unref (bus);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue