mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
tests/examples/seek/seek.c: Hook up the SKIP seek flag.
Original commit message from CVS: * 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.
This commit is contained in:
parent
172e478fd1
commit
029f358f80
2 changed files with 35 additions and 4 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2008-12-11 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
|
* 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 <wim.taymans@collabora.co.uk>
|
2008-12-10 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
* gst/playback/gstplaybin2.c: (pad_added_cb):
|
* gst/playback/gstplaybin2.c: (pad_added_cb):
|
||||||
|
|
|
@ -77,6 +77,7 @@ static gboolean loop_seek = FALSE;
|
||||||
static gboolean flush_seek = TRUE;
|
static gboolean flush_seek = TRUE;
|
||||||
static gboolean scrub = TRUE;
|
static gboolean scrub = TRUE;
|
||||||
static gboolean play_scrub = FALSE;
|
static gboolean play_scrub = FALSE;
|
||||||
|
static gboolean skip_seek = FALSE;
|
||||||
static gdouble rate = 1.0;
|
static gdouble rate = 1.0;
|
||||||
|
|
||||||
static GstElement *pipeline;
|
static GstElement *pipeline;
|
||||||
|
@ -106,7 +107,7 @@ static gboolean need_streams = TRUE;
|
||||||
static GtkWidget *video_combo, *audio_combo, *text_combo, *vis_combo;
|
static GtkWidget *video_combo, *audio_combo, *text_combo, *vis_combo;
|
||||||
static GtkWidget *vis_checkbox, *video_checkbox, *audio_checkbox;
|
static GtkWidget *vis_checkbox, *video_checkbox, *audio_checkbox;
|
||||||
static GtkWidget *text_checkbox, *mute_checkbox, *volume_spinbutton;
|
static GtkWidget *text_checkbox, *mute_checkbox, *volume_spinbutton;
|
||||||
static GtkWidget *video_window;
|
static GtkWidget *skip_checkbox, *video_window;
|
||||||
|
|
||||||
GList *paths = NULL, *l = NULL;
|
GList *paths = NULL, *l = NULL;
|
||||||
|
|
||||||
|
@ -1285,6 +1286,8 @@ do_seek (GtkWidget * widget)
|
||||||
flags |= GST_SEEK_FLAG_KEY_UNIT;
|
flags |= GST_SEEK_FLAG_KEY_UNIT;
|
||||||
if (loop_seek)
|
if (loop_seek)
|
||||||
flags |= GST_SEEK_FLAG_SEGMENT;
|
flags |= GST_SEEK_FLAG_SEGMENT;
|
||||||
|
if (skip_seek)
|
||||||
|
flags |= GST_SEEK_FLAG_SKIP;
|
||||||
|
|
||||||
if (rate >= 0) {
|
if (rate >= 0) {
|
||||||
s_event = gst_event_new_seek (rate,
|
s_event = gst_event_new_seek (rate,
|
||||||
|
@ -1514,6 +1517,7 @@ stop_cb (GtkButton * button, gpointer data)
|
||||||
if (pipeline_type == 16)
|
if (pipeline_type == 16)
|
||||||
clear_streams (pipeline);
|
clear_streams (pipeline);
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* if one uses parse_launch, play, stop and play again it fails as all the
|
/* if one uses parse_launch, play, stop and play again it fails as all the
|
||||||
* pads after the demuxer can't be reconnected
|
* pads after the demuxer can't be reconnected
|
||||||
*/
|
*/
|
||||||
|
@ -1533,6 +1537,7 @@ stop_cb (GtkButton * button, gpointer data)
|
||||||
gst_element_set_state (pipeline, GST_STATE_READY);
|
gst_element_set_state (pipeline, GST_STATE_READY);
|
||||||
connect_bus_signals (pipeline);
|
connect_bus_signals (pipeline);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1582,6 +1587,15 @@ play_scrub_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
|
||||||
play_scrub = gtk_toggle_button_get_active (button);
|
play_scrub = gtk_toggle_button_get_active (button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
rate_spinbutton_changed_cb (GtkSpinButton * button, GstPipeline * pipeline)
|
rate_spinbutton_changed_cb (GtkSpinButton * button, GstPipeline * pipeline)
|
||||||
{
|
{
|
||||||
|
@ -1600,6 +1614,8 @@ rate_spinbutton_changed_cb (GtkSpinButton * button, GstPipeline * pipeline)
|
||||||
flags |= GST_SEEK_FLAG_ACCURATE;
|
flags |= GST_SEEK_FLAG_ACCURATE;
|
||||||
if (keyframe_seek)
|
if (keyframe_seek)
|
||||||
flags |= GST_SEEK_FLAG_KEY_UNIT;
|
flags |= GST_SEEK_FLAG_KEY_UNIT;
|
||||||
|
if (skip_seek)
|
||||||
|
flags |= GST_SEEK_FLAG_SKIP;
|
||||||
|
|
||||||
if (rate >= 0) {
|
if (rate >= 0) {
|
||||||
s_event = gst_event_new_seek (rate,
|
s_event = gst_event_new_seek (rate,
|
||||||
|
@ -2002,7 +2018,9 @@ msg_segment_done (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
|
||||||
/* in the segment-done callback we never flush as this would not make sense
|
/* in the segment-done callback we never flush as this would not make sense
|
||||||
* for seamless playback. */
|
* for seamless playback. */
|
||||||
if (loop_seek)
|
if (loop_seek)
|
||||||
flags = GST_SEEK_FLAG_SEGMENT;
|
flags |= GST_SEEK_FLAG_SEGMENT;
|
||||||
|
if (skip_seek)
|
||||||
|
flags |= GST_SEEK_FLAG_SKIP;
|
||||||
|
|
||||||
s_event = gst_event_new_seek (rate,
|
s_event = gst_event_new_seek (rate,
|
||||||
GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0),
|
GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0),
|
||||||
|
@ -2328,6 +2346,7 @@ main (int argc, char **argv)
|
||||||
flush_checkbox = gtk_check_button_new_with_label ("Flush");
|
flush_checkbox = gtk_check_button_new_with_label ("Flush");
|
||||||
scrub_checkbox = gtk_check_button_new_with_label ("Scrub");
|
scrub_checkbox = gtk_check_button_new_with_label ("Scrub");
|
||||||
play_scrub_checkbox = gtk_check_button_new_with_label ("Play 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);
|
rate_spinbutton = gtk_spin_button_new_with_range (-100, 100, 0.1);
|
||||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (rate_spinbutton), 3);
|
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (rate_spinbutton), 3);
|
||||||
rate_label = gtk_label_new ("Rate");
|
rate_label = gtk_label_new ("Rate");
|
||||||
|
@ -2347,6 +2366,8 @@ main (int argc, char **argv)
|
||||||
NULL);
|
NULL);
|
||||||
gtk_tooltips_set_tip (tips, play_scrub_checkbox, "play video while seeking",
|
gtk_tooltips_set_tip (tips, play_scrub_checkbox, "play video while seeking",
|
||||||
NULL);
|
NULL);
|
||||||
|
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 (flush_checkbox), TRUE);
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scrub_checkbox), TRUE);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scrub_checkbox), TRUE);
|
||||||
|
@ -2461,8 +2482,9 @@ main (int argc, char **argv)
|
||||||
gtk_table_attach_defaults (GTK_TABLE (flagtable), scrub_checkbox, 1, 2, 1, 2);
|
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,
|
gtk_table_attach_defaults (GTK_TABLE (flagtable), play_scrub_checkbox, 2, 3,
|
||||||
1, 2);
|
1, 2);
|
||||||
gtk_table_attach_defaults (GTK_TABLE (flagtable), rate_label, 3, 4, 0, 1);
|
gtk_table_attach_defaults (GTK_TABLE (flagtable), skip_checkbox, 3, 4, 0, 1);
|
||||||
gtk_table_attach_defaults (GTK_TABLE (flagtable), rate_spinbutton, 3, 4, 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);
|
2);
|
||||||
if (panel && boxes && boxes2) {
|
if (panel && boxes && boxes2) {
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), panel, FALSE, FALSE, 2);
|
gtk_box_pack_start (GTK_BOX (vbox), panel, FALSE, FALSE, 2);
|
||||||
|
@ -2491,6 +2513,8 @@ main (int argc, char **argv)
|
||||||
G_CALLBACK (scrub_toggle_cb), pipeline);
|
G_CALLBACK (scrub_toggle_cb), pipeline);
|
||||||
g_signal_connect (G_OBJECT (play_scrub_checkbox), "toggled",
|
g_signal_connect (G_OBJECT (play_scrub_checkbox), "toggled",
|
||||||
G_CALLBACK (play_scrub_toggle_cb), pipeline);
|
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_signal_connect (G_OBJECT (rate_spinbutton), "value_changed",
|
||||||
G_CALLBACK (rate_spinbutton_changed_cb), pipeline);
|
G_CALLBACK (rate_spinbutton_changed_cb), pipeline);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue