Class (GI Struct)

GstBase-1.0GstBaseByteWriter

GstBase.ByteWriter provides a byte writer and reader that can write/read different integer and floating point types to/from a memory buffer. It provides functions for writing/reading signed/unsigned, little/big endian integers of 8, 16, 24, 32 and 64 bits and functions for reading little/big endian floating points numbers of 32 and 64 bits. It also provides functions to write/read NUL-terminated strings in various character encodings.

Index

Constructors

  • Parameters

    • Optionalproperties: Partial<
          {
              alloc_size: number;
              fixed: boolean;
              owned: boolean;
              parent: ByteReader;
          },
      >

    Returns ByteWriter

Properties

alloc_size: number
fixed: boolean
owned: boolean
$gtype: GType<ByteWriter>

Methods

  • Checks if enough free space from the current write cursor is available and reallocates if necessary.

    Parameters

    • size: number

      Number of bytes that should be available

    Returns boolean

    true if at least size bytes are still available

  • Writes size bytes containing value to writer.

    Parameters

    • value: number

      Value to be written

    • size: number

      Number of bytes to be written

    Returns boolean

    true if the value could be written

  • Frees writer and all memory allocated by it except the current data, which is returned.

    Free-function: g_free

    Returns number

    the current data. g_free() after usage.

  • Returns the remaining size of data that can still be written. If -1 is returned the remaining size is only limited by system resources.

    Returns number

    the remaining size of data that can still be written

  • Initializes writer with the given memory area. If initialized is true it is possible to read size bytes from the GstBase.ByteWriter from the beginning.

    Parameters

    • data: string | Uint8Array<ArrayBufferLike>

      Memory area for writing

    • initialized: boolean

      If true the complete data can be read from the beginning

    Returns void

  • Initializes writer with the given initial data size.

    Parameters

    • size: number

      Initial size of data

    • fixed: boolean

      If true the data can't be reallocated

    Returns void

  • Writes size bytes of data to writer.

    Parameters

    • buffer: Gst.Buffer

      source Gst.Buffer

    • offset: number

      offset to copy from

    • size: number

      total size to copy. If -1, all data is copied

    Returns boolean

    true if the data could be written

  • Writes size bytes of data to writer.

    Parameters

    • data: string | Uint8Array<ArrayBufferLike>

      Data to write

    Returns boolean

    true if the value could be written

  • Writes a big endian 32 bit float to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a little endian 32 bit float to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a big endian 64 bit float to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a little endian 64 bit float to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a signed big endian 16 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a signed little endian 16 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a signed big endian 24 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a signed little endian 24 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a signed big endian 32 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a signed little endian 32 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a signed big endian 64 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a signed little endian 64 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a signed 8 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a NUL-terminated UTF16 string to writer (including the terminator).

    Parameters

    • data: number[]

      UTF16 string to write

    Returns boolean

    true if the value could be written

  • Writes a NUL-terminated UTF32 string to writer (including the terminator).

    Parameters

    • data: number[]

      UTF32 string to write

    Returns boolean

    true if the value could be written

  • Writes a NUL-terminated UTF8 string to writer (including the terminator).

    Parameters

    • data: string

      UTF8 string to write

    Returns boolean

    true if the value could be written

  • Writes a unsigned big endian 16 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a unsigned little endian 16 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a unsigned big endian 24 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a unsigned little endian 24 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a unsigned big endian 32 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a unsigned little endian 32 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a unsigned big endian 64 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a unsigned little endian 64 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Writes a unsigned 8 bit integer to writer.

    Parameters

    • val: number

      Value to write

    Returns boolean

    true if the value could be written

  • Resets writer and returns the current data.

    Free-function: g_free

    Returns Uint8Array

    the current data. g_free() after usage.