NetTimePacket#

class NetTimePacket(*args, **kwargs)#

Various functions for receiving, sending an serializing NetTimePacket structures.

Constructors#

class NetTimePacket
classmethod new(buffer: list[int] | None = None) NetTimePacket#

Creates a new NetTimePacket from a buffer received over the network. The caller is responsible for ensuring that buffer is at least GST_NET_TIME_PACKET_SIZE bytes long.

If buffer is None, the local and remote times will be set to GST_CLOCK_TIME_NONE.

MT safe. Caller owns return value (gst_net_time_packet_free to free).

Parameters:

buffer – a buffer from which to construct the packet, or NULL

Methods#

class NetTimePacket
free() None#

Free packet.

classmethod receive() Tuple[NetTimePacket, SocketAddress]#

Receives a NetTimePacket over a socket. Handles interrupted system calls, but otherwise returns NULL on error.

send(socket: Socket, dest_address: SocketAddress) bool#

Sends a NetTimePacket over a socket.

MT safe.

Parameters:
  • socket – socket to send the time packet on

  • dest_address – address to send the time packet to

serialize() list[int]#

Serialized a NetTimePacket into a newly-allocated sequence of GST_NET_TIME_PACKET_SIZE bytes, in network byte order. The value returned is suitable for passing to write(2) or sendto(2) for communication over the network.

MT safe. Caller owns return value (g_free to free).

Fields#

class NetTimePacket
local_time#

The local time when this packet was sent

remote_time#

The remote time observation