Implement seekable property. Tested on named pipes, http streams and regular files...
authorDavid Schleef <ds@schleef.org>
Tue, 29 Jul 2003 07:18:06 +0000 (07:18 +0000)
committerDavid Schleef <ds@schleef.org>
Tue, 29 Jul 2003 07:18:06 +0000 (07:18 +0000)
Original commit message from CVS:
Implement seekable property.  Tested on named pipes, http streams and
regular files.  Fixes #104840

common
ext/gnomevfs/gstgnomevfssrc.c

diff --git a/common b/common
index d6e219f..8b323f4 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit d6e219fd076d8f182bd1ee84228b1b85cdb807a6
+Subproject commit 8b323f41bfaccb8f30bddfc6ff8bd6a4be04a3e1
index 3cb741e..7dadf5a 100644 (file)
@@ -99,6 +99,7 @@ struct _GstGnomeVFSSrc {
        /* icecast/audiocast metadata extraction handling */
        gboolean iradio_mode;
        gboolean http_callbacks_pushed;
+       gboolean seekable;
 
        gint icy_metaint;
        GnomeVFSFileSize icy_count;
@@ -165,6 +166,7 @@ enum {
        ARG_IRADIO_GENRE,
        ARG_IRADIO_URL,
        ARG_IRADIO_TITLE,
+       ARG_SEEKABLE,
 };
 
 GType gst_gnomevfssrc_get_type(void);
@@ -276,6 +278,13 @@ static void gst_gnomevfssrc_class_init(GstGnomeVFSSrcClass *klass)
                                                              "Name of currently playing song",
                                                              NULL,
                                                              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->get_property = gst_gnomevfssrc_get_property;
@@ -308,6 +317,8 @@ static void gst_gnomevfssrc_init(GstGnomeVFSSrc *gnomevfssrc)
 
        gnomevfssrc->icy_metaint = 0;
 
+       gnomevfssrc->seekable = FALSE;
+
        gnomevfssrc->iradio_mode = FALSE;
        gnomevfssrc->http_callbacks_pushed = FALSE;
        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_mutex_unlock(src->audiocast_udpdata_mutex);
                break;
+       case ARG_SEEKABLE:
+               g_value_set_boolean (value, src->seekable);
+               break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
                break;
@@ -1064,6 +1078,13 @@ static gboolean gst_gnomevfssrc_open_file(GstGnomeVFSSrc *src)
 
        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);
 
        return TRUE;