Base module

PacketStreamAdapter

This class is a wrapper for integrating external classes with the a [PacketStream]({#ref classicy_1_1PacketStream #})'s

PacketStreamAdapter

#include <icy/packetstream.h>

Subclassed by: PacketProcessor, ThreadedStreamReader, ICapture, FormWriter, WebRtcTrackReceiver

This class is a wrapper for integrating external classes with the a PacketStream's data flow and state machine.

Public Methods

ReturnNameDescription
PacketStreamAdapterConstruct the adapter, binding it to the given packet signal.
voidemit virtualEmit a mutable raw buffer as a packet.
voidemit virtualEmit a read-only raw buffer as a packet (data is copied internally).
voidemit virtualEmit a string as a packet (data is copied internally).
voidemit virtualEmit a flag-only packet carrying no payload data.
voidemit virtualEmit an existing packet directly onto the outgoing signal.
PacketSignal &getEmitterReturns a reference to the outgoing packet signal.
PacketRetentionretention virtual constReturns how this adapter treats incoming packet lifetime. Most adapters are synchronous and therefore only borrow the packet for the current call chain. Queue-style adapters override this to advertise that they clone before deferred use. Callers may treat the first adapter reporting Cloned or Retained as the explicit ownership boundary in the stream graph.
voidonStreamStateChange virtual inlineCalled by the PacketStream to notify when the internal Stream state changes. On receiving the Stopped state, it is the responsibility of the adapter to have ceased all outgoing packet transmission, especially in multi-thread scenarios.

PacketStreamAdapter

PacketStreamAdapter(PacketSignal & emitter)

Construct the adapter, binding it to the given packet signal.

Parameters

  • emitter The outgoing packet signal owned by the subclass.

emit

virtual

virtual void emit(char * data, size_t len, unsigned flags)

Emit a mutable raw buffer as a packet.

Parameters

  • data Pointer to the buffer (not copied; caller retains ownership).

  • len Number of bytes in the buffer.

  • flags Optional packet flags (see PacketFlags).


emit

virtual

virtual void emit(const char * data, size_t len, unsigned flags)

Emit a read-only raw buffer as a packet (data is copied internally).

Parameters

  • data Pointer to the buffer.

  • len Number of bytes in the buffer.

  • flags Optional packet flags (see PacketFlags).


emit

virtual

virtual void emit(const std::string & str, unsigned flags)

Emit a string as a packet (data is copied internally).

Parameters

  • str String payload.

  • flags Optional packet flags (see PacketFlags).


emit

virtual

virtual void emit(unsigned flags)

Emit a flag-only packet carrying no payload data.

Parameters

  • flags Packet flags to embed in the emitted FlagPacket.

emit

virtual

virtual void emit(IPacket & packet)

Emit an existing packet directly onto the outgoing signal.

Parameters

  • packet The packet to forward; must remain valid for the duration of the call.

getEmitter

PacketSignal & getEmitter()

Returns a reference to the outgoing packet signal.


retention

virtual const

virtual PacketRetention retention() const

Returns how this adapter treats incoming packet lifetime. Most adapters are synchronous and therefore only borrow the packet for the current call chain. Queue-style adapters override this to advertise that they clone before deferred use. Callers may treat the first adapter reporting Cloned or Retained as the explicit ownership boundary in the stream graph.


onStreamStateChange

virtual inline

virtual inline void onStreamStateChange(const PacketStreamState &)

Called by the PacketStream to notify when the internal Stream state changes. On receiving the Stopped state, it is the responsibility of the adapter to have ceased all outgoing packet transmission, especially in multi-thread scenarios.

Protected Attributes

ReturnNameDescription
PacketSignal &_emitter

_emitter

PacketSignal & _emitter

Protected Methods

ReturnNameDescription
PacketStreamAdapterNonCopyable and NonMovable.
PacketStreamAdapterDeleted constructor.

PacketStreamAdapter

PacketStreamAdapter(const PacketStreamAdapter &) = delete

NonCopyable and NonMovable.


PacketStreamAdapter

PacketStreamAdapter(PacketStreamAdapter &&) = delete

Deleted constructor.