Implement seekable property. Tested on named pipes, http streams and regular files. Fixes #104840

Original commit message from CVS:
Implement seekable property.  Tested on named pipes, http streams and
regular files.  Fixes #104840
This commit is contained in:
David Schleef 2003-07-29 07:18:06 +00:00
parent 190850342b
commit c34b8d7fd7
2 changed files with 22 additions and 1 deletions

2
common

@ -1 +1 @@
Subproject commit d6e219fd076d8f182bd1ee84228b1b85cdb807a6 Subproject commit 8b323f41bfaccb8f30bddfc6ff8bd6a4be04a3e1

View file

@ -99,6 +99,7 @@ struct _GstGnomeVFSSrc {
/* icecast/audiocast metadata extraction handling */ /* icecast/audiocast metadata extraction handling */
gboolean iradio_mode; gboolean iradio_mode;
gboolean http_callbacks_pushed; gboolean http_callbacks_pushed;
gboolean seekable;
gint icy_metaint; gint icy_metaint;
GnomeVFSFileSize icy_count; GnomeVFSFileSize icy_count;
@ -165,6 +166,7 @@ enum {
ARG_IRADIO_GENRE, ARG_IRADIO_GENRE,
ARG_IRADIO_URL, ARG_IRADIO_URL,
ARG_IRADIO_TITLE, ARG_IRADIO_TITLE,
ARG_SEEKABLE,
}; };
GType gst_gnomevfssrc_get_type(void); GType gst_gnomevfssrc_get_type(void);
@ -276,6 +278,13 @@ static void gst_gnomevfssrc_class_init(GstGnomeVFSSrcClass *klass)
"Name of currently playing song", "Name of currently playing song",
NULL, NULL,
G_PARAM_READABLE)); G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
ARG_SEEKABLE,
g_param_spec_boolean ("seekable",
"seekable",
"TRUE is stream is seekable",
FALSE,
G_PARAM_READABLE));
gstelement_class->set_property = gst_gnomevfssrc_set_property; gstelement_class->set_property = gst_gnomevfssrc_set_property;
gstelement_class->get_property = gst_gnomevfssrc_get_property; gstelement_class->get_property = gst_gnomevfssrc_get_property;
@ -308,6 +317,8 @@ static void gst_gnomevfssrc_init(GstGnomeVFSSrc *gnomevfssrc)
gnomevfssrc->icy_metaint = 0; gnomevfssrc->icy_metaint = 0;
gnomevfssrc->seekable = FALSE;
gnomevfssrc->iradio_mode = FALSE; gnomevfssrc->iradio_mode = FALSE;
gnomevfssrc->http_callbacks_pushed = FALSE; gnomevfssrc->http_callbacks_pushed = FALSE;
gnomevfssrc->icy_count = 0; gnomevfssrc->icy_count = 0;
@ -441,6 +452,9 @@ static void gst_gnomevfssrc_get_property(GObject *object, guint prop_id, GValue
g_value_set_string (value, src->iradio_title); g_value_set_string (value, src->iradio_title);
g_mutex_unlock(src->audiocast_udpdata_mutex); g_mutex_unlock(src->audiocast_udpdata_mutex);
break; break;
case ARG_SEEKABLE:
g_value_set_boolean (value, src->seekable);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -1064,6 +1078,13 @@ static gboolean gst_gnomevfssrc_open_file(GstGnomeVFSSrc *src)
src->in_first_get = TRUE; src->in_first_get = TRUE;
if(gnome_vfs_seek(src->handle, GNOME_VFS_SEEK_CURRENT, 0)
== GNOME_VFS_OK){
src->seekable = TRUE;
}else{
src->seekable = FALSE;
}
GST_FLAG_SET(src, GST_GNOMEVFSSRC_OPEN); GST_FLAG_SET(src, GST_GNOMEVFSSRC_OPEN);
return TRUE; return TRUE;