[gst-devel] Re: [gst-cvs] dschleef gst-plugins: gst-plugins/ext/gnomevfs/

Ronald Bultje rbultje at ronald.bitfreak.net
Tue Jul 29 02:13:20 CEST 2003

Hey Dave,

On Tue, 2003-07-29 at 09:18, David Schleef wrote:
> Implement seekable property.  Tested on named pipes, http streams and
> regular files.  Fixes #104840

Interestingly, I've been working on something similar, but for filesink
(would work the same for filesrc). The idea is that filesink can write
to FIFOs and sockets, which aren't seekable. I'm doing this kind of
differently, I'm creating an event mask based on seekability. Code:
static const GstEventMask *
gst_filesink_get_event_mask (GstPad *pad)
  GstFileSink *filesink = GST_FILESINK (gst_pad_get_parent (pad));
  struct stat filestat;
  static const GstEventMask seek_masks[] = {
                      GST_SEEK_METHOD_SET |
                      GST_SEEK_METHOD_END |
                      GST_SEEK_FLAG_FLUSH },
    { GST_EVENT_FLUSH, 0 },
    { 0, 0 }
  }, noseek_masks[] = {
    { GST_EVENT_FLUSH, 0 },
    { 0, 0 }
  }, *selected = seek_masks;

  if (filesink->file != NULL) {
    if (fstat (fileno (filesink->file), &filestat) == 0) {
      if (S_ISFIFO (filestat.st_mode) ||
          S_ISSOCK (filestat.st_mode)) {
        selected = noseek_masks;

  return selected;
This looks more "gstreamerish" than properties, imo. I want to get rid
of as many "unneeded" properties as possible - the idea here is that a
pipeline solves all problems internally, and the application doesn't
need to do anything. Properties cannot do that.
For both an application (which might need it - in some cases) and for
plugins inside a pipeline, seekability can be retrieved by requesting
the event mask and checking for the GST_EVENT_SEEK event type in it. In
avimux, I'm currently using an internal function for that, that might
have to be ported to the core (gboolean gst_pad_can_seek (GstPad *pad);
or so, with a gboolean gst_element_can_seek (GstElement *element);
wrapper for applications):
static gboolean
gst_avimux_can_seek(GstAviMux *avimux)
  const GstEventMask *masks =

  while (masks->type != 0) {
    if (masks->type == GST_EVENT_SEEK) {
      return TRUE;
  return FALSE;
Note that most of this isn't committed yet, although it does work. I'll
commit it one of the next few days, if you guys agree that this is the
right way (tm) to do it. I'd appreciate if {file,gnomevfs}{src,sink} all
used the same way to do this. I can commit my code for filesink and copy
it to filesrc if wanted.


Ronald Bultje <rbultje at ronald.bitfreak.net>

More information about the gstreamer-devel mailing list