Gjsify LogoGjsify Logo

The GstRTPBuffer helper functions makes it easy to parse and create regular #GstBuffer objects that contain RTP payloads. These buffers are typically of 'application/x-rtp' #GstCaps.

record

Hierarchy

  • RTPBuffer

Index

Constructors

Properties

buffer: Gst.Buffer

pointer to RTP buffer

field
data: object[]

array of data

field
map: MapInfo[]

array of #GstMapInfo

field
size: number[]

array of size

field
state: number

internal state

field
name: string

Methods

  • add_extension_onebyte_header(id: number, data: Uint8Array): boolean
  • Adds a RFC 5285 header extension with a one byte header to the end of the RTP header. If there is already a RFC 5285 header extension with a one byte header, the new extension will be appended. It will not work if there is already a header extension that does not follow the mechanism described in RFC 5285 or if there is a header extension with a two bytes header as described in RFC 5285. In that case, use gst_rtp_buffer_add_extension_twobytes_header()

    Parameters

    • id: number

      The ID of the header extension (between 1 and 14).

    • data: Uint8Array

      location for data

    Returns boolean

  • add_extension_twobytes_header(appbits: number, id: number, data: Uint8Array): boolean
  • Adds a RFC 5285 header extension with a two bytes header to the end of the RTP header. If there is already a RFC 5285 header extension with a two bytes header, the new extension will be appended. It will not work if there is already a header extension that does not follow the mechanism described in RFC 5285 or if there is a header extension with a one byte header as described in RFC 5285. In that case, use gst_rtp_buffer_add_extension_onebyte_header()

    Parameters

    • appbits: number

      Application specific bits

    • id: number

      The ID of the header extension

    • data: Uint8Array

      location for data

    Returns boolean

  • get_csrc(idx: number): number
  • get_csrc_count(): number
  • get_extension(): boolean
  • get_extension_data(): [Bytes, number]
  • Similar to gst_rtp_buffer_get_extension_data, but more suitable for language bindings usage. bits will contain the extension 16 bits of custom data and the extension data (not including the extension header) is placed in a new #GBytes structure.

    If rtp did not contain an extension, this function will return %NULL, with bits unchanged. If there is an extension header but no extension data then an empty #GBytes will be returned.

    Returns [Bytes, number]

  • get_extension_onebyte_header(id: number, nth: number): [boolean, Uint8Array]
  • Parses RFC 5285 style header extensions with a one byte header. It will return the nth extension with the requested id.

    Parameters

    • id: number

      The ID of the header extension to be read (between 1 and 14).

    • nth: number

      Read the nth extension packet with the requested ID

    Returns [boolean, Uint8Array]

  • get_extension_twobytes_header(id: number, nth: number): [boolean, number, Uint8Array]
  • Parses RFC 5285 style header extensions with a two bytes header. It will return the nth extension with the requested id.

    Parameters

    • id: number

      The ID of the header extension to be read (between 1 and 14).

    • nth: number

      Read the nth extension packet with the requested ID

    Returns [boolean, number, Uint8Array]

  • get_header_len(): number
  • Return the total length of the header in buffer. This include the length of the fixed header, the CSRC list and the extension header.

    Returns number

  • get_marker(): boolean
  • get_packet_len(): number
  • get_padding(): boolean
  • Similar to gst_rtp_buffer_get_payload, but more suitable for language bindings usage. The return value is a pointer to a #GBytes structure containing the payload data in rtp.

    Returns Bytes

  • Create a buffer of the payload of the RTP packet in buffer. This function will internally create a subbuffer of buffer so that a memcpy can be avoided.

    Returns Gst.Buffer

  • get_payload_len(): number
  • get_payload_subbuffer(offset: number, len: number): Gst.Buffer
  • Create a subbuffer of the payload of the RTP packet in buffer. offset bytes are skipped in the payload and the subbuffer will be of size len. If len is -1 the total payload starting from offset is subbuffered.

    Parameters

    • offset: number

      the offset in the payload

    • len: number

      the length in the payload

    Returns Gst.Buffer

  • get_payload_type(): number
  • get_seq(): number
  • get_ssrc(): number
  • get_timestamp(): number
  • get_version(): number
  • pad_to(len: number): void
  • Set the amount of padding in the RTP packet in buffer to len. If len is 0, the padding is removed.

    NOTE: This function does not work correctly.

    Parameters

    • len: number

      the new amount of padding

    Returns void

  • remove_extension_data(): void
  • Unsets the extension bit of the RTP buffer and removes the extension header and data.

    If the RTP buffer has no header extension data, the action has no effect. The RTP buffer must be mapped READWRITE only once and the underlying GstBuffer must be writable.

    Returns void

  • set_csrc(idx: number, csrc: number): void
  • Modify the CSRC at index idx in buffer to csrc.

    Parameters

    • idx: number

      the CSRC index to set

    • csrc: number

      the CSRC in host order to set at idx

    Returns void

  • set_extension(extension: boolean): void
  • Set the extension bit on the RTP packet in buffer to extension.

    Parameters

    • extension: boolean

      the new extension

    Returns void

  • set_extension_data(bits: number, length: number): boolean
  • Set the extension bit of the rtp buffer and fill in the bits and length of the extension header. If the existing extension data is not large enough, it will be made larger.

    Will also shorten the extension data from 1.20.

    Parameters

    • bits: number

      the bits specific for the extension

    • length: number

      the length that counts the number of 32-bit words in the extension, excluding the extension header ( therefore zero is a valid length)

    Returns boolean

  • set_marker(marker: boolean): void
  • set_packet_len(len: number): void
  • Set the total rtp size to len. The data in the buffer will be made larger if needed. Any padding will be removed from the packet.

    Parameters

    • len: number

      the new packet length

    Returns void

  • set_padding(padding: boolean): void
  • Set the padding bit on the RTP packet in buffer to padding.

    Parameters

    • padding: boolean

      the new padding

    Returns void

  • set_payload_type(payload_type: number): void
  • Set the payload type of the RTP packet in buffer to payload_type.

    Parameters

    • payload_type: number

      the new type

    Returns void

  • set_seq(seq: number): void
  • Set the sequence number of the RTP packet in buffer to seq.

    Parameters

    • seq: number

      the new sequence number

    Returns void

  • set_ssrc(ssrc: number): void
  • set_timestamp(timestamp: number): void
  • Set the timestamp of the RTP packet in buffer to timestamp.

    Parameters

    • timestamp: number

      the new timestamp

    Returns void

  • set_version(version: number): void
  • unmap(): void
  • allocate_data(buffer: Gst.Buffer, payload_len: number, pad_len: number, csrc_count: number): void
  • Allocate enough data in buffer to hold an RTP packet with csrc_count CSRCs, a payload length of payload_len and padding of pad_len. buffer must be writable and all previous memory in buffer will be freed. If pad_len is >0, the padding bit will be set. All other RTP header fields will be set to 0/FALSE.

    Parameters

    • buffer: Gst.Buffer

      a #GstBuffer

    • payload_len: number

      the length of the payload

    • pad_len: number

      the amount of padding

    • csrc_count: number

      the number of CSRC entries

    Returns void

  • calc_header_len(csrc_count: number): number
  • Calculate the header length of an RTP packet with csrc_count CSRC entries. An RTP packet can have at most 15 CSRC entries.

    Parameters

    • csrc_count: number

      the number of CSRC entries

    Returns number

  • calc_packet_len(payload_len: number, pad_len: number, csrc_count: number): number
  • Calculate the total length of an RTP packet with a payload size of payload_len, a padding of pad_len and a csrc_count CSRC entries.

    Parameters

    • payload_len: number

      the length of the payload

    • pad_len: number

      the amount of padding

    • csrc_count: number

      the number of CSRC entries

    Returns number

  • calc_payload_len(packet_len: number, pad_len: number, csrc_count: number): number
  • Calculate the length of the payload of an RTP packet with size packet_len, a padding of pad_len and a csrc_count CSRC entries.

    Parameters

    • packet_len: number

      the length of the total RTP packet

    • pad_len: number

      the amount of padding

    • csrc_count: number

      the number of CSRC entries

    Returns number

  • compare_seqnum(seqnum1: number, seqnum2: number): number
  • Compare two sequence numbers, taking care of wraparounds. This function returns the difference between seqnum1 and seqnum2.

    Parameters

    • seqnum1: number

      a sequence number

    • seqnum2: number

      a sequence number

    Returns number

  • default_clock_rate(payload_type: number): number
  • Get the default clock-rate for the static payload type payload_type.

    Parameters

    • payload_type: number

      the static payload type

    Returns number

  • ext_timestamp(exttimestamp: number, timestamp: number): [number, number]
  • Update the exttimestamp field with the extended timestamp of timestamp For the first call of the method, exttimestamp should point to a location with a value of -1.

    This function is able to handle both forward and backward timestamps taking into account:

    • timestamp wraparound making sure that the returned value is properly increased.
    • timestamp unwraparound making sure that the returned value is properly decreased.

    Parameters

    • exttimestamp: number

      a previous extended timestamp

    • timestamp: number

      a new timestamp

    Returns [number, number]

  • get_extension_onebyte_header_from_bytes(bytes: Bytes, bit_pattern: number, id: number, nth: number): [boolean, Uint8Array]
  • Similar to gst_rtp_buffer_get_extension_onebyte_header, but working on the #GBytes you get from gst_rtp_buffer_get_extension_bytes. Parses RFC 5285 style header extensions with a one byte header. It will return the nth extension with the requested id.

    Parameters

    • bytes: Bytes

      #GBytes

    • bit_pattern: number

      The bit-pattern. Anything but 0xBEDE is rejected.

    • id: number

      The ID of the header extension to be read (between 1 and 14).

    • nth: number

      Read the nth extension packet with the requested ID

    Returns [boolean, Uint8Array]

  • new_allocate(payload_len: number, pad_len: number, csrc_count: number): Gst.Buffer
  • Allocate a new #GstBuffer with enough data to hold an RTP packet with csrc_count CSRCs, a payload length of payload_len and padding of pad_len. All other RTP header fields will be set to 0/FALSE.

    Parameters

    • payload_len: number

      the length of the payload

    • pad_len: number

      the amount of padding

    • csrc_count: number

      the number of CSRC entries

    Returns Gst.Buffer

  • new_allocate_len(packet_len: number, pad_len: number, csrc_count: number): Gst.Buffer
  • Create a new #GstBuffer that can hold an RTP packet that is exactly packet_len long. The length of the payload depends on pad_len and csrc_count and can be calculated with gst_rtp_buffer_calc_payload_len(). All RTP header fields will be set to 0/FALSE.

    Parameters

    • packet_len: number

      the total length of the packet

    • pad_len: number

      the amount of padding

    • csrc_count: number

      the number of CSRC entries

    Returns Gst.Buffer

  • Create a new buffer and set the data to a copy of len bytes of data and the size to len. The data will be freed when the buffer is freed.

    Parameters

    • data: Uint8Array

      data for the new buffer

    Returns Gst.Buffer

  • Create a new buffer and set the data and size of the buffer to data and len respectively. data will be freed when the buffer is unreffed, so this function transfers ownership of data to the new buffer.

    Parameters

    • data: Uint8Array

      data for the new buffer

    Returns Gst.Buffer

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method