Home
Base module

PacketStreamAdapter

This class is a wrapper for integrating external classes with the a PacketStream's

PacketStreamAdapter

#include <icy/packetstream.h>
class PacketStreamAdapter

Defined in src/base/include/icy/packetstream.h:42

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.

List of all members

NameKindOwner
PacketStreamAdapterfunctionDeclared here
~PacketStreamAdapterfunctionDeclared here
emitfunctionDeclared here
emitfunctionDeclared here
emitfunctionDeclared here
emitfunctionDeclared here
emitfunctionDeclared here
getEmitterfunctionDeclared here
retentionfunctionDeclared here
onStreamStateChangefunctionDeclared here
_emittervariableDeclared here
PacketStreamAdapterfunctionDeclared here
operator=functionDeclared here
PacketStreamAdapterfunctionDeclared here
operator=functionDeclared here

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)

Defined in src/base/include/icy/packetstream.h:47

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 = 0)

Defined in src/base/include/icy/packetstream.h:54

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 = 0)

Defined in src/base/include/icy/packetstream.h:60

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 = 0)

Defined in src/base/include/icy/packetstream.h:65

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 = 0)

Defined in src/base/include/icy/packetstream.h:69

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)

Defined in src/base/include/icy/packetstream.h:73

Emit an existing packet directly onto the outgoing signal.

Parameters

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

getEmitter

PacketSignal & getEmitter()

Defined in src/base/include/icy/packetstream.h:76

Returns a reference to the outgoing packet signal.


retention

virtual const

virtual PacketRetention retention() const

Defined in src/base/include/icy/packetstream.h:84

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.

Reimplemented by

onStreamStateChange

virtual inline

virtual inline void onStreamStateChange(const PacketStreamState &)

Defined in src/base/include/icy/packetstream.h:91

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.

Reimplemented by

Protected Attributes

ReturnNameDescription
PacketSignal &_emitter

_emitter

PacketSignal & _emitter

Defined in src/base/include/icy/packetstream.h:100

Protected Methods

ReturnNameDescription
PacketStreamAdapterNonCopyable and NonMovable.
PacketStreamAdapterDeleted constructor.

PacketStreamAdapter

PacketStreamAdapter(const PacketStreamAdapter &) = delete

Defined in src/base/include/icy/packetstream.h:95

NonCopyable and NonMovable.


PacketStreamAdapter

PacketStreamAdapter(PacketStreamAdapter &&) = delete

Defined in src/base/include/icy/packetstream.h:97

Deleted constructor.