Shaka Player Embedded
|
#include <byte_buffer.h>
Public Member Functions | |
ByteBuffer () | |
ByteBuffer (const uint8_t *data, size_t data_size) | |
~ByteBuffer () override | |
ByteBuffer (const ByteBuffer &)=delete | |
ByteBuffer (ByteBuffer &&) | |
ByteBuffer & | operator= (const ByteBuffer &other)=delete |
ByteBuffer & | operator= (ByteBuffer &&other) |
const uint8_t * | data () const |
size_t | size () const |
void | Clear () |
void | SetFromDynamicBuffer (const util::DynamicBuffer &other) |
void | SetFromBuffer (const void *buffer, size_t size) |
bool | TryConvert (Handle< JsValue > value) override |
ReturnVal< JsValue > | ToJsValue () const override |
void | Trace (memory::HeapTracer *tracer) const override |
ReturnVal< JsValue > | ToJsValue (proto::ValueType kind) const |
![]() | |
virtual | ~GenericConverter () |
![]() | |
virtual | ~Traceable () |
virtual bool | IsRootedAlive () const |
virtual bool | IsShortLived () const |
Static Public Member Functions | |
static std::string | name () |
Additional Inherited Members | |
![]() | |
static constexpr const uint64_t | kShortLiveDurationMs = 5000 |
Represents a buffer of data that is shared between C++ and JavaScript. This holds a single ArrayBuffer that refers to the data, which can be passed into JavaScript. Since ArrayBuffers are immutable, this type is read-only.
Definition at line 33 of file byte_buffer.h.
shaka::ByteBuffer::ByteBuffer | ( | ) |
Definition at line 35 of file byte_buffer.cc.
shaka::ByteBuffer::ByteBuffer | ( | const uint8_t * | data, |
size_t | data_size | ||
) |
Definition at line 37 of file byte_buffer.cc.
|
override |
Definition at line 49 of file byte_buffer.cc.
|
delete |
shaka::ByteBuffer::ByteBuffer | ( | ByteBuffer && | other | ) |
Definition at line 41 of file byte_buffer.cc.
void shaka::ByteBuffer::Clear | ( | ) |
Clears all the data stored in the buffer.
Definition at line 66 of file byte_buffer.cc.
|
inline |
Definition at line 50 of file byte_buffer.h.
|
inlinestatic |
Definition at line 35 of file byte_buffer.h.
|
delete |
ByteBuffer & shaka::ByteBuffer::operator= | ( | ByteBuffer && | other | ) |
Definition at line 53 of file byte_buffer.cc.
void shaka::ByteBuffer::SetFromBuffer | ( | const void * | buffer, |
size_t | size | ||
) |
Similar to SetFromDynamicBuffer, except accepts a single buffer source.
Definition at line 77 of file byte_buffer.cc.
void shaka::ByteBuffer::SetFromDynamicBuffer | ( | const util::DynamicBuffer & | other | ) |
Clears the buffer and sets the contents to a copy of the given buffer. This can be called from any thread.
This will allocate a block of memory the same as JavaScript expects and take ownership of it (own_ptr_). Then, when we need the ArrayBuffer, we create it then giving up ownership of the pointer so we don't have to copy it.
Definition at line 72 of file byte_buffer.cc.
|
inline |
Definition at line 55 of file byte_buffer.h.
|
overridevirtual |
Converts the current value into a JavaScript value.
Implements shaka::GenericConverter.
Definition at line 123 of file byte_buffer.cc.
ReturnVal< JsValue > shaka::ByteBuffer::ToJsValue | ( | proto::ValueType | kind | ) | const |
Creates an ArrayBuffer/TypedArray of the given type.
Definition at line 139 of file byte_buffer.cc.
|
overridevirtual |
Called during a GC run. This should call HeapTracer::Trace on all Traceable members. Be sure to call the base method when overriding.
Implements shaka::memory::Traceable.
Definition at line 240 of file byte_buffer.cc.
|
overridevirtual |
Tries to convert the given value into the required type, populating the members of this object as needed.
Implements shaka::GenericConverter.
Definition at line 82 of file byte_buffer.cc.