
public class ContainerStream extends RefCounted
Streams are really virtual concepts; Container objects really just contain
a bunch of Packets. But each Packet usually has a stream
id associated with it, and all Packets with that stream id represent
the same type of (usually time-based) data. For example in many FLV
video files, there is a stream with id "0" that contains all video data, and
a stream with id "1" that contains all audio data.
You use an Stream object to get properly configured Decoders
for decoding, and to tell Encoders how to encode Packets when
decoding.
| Modifier and Type | Class and Description |
|---|---|
static class |
ContainerStream.Disposition
The disposition of this stream.
|
static class |
ContainerStream.ParseType
What types of parsing can we do on a call to
Source#read(Packet) |
| Modifier and Type | Method and Description |
|---|---|
ContainerStream |
copyReference()
Create a new ContainerStream object that is actually referring to the
exact same underlying native object.
|
boolean |
equals(Object obj)
Compares two values, returning true if the underlying objects in native code are the same object.
|
IndexEntry |
findTimeStampEntryInIndex(long wantedTimeStamp,
int flags)
Search for the given time stamp in the key-frame index for this Stream.
|
int |
findTimeStampPositionInIndex(long wantedTimeStamp,
int flags)
Search for the given time stamp in the key-frame index for this Stream.
|
MediaPacket |
getAttachedPic()
For containers with Stream.Disposition.DISPOSITION_ATTACHED_PIC,
this returns a read-only copy of the packet containing the picture (needs to be decoded separately). |
Container |
getContainer()
Get the underlying container for this stream, or null if Humble Video
doesn't know. |
long |
getCurrentDts()
The current Decompression Time Stamp that will be used on this stream,
in #getTimeBase() units. |
ContainerStream.Disposition |
getDisposition()
Get the Stream.Disposition of this stream.
|
long |
getDuration()
Return the duration, in #getTimeBase() units, of this stream,
or Global#NO_PTS if unknown. |
Rational |
getFrameRate()
Get the (sometimes estimated) average frame rate of this container.
For variable frame-rate containers (they do exist) this is just an approximation. |
int |
getId()
Return a container format specific id for this stream.
|
int |
getIndex()
Get the relative position this stream has in the hosting
Container object. |
List<IndexEntry> |
getIndexEntries()
Get an ordered sequence of index entries in this
Stream. |
IndexEntry |
getIndexEntry(int position)
Get the IndexEntry at the given position in this
Stream object's index. |
KeyValueBag |
getMetaData()
Get the KeyValueBag for this object,
or null if none. |
long |
getNumFrames()
Returns the number of encoded frames if known.
|
int |
getNumIndexEntries()
Get the number of index entries in this stream.
|
ContainerStream.ParseType |
getParseType()
Get how the decoding codec should parse data from this stream.
|
Rational |
getSampleAspectRatio()
Gets the sample aspect ratio.
|
long |
getStartTime()
Return the start time, in #getTimeBase() units, when this stream
started. |
Rational |
getTimeBase()
The time base in which all timestamps (e.g.
|
int |
hashCode()
Get a hashable value for this object.
|
boolean |
matchSpecifier(String specifier)
Check if the stream is matched by the stream specifier.
See the "stream specifiers" chapter in the FFmpeg documentation for the syntax of specifier: https://www.ffmpeg.org/ffmpeg.html#Stream-selection |
void |
setParseType(ContainerStream.ParseType type)
Set the parse type the decoding codec should use.
|
delete, getCurrentRefCountpublic ContainerStream copyReference()
copyReference in class RefCountedpublic boolean equals(Object obj)
public int hashCode()
public List<IndexEntry> getIndexEntries()
Stream.public int getIndex()
public int getId()
public Rational getFrameRate()
public Rational getTimeBase()
public long getStartTime()
public long getDuration()
public long getCurrentDts()
public int getNumIndexEntries()
getIndexEntry(int)public long getNumFrames()
public Rational getSampleAspectRatio()
public Container getContainer()
public ContainerStream.ParseType getParseType()
public void setParseType(ContainerStream.ParseType type)
Warning: do not set this flag unless you know what you're doing,
and do not set after you've started reading packets.
type - The type to set.public KeyValueBag getMetaData()
If the Container or Stream object
that this KeyValueBag came from was opened
for reading, then changes via KeyValueBag#setValue(String, String)
will have no effect on the underlying media.
If the Container or Stream object
that this KeyValueBag came from was opened
for writing, then changes via KeyValueBag#setValue(String, String)
will have no effect after Container#writeHeader()
is called.
public IndexEntry findTimeStampEntryInIndex(long wantedTimeStamp, int flags)
Not all ContainerFormat implementations
maintain key frame indexes, but if they have one,
then this method searches in the Stream index
to quickly find the byte-offset of the nearest key-frame to
the given time stamp.
wantedTimeStamp - the time stamp wanted, in the stream'sflags - A bitmask of the SEEK_FLAG_* flags, or 0 to turnpublic int findTimeStampPositionInIndex(long wantedTimeStamp,
int flags)
Not all ContainerFormat implementations
maintain key frame indexes, but if they have one,
then this method searches in the Stream index
to quickly find the index entry position of the nearest key-frame to
the given time stamp.
wantedTimeStamp - the time stamp wanted, in the stream'sflags - A bitmask of the SEEK_FLAG_* flags, or 0 to turngetIndexEntry(int)public IndexEntry getIndexEntry(int position)
Not all ContainerFormat types maintain
Stream indexes, but if they do,
this method can return those entries.
Do not modify the Container this stream
is from between calls to this method and
#getNumIndexEntries() as indexes may
be compacted while processing.
position - The position in the index table.public ContainerStream.Disposition getDisposition()
public MediaPacket getAttachedPic()
public boolean matchSpecifier(String specifier)
specifier - the specifier stringInvalidArgument - if the specifier is invalid.Copyright © 2018 Humble Software. All rights reserved.