|
AVPKit
|
Represents an encoded piece of data that can be placed in an IContainer for a given IStream of data. More...
#include <IPacket.h>


Public Member Functions | |
| virtual void | reset ()=0 |
| Clear out any data in this packet, but leaves the buffer available for reuse. | |
| virtual bool | isComplete ()=0 |
| Is this packet complete. More... | |
| virtual int64_t | getPts ()=0 |
| Get the Presentation Time Stamp (PTS) for this packet. More... | |
| virtual void | setPts (int64_t aPts)=0 |
| Set a new Presentation Time Stamp (PTS) for this packet. More... | |
| virtual int64_t | getDts ()=0 |
| Get the Decompression Time Stamp (DTS) for this packet. More... | |
| virtual void | setDts (int64_t aDts)=0 |
| Set a new Decompression Time Stamp (DTS) for this packet. More... | |
| virtual int32_t | getSize ()=0 |
| Get the size in bytes of the payload currently in this packet. More... | |
| virtual int32_t | getMaxSize ()=0 |
| Get the maximum size (in bytes) of payload this packet can hold. More... | |
| virtual int32_t | getStreamIndex ()=0 |
| Get the container-specific index for the stream this packet is part of. More... | |
| virtual int32_t | getFlags ()=0 |
| Get any flags set on this packet, as a 4-byte binary-ORed bit-mask. More... | |
| virtual bool | isKeyPacket ()=0 |
| Does this packet contain Key data? i.e. More... | |
| virtual int64_t | getDuration ()=0 |
| Return the duration of this packet, in units of getTimeBase(). More... | |
| virtual int64_t | getPosition ()=0 |
| Return the position (in bytes) of this packet in the stream. More... | |
| virtual int32_t | allocateNewPayload (int32_t payloadSize)=0 |
| Discard the current payload and allocate a new payload. More... | |
| virtual void | setKeyPacket (bool keyPacket)=0 |
| Set if this is a key packet. More... | |
| virtual void | setFlags (int32_t flags)=0 |
| Set any internal flags. More... | |
| virtual void | setComplete (bool complete, int32_t size)=0 |
| Set if this packet is complete, and what the total size of the data should be assumed to be. More... | |
| virtual void | setStreamIndex (int32_t streamIndex)=0 |
| Set the stream index for this packet. More... | |
| virtual void | setDuration (int64_t duration)=0 |
| Set the duration. More... | |
| virtual void | setPosition (int64_t position)=0 |
| Set the position. More... | |
Public Member Functions inherited from com::avpkit::core::IMediaData | |
| virtual int64_t | getTimeStamp ()=0 |
| Get the time stamp of this object in getTimeBase() units. More... | |
| virtual void | setTimeStamp (int64_t aTimeStamp)=0 |
| Set the time stamp for this object in getTimeBase() units. More... | |
| virtual IRational * | getTimeBase ()=0 |
| Get the time base that time stamps of this object are represented in. More... | |
| virtual void | setTimeBase (IRational *aBase)=0 |
| Set the time base that time stamps of this object are represented in. More... | |
| virtual com::avpkit::ferry::IBuffer * | getData ()=0 |
| Get any underlying raw data available for this object. More... | |
| virtual bool | isKey ()=0 |
| Is this object a key object? i.e. More... | |
| virtual void | setData (com::avpkit::ferry::IBuffer *buffer)=0 |
| Sets the underlying buffer used by this object. More... | |
Public Member Functions inherited from com::avpkit::ferry::RefCounted | |
| virtual int32_t | acquire () |
| Internal Only. More... | |
| virtual int32_t | release () |
| Internal Only. More... | |
| virtual RefCounted * | copyReference () |
| Create a new Java object that refers to the same native object. More... | |
| virtual int32_t | getCurrentRefCount () |
| Return the current reference count on this object. More... | |
| void | setJavaAllocator (void *allocator) |
| This method is public but not part of the standard API. More... | |
| void * | getJavaAllocator () |
| This method is public but not part of the standard API. More... | |
Static Public Member Functions | |
| static IPacket * | make () |
| Allocate a new packet. More... | |
| static IPacket * | make (com::avpkit::ferry::IBuffer *buffer) |
| Allocate a new packet that wraps an existing IBuffer. More... | |
| static IPacket * | make (IPacket *packet, bool copyData) |
| Allocate a new packet wrapping the existing contents of a passed in packet. More... | |
| static IPacket * | make (int32_t size) |
| Allocate a new packet. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from com::avpkit::ferry::RefCounted | |
| virtual void | destroy () |
| This method is called by RefCounted objects when their Ref Count reaches zero and they are about to be destroyed. | |
Protected Attributes inherited from com::avpkit::ferry::RefCounted | |
| AtomicInteger * | mRefCount |
| This is the internal reference count, represented as an AtomicInteger to make sure it is thread safe. | |
| void * | mAllocator |
| Not part of public API. | |
Represents an encoded piece of data that can be placed in an IContainer for a given IStream of data.
You read this object out of IContainer objects when decoding, and pass to an IStreamCoder object to decode.
You pass this object to a IStreamCoder to encode data, and then pass to an IContainer object to write to a data source.
Lastly, the units of timestamps in an IPacket are determined by the IContainer it came from (or is going to). For example, FLV IPackets are always in milliseconds (1/1000 of a second). You cannot assume these timestamps are in any given timeunit without getting an IStream object and finding out what Time Base that stream operates in.
For convenience, the AVPKit API always uses Microseconds for raw data (IVideoPicture and IAudioSamples objects), and will convert to the right time stamp unit when decoding or encoding data (with an IStreamCoder) from or to an IContainer.
|
pure virtual |
Discard the current payload and allocate a new payload.
Note that if any people have access to the old payload using getData(), the memory will continue to be available to them until they release their hold of the IBuffer.
When requesting a packet size, the system may allocate a larger payloadSize.
| payloadSize | The (minimum) payloadSize of this packet in bytes. |
Implemented in com::avpkit::core::Packet.
Referenced by make().
|
pure virtual |
Get the Decompression Time Stamp (DTS) for this packet.
This is the time at which the payload for this packet should be decompressed, in units of getTimeBase(), relative to the start of stream.
Some media codecs can require packets from the "future" to be decompressed before earliest packets as an additional way to compress data. In general you don't need to worry about this, but if you're curious start reading about the difference between I-Frames, P-Frames and B-Frames (or Bi-Directional Frames). B-Frames can use information from future frames when compressed.
Implemented in com::avpkit::core::Packet.
Referenced by com::avpkit::core::Stream::stampOutputPacket().
|
pure virtual |
Return the duration of this packet, in units of getTimeBase().
Implemented in com::avpkit::core::Packet.
Referenced by com::avpkit::core::Stream::stampOutputPacket().
|
pure virtual |
Get any flags set on this packet, as a 4-byte binary-ORed bit-mask.
This is access to raw FFMPEG flags, but it is easier to use the is* methods below.
Implemented in com::avpkit::core::Packet.
|
pure virtual |
Get the maximum size (in bytes) of payload this packet can hold.
Implemented in com::avpkit::core::Packet.
|
pure virtual |
Return the position (in bytes) of this packet in the stream.
Implemented in com::avpkit::core::Packet.
|
pure virtual |
Get the Presentation Time Stamp (PTS) for this packet.
This is the time at which the payload for this packet should be presented to the user, in units of getTimeBase(), relative to the start of stream.
Implemented in com::avpkit::core::Packet.
Referenced by com::avpkit::core::Stream::stampOutputPacket().
|
pure virtual |
Get the size in bytes of the payload currently in this packet.
Implements com::avpkit::core::IMediaData.
Implemented in com::avpkit::core::Packet.
|
pure virtual |
Get the container-specific index for the stream this packet is part of.
Implemented in com::avpkit::core::Packet.
|
pure virtual |
Is this packet complete.
Implemented in com::avpkit::core::Packet.
|
pure virtual |
Does this packet contain Key data? i.e.
data that needs no other frames or samples to decode.
Implemented in com::avpkit::core::Packet.
|
static |
Allocate a new packet.
Note that any buffers this packet needs will be lazily allocated (i.e. we won't actually grab all the memory until we need it).
Definition at line 37 of file IPacket.cpp.
References com::avpkit::core::Global::init().
Referenced by make().
|
static |
Allocate a new packet that wraps an existing IBuffer.
| buffer | The IBuffer to wrap. |
Definition at line 44 of file IPacket.cpp.
References com::avpkit::core::Global::init(), and make().
|
static |
Allocate a new packet.
Note that any buffers this packet needs will be lazily allocated (i.e. we won't actually grab all the memory until we need it).
| size | The maximum size, in bytes, of data you want to put in this packet. |
Definition at line 61 of file IPacket.cpp.
References allocateNewPayload(), and com::avpkit::core::Global::init().
Allocate a new packet wrapping the existing contents of a passed in packet.
Callers can then modify getPts(), getDts() and other get/set methods without modifying the original packet.
| packet | Packet to reuse buffer from and to copy settings from. |
| copyData | if true copy data from packet into our own buffer. If false, share the same data buffer that packet uses |
Definition at line 54 of file IPacket.cpp.
References com::avpkit::core::Global::init(), and make().
|
pure virtual |
Set if this packet is complete, and what the total size of the data should be assumed to be.
| complete | True for complete, false for not. |
| size | Size of data in packet. |
Implemented in com::avpkit::core::Packet.
|
pure virtual |
Set a new Decompression Time Stamp (DTS) for this packet.
| aDts | a new DTS for this packet. |
Implemented in com::avpkit::core::Packet.
Referenced by com::avpkit::core::Stream::stampOutputPacket().
|
pure virtual |
Set the duration.
| duration | new duration |
Implemented in com::avpkit::core::Packet.
Referenced by com::avpkit::core::Stream::stampOutputPacket().
|
pure virtual |
|
pure virtual |
Set if this is a key packet.
| keyPacket | true for yes, false for no. |
Implemented in com::avpkit::core::Packet.
|
pure virtual |
Set the position.
| position | new position |
Implemented in com::avpkit::core::Packet.
|
pure virtual |
Set a new Presentation Time Stamp (PTS) for this packet.
| aPts | a new PTS for this packet. |
Implemented in com::avpkit::core::Packet.
Referenced by com::avpkit::core::Stream::stampOutputPacket().
|
pure virtual |
Set the stream index for this packet.
| streamIndex | The stream index, as determined from the IContainer this packet will be written to. |
Implemented in com::avpkit::core::Packet.
Referenced by com::avpkit::core::Stream::stampOutputPacket().