|
AVPKit
|
Allows Java code to get data from a native buffers, and optionally modify native memory directly. More...
#include <IBuffer.h>


Public Member Functions | |
| virtual void * | getBytes (int32_t offset, int32_t length)=0 |
| Returns up to length bytes, starting at offset in the underlying buffer we're managing. More... | |
| virtual int32_t | getBufferSize ()=0 |
| Get the current maximum number of bytes that can be safely placed in this buffer. More... | |
| virtual Type | getType ()=0 |
| Get the type this buffer was created as. More... | |
| virtual void | setType (Type type)=0 |
| Reset the buffer type to a new type. More... | |
| virtual int32_t | getSize ()=0 |
| Returns the size, in units of getType() of this buffer. 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 IBuffer * | make (RefCounted *requestor, void *bufToWrap, int32_t bufferSize, FreeFunc freeFunc, void *closure) |
| Allocate a new buffer by wrapping a native buffer. More... | |
| static IBuffer * | make (com::avpkit::ferry::RefCounted *requestor, int32_t bufferSize) |
| Allocate a new buffer of at least bufferSize. More... | |
| static int32_t | getTypeSize (Type type) |
| Returns the size, in bytes, of elements of given Type. More... | |
| static IBuffer * | make (com::avpkit::ferry::RefCounted *requestor, Type type, int32_t numElements, bool zero) |
| Allocate a new buffer of at least bufferSize. 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. | |
Allows Java code to get data from a native buffers, and optionally modify native memory directly.
When accessing from Java, you can copy in and out ranges of buffers. You can do this by-copy (which is safer but a little slower) or by-reference where you directly access underlying C++/native memory from Java. Take special care if you decide that native access is required.
When accessing from C++, you get direct access to the underlying buffer.
To make an IBuffer object that is not a AVPKit internal object, pass in null for the RefCounted parameter.
|
pure virtual |
Get the current maximum number of bytes that can be safely placed in this buffer.
Implemented in com::avpkit::ferry::Buffer.
Referenced by com::avpkit::core::VideoPicture::copyAVFrame(), com::avpkit::core::Container::createSDPData(), com::avpkit::core::VideoPicture::fillAVFrame(), com::avpkit::core::VideoPicture::getAVFrame(), com::avpkit::core::VideoPicture::getData(), and com::avpkit::core::VideoPicture::make().
|
pure virtual |
Returns up to length bytes, starting at offset in the underlying buffer we're managing.
Note that with this method you are accessing the direct memory, so be careful.
| offset | The offset (in bytes) into the buffer managed by this IBuffer |
| length | The requested length (in bytes) you want to access. The buffer returned may actually be longer than length. |
Implemented in com::avpkit::ferry::Buffer.
Referenced by com::avpkit::core::VideoPicture::copy(), com::avpkit::core::VideoPicture::copyAVFrame(), com::avpkit::core::Container::createSDPData(), com::avpkit::core::VideoPicture::fillAVFrame(), com::avpkit::core::StreamCoder::getExtraData(), com::avpkit::core::VideoPicture::make(), and com::avpkit::core::StreamCoder::setExtraData().
|
pure virtual |
Returns the size, in units of getType() of this buffer.
Implemented in com::avpkit::ferry::Buffer.
|
pure virtual |
Get the type this buffer was created as.
A type is really just a hint. Like objects, IBuffer objects can be cast to and from any type.
Implemented in com::avpkit::ferry::Buffer.
|
static |
Returns the size, in bytes, of elements of given Type.
Definition at line 65 of file IBuffer.cpp.
|
static |
Allocate a new buffer of at least bufferSize.
| requestor | An optional value telling the IBuffer class what object requested it. This is used for debugging memory leaks; it's a marker for the FERRY object (e.g. IPacket) that actually requested the buffer. If you're not an FERRY object, pass in null here. |
| bufferSize | The minimum buffer size you're requesting in bytes; a buffer with a larger size may be returned. |
Definition at line 42 of file IBuffer.cpp.
References com::avpkit::ferry::Buffer::make().
|
static |
Allocate a new buffer of at least bufferSize.
| requestor | An optional value telling the IBuffer class what object requested it. This is used for debugging memory leaks; it's a marker for the FERRY object (e.g. IPacket) that actually requested the buffer. If you're not an FERRY object, pass in null here. |
| type | The type of buffer. |
| numElements | The minimum number of elements of the specified type you will put in this buffer. |
| zero | If true, we will guarantee the buffer contains only zeros. If false, we will not (it is faster to not, but then the buffer will have garbage-data in it). |
Definition at line 58 of file IBuffer.cpp.
References com::avpkit::ferry::Buffer::make().
|
static |
Allocate a new buffer by wrapping a native buffer.
To make an IBuffer object that is not a AVPKit internal object, pass in null for the requestor parameter.
| requestor | An optional value telling the IBuffer class what object requested it. This is used for debugging memory leaks; it's a marker for the FERRY object (e.g. IPacket) that actually requested the buffer. If you're not an FERRY object, pass in null here. |
| bufToWrap | Buffer to wrap |
| bufferSize | The minimum buffer size you're requesting in bytes; a buffer with a larger size may be returned. |
| freeFunc | A function that will be called when we decide to free the buffer |
| closure | A value that will be passed, along with this, to freeFunc |
Definition at line 48 of file IBuffer.cpp.
References com::avpkit::ferry::Buffer::make().
|
pure virtual |
Reset the buffer type to a new type.
This method does not do any data conversion, it just changes the reported type (so changing from Type#IBUFFER_UINT8 to Type#IBUFFER_SINT16 is really just a "cast" operation).
| type | the type to set to. |
Implemented in com::avpkit::ferry::Buffer.