When seek rate is set in reverse the current position isn’t updated.

Nick.Adamson at gdlsuk.com Nick.Adamson at gdlsuk.com
Fri Dec 11 09:04:42 PST 2015


Hi All.

I’ve come across something with Gstreamer I can’t explain. I assume I’ve missed a step somewhere however I can’t work out where.

I’m playing a file, I’ve tried it with both an MPG video and an OGG audio file. My application is using uridecodebin in to playsink.

I’m using the seek command to fast forward and rewind through the media file. Initially this works fine and I can hear the audio file going backward and forward.
However when rewinding the file the current position as retrieved by gst_element_query_position is not reducing, rather it’s staying exactly where it was when I started rewinding.
This then causes an issue as when I stop rewinding and I want to play from where I’ve rewound to it actually starts playing from the original position. Below I’ve copied the rate setting function I’ve written.

Can  anyone spot what I’m doing wrong or have any suggestions how to resolve this?
  void stepSeek(const double& rate)
  {
    gint64 position( 0 );
    gst_element_query_position( pipeline, GST_FORMAT_TIME, &position);
    gint64 duration( 0 );
    gst_element_query_duration( pipeline, GST_FORMAT_TIME, &duration);

    printD("received rate command to %f", rate);
    printD("\tCurrent position = %f", ((double)(position) / GST_SECOND) );
    printD("\ttotal duration = %f", ((double)(duration) / GST_SECOND) );

    bool result( false );
    if (rate >= 0)
    { // going forward.
      result = gst_element_seek(pipeline, // pipe line.
        rate, // rate
        GST_FORMAT_TIME, // format
        (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_TRICKMODE | GST_SEEK_FLAG_ACCURATE), // seek flags.
        GST_SEEK_TYPE_SET, // start type.
        position, // start time in NS to seek to.
        GST_SEEK_TYPE_SET, // stop type.
        duration); // stop point in NS..
    }
    else
    { // going backward.
      result = gst_element_seek(pipeline, // pipe line.
        rate, // rate
        GST_FORMAT_TIME, // format
        (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_TRICKMODE | GST_SEEK_FLAG_ACCURATE), // seek flags.
        GST_SEEK_TYPE_SET, // start type.
        0, // start time in NS to seek to.
        GST_SEEK_TYPE_SET, // stop type.
        position); // stop point in NS..
    }

    if (true == result)
    {
      printD("Play back rate set to %f.", rate );
    }
    else
    {
      print("Seek failed!");
    }
  }

Thanks.
Nick.



Nick Adamson
Software Engineer
------------------------------------------------------------------------------

This email and any files attached are intended for the addressee and may contain information of a confidential nature. If you are not the intended recipient, be aware that this email was sent to you in error and you should not disclose, distribute, print, copy or make other use of this email or its attachments. Such actions, in fact, may be unlawful. In compliance with the various Regulations and Acts, General Dynamics United Kingdom Limited reserves the right to monitor (and examine for viruses) all emails and email attachments, both inbound and outbound. Email communications and their attachments may not be secure or error- or virus-free and the company does not accept liability or responsibility for such matters or the consequences thereof. General Dynamics United Kingdom Limited, Registered Office: 21 Holborn Viaduct, London EC1A 2DY. Registered in England and Wales No: 1911653.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20151211/92c58913/attachment-0001.html>


More information about the gstreamer-devel mailing list