playback, mixerutils: gst_registry_get_default() -> gst_registry_get()
[platform/upstream/gstreamer.git] / tests / examples / seek / jsseek.c
index 3329d56..b803eb6 100644 (file)
 #ifdef HAVE_X
 #include <gdk/gdkx.h>
 #endif
-#include <gst/interfaces/videooverlay.h>
+#include <gst/video/videooverlay.h>
 
 GST_DEBUG_CATEGORY_STATIC (seek_debug);
 #define GST_CAT_DEFAULT (seek_debug)
 
-#if (!GTK_CHECK_VERSION(2, 23, 0) || GTK_CHECK_VERSION(2, 90, 0)) && !GTK_CHECK_VERSION(2, 91, 1)
-#define gtk_combo_box_text_new gtk_combo_box_new_text
-#define gtk_combo_box_text_append_text gtk_combo_box_append_text
-#define gtk_combo_box_text_remove gtk_combo_box_remove_text
-#define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX
-#endif
-
-#if !GTK_CHECK_VERSION (2, 17, 7)
-static void
-gtk_widget_get_allocation (GtkWidget * w, GtkAllocation * a)
-{
-  *a = w->allocation;
-}
-#endif
-
 /* configuration */
 #define SOURCE "filesrc"
 
@@ -963,9 +948,9 @@ make_playerbin_pipeline (const gchar * location)
 static GstElement *
 make_playerbin2_pipeline (const gchar * location)
 {
-  GstElement *pipeline = construct_playerbin ("playbin2", location);
+  GstElement *pipeline = construct_playerbin ("playbin", location);
 
-  /* FIXME: this is not triggered, playbin2 is not forwarding it from the sink */
+  /* FIXME: this is not triggered, playbin is not forwarding it from the sink */
   g_signal_connect (pipeline, "notify::volume", G_CALLBACK (volume_notify_cb),
       NULL);
   return pipeline;
@@ -1565,6 +1550,7 @@ stop_cb (GtkButton * button, gpointer data)
 
     state = STOP_STATE;
     gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Stopped");
+    gtk_widget_queue_draw (video_window);
 
     is_live = FALSE;
     buffering = FALSE;
@@ -1814,7 +1800,7 @@ update_streams (GstPipeline * pipeline)
     /* remove previous info */
     clear_streams (GST_ELEMENT_CAST (pipeline));
 
-    /* here we get and update the different streams detected by playbin2 */
+    /* here we get and update the different streams detected by playbin */
     g_object_get (pipeline, "n-video", &n_video, NULL);
     g_object_get (pipeline, "n-audio", &n_audio, NULL);
     g_object_get (pipeline, "n-text", &n_text, NULL);
@@ -1942,7 +1928,7 @@ init_visualization_features (void)
 
   vis_entries = g_array_new (FALSE, FALSE, sizeof (VisEntry));
 
-  list = gst_registry_feature_filter (gst_registry_get_default (),
+  list = gst_registry_feature_filter (gst_registry_get (),
       filter_features, FALSE, NULL);
 
   for (walk = list; walk; walk = g_list_next (walk)) {
@@ -1975,7 +1961,7 @@ vis_combo_cb (GtkComboBox * combo, GstPipeline * pipeline)
     if (!element)
       return;
 
-    /* set vis plugin for playbin2 */
+    /* set vis plugin for playbin */
     g_object_set (pipeline, "vis-plugin", element, NULL);
   }
 }
@@ -2473,19 +2459,17 @@ bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * data)
 #endif
 
 static gboolean
-handle_expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
+draw_cb (GtkWidget * widget, cairo_t * cr, gpointer data)
 {
   if (state < GST_STATE_PAUSED) {
-    GtkAllocation allocation;
-    GdkWindow *window = gtk_widget_get_window (widget);
-    cairo_t *cr;
+    int width, height;
 
-    gtk_widget_get_allocation (widget, &allocation);
-    cr = gdk_cairo_create (window);
+    width = gtk_widget_get_allocated_width (widget);
+    height = gtk_widget_get_allocated_height (widget);
     cairo_set_source_rgb (cr, 0, 0, 0);
-    cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
+    cairo_rectangle (cr, 0, 0, width, height);
     cairo_fill (cr);
-    cairo_destroy (cr);
+    return TRUE;
   }
   return FALSE;
 }
@@ -2493,24 +2477,16 @@ handle_expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
 static void
 realize_cb (GtkWidget * widget, gpointer data)
 {
-#if GTK_CHECK_VERSION(2,18,0)
-  {
-    GdkWindow *window = gtk_widget_get_window (widget);
+  GdkWindow *window = gtk_widget_get_window (widget);
 
-    /* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
-     * as well */
-    if (!gdk_window_ensure_native (window))
-      g_error ("Couldn't create native window needed for GstVideoOverlay!");
-  }
-#endif
+  /* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
+   * as well */
+  if (!gdk_window_ensure_native (window))
+    g_error ("Couldn't create native window needed for GstXOverlay!");
 
 #ifdef HAVE_X
-  {
-    GdkWindow *window = gtk_widget_get_window (video_window);
-
-    embed_xid = GDK_WINDOW_XID (window);
-    g_print ("Window realize: video window XID = %lu\n", embed_xid);
-  }
+  embed_xid = GDK_WINDOW_XID (window);
+  g_print ("Window realize: video window XID = %lu\n", embed_xid);
 #endif
 }
 
@@ -2700,8 +2676,10 @@ main (int argc, char **argv)
   GOptionContext *ctx;
   GError *err = NULL;
 
+#if !GLIB_CHECK_VERSION (2, 31, 0)
   if (!g_thread_supported ())
     g_thread_init (NULL);
+#endif
 
   ctx = g_option_context_new ("- test seeking in gsteamer");
   g_option_context_add_main_entries (ctx, options, NULL);
@@ -2758,8 +2736,7 @@ main (int argc, char **argv)
   /* initialize gui elements ... */
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   video_window = gtk_drawing_area_new ();
-  g_signal_connect (video_window, "expose-event",
-      G_CALLBACK (handle_expose_cb), NULL);
+  g_signal_connect (video_window, "draw", G_CALLBACK (draw_cb), NULL);
   g_signal_connect (video_window, "realize", G_CALLBACK (realize_cb), NULL);
   gtk_widget_set_double_buffered (video_window, FALSE);
 
@@ -2878,7 +2855,7 @@ main (int argc, char **argv)
       pipeline);
 
   if (pipeline_type == 16) {
-    /* the playbin2 panel controls for the video/audio/subtitle tracks */
+    /* the playbin panel controls for the video/audio/subtitle tracks */
     panel = gtk_hbox_new (FALSE, 0);
     video_combo = gtk_combo_box_text_new ();
     audio_combo = gtk_combo_box_text_new ();
@@ -2895,7 +2872,7 @@ main (int argc, char **argv)
         G_CALLBACK (audio_combo_cb), pipeline);
     g_signal_connect (G_OBJECT (text_combo), "changed",
         G_CALLBACK (text_combo_cb), pipeline);
-    /* playbin2 panel for flag checkboxes and volume/mute */
+    /* playbin panel for flag checkboxes and volume/mute */
     boxes = gtk_hbox_new (FALSE, 0);
     vis_checkbox = gtk_check_button_new_with_label ("Vis");
     video_checkbox = gtk_check_button_new_with_label ("Video");
@@ -2939,7 +2916,7 @@ main (int argc, char **argv)
         G_CALLBACK (buffer_toggle_cb), pipeline);
     g_signal_connect (G_OBJECT (volume_spinbutton), "value_changed",
         G_CALLBACK (volume_spinbutton_changed_cb), pipeline);
-    /* playbin2 panel for snapshot */
+    /* playbin panel for snapshot */
     boxes2 = gtk_hbox_new (FALSE, 0);
     shot_button = gtk_button_new_from_stock (GTK_STOCK_SAVE);
     gtk_widget_set_tooltip_text (shot_button,
@@ -2984,7 +2961,7 @@ main (int argc, char **argv)
   gtk_table_attach_defaults (GTK_TABLE (flagtable), rate_spinbutton, 4, 5, 1,
       2);
   if (panel && boxes && boxes2) {
-    expander = gtk_expander_new ("playbin2 options");
+    expander = gtk_expander_new ("playbin options");
     pb2vbox = gtk_vbox_new (FALSE, 0);
     gtk_box_pack_start (GTK_BOX (pb2vbox), panel, FALSE, FALSE, 2);
     gtk_box_pack_start (GTK_BOX (pb2vbox), boxes, FALSE, FALSE, 2);