static GtkWidget *shuttle_hscale;
static GtkAdjustment *shuttle_adjustment;
+static struct
+{
+ GstNavigationCommand cmd;
+ GtkWidget *button;
+} navigation_buttons[14];
+
static GList *paths = NULL, *l = NULL;
/* we keep an array of the visualisation entries so that we can easily switch
static void clear_streams (GstElement * pipeline);
static void volume_notify_cb (GstElement * pipeline, GParamSpec * arg,
gpointer user_dat);
+static void find_navigation_element (void);
/* pipeline construction */
{
if (state != STOP_STATE) {
GstStateChangeReturn ret;
+ gint i;
g_print ("READY pipeline\n");
gtk_statusbar_pop (GTK_STATUSBAR (statusbar), status_id);
}
#endif
gtk_widget_set_sensitive (GTK_WIDGET (hscale), TRUE);
+ for (i = 0; i < G_N_ELEMENTS (navigation_buttons); i++)
+ gtk_widget_set_sensitive (navigation_buttons[i].button, FALSE);
}
return;
/* update the available streams */
update_streams (pipeline);
+
+ find_navigation_element ();
}
static void
}
}
-#if defined (GDK_WINDOWING_X11) || defined (GDK_WINDOWING_WIN32) || defined (GDK_WINDOWING_QUARTZ)
-
-static GstElement *xoverlay_element = NULL;
static GstElement *navigation_element = NULL;
-static guintptr embed_xid = 0;
static void
find_navigation_element (void)
gst_object_unref (video_sink);
}
+/* called when Navigation command button is pressed */
+static void
+navigation_cmd_cb (GtkButton * button, gpointer data)
+{
+ GstNavigationCommand cmd = GPOINTER_TO_INT (data);
+
+ if (!navigation_element) {
+ find_navigation_element ();
+ if (!navigation_element)
+ return;
+ }
+
+ gst_navigation_send_command (GST_NAVIGATION (navigation_element), cmd);
+}
+
+#if defined (GDK_WINDOWING_X11) || defined (GDK_WINDOWING_WIN32) || defined (GDK_WINDOWING_QUARTZ)
+
+static GstElement *xoverlay_element = NULL;
+static guintptr embed_xid = 0;
+
/* We set the xid here in response to the prepare-xwindow-id message via a
* bus sync handler because we don't know the actual videosink used from the
* start (as we don't know the pipeline, or bin elements such as autovideosink
switch (nav_type) {
case GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED:{
GstQuery *query;
- gboolean res;
+ gboolean res, j;
/* 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);
+ for (j = 0; j < G_N_ELEMENTS (navigation_buttons); j++)
+ gtk_widget_set_sensitive (navigation_buttons[j].button, FALSE);
+
if (res) {
gboolean is_menu = FALSE;
guint i, n;
is_menu |= (cmd == GST_NAVIGATION_COMMAND_RIGHT);
is_menu |= (cmd == GST_NAVIGATION_COMMAND_UP);
is_menu |= (cmd == GST_NAVIGATION_COMMAND_DOWN);
+
+ for (j = 0; j < G_N_ELEMENTS (navigation_buttons); j++) {
+ if (navigation_buttons[j].cmd != cmd)
+ continue;
+
+ gtk_widget_set_sensitive (navigation_buttons[j].button, TRUE);
+ }
}
}
main (int argc, char **argv)
{
GtkWidget *window, *hbox, *vbox, *panel, *expander, *pb2vbox, *boxes,
- *flagtable, *boxes2, *step;
+ *flagtable, *boxes2, *step, *navigation;
GtkWidget *play_button, *pause_button, *stop_button, *shot_button;
GtkWidget *accurate_checkbox, *key_checkbox, *loop_checkbox, *flush_checkbox;
GtkWidget *scrub_checkbox, *play_scrub_checkbox;
gtk_container_add (GTK_CONTAINER (step), hbox);
}
+ /* navigation command expander */
+ {
+ GtkWidget *navigation_button;
+ GtkWidget *grid;
+ gint i = 0;
+
+ navigation = gtk_expander_new ("navigation commands");
+ grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 2);
+ gtk_grid_set_row_homogeneous (GTK_GRID (grid), TRUE);
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 2);
+ gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
+
+ navigation_button = gtk_button_new_with_label ("Menu 1");
+ g_signal_connect (G_OBJECT (navigation_button), "clicked",
+ G_CALLBACK (navigation_cmd_cb),
+ GINT_TO_POINTER (GST_NAVIGATION_COMMAND_MENU1));
+ gtk_grid_attach (GTK_GRID (grid), navigation_button, i, 0, 1, 1);
+ gtk_widget_set_sensitive (navigation_button, FALSE);
+ gtk_widget_set_tooltip_text (navigation_button, "DVD Menu");
+ navigation_buttons[i].button = navigation_button;
+ navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_MENU1;
+
+ navigation_button = gtk_button_new_with_label ("Menu 2");
+ g_signal_connect (G_OBJECT (navigation_button), "clicked",
+ G_CALLBACK (navigation_cmd_cb),
+ GINT_TO_POINTER (GST_NAVIGATION_COMMAND_MENU2));
+ gtk_grid_attach (GTK_GRID (grid), navigation_button, i, 0, 1, 1);
+ gtk_widget_set_sensitive (navigation_button, FALSE);
+ gtk_widget_set_tooltip_text (navigation_button, "DVD Title Menu");
+ navigation_buttons[i].button = navigation_button;
+ navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_MENU2;
+
+ navigation_button = gtk_button_new_with_label ("Menu 3");
+ g_signal_connect (G_OBJECT (navigation_button), "clicked",
+ G_CALLBACK (navigation_cmd_cb),
+ GINT_TO_POINTER (GST_NAVIGATION_COMMAND_MENU3));
+ gtk_grid_attach (GTK_GRID (grid), navigation_button, i, 0, 1, 1);
+ gtk_widget_set_sensitive (navigation_button, FALSE);
+ gtk_widget_set_tooltip_text (navigation_button, "DVD Root Menu");
+ navigation_buttons[i].button = navigation_button;
+ navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_MENU3;
+
+ navigation_button = gtk_button_new_with_label ("Menu 4");
+ g_signal_connect (G_OBJECT (navigation_button), "clicked",
+ G_CALLBACK (navigation_cmd_cb),
+ GINT_TO_POINTER (GST_NAVIGATION_COMMAND_MENU4));
+ gtk_grid_attach (GTK_GRID (grid), navigation_button, i, 0, 1, 1);
+ gtk_widget_set_sensitive (navigation_button, FALSE);
+ gtk_widget_set_tooltip_text (navigation_button, "DVD Subpicture Menu");
+ navigation_buttons[i].button = navigation_button;
+ navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_MENU4;
+
+ navigation_button = gtk_button_new_with_label ("Menu 5");
+ g_signal_connect (G_OBJECT (navigation_button), "clicked",
+ G_CALLBACK (navigation_cmd_cb),
+ GINT_TO_POINTER (GST_NAVIGATION_COMMAND_MENU5));
+ gtk_grid_attach (GTK_GRID (grid), navigation_button, i, 0, 1, 1);
+ gtk_widget_set_sensitive (navigation_button, FALSE);
+ gtk_widget_set_tooltip_text (navigation_button, "DVD Audio Menu");
+ navigation_buttons[i].button = navigation_button;
+ navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_MENU5;
+
+ navigation_button = gtk_button_new_with_label ("Menu 6");
+ g_signal_connect (G_OBJECT (navigation_button), "clicked",
+ G_CALLBACK (navigation_cmd_cb),
+ GINT_TO_POINTER (GST_NAVIGATION_COMMAND_MENU6));
+ gtk_grid_attach (GTK_GRID (grid), navigation_button, i, 0, 1, 1);
+ gtk_widget_set_sensitive (navigation_button, FALSE);
+ gtk_widget_set_tooltip_text (navigation_button, "DVD Angle Menu");
+ navigation_buttons[i].button = navigation_button;
+ navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_MENU6;
+
+ navigation_button = gtk_button_new_with_label ("Menu 7");
+ g_signal_connect (G_OBJECT (navigation_button), "clicked",
+ G_CALLBACK (navigation_cmd_cb),
+ GINT_TO_POINTER (GST_NAVIGATION_COMMAND_MENU7));
+ gtk_grid_attach (GTK_GRID (grid), navigation_button, i, 0, 1, 1);
+ gtk_widget_set_sensitive (navigation_button, FALSE);
+ gtk_widget_set_tooltip_text (navigation_button, "DVD Chapter Menu");
+ navigation_buttons[i].button = navigation_button;
+ navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_MENU7;
+
+ navigation_button = gtk_button_new_with_label ("Left");
+ g_signal_connect (G_OBJECT (navigation_button), "clicked",
+ G_CALLBACK (navigation_cmd_cb),
+ GINT_TO_POINTER (GST_NAVIGATION_COMMAND_LEFT));
+ gtk_grid_attach (GTK_GRID (grid), navigation_button, i - 7, 1, 1, 1);
+ gtk_widget_set_sensitive (navigation_button, FALSE);
+ navigation_buttons[i].button = navigation_button;
+ navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_LEFT;
+
+ navigation_button = gtk_button_new_with_label ("Right");
+ g_signal_connect (G_OBJECT (navigation_button), "clicked",
+ G_CALLBACK (navigation_cmd_cb),
+ GINT_TO_POINTER (GST_NAVIGATION_COMMAND_RIGHT));
+ gtk_grid_attach (GTK_GRID (grid), navigation_button, i - 7, 1, 1, 1);
+ gtk_widget_set_sensitive (navigation_button, FALSE);
+ navigation_buttons[i].button = navigation_button;
+ navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_RIGHT;
+
+ navigation_button = gtk_button_new_with_label ("Up");
+ g_signal_connect (G_OBJECT (navigation_button), "clicked",
+ G_CALLBACK (navigation_cmd_cb),
+ GINT_TO_POINTER (GST_NAVIGATION_COMMAND_UP));
+ gtk_grid_attach (GTK_GRID (grid), navigation_button, i - 7, 1, 1, 1);
+ gtk_widget_set_sensitive (navigation_button, FALSE);
+ navigation_buttons[i].button = navigation_button;
+ navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_UP;
+
+ navigation_button = gtk_button_new_with_label ("Down");
+ g_signal_connect (G_OBJECT (navigation_button), "clicked",
+ G_CALLBACK (navigation_cmd_cb),
+ GINT_TO_POINTER (GST_NAVIGATION_COMMAND_DOWN));
+ gtk_grid_attach (GTK_GRID (grid), navigation_button, i - 7, 1, 1, 1);
+ gtk_widget_set_sensitive (navigation_button, FALSE);
+ navigation_buttons[i].button = navigation_button;
+ navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_DOWN;
+
+ navigation_button = gtk_button_new_with_label ("Activate");
+ g_signal_connect (G_OBJECT (navigation_button), "clicked",
+ G_CALLBACK (navigation_cmd_cb),
+ GINT_TO_POINTER (GST_NAVIGATION_COMMAND_ACTIVATE));
+ gtk_grid_attach (GTK_GRID (grid), navigation_button, i - 7, 1, 1, 1);
+ gtk_widget_set_sensitive (navigation_button, FALSE);
+ navigation_buttons[i].button = navigation_button;
+ navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_ACTIVATE;
+
+ navigation_button = gtk_button_new_with_label ("Prev. Angle");
+ g_signal_connect (G_OBJECT (navigation_button), "clicked",
+ G_CALLBACK (navigation_cmd_cb),
+ GINT_TO_POINTER (GST_NAVIGATION_COMMAND_PREV_ANGLE));
+ gtk_grid_attach (GTK_GRID (grid), navigation_button, i - 7, 1, 1, 1);
+ gtk_widget_set_sensitive (navigation_button, FALSE);
+ navigation_buttons[i].button = navigation_button;
+ navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_PREV_ANGLE;
+
+ navigation_button = gtk_button_new_with_label ("Next. Angle");
+ g_signal_connect (G_OBJECT (navigation_button), "clicked",
+ G_CALLBACK (navigation_cmd_cb),
+ GINT_TO_POINTER (GST_NAVIGATION_COMMAND_NEXT_ANGLE));
+ gtk_grid_attach (GTK_GRID (grid), navigation_button, i - 7, 1, 1, 1);
+ gtk_widget_set_sensitive (navigation_button, FALSE);
+ navigation_buttons[i].button = navigation_button;
+ navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_NEXT_ANGLE;
+
+ gtk_container_add (GTK_CONTAINER (navigation), grid);
+ }
+
/* seek bar */
adjustment =
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, N_GRAD, 0.1, 1.0, 1.0));
gtk_box_pack_start (GTK_BOX (vbox), expander, FALSE, FALSE, 2);
}
gtk_box_pack_start (GTK_BOX (vbox), step, FALSE, FALSE, 2);
+ gtk_box_pack_start (GTK_BOX (vbox), navigation, FALSE, FALSE, 2);
gtk_box_pack_start (GTK_BOX (vbox), hscale, FALSE, FALSE, 2);
gtk_box_pack_start (GTK_BOX (vbox), statusbar, FALSE, FALSE, 2);