ext/gnomevfs/gstgnomevfssrc.c: Override GstBaseSrc::check_get_range() in order to avoid opening the resource just to ...

Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_class_init),
(gst_gnome_vfs_src_check_get_range):
Override GstBaseSrc::check_get_range() in order to avoid opening
the resource just to check whether we can operate in pull-mode or
not - we can predict that pretty well from the URI alone. Should
fix problems with last.fm (#331690). (Requires latest core CVS).
This commit is contained in:
Tim-Philipp Müller 2006-03-06 20:07:55 +00:00
parent a5ff88df2a
commit 1e3f394a97
2 changed files with 38 additions and 0 deletions

View file

@ -1,3 +1,12 @@
2006-03-06 Tim-Philipp Müller <tim at centricular dot net>
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_class_init),
(gst_gnome_vfs_src_check_get_range):
Override GstBaseSrc::check_get_range() in order to avoid opening
the resource just to check whether we can operate in pull-mode or
not - we can predict that pretty well from the URI alone. Should
fix problems with last.fm (#331690). (Requires latest core CVS).
2006-03-06 Wim Taymans <wim@fluendo.com>
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init),

View file

@ -134,6 +134,7 @@ static void gst_gnome_vfs_src_get_property (GObject * object, guint prop_id,
static gboolean gst_gnome_vfs_src_stop (GstBaseSrc * src);
static gboolean gst_gnome_vfs_src_start (GstBaseSrc * src);
static gboolean gst_gnome_vfs_src_is_seekable (GstBaseSrc * src);
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);
@ -254,6 +255,8 @@ gst_gnome_vfs_src_class_init (GstGnomeVFSSrcClass * klass)
gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_get_size);
gstbasesrc_class->is_seekable =
GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_is_seekable);
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);
}
@ -1047,6 +1050,32 @@ gst_gnome_vfs_src_is_seekable (GstBaseSrc * basesrc)
return src->seekable;
}
static gboolean
gst_gnome_vfs_src_check_get_range (GstBaseSrc * basesrc)
{
GstGnomeVFSSrc *src;
gboolean is_local;
src = GST_GNOME_VFS_SRC (basesrc);
if (src->uri == NULL) {
GST_WARNING_OBJECT (src, "no URI set yet");
/* don't know what to do, let the basesrc class decide for us */
if (GST_BASE_SRC_CLASS (parent_class)->check_get_range)
return GST_BASE_SRC_CLASS (parent_class)->check_get_range (basesrc);
else
return FALSE;
}
is_local = gnome_vfs_uri_is_local (src->uri);
GST_LOG_OBJECT (src, "%s URI (%s), random access %spossible",
(is_local) ? "local" : "remote", GST_STR_NULL (src->uri_name),
(is_local) ? "" : "not ");
return is_local;
}
static gboolean
gst_gnome_vfs_src_get_size (GstBaseSrc * basesrc, guint64 * size)
{