baseparse converting seek event from format BYTES to TIME

Eric Trousset etrousset at awox.com
Fri Jan 31 00:48:51 PST 2014


Hi, 
Thx for the patch. I think I found another bug regarding seeking with mp3 file.

I did the following modification to gsttagdemux.c to ensure the seekevent is first sent upstream if in time format.
I think this patch might break the case when the source won't handle the time seek...

static gboolean
gst_tag_demux_seek_push (GstTagDemux * tagdemux, GstEvent * event)
{
  gboolean res = FALSE;
  gdouble rate;
  GstFormat format;
  GstSeekType start_type, stop_type;
  GstSeekFlags flags;
  gint64 start, stop;
 
  gst_event_parse_seek (event, &rate, &format, &flags,
      &start_type, &start, &stop_type, &stop);
 
  if (format == GST_FORMAT_BYTES &&
      tagdemux->priv->state == GST_TAG_DEMUX_STREAMING &&
      gst_pad_is_linked (tagdemux->priv->sinkpad)) {
    GstEvent *upstream;
 
    switch (start_type) {
      case GST_SEEK_TYPE_SET:
        if (start == -1)
          start = 0;
        start += tagdemux->priv->strip_start;
        break;
      case GST_SEEK_TYPE_END:
        /* Adjust the seek to be relative to the start of any end tag
         * (note: 10 bytes before end is represented by stop=-10) */
        if (start > 0)
          start = 0;
        start -= tagdemux->priv->strip_end;
        break;
      case GST_SEEK_TYPE_NONE:
      default:
        break;
    }
    switch (stop_type) {
      case GST_SEEK_TYPE_SET:
        if (stop != -1) {
          /* -1 means the end of the file, pass it upstream intact */
          stop += tagdemux->priv->strip_start;
        }
        break;
      case GST_SEEK_TYPE_END:
        /* Adjust the seek to be relative to the start of any end tag
         * (note: 10 bytes before end is represented by stop=-10) */
        if (stop > 0)
          stop = 0;
        stop -= tagdemux->priv->strip_end;
        break;
      case GST_SEEK_TYPE_NONE:
      default:
        break;
    }
    upstream = gst_event_new_seek (rate, format, flags,
        start_type, start, stop_type, stop);
    res = gst_pad_push_event (tagdemux->priv->sinkpad, upstream);
  }
  else
  /* try upstream first */
#warning Proper patch needed!!!
  if (GST_PAD_MODE(tagdemux->priv->sinkpad) != GST_PAD_MODE_PULL) {  // TODO : Send the PATCH to GSTREAMER !!!!
        res = gst_pad_push_event (tagdemux->priv->sinkpad, gst_event_ref (event));
  }


Cheers,
Eric

> -----Original Message-----
> From: gstreamer-devel-bounces at lists.freedesktop.org [mailto:gstreamer-
> devel-bounces at lists.freedesktop.org] On Behalf Of Sebastian Dröge
> Sent: jeudi 30 janvier 2014 20:31
> To: Discussion of the development of and with GStreamer
> Subject: Re: baseparse converting seek event from format BYTES to TIME
> 
> On Do, 2014-01-30 at 14:23 +0100, Eric Trousset wrote:
> > After more investigation I found the root cause. It looks like the bugs
> happens with mpegts container, when the GST_SEEK_FLAG_SKIP is used.
> > You can reproduce with playback-test program, adding the "Play Skip"
> option. The seek will fail!
> 
> Yes, if you look at the code:
>   if (flags & (GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_SKIP)) {
>     GST_WARNING ("seek flags 0x%x are not supported", (int) flags);
>     goto done;
>   }
> 
> This has to be implemented, or at least the SKIP flag should be just ignored in
> the TS demuxer. Fixed here for now by ignoring:
> http://cgit.freedesktop.org/gstreamer/gst-plugins-
> bad/commit/?id=9682e44db649cd0a993ac18e25bb6173262e5939
> 
> For the segment flag there is a bug in Bugzilla already, quite easy to
> implement if someone actually needs that.
> 
> --
> Sebastian Dröge, Centricular Ltd - http://www.centricular.com Expertise,
> Straight from the Source


More information about the gstreamer-devel mailing list