basesrc: Add default handler for URI query in GstURIHandler subclasses

This commit is contained in:
Sebastian Dröge 2012-07-31 17:25:50 +02:00
parent 8d9a4b2e94
commit 389ec66946
2 changed files with 12 additions and 24 deletions

View file

@ -1193,6 +1193,18 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query)
res = FALSE; res = FALSE;
break; break;
} }
case GST_QUERY_URI:{
if (GST_IS_URI_HANDLER (src)) {
gchar *uri = gst_uri_handler_get_uri (GST_URI_HANDLER (src));
gst_query_set_uri (query, uri);
g_free (uri);
res = TRUE;
} else {
res = FALSE;
}
break;
}
default: default:
res = FALSE; res = FALSE;
break; break;

View file

@ -149,7 +149,6 @@ static gboolean gst_file_src_is_seekable (GstBaseSrc * src);
static gboolean gst_file_src_get_size (GstBaseSrc * src, guint64 * size); static gboolean gst_file_src_get_size (GstBaseSrc * src, guint64 * size);
static GstFlowReturn gst_file_src_fill (GstBaseSrc * src, guint64 offset, static GstFlowReturn gst_file_src_fill (GstBaseSrc * src, guint64 offset,
guint length, GstBuffer * buf); guint length, GstBuffer * buf);
static gboolean gst_file_src_query (GstBaseSrc * src, GstQuery * query);
static void gst_file_src_uri_handler_init (gpointer g_iface, static void gst_file_src_uri_handler_init (gpointer g_iface,
gpointer iface_data); gpointer iface_data);
@ -195,7 +194,6 @@ gst_file_src_class_init (GstFileSrcClass * klass)
gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_file_src_is_seekable); gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_file_src_is_seekable);
gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_file_src_get_size); gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_file_src_get_size);
gstbasesrc_class->fill = GST_DEBUG_FUNCPTR (gst_file_src_fill); gstbasesrc_class->fill = GST_DEBUG_FUNCPTR (gst_file_src_fill);
gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_file_src_query);
if (sizeof (off_t) < 8) { if (sizeof (off_t) < 8) {
GST_LOG ("No large file support, sizeof (off_t) = %" G_GSIZE_FORMAT "!", GST_LOG ("No large file support, sizeof (off_t) = %" G_GSIZE_FORMAT "!",
@ -403,28 +401,6 @@ eos:
} }
} }
static gboolean
gst_file_src_query (GstBaseSrc * basesrc, GstQuery * query)
{
gboolean ret = FALSE;
GstFileSrc *src = GST_FILE_SRC (basesrc);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_URI:
gst_query_set_uri (query, src->uri);
ret = TRUE;
break;
default:
ret = FALSE;
break;
}
if (!ret)
ret = GST_BASE_SRC_CLASS (parent_class)->query (basesrc, query);
return ret;
}
static gboolean static gboolean
gst_file_src_is_seekable (GstBaseSrc * basesrc) gst_file_src_is_seekable (GstBaseSrc * basesrc)
{ {