Class IIndexEntry


  • public class IIndexEntry
    extends RefCounted
    An index entry for a {IStream}.


    Some ContainerFormats can maintain index of where key-frames
    (and other interesting frames) can be found in a byte-stream.
    This is really helpful for implementing efficient seeking (for
    example, you can find all index entries near a desired timestamp,
    and you'll find the nearest key-frame).



    We don't maintain a complete list of all ContainerFormats that support
    index, but if they do, you can query the {IStream#getNumIndexEntries()}
    method to find how many entires are in the index. Some ContainerFormats can
    parse the relevant Container message if an index is embedded in the
    container (for example, the MOV and MP4 demuxer can do this). Other
    ContainerFormats can create an index automatically as they read the file,
    even if an index is not embedded in the container (for example the FLV
    demuxer does this).



    Since:
    3.4
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected IIndexEntry​(long cPtr, boolean cMemoryOwn)
      Internal Only.
      protected IIndexEntry​(long cPtr, boolean cMemoryOwn, java.util.concurrent.atomic.AtomicLong ref)
      Internal Only.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      IIndexEntry copyReference()
      Create a new IIndexEntry object that is actually referring to the exact same underlying native object.
      boolean equals​(java.lang.Object obj)
      Compares two values, returning true if the underlying objects in native code are the same object.
      static long getCPtr​(IIndexEntry obj)
      Internal Only.
      int getFlags()
      Flags set for this entry.
      int getMinDistance()
      Minimum number of index entries between this index entry
      and the last keyframe in the index, used to avoid unneeded searching.
      long getMyCPtr()
      Internal Only.
      long getPosition()
      The position in bytes of the frame corresponding to this index entry
      in the {IContainer}.
      int getSize()
      The size of bytes of the frame this index entry points to.
      long getTimeStamp()
      The actual time stamp, in units of {IStream#getTimeBase()}, of the frame this entry points to.
      int hashCode()
      Get a hashable value for this object.
      boolean isKeyFrame()
      Is this index entry pointing to a key frame.
      Really shorthand for {#getFlags()} & {#IINDEX_FLAG_KEYFRAME}.
      static IIndexEntry make​(long position, long timeStamp, int flags, int size, int minDistance)
      Create a new {IIndexEntry} with the specified
      values.

      java.lang.String toString()
      info about this entry.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • IINDEX_FLAG_KEYFRAME

        public static final int IINDEX_FLAG_KEYFRAME
        A bit mask value that may be set in {#getFlags}.
    • Constructor Detail

      • IIndexEntry

        protected IIndexEntry​(long cPtr,
                              boolean cMemoryOwn)
        Internal Only.
      • IIndexEntry

        protected IIndexEntry​(long cPtr,
                              boolean cMemoryOwn,
                              java.util.concurrent.atomic.AtomicLong ref)
        Internal Only.
    • Method Detail

      • getCPtr

        public static long getCPtr​(IIndexEntry obj)
        Internal Only. Not part of public API. Get the raw value of the native object that obj is proxying for.
        Parameters:
        obj - The java proxy object for a native object.
        Returns:
        The raw pointer obj is proxying for.
      • getMyCPtr

        public long getMyCPtr()
        Internal Only. Not part of public API. Get the raw value of the native object that we're proxying for.
        Overrides:
        getMyCPtr in class RefCounted
        Returns:
        The raw pointer we're proxying for.
      • equals

        public boolean equals​(java.lang.Object obj)
        Compares two values, returning true if the underlying objects in native code are the same object. That means you can have two different Java objects, but when you do a comparison, you'll find out they are the EXACT same object.
        Overrides:
        equals in class java.lang.Object
        Returns:
        True if the underlying native object is the same. False otherwise.
      • hashCode

        public int hashCode()
        Get a hashable value for this object.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hashable value.
      • toString

        public java.lang.String toString()
        info about this entry.
        Overrides:
        toString in class java.lang.Object
        Returns:
        information about this entry.
      • make

        public static IIndexEntry make​(long position,
                                       long timeStamp,
                                       int flags,
                                       int size,
                                       int minDistance)
        Create a new {IIndexEntry} with the specified
        values.

        Parameters:
        position - The value to be returned from {#getPosition()}.
        timeStamp - The value to be returned from {#getTimeStamp()}.
        flags - The value to be returned from {#getFlags()}.
        size - The value to be returned from {#getSize()}.
        minDistance - The value to be returned from {#getMinDistance()}.
      • getPosition

        public long getPosition()
        The position in bytes of the frame corresponding to this index entry
        in the {IContainer}.
        Returns:
        The byte-offset from start of the IContainer where the
        frame for this {IIndexEntry} can be found.
      • getTimeStamp

        public long getTimeStamp()
        The actual time stamp, in units of {IStream#getTimeBase()}, of the frame this entry points to.
        Returns:
        The time stamp for this entry.
      • getFlags

        public int getFlags()
        Flags set for this entry. See the IINDEX_FLAG* constants
        above.
        Returns:
        the flags.
      • getSize

        public int getSize()
        The size of bytes of the frame this index entry points to.
        Returns:
        The size in bytes.
      • getMinDistance

        public int getMinDistance()
        Minimum number of index entries between this index entry
        and the last keyframe in the index, used to avoid unneeded searching.
        Returns:
        the minimum distance, in bytes.
      • isKeyFrame

        public boolean isKeyFrame()
        Is this index entry pointing to a key frame.
        Really shorthand for {#getFlags()} & {#IINDEX_FLAG_KEYFRAME}.
        Returns:
        True if this index entry is for a key frame.