From 2deab46c699196a902a076bbd969d26a15d9068a Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 30 Dec 2002 17:53:18 +0000 Subject: Fix plugins for new query API Original commit message from CVS: Fix plugins for new query API --- examples/indexing/indexmpeg.c | 3 +-- examples/seeking/cdparanoia.c | 4 ++-- examples/seeking/cdplayer.c | 43 ++++++++++++++++++------------------------ examples/seeking/seek.c | 8 ++++---- examples/seeking/spider_seek.c | 6 +++--- examples/seeking/vorbisfile.c | 2 +- examples/stats/mp2ogg.c | 4 ++-- 7 files changed, 31 insertions(+), 39 deletions(-) (limited to 'examples') diff --git a/examples/indexing/indexmpeg.c b/examples/indexing/indexmpeg.c index fc5b83fb..10215a0e 100644 --- a/examples/indexing/indexmpeg.c +++ b/examples/indexing/indexmpeg.c @@ -175,7 +175,7 @@ print_progress (GstPad *pad) status[0] = '|'; format = GST_FORMAT_PERCENT; - res = gst_pad_query (pad, GST_PAD_QUERY_POSITION, &format, &value); + res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &value); if (res) { percent = value / (2 * GST_FORMAT_PERCENT_SCALE); } @@ -222,7 +222,6 @@ main (gint argc, gchar *argv[]) /* create index that elements can fill */ index = gst_index_factory_make ("memindex"); - index = NULL; if (verbose && index) g_signal_connect (G_OBJECT (index), "entry_added", G_CALLBACK (entry_added), NULL); 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); diff --git a/examples/stats/mp2ogg.c b/examples/stats/mp2ogg.c index 273a349a..e5d3fbd9 100644 --- a/examples/stats/mp2ogg.c +++ b/examples/stats/mp2ogg.c @@ -71,11 +71,11 @@ main (gint argc, gchar *argv[]) format = GST_FORMAT_TIME; /* get the position */ - gst_pad_query (enc_src, GST_PAD_QUERY_POSITION, + gst_pad_query (enc_src, GST_QUERY_POSITION, &format, &position); /* get the total duration */ - gst_pad_query (enc_src, GST_PAD_QUERY_TOTAL, + gst_pad_query (enc_src, GST_QUERY_TOTAL, &format, &duration); format = GST_FORMAT_BYTES; -- cgit v1.2.1