After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 674934 - Snapping direction flags for seeking
Snapping direction flags for seeking
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.10.x
Other Linux
: Normal enhancement
: 0.10.37
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-04-27 10:56 UTC by Vincent Penquerc'h
Modified: 2012-04-30 09:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add the new seeking snap flags (4.17 KB, patch)
2012-04-27 10:56 UTC, Vincent Penquerc'h
none Details | Review
updated seek flags patch with wim's comments (4.60 KB, patch)
2012-04-27 13:45 UTC, Vincent Penquerc'h
committed Details | Review
avi seeking with snap flags (6.64 KB, patch)
2012-04-27 13:45 UTC, Vincent Penquerc'h
committed Details | Review
matroska seeking with snap flags (6.33 KB, patch)
2012-04-27 13:46 UTC, Vincent Penquerc'h
committed Details | Review

Description Vincent Penquerc'h 2012-04-27 10:56:13 UTC
Created attachment 212947 [details] [review]
Add the new seeking snap flags

This is for 0.10 for now, it does not apply on master, I'll do it when a final form has been agreed.

Two new flags added, GST_SEEK_FLAG_KEY_UNIT_SNAP_{FOR,BACK}WARD, which may be used to tell a seeking implementation which keyframe is preferred. Selecting both causes the nearest to be snapped to, selecting none leaves the decision to the demuxer.

Comments welcome.
Comment 1 Wim Taymans 2012-04-27 12:56:28 UTC
My 2¢:

   GST_SEEK_FLAG_KEY_UNIT        = (1 << 2),
   GST_SEEK_FLAG_SNAP_BEFORE     = (1 << 5),
   GST_SEEK_FLAG_SNAP_AFTER      = (1 << 6),
   GST_SEEK_FLAG_SNAP_NEAREST    = GST_SEEK_FLAG_SNAP_BEFORE |
                                   GST_SEEK_FLAG_SNAP_AFTER,

KEY_UNIT     = go to a keyframe, demuxer chooses which one
SNAP_BEFORE  = go to a location before the requested position, if KEY_UNIT this
               means the keyframe at or before the requested position
SNAP_AFTER   = go to a location after the requested position, if KEY_UNIT this
               means the keyframe at of after the requested position
SNAP_NEAREST = go to a position near the requested position, if KEY_UNIT this
               means the keyframe closest to the requested position, if both
               keyframes are at an equal distance, behaves like SNAP_BEFORE

BEFORE/AFTER always refers to the position in stream-time.

BEFORE/AFTER, seems more natural than BACKWARDS/FORWARDS to express a position relative to the requested position.

SNAP_* instead of SNAP_KEY_UNIT_* because the snapping might also make sense when  not doing a keyframe seek (like going to the nearest frame boundary).
Comment 2 Wim Taymans 2012-04-27 13:10:51 UTC
(In reply to comment #1)
> BEFORE/AFTER always refers to the position in stream-time.

That should be running-time, ie, the media that will be played BEFORE/AFTER the one at the requested position.
Comment 3 Vincent Penquerc'h 2012-04-27 13:45:08 UTC
Created attachment 212967 [details] [review]
updated seek flags patch with wim's comments

Comments included.
I'll also attach two patches (for avi and matroska) using these flags for keyframe seeks with an index.
Comment 4 Vincent Penquerc'h 2012-04-27 13:45:40 UTC
Created attachment 212968 [details] [review]
avi seeking with snap flags
Comment 5 Vincent Penquerc'h 2012-04-27 13:46:03 UTC
Created attachment 212969 [details] [review]
matroska seeking with snap flags
Comment 6 Tim-Philipp Müller 2012-04-28 10:24:03 UTC
Looks good to me.
Comment 7 Vincent Penquerc'h 2012-04-30 09:39:38 UTC
Pushed (0.10 and 0.11).

commit 477636479cc0171a3a3fad4a5c17ac47e39cd7e6
Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Date:   Mon Apr 30 09:58:09 2012 +0100

    event: add new seek snap flags
    
    They can be used to select snapping behavior (to previous, next, or
    nearest location, where relevant) when seeking.
    
    The seeking implementation (eg, demuxer) may currently ignore some
    or all of these flags.

commit cc242a656348fd0c5d7cbc2fc34de43aa3a33304
Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Date:   Thu Apr 26 12:47:27 2012 +0100

    matroska: implement forward snapping keyframe seeking
    
    Requires an index.

commit 048b91b303b963920b9668e50065f16c62608506
Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Date:   Thu Apr 26 12:46:11 2012 +0100

    avi: implement forward snapping keyframe seeking
    
    In pull mode with an index.