wtay gst-plugins-base: gst-plugins-base/ gst-plugins-base/tests/examples/seek/

[email protected] Thu, 11 Dec 2008 02:28:57 -0800 (PST)
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gst-plugins-base
Changes by:     wtay
Date:           Thu Dec 11 2008  10:28:57 UTC

Log message:
* tests/examples/seek/seek.c: (do_seek), (stop_cb),
(skip_toggle_cb), (rate_spinbutton_changed_cb), (msg_segment_done),
(main):
Hook up the SKIP seek flag.

Modified files:
    .               : ChangeLog
    tests/examples/seek: seek.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.4241&r2=1.4242
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/tests/examples/seek/seek.c.diff?r1=1.111&r2=1.112

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v
retrieving revision 1.4241
retrieving revision 1.4242
diff -u -d -r1.4241 -r1.4242
--- ChangeLog	10 Dec 2008 18:43:30 -0000	1.4241
+++ ChangeLog	11 Dec 2008 10:28:42 -0000	1.4242
@@ -1,3 +1,10 @@
+2008-12-11  Wim Taymans  <[email protected]>
+
+	* tests/examples/seek/seek.c: (do_seek), (stop_cb),
+	(skip_toggle_cb), (rate_spinbutton_changed_cb), (msg_segment_done),
+	(main):
+	Hook up the SKIP seek flag.
 2008-12-10  Wim Taymans  <[email protected]>
 
 	* gst/playback/gstplaybin2.c: (pad_added_cb):
Index: seek.c
RCS file: /cvs/gstreamer/gst-plugins-base/tests/examples/seek/seek.c,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- seek.c	21 Aug 2008 11:20:36 -0000	1.111
+++ seek.c	11 Dec 2008 10:28:43 -0000	1.112
@@ -77,6 +77,7 @@
 static gboolean flush_seek = TRUE;
 static gboolean scrub = TRUE;
 static gboolean play_scrub = FALSE;
+static gboolean skip_seek = FALSE;
 static gdouble rate = 1.0;
 static GstElement *pipeline;
@@ -106,7 +107,7 @@
 static GtkWidget *video_combo, *audio_combo, *text_combo, *vis_combo;
 static GtkWidget *vis_checkbox, *video_checkbox, *audio_checkbox;
 static GtkWidget *text_checkbox, *mute_checkbox, *volume_spinbutton;
-static GtkWidget *video_window;
+static GtkWidget *skip_checkbox, *video_window;
 GList *paths = NULL, *l = NULL;
@@ -1285,6 +1286,8 @@
     flags |= GST_SEEK_FLAG_KEY_UNIT;
   if (loop_seek)
     flags |= GST_SEEK_FLAG_SEGMENT;
+  if (skip_seek)
+    flags |= GST_SEEK_FLAG_SKIP;
   if (rate >= 0) {
     s_event = gst_event_new_seek (rate,
@@ -1514,6 +1517,7 @@
     if (pipeline_type == 16)
       clear_streams (pipeline);
+#if 0
     /* if one uses parse_launch, play, stop and play again it fails as all the
      * pads after the demuxer can't be reconnected
      */
@@ -1533,6 +1537,7 @@
       gst_element_set_state (pipeline, GST_STATE_READY);
       connect_bus_signals (pipeline);
     }
+#endif
   }
   return;
@@ -1583,6 +1588,15 @@
 }
 static void
+skip_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
+{
+  skip_seek = gtk_toggle_button_get_active (button);
+  if (state == GST_STATE_PLAYING) {
+    do_seek (hscale);
+  }
+}
+static void
 rate_spinbutton_changed_cb (GtkSpinButton * button, GstPipeline * pipeline)
 {
   gboolean res = FALSE;
@@ -1600,6 +1614,8 @@
     flags |= GST_SEEK_FLAG_ACCURATE;
   if (keyframe_seek)
@@ -2002,7 +2018,9 @@
   /* in the segment-done callback we never flush as this would not make sense
    * for seamless playback. */
-    flags = GST_SEEK_FLAG_SEGMENT;
+    flags |= GST_SEEK_FLAG_SEGMENT;
   s_event = gst_event_new_seek (rate,
       GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0),
@@ -2328,6 +2346,7 @@
   flush_checkbox = gtk_check_button_new_with_label ("Flush");
   scrub_checkbox = gtk_check_button_new_with_label ("Scrub");
   play_scrub_checkbox = gtk_check_button_new_with_label ("Play Scrub");
+  skip_checkbox = gtk_check_button_new_with_label ("Play Skip");
   rate_spinbutton = gtk_spin_button_new_with_range (-100, 100, 0.1);
   gtk_spin_button_set_digits (GTK_SPIN_BUTTON (rate_spinbutton), 3);
   rate_label = gtk_label_new ("Rate");
@@ -2347,6 +2366,8 @@
       NULL);
   gtk_tooltips_set_tip (tips, play_scrub_checkbox, "play video while seeking",
+  gtk_tooltips_set_tip (tips, skip_checkbox,
+      "Skip frames while playing at high frame rates", NULL);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flush_checkbox), TRUE);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scrub_checkbox), TRUE);
@@ -2461,8 +2482,9 @@
   gtk_table_attach_defaults (GTK_TABLE (flagtable), scrub_checkbox, 1, 2, 1, 2);
   gtk_table_attach_defaults (GTK_TABLE (flagtable), play_scrub_checkbox, 2, 3,
       1, 2);
-  gtk_table_attach_defaults (GTK_TABLE (flagtable), rate_label, 3, 4, 0, 1);
-  gtk_table_attach_defaults (GTK_TABLE (flagtable), rate_spinbutton, 3, 4, 1,
+  gtk_table_attach_defaults (GTK_TABLE (flagtable), skip_checkbox, 3, 4, 0, 1);
+  gtk_table_attach_defaults (GTK_TABLE (flagtable), rate_label, 4, 5, 0, 1);
+  gtk_table_attach_defaults (GTK_TABLE (flagtable), rate_spinbutton, 4, 5, 1,
       2);
   if (panel && boxes && boxes2) {
     gtk_box_pack_start (GTK_BOX (vbox), panel, FALSE, FALSE, 2);
@@ -2491,6 +2513,8 @@
       G_CALLBACK (scrub_toggle_cb), pipeline);
   g_signal_connect (G_OBJECT (play_scrub_checkbox), "toggled",
       G_CALLBACK (play_scrub_toggle_cb), pipeline);
+  g_signal_connect (G_OBJECT (skip_checkbox), "toggled",
+      G_CALLBACK (skip_toggle_cb), pipeline);
   g_signal_connect (G_OBJECT (rate_spinbutton), "value_changed",
       G_CALLBACK (rate_spinbutton_changed_cb), pipeline);

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/