NetTimePacket
- class NetTimePacket(*args, **kwargs)
Various functions for receiving, sending an serializing NetTimePacket
structures.
Constructors
- class NetTimePacket
- classmethod new(buffer: Sequence[int] | None = None) NetTimePacket
Creates a new
NetTimePacket
from a buffer received over the network. The caller is responsible for ensuring thatbuffer
is at leastGST_NET_TIME_PACKET_SIZE
bytes long.If
buffer
isNone
, the local and remote times will be set toGST_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
-
- receive(socket: Socket) tuple[NetTimePacket, SocketAddress]
Receives a
NetTimePacket
over a socket. Handles interrupted system calls, but otherwise returns NULL on error.- Parameters:
socket – socket to receive the time packet on
- 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() bytes
Serialized a
NetTimePacket
into a newly-allocated sequence ofGST_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).