From 12bd93773cd3f2684b69af42fbf47bfea82791c4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 30 Dec 2002 17:53:18 +0000 Subject: [PATCH] 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 +-- ext/cdparanoia/gstcdparanoia.c | 26 +++++++-------- ext/gnomevfs/gstgnomevfssrc.c | 16 ++++----- ext/vorbis/vorbisenc.c | 16 ++++----- ext/vorbis/vorbisfile.c | 18 +++++------ gst-libs/gst/media-info/media-info.c | 6 ++-- gst-libs/gst/play/play.old.c | 4 +-- tests/examples/seek/seek.c | 8 ++--- tests/examples/seek/spider_seek.c | 6 ++-- tests/examples/seek/vorbisfile.c | 2 +- tests/old/examples/indexing/indexmpeg.c | 3 +- tests/old/examples/seek/cdparanoia.c | 4 +-- tests/old/examples/seek/cdplayer.c | 43 +++++++++++-------------- tests/old/examples/seek/spider_seek.c | 6 ++-- tests/old/examples/seek/vorbisfile.c | 2 +- tests/old/examples/stats/mp2ogg.c | 4 +-- 22 files changed, 109 insertions(+), 125 deletions(-) diff --git a/examples/indexing/indexmpeg.c b/examples/indexing/indexmpeg.c index fc5b83fb4..10215a0e9 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 ec047f958..db7223ffe 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 a833c67a5..359210237 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 49b3a5080..b8fcad774 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 849bafaaf..6c88ae441 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 489c5c644..304c18511 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 273a349ac..e5d3fbd9b 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; diff --git a/ext/cdparanoia/gstcdparanoia.c b/ext/cdparanoia/gstcdparanoia.c index 7cb263908..06485d8fb 100644 --- a/ext/cdparanoia/gstcdparanoia.c +++ b/ext/cdparanoia/gstcdparanoia.c @@ -155,9 +155,9 @@ static gboolean cdparanoia_convert (GstPad *pad, gint64 src_value, GstFormat *dest_format, gint64 *dest_value); -static gboolean cdparanoia_query (GstPad *pad, GstPadQueryType type, +static gboolean cdparanoia_query (GstPad *pad, GstQueryType type, GstFormat *format, gint64 *value); -static const GstPadQueryType* +static const GstQueryType* cdparanoia_get_query_types (GstPad *pad); static GstElementStateReturn cdparanoia_change_state (GstElement *element); @@ -963,21 +963,21 @@ cdparanoia_convert (GstPad *pad, return TRUE; } -static const GstPadQueryType* +static const GstQueryType* cdparanoia_get_query_types (GstPad *pad) { - static const GstPadQueryType src_query_types[] = { - GST_PAD_QUERY_TOTAL, - GST_PAD_QUERY_POSITION, - GST_PAD_QUERY_START, - GST_PAD_QUERY_SEGMENT_END, + static const GstQueryType src_query_types[] = { + GST_QUERY_TOTAL, + GST_QUERY_POSITION, + GST_QUERY_START, + GST_QUERY_SEGMENT_END, 0 }; return src_query_types; } static gboolean -cdparanoia_query (GstPad *pad, GstPadQueryType type, +cdparanoia_query (GstPad *pad, GstQueryType type, GstFormat *format, gint64 *value) { gboolean res = TRUE; @@ -989,25 +989,25 @@ cdparanoia_query (GstPad *pad, GstPadQueryType type, return FALSE; switch (type) { - case GST_PAD_QUERY_TOTAL: + case GST_QUERY_TOTAL: /* we take the last sector + 1 so that we also have the full * size of that last sector */ res = gst_pad_convert (src->srcpad, sector_format, src->last_sector + 1, format, value); break; - case GST_PAD_QUERY_POSITION: + case GST_QUERY_POSITION: /* bring our current sector to the requested format */ res = gst_pad_convert (src->srcpad, sector_format, src->cur_sector, format, value); break; - case GST_PAD_QUERY_START: + case GST_QUERY_START: res = gst_pad_convert (src->srcpad, sector_format, src->segment_start_sector, format, value); break; - case GST_PAD_QUERY_SEGMENT_END: + case GST_QUERY_SEGMENT_END: res = gst_pad_convert (src->srcpad, sector_format, src->segment_end_sector, format, value); diff --git a/ext/gnomevfs/gstgnomevfssrc.c b/ext/gnomevfs/gstgnomevfssrc.c index adff9550b..31c5e1257 100644 --- a/ext/gnomevfs/gstgnomevfssrc.c +++ b/ext/gnomevfs/gstgnomevfssrc.c @@ -137,16 +137,16 @@ GstElementDetails gst_gnomevfssrc_details = { "(C) 2001", }; -GST_FORMATS_FUNCTION (gst_gnomevfssrc_get_formats, +GST_PAD_FORMATS_FUNCTION (gst_gnomevfssrc_get_formats, GST_FORMAT_BYTES ) GST_PAD_QUERY_TYPE_FUNCTION (gst_gnomevfssrc_get_query_types, - GST_PAD_QUERY_TOTAL, - GST_PAD_QUERY_POSITION + GST_QUERY_TOTAL, + GST_QUERY_POSITION ) -GST_EVENT_MASK_FUNCTION (gst_gnomevfssrc_get_event_mask, +GST_PAD_EVENT_MASK_FUNCTION (gst_gnomevfssrc_get_event_mask, { GST_EVENT_SEEK, GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_SET | GST_SEEK_METHOD_END | @@ -190,7 +190,7 @@ static GstElementStateReturn static void gst_gnomevfssrc_close_file (GstGnomeVFSSrc *src); static gboolean gst_gnomevfssrc_open_file (GstGnomeVFSSrc *src); static gboolean gst_gnomevfssrc_srcpad_event (GstPad *pad, GstEvent *event); -static gboolean gst_gnomevfssrc_srcpad_query (GstPad *pad, GstPadQueryType type, +static gboolean gst_gnomevfssrc_srcpad_query (GstPad *pad, GstQueryType type, GstFormat *format, gint64 *value); static int audiocast_init(GstGnomeVFSSrc *src); @@ -1155,19 +1155,19 @@ static gboolean plugin_init(GModule *module, GstPlugin *plugin) static gboolean -gst_gnomevfssrc_srcpad_query (GstPad *pad, GstPadQueryType type, +gst_gnomevfssrc_srcpad_query (GstPad *pad, GstQueryType type, GstFormat *format, gint64 *value) { GstGnomeVFSSrc *src = GST_GNOMEVFSSRC (gst_pad_get_parent (pad)); switch (type) { - case GST_PAD_QUERY_TOTAL: + case GST_QUERY_TOTAL: if (*format != GST_FORMAT_BYTES) { return FALSE; } *value = src->size; break; - case GST_PAD_QUERY_POSITION: + case GST_QUERY_POSITION: if (*format != GST_FORMAT_BYTES) { return FALSE; } diff --git a/ext/vorbis/vorbisenc.c b/ext/vorbis/vorbisenc.c index 34b5e7f60..db9cbff7c 100644 --- a/ext/vorbis/vorbisenc.c +++ b/ext/vorbis/vorbisenc.c @@ -307,19 +307,19 @@ gst_vorbisenc_convert_sink (GstPad *pad, GstFormat src_format, gint64 src_value, return res; } -static const GstPadQueryType* +static const GstQueryType* gst_vorbisenc_get_query_types (GstPad *pad) { - static const GstPadQueryType gst_vorbisenc_src_query_types[] = { - GST_PAD_QUERY_TOTAL, - GST_PAD_QUERY_POSITION, + static const GstQueryType gst_vorbisenc_src_query_types[] = { + GST_QUERY_TOTAL, + GST_QUERY_POSITION, 0 }; return gst_vorbisenc_src_query_types; } static gboolean -gst_vorbisenc_src_query (GstPad *pad, GstPadQueryType type, +gst_vorbisenc_src_query (GstPad *pad, GstQueryType type, GstFormat *format, gint64 *value) { gboolean res = TRUE; @@ -328,7 +328,7 @@ gst_vorbisenc_src_query (GstPad *pad, GstPadQueryType type, vorbisenc = GST_VORBISENC (gst_pad_get_parent (pad)); switch (type) { - case GST_PAD_QUERY_TOTAL: + case GST_QUERY_TOTAL: { switch (*format) { case GST_FORMAT_DEFAULT: @@ -349,7 +349,7 @@ gst_vorbisenc_src_query (GstPad *pad, GstPadQueryType type, GstFormat peer_format = *peer_formats; /* do the probe */ - if (gst_pad_query (GST_PAD_PEER (vorbisenc->sinkpad), GST_PAD_QUERY_TOTAL, + if (gst_pad_query (GST_PAD_PEER (vorbisenc->sinkpad), GST_QUERY_TOTAL, &peer_format, &peer_value)) { GstFormat conv_format; @@ -373,7 +373,7 @@ gst_vorbisenc_src_query (GstPad *pad, GstPadQueryType type, } break; } - case GST_PAD_QUERY_POSITION: + case GST_QUERY_POSITION: switch (*format) { case GST_FORMAT_DEFAULT: *format = GST_FORMAT_TIME; diff --git a/ext/vorbis/vorbisfile.c b/ext/vorbis/vorbisfile.c index e1d8f92a4..628ace42e 100644 --- a/ext/vorbis/vorbisfile.c +++ b/ext/vorbis/vorbisfile.c @@ -116,11 +116,11 @@ static gboolean gst_vorbisfile_sink_convert (GstPad *pad, gint64 src_value, GstFormat *dest_format, gint64 *dest_value); -static const GstPadQueryType* +static const GstQueryType* gst_vorbisfile_get_query_types (GstPad *pad); static gboolean gst_vorbisfile_src_query (GstPad *pad, - GstPadQueryType type, + GstQueryType type, GstFormat *format, gint64 *value); static const @@ -816,12 +816,12 @@ gst_vorbisfile_sink_convert (GstPad *pad, return res; } -static const GstPadQueryType* +static const GstQueryType* gst_vorbisfile_get_query_types (GstPad *pad) { - static const GstPadQueryType types[] = { - GST_PAD_QUERY_TOTAL, - GST_PAD_QUERY_POSITION, + static const GstQueryType types[] = { + GST_QUERY_TOTAL, + GST_QUERY_POSITION, 0 }; return types; @@ -829,7 +829,7 @@ gst_vorbisfile_get_query_types (GstPad *pad) /* handles queries for location in the stream in the requested format */ static gboolean -gst_vorbisfile_src_query (GstPad *pad, GstPadQueryType type, +gst_vorbisfile_src_query (GstPad *pad, GstQueryType type, GstFormat *format, gint64 *value) { gboolean res = TRUE; @@ -841,7 +841,7 @@ gst_vorbisfile_src_query (GstPad *pad, GstPadQueryType type, vi = ov_info (&vorbisfile->vf, -1); switch (type) { - case GST_PAD_QUERY_TOTAL: + case GST_QUERY_TOTAL: { switch (*format) { case GST_FORMAT_UNITS: @@ -878,7 +878,7 @@ gst_vorbisfile_src_query (GstPad *pad, GstPadQueryType type, } break; } - case GST_PAD_QUERY_POSITION: + case GST_QUERY_POSITION: switch (*format) { case GST_FORMAT_DEFAULT: *format = GST_FORMAT_TIME; diff --git a/gst-libs/gst/media-info/media-info.c b/gst-libs/gst/media-info/media-info.c index 4dea33b45..624a06a02 100644 --- a/gst-libs/gst/media-info/media-info.c +++ b/gst-libs/gst/media-info/media-info.c @@ -519,7 +519,7 @@ gst_media_info_get_stream (GstMediaInfo *info, GstMediaInfoStream *stream) format = *formats; g_assert (GST_IS_PAD (priv->decoder_pad)); - res = gst_pad_query (priv->decoder_pad, GST_PAD_QUERY_TOTAL, + res = gst_pad_query (priv->decoder_pad, GST_QUERY_TOTAL, &format, &value); definition = gst_format_get_details (*formats); @@ -554,7 +554,7 @@ gst_media_info_get_stream (GstMediaInfo *info, GstMediaInfoStream *stream) /* now get number of bytes from the sink pad to get the bitrate */ format = GST_FORMAT_BYTES; g_assert (GST_IS_PAD (priv->source_pad)); - res = gst_pad_query (priv->source_pad, GST_PAD_QUERY_TOTAL, + res = gst_pad_query (priv->source_pad, GST_QUERY_TOTAL, &format, &value); if (!res) g_warning ("Failed to query on sink pad !"); bytes = value; @@ -622,7 +622,7 @@ gst_media_info_find_streaminfo (GstMediaInfo *info) gint64 value_start, value_end; gboolean res; - res = gst_pad_query (priv->decoder_pad, GST_PAD_QUERY_POSITION, + res = gst_pad_query (priv->decoder_pad, GST_QUERY_POSITION, &track_format, &value_start); if (res) { diff --git a/gst-libs/gst/play/play.old.c b/gst-libs/gst/play/play.old.c index 41f9edef2..2e9edea73 100644 --- a/gst-libs/gst/play/play.old.c +++ b/gst-libs/gst/play/play.old.c @@ -548,12 +548,12 @@ gst_play_get_length_callback (GstPlay *play) g_print("trying to get length\n"); if (play->audio_sink_element != NULL){ g_mutex_lock(play->audio_bin_mutex); - query_worked = gst_element_query (play->audio_sink_element, GST_PAD_QUERY_TOTAL, &format, &value); + query_worked = gst_element_query (play->audio_sink_element, GST_QUERY_TOTAL, &format, &value); g_mutex_unlock(play->audio_bin_mutex); } else if (play->video_sink_element != NULL){ g_mutex_lock(play->video_bin_mutex); - query_worked = gst_element_query (play->video_sink_element, GST_PAD_QUERY_TOTAL, &format, &value); + query_worked = gst_element_query (play->video_sink_element, GST_QUERY_TOTAL, &format, &value); g_mutex_unlock(play->video_bin_mutex); } if (query_worked){ diff --git a/tests/examples/seek/seek.c b/tests/examples/seek/seek.c index 49b3a5080..b8fcad774 100644 --- a/tests/examples/seek/seek.c +++ b/tests/examples/seek/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/tests/examples/seek/spider_seek.c b/tests/examples/seek/spider_seek.c index 849bafaaf..6c88ae441 100644 --- a/tests/examples/seek/spider_seek.c +++ b/tests/examples/seek/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/tests/examples/seek/vorbisfile.c b/tests/examples/seek/vorbisfile.c index 489c5c644..304c18511 100644 --- a/tests/examples/seek/vorbisfile.c +++ b/tests/examples/seek/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/tests/old/examples/indexing/indexmpeg.c b/tests/old/examples/indexing/indexmpeg.c index fc5b83fb4..10215a0e9 100644 --- a/tests/old/examples/indexing/indexmpeg.c +++ b/tests/old/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/tests/old/examples/seek/cdparanoia.c b/tests/old/examples/seek/cdparanoia.c index ec047f958..db7223ffe 100644 --- a/tests/old/examples/seek/cdparanoia.c +++ b/tests/old/examples/seek/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/tests/old/examples/seek/cdplayer.c b/tests/old/examples/seek/cdplayer.c index a833c67a5..359210237 100644 --- a/tests/old/examples/seek/cdplayer.c +++ b/tests/old/examples/seek/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/tests/old/examples/seek/spider_seek.c b/tests/old/examples/seek/spider_seek.c index 849bafaaf..6c88ae441 100644 --- a/tests/old/examples/seek/spider_seek.c +++ b/tests/old/examples/seek/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/tests/old/examples/seek/vorbisfile.c b/tests/old/examples/seek/vorbisfile.c index 489c5c644..304c18511 100644 --- a/tests/old/examples/seek/vorbisfile.c +++ b/tests/old/examples/seek/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/tests/old/examples/stats/mp2ogg.c b/tests/old/examples/stats/mp2ogg.c index 273a349ac..e5d3fbd9b 100644 --- a/tests/old/examples/stats/mp2ogg.c +++ b/tests/old/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; -- 2.34.1