summaryrefslogtreecommitdiffstats
path: root/examples/seeking
diff options
context:
space:
mode:
Diffstat (limited to 'examples/seeking')
-rw-r--r--examples/seeking/cdparanoia.c4
-rw-r--r--examples/seeking/cdplayer.c43
-rw-r--r--examples/seeking/seek.c8
-rw-r--r--examples/seeking/spider_seek.c6
-rw-r--r--examples/seeking/vorbisfile.c2
5 files changed, 28 insertions, 35 deletions
diff --git a/examples/seeking/cdparanoia.c b/examples/seeking/cdparanoia.c
index ec047f95..db7223ff 100644
--- a/examples/seeking/cdparanoia.c
+++ b/examples/seeking/cdparanoia.c
@@ -24,7 +24,7 @@ get_position_info (GstElement *cdparanoia)
definition = gst_format_get_details (*formats);
format = *formats;
- res = gst_pad_query (pad, GST_PAD_QUERY_POSITION,
+ res = gst_pad_query (pad, GST_QUERY_POSITION,
&format, &position);
if (format == GST_FORMAT_TIME) {
@@ -70,7 +70,7 @@ get_track_info (GstElement *cdparanoia)
definition = gst_format_get_details (*formats);
format = *formats;
- res = gst_pad_query (pad, GST_PAD_QUERY_TOTAL,
+ res = gst_pad_query (pad, GST_QUERY_TOTAL,
&format, &total);
if (res) {
if (format == GST_FORMAT_TIME) {
diff --git a/examples/seeking/cdplayer.c b/examples/seeking/cdplayer.c
index a833c67a..35921023 100644
--- a/examples/seeking/cdplayer.c
+++ b/examples/seeking/cdplayer.c
@@ -13,31 +13,19 @@ static guint64 duration;
static guint update_id;
-//#define SOURCE "gnomevfssrc"
-#define SOURCE "filesrc"
-
#define UPDATE_INTERVAL 500
static GstElement*
-make_cdaudio_pipeline (gboolean thread)
+make_cdaudio_pipeline (void)
{
- GstElement *pipeline;
GstElement *cdaudio;
- if (thread) {
- pipeline = gst_thread_new ("app");
- }
- else {
- pipeline = gst_pipeline_new ("app");
- }
-
cdaudio = gst_element_factory_make ("cdaudio", "cdaudio");
-
- gst_bin_add (GST_BIN (pipeline), cdaudio);
+ g_assert (cdaudio != NULL);
seekable_elements = g_list_prepend (seekable_elements, cdaudio);
- return pipeline;
+ return cdaudio;
}
static gchar*
@@ -91,7 +79,7 @@ query_durations ()
GstFormat format;
format = seek_formats[i].format;
- res = gst_element_query (element, GST_PAD_QUERY_TOTAL, &format, &value);
+ res = gst_element_query (element, GST_QUERY_TOTAL, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
}
@@ -121,7 +109,7 @@ query_positions ()
GstFormat format;
format = seek_formats[i].format;
- res = gst_element_query (element, GST_PAD_QUERY_POSITION, &format, &value);
+ res = gst_element_query (element, GST_QUERY_POSITION, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
}
@@ -139,7 +127,7 @@ static gboolean
update_scale (gpointer data)
{
GstClock *clock;
- guint64 position;
+ guint64 position = 0;
GstFormat format = GST_FORMAT_TIME;
duration = 0;
@@ -147,12 +135,14 @@ update_scale (gpointer data)
if (seekable_elements) {
GstElement *element = GST_ELEMENT (seekable_elements->data);
- gst_element_query (element, GST_PAD_QUERY_TOTAL, &format, &duration);
+ gst_element_query (element, GST_QUERY_TOTAL, &format, &duration);
}
- position = gst_clock_get_time (clock);
+ if (clock)
+ position = gst_clock_get_time (clock);
if (stats) {
- g_print ("clock: %13llu (%s)\n", position, gst_object_get_name (GST_OBJECT (clock)));
+ if (clock)
+ g_print ("clock: %13llu (%s)\n", position, gst_object_get_name (GST_OBJECT (clock)));
query_durations ();
query_positions ();
}
@@ -168,6 +158,7 @@ iterate (gpointer data)
{
gboolean res = TRUE;
+ g_print ("iterate\n");
res = gst_bin_iterate (GST_BIN (data));
if (!res) {
gtk_timeout_remove (update_id);
@@ -249,10 +240,7 @@ main (int argc, char **argv)
GtkWidget *window, *hbox, *vbox,
*play_button, *pause_button, *stop_button,
*hscale;
- gboolean threaded = FALSE;
struct poptOption options[] = {
- {"threaded", 't', POPT_ARG_NONE|POPT_ARGFLAG_STRIP, &threaded, 0,
- "Run the pipeline in a toplevel thread", NULL},
{"stats", 's', POPT_ARG_NONE|POPT_ARGFLAG_STRIP, &stats, 0,
"Show element stats", NULL},
POPT_TABLEEND
@@ -261,7 +249,10 @@ main (int argc, char **argv)
gst_init_with_popt_table (&argc, &argv, options);
gtk_init (&argc, &argv);
- pipeline = make_cdaudio_pipeline (threaded);
+ pipeline = make_cdaudio_pipeline ();
+
+ g_signal_connect (pipeline, "deep_notify", G_CALLBACK (gst_element_default_deep_notify), NULL);
+ g_signal_connect (pipeline, "error", G_CALLBACK (gst_element_default_error), NULL);
/* initialize gui elements ... */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@@ -303,6 +294,8 @@ main (int argc, char **argv)
gtk_main ();
+ gst_element_set_state (pipeline, GST_STATE_NULL);
+
gst_buffer_print_stats();
gst_event_print_stats();
diff --git a/examples/seeking/seek.c b/examples/seeking/seek.c
index 49b3a508..b8fcad77 100644
--- a/examples/seeking/seek.c
+++ b/examples/seeking/seek.c
@@ -407,7 +407,7 @@ make_mpeg_pipeline (const gchar *location)
g_object_set (G_OBJECT (src), "location", location, NULL);
demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
- //g_object_set (G_OBJECT (demux), "sync", TRUE, NULL);
+ g_object_set (G_OBJECT (demux), "sync", TRUE, NULL);
seekable_elements = g_list_prepend (seekable_elements, demux);
@@ -604,7 +604,7 @@ query_durations ()
GstFormat format;
format = seek_formats[i].format;
- res = gst_pad_query (pad, GST_PAD_QUERY_TOTAL, &format, &value);
+ res = gst_pad_query (pad, GST_QUERY_TOTAL, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
}
@@ -635,7 +635,7 @@ query_positions ()
GstFormat format;
format = seek_formats[i].format;
- res = gst_pad_query (pad, GST_PAD_QUERY_POSITION, &format, &value);
+ res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
}
@@ -662,7 +662,7 @@ update_scale (gpointer data)
if (seekable_pads) {
GstPad *pad = GST_PAD (seekable_pads->data);
- gst_pad_query (pad, GST_PAD_QUERY_TOTAL, &format, &duration);
+ gst_pad_query (pad, GST_QUERY_TOTAL, &format, &duration);
}
position = gst_clock_get_time (clock);
diff --git a/examples/seeking/spider_seek.c b/examples/seeking/spider_seek.c
index 849bafaa..6c88ae44 100644
--- a/examples/seeking/spider_seek.c
+++ b/examples/seeking/spider_seek.c
@@ -153,7 +153,7 @@ query_durations ()
GstFormat format;
format = seek_formats[i].format;
- res = gst_element_query (element, GST_PAD_QUERY_TOTAL, &format, &value);
+ res = gst_element_query (element, GST_QUERY_TOTAL, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
}
@@ -183,7 +183,7 @@ query_positions ()
GstFormat format;
format = seek_formats[i].format;
- res = gst_element_query (element, GST_PAD_QUERY_POSITION, &format, &value);
+ res = gst_element_query (element, GST_QUERY_POSITION, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
}
@@ -209,7 +209,7 @@ update_scale (gpointer data)
if (seekable_elements) {
GstElement *element = GST_ELEMENT (seekable_elements->data);
- gst_element_query (element, GST_PAD_QUERY_TOTAL, &format, &duration);
+ gst_element_query (element, GST_QUERY_TOTAL, &format, &duration);
}
position = gst_clock_get_time (clock);
diff --git a/examples/seeking/vorbisfile.c b/examples/seeking/vorbisfile.c
index 489c5c64..304c1851 100644
--- a/examples/seeking/vorbisfile.c
+++ b/examples/seeking/vorbisfile.c
@@ -230,7 +230,7 @@ collect_stream_properties (struct probe_context *context)
format = *formats;
formats++;
- res = gst_pad_query (context->pad, GST_PAD_QUERY_TOTAL,
+ res = gst_pad_query (context->pad, GST_QUERY_TOTAL,
&format, &value);
definition = gst_format_get_details (format);