summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2002-12-30 17:53:18 +0000
committerWim Taymans <wim.taymans@gmail.com>2002-12-30 17:53:18 +0000
commit2deab46c699196a902a076bbd969d26a15d9068a (patch)
tree6d3936fd0046d1a3679a29aa833c72dc959fa9e9
parent5f3fa649393fc4321b76e3220d3682511281d405 (diff)
downloadgst-plugins-bad-2deab46c699196a902a076bbd969d26a15d9068a.tar.gz
gst-plugins-bad-2deab46c699196a902a076bbd969d26a15d9068a.tar.bz2
gst-plugins-bad-2deab46c699196a902a076bbd969d26a15d9068a.zip
Fix plugins for new query API
Original commit message from CVS: Fix plugins for new query API
-rw-r--r--examples/indexing/indexmpeg.c3
-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
-rw-r--r--examples/stats/mp2ogg.c4
-rw-r--r--ext/swfdec/gstswfdec.c10
-rw-r--r--gst-libs/gst/media-info/media-info.c6
-rw-r--r--gst-libs/gst/play/play.old.c4
-rw-r--r--gst/modplug/gstmodplug.cc28
11 files changed, 57 insertions, 61 deletions
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;
diff --git a/ext/swfdec/gstswfdec.c b/ext/swfdec/gstswfdec.c
index 9f696e70..497717f9 100644
--- a/ext/swfdec/gstswfdec.c
+++ b/ext/swfdec/gstswfdec.c
@@ -102,7 +102,7 @@ gst_swfdec_request_new_pad (GstElement *element, GstPadTemplate *templ,
#if 0
static gboolean gst_swfdec_src_event (GstPad *pad, GstEvent *event);
-static gboolean gst_swfdec_src_query (GstPad *pad, GstPadQueryType type,
+static gboolean gst_swfdec_src_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value);
static gboolean gst_swfdec_convert_sink (GstPad *pad, GstFormat src_format, gint64 src_value,
@@ -851,7 +851,7 @@ gst_swfdec_convert_src (GstPad *pad, GstFormat src_format, gint64 src_value,
#if 0
static gboolean
-gst_swfdec_src_query (GstPad *pad, GstPadQueryType type,
+gst_swfdec_src_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value)
{
gboolean res = TRUE;
@@ -863,7 +863,7 @@ gst_swfdec_src_query (GstPad *pad, GstPadQueryType type,
swfdec = GST_SWFDEC (gst_pad_get_parent (pad));
switch (type) {
- case GST_PAD_QUERY_TOTAL:
+ case GST_QUERY_TOTAL:
{
switch (*format) {
case GST_FORMAT_DEFAULT:
@@ -882,7 +882,7 @@ gst_swfdec_src_query (GstPad *pad, GstPadQueryType type,
peer_format = formats[i];
/* do the probe */
- if (gst_pad_query (GST_PAD_PEER (swfdec->sinkpad), GST_PAD_QUERY_TOTAL,
+ if (gst_pad_query (GST_PAD_PEER (swfdec->sinkpad), GST_QUERY_TOTAL,
&peer_format, &peer_value))
{
GstFormat conv_format;
@@ -906,7 +906,7 @@ gst_swfdec_src_query (GstPad *pad, GstPadQueryType type,
}
break;
}
- case GST_PAD_QUERY_POSITION:
+ case GST_QUERY_POSITION:
{
switch (*format) {
case GST_FORMAT_DEFAULT:
diff --git a/gst-libs/gst/media-info/media-info.c b/gst-libs/gst/media-info/media-info.c
index 4dea33b4..624a06a0 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 41f9edef..2e9edea7 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/gst/modplug/gstmodplug.cc b/gst/modplug/gstmodplug.cc
index 61fd270a..bf2bfdf1 100644
--- a/gst/modplug/gstmodplug.cc
+++ b/gst/modplug/gstmodplug.cc
@@ -120,12 +120,12 @@ static void gst_modplug_loop (GstElement *element);
static void gst_modplug_setup (GstModPlug *modplug);
static const GstFormat*
gst_modplug_get_formats (GstPad *pad);
-static const GstPadQueryType*
+static const GstQueryType*
gst_modplug_get_query_types (GstPad *pad);
static gboolean
gst_modplug_src_event (GstPad *pad, GstEvent *event);
static gboolean
- gst_modplug_src_query (GstPad *pad, GstPadQueryType type, GstFormat *format, gint64 *value);
+ gst_modplug_src_query (GstPad *pad, GstQueryType type, GstFormat *format, gint64 *value);
static GstElementStateReturn
gst_modplug_change_state (GstElement *element);
@@ -395,18 +395,18 @@ gst_modplug_get_formats (GstPad *pad)
return (GST_PAD_IS_SRC (pad) ? src_formats : sink_formats);
}
-static const GstPadQueryType*
+static const GstQueryType*
gst_modplug_get_query_types (GstPad *pad)
{
- static const GstPadQueryType gst_modplug_src_query_types[] = {
- GST_PAD_QUERY_TOTAL,
- GST_PAD_QUERY_POSITION,
- (GstPadQueryType)0
+ static const GstQueryType gst_modplug_src_query_types[] = {
+ GST_QUERY_TOTAL,
+ GST_QUERY_POSITION,
+ (GstQueryType)0
};
return gst_modplug_src_query_types;
}
static gboolean
-gst_modplug_src_query (GstPad *pad, GstPadQueryType type,
+gst_modplug_src_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value)
{
gboolean res = TRUE;
@@ -416,7 +416,7 @@ gst_modplug_src_query (GstPad *pad, GstPadQueryType type,
modplug = GST_MODPLUG (gst_pad_get_parent (pad));
switch (type) {
- case GST_PAD_QUERY_TOTAL:
+ case GST_QUERY_TOTAL:
switch (*format) {
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
@@ -428,7 +428,7 @@ gst_modplug_src_query (GstPad *pad, GstPadQueryType type,
break;
}
break;
- case GST_PAD_QUERY_POSITION:
+ case GST_QUERY_POSITION:
switch (*format) {
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
@@ -621,7 +621,11 @@ gst_modplug_handle_event (GstPad *pad, GstBuffer *buffer)
for (i = 0; i < n; i++)
{
- if (gst_pad_handles_format (pad,
+ const GstFormat *formats;
+
+ formats = gst_pad_get_formats (pad);
+
+ if (gst_formats_contains (formats,
GST_EVENT_DISCONT_OFFSET(event, i).format))
{
gint64 value = GST_EVENT_DISCONT_OFFSET (event, i).value;
@@ -754,7 +758,7 @@ gst_modplug_loop (GstElement *element)
gint64 value;
format = GST_FORMAT_TIME;
- gst_modplug_src_query (modplug->srcpad, GST_PAD_QUERY_POSITION, &format, &value);
+ gst_modplug_src_query (modplug->srcpad, GST_QUERY_POSITION, &format, &value);
if (modplug->need_discont && GST_PAD_IS_USABLE (modplug->srcpad))
{