Class IIndexEntry
- java.lang.Object
-
- com.avpkit.ferry.RefCounted
-
- com.avpkit.core.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
-
-
Field Summary
Fields Modifier and Type Field Description static intIINDEX_FLAG_KEYFRAMEA bit mask value that may be set in {#getFlags}.-
Fields inherited from class com.avpkit.ferry.RefCounted
swigCMemOwn
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedIIndexEntry(long cPtr, boolean cMemoryOwn)Internal Only.protectedIIndexEntry(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 IIndexEntrycopyReference()Create a new IIndexEntry object that is actually referring to the exact same underlying native object.booleanequals(java.lang.Object obj)Compares two values, returning true if the underlying objects in native code are the same object.static longgetCPtr(IIndexEntry obj)Internal Only.intgetFlags()Flags set for this entry.intgetMinDistance()Minimum number of index entries between this index entry
and the last keyframe in the index, used to avoid unneeded searching.longgetMyCPtr()Internal Only.longgetPosition()The position in bytes of the frame corresponding to this index entry
in the {IContainer}.intgetSize()The size of bytes of the frame this index entry points to.longgetTimeStamp()The actual time stamp, in units of {IStream#getTimeBase()}, of the frame this entry points to.inthashCode()Get a hashable value for this object.booleanisKeyFrame()Is this index entry pointing to a key frame.
Really shorthand for{#getFlags()} & {#IINDEX_FLAG_KEYFRAME}.static IIndexEntrymake(long position, long timeStamp, int flags, int size, int minDistance)Create a new {IIndexEntry} with the specified
values.
java.lang.StringtoString()info about this entry.-
Methods inherited from class com.avpkit.ferry.RefCounted
acquire, delete, getCPtr, getCurrentRefCount, getJavaRefCount, release
-
-
-
-
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:
getMyCPtrin classRefCounted- Returns:
- The raw pointer we're proxying for.
-
copyReference
public IIndexEntry copyReference()
Create a new IIndexEntry object that is actually referring to the exact same underlying native object.- Overrides:
copyReferencein classRefCounted- Returns:
- the new Java object.
-
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:
equalsin classjava.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:
hashCodein classjava.lang.Object- Returns:
- the hashable value.
-
toString
public java.lang.String toString()
info about this entry.- Overrides:
toStringin classjava.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.
-
-