ext/: Implement URI query. Fixes bug #562949.

Original commit message from CVS:
* ext/gio/gstgiobasesink.c: (gst_gio_base_sink_query):
* ext/gio/gstgiobasesrc.c: (gst_gio_base_src_class_init),
(gst_gio_base_src_query):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_query):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_class_init),
(gst_gnome_vfs_src_query):
Implement URI query. Fixes bug #562949.
This commit is contained in:
Sebastian Dröge 2008-12-20 17:38:41 +00:00
parent dba6f1f28c
commit 7e58fe30f5
5 changed files with 75 additions and 6 deletions

View file

@ -1,3 +1,13 @@
2008-12-20 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* ext/gio/gstgiobasesink.c: (gst_gio_base_sink_query):
* ext/gio/gstgiobasesrc.c: (gst_gio_base_src_class_init),
(gst_gio_base_src_query):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_query):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_class_init),
(gst_gnome_vfs_src_query):
Implement URI query. Fixes bug #562949.
2008-12-20 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/playback/gstplaybin2.c: (no_more_pads_cb):

View file

@ -308,6 +308,15 @@ gst_gio_base_sink_query (GstPad * pad, GstQuery * query)
case GST_QUERY_FORMATS:
gst_query_set_formats (query, 2, GST_FORMAT_DEFAULT, GST_FORMAT_BYTES);
return TRUE;
case GST_QUERY_URI:
if (GST_IS_URI_HANDLER (sink)) {
const gchar *uri;
uri = gst_uri_handler_get_uri (GST_URI_HANDLER (sink));
gst_query_set_uri (query, uri);
return TRUE;
}
return FALSE;
default:
return gst_pad_query_default (pad, query);
}

View file

@ -39,21 +39,17 @@ GST_BOILERPLATE (GstGioBaseSrc, gst_gio_base_src, GstBaseSrc,
static void gst_gio_base_src_finalize (GObject * object);
static gboolean gst_gio_base_src_start (GstBaseSrc * base_src);
static gboolean gst_gio_base_src_stop (GstBaseSrc * base_src);
static gboolean gst_gio_base_src_get_size (GstBaseSrc * base_src,
guint64 * size);
static gboolean gst_gio_base_src_is_seekable (GstBaseSrc * base_src);
static gboolean gst_gio_base_src_unlock (GstBaseSrc * base_src);
static gboolean gst_gio_base_src_unlock_stop (GstBaseSrc * base_src);
static gboolean gst_gio_base_src_check_get_range (GstBaseSrc * base_src);
static GstFlowReturn gst_gio_base_src_create (GstBaseSrc * base_src,
guint64 offset, guint size, GstBuffer ** buf);
static gboolean gst_gio_base_src_query (GstBaseSrc * base_src,
GstQuery * query);
static void
gst_gio_base_src_base_init (gpointer gclass)
@ -93,6 +89,7 @@ gst_gio_base_src_class_init (GstGioBaseSrcClass * klass)
gstbasesrc_class->check_get_range =
GST_DEBUG_FUNCPTR (gst_gio_base_src_check_get_range);
gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_gio_base_src_create);
gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_gio_base_src_query);
}
static void
@ -431,6 +428,31 @@ gst_gio_base_src_create (GstBaseSrc * base_src, guint64 offset, guint size,
return ret;
}
static gboolean
gst_gio_base_src_query (GstBaseSrc * base_src, GstQuery * query)
{
gboolean ret = FALSE;
GstGioBaseSrc *src = GST_GIO_BASE_SRC (base_src);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_URI:
if (GST_IS_URI_HANDLER (src)) {
const gchar *uri = gst_uri_handler_get_uri (GST_URI_HANDLER (src));
gst_query_set_uri (query, uri);
ret = TRUE;
}
break;
default:
ret = FALSE;
break;
}
if (!ret)
ret = GST_BASE_SRC_CLASS (parent_class)->query (base_src, query);
return ret;
}
void
gst_gio_base_src_set_stream (GstGioBaseSrc * src, GInputStream * stream)
{

View file

@ -511,6 +511,10 @@ gst_gnome_vfs_sink_query (GstPad * pad, GstQuery * query)
gst_query_set_formats (query, 2, GST_FORMAT_DEFAULT, GST_FORMAT_BYTES);
return TRUE;
case GST_QUERY_URI:
gst_query_set_uri (query, sink->uri_name);
return TRUE;
default:
return gst_pad_query_default (pad, query);
}

View file

@ -141,6 +141,7 @@ static gboolean gst_gnome_vfs_src_check_get_range (GstBaseSrc * src);
static gboolean gst_gnome_vfs_src_get_size (GstBaseSrc * src, guint64 * size);
static GstFlowReturn gst_gnome_vfs_src_create (GstBaseSrc * basesrc,
guint64 offset, guint size, GstBuffer ** buffer);
static gboolean gst_gnome_vfs_src_query (GstBaseSrc * src, GstQuery * query);
static GstElementClass *parent_class = NULL;
@ -249,6 +250,7 @@ gst_gnome_vfs_src_class_init (GstGnomeVFSSrcClass * klass)
gstbasesrc_class->check_get_range =
GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_check_get_range);
gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_create);
gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_query);
}
static void
@ -690,6 +692,28 @@ eos:
}
}
static gboolean
gst_gnome_vfs_src_query (GstBaseSrc * basesrc, GstQuery * query)
{
gboolean ret = FALSE;
GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (basesrc);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_URI:
gst_query_set_uri (query, src->uri_name);
ret = TRUE;
break;
default:
ret = FALSE;
break;
}
if (!ret)
ret = GST_BASE_SRC_CLASS (parent_class)->query (basesrc, query);
return ret;
}
static gboolean
gst_gnome_vfs_src_is_seekable (GstBaseSrc * basesrc)
{