MultiplexPacketEncoder
MultiplexPacketEncoder
#include <icy/av/multiplexpacketencoder.h>class MultiplexPacketEncoderDefined in src/av/include/icy/av/multiplexpacketencoder.h:28
Inherits:
MultiplexEncoder,PacketProcessor
Encodes and multiplexes a realtime video stream form audio / video capture sources. FFmpeg is used for encoding.
List of all members
| Name | Kind | Owner |
|---|---|---|
PacketStream | friend | Declared here |
MultiplexPacketEncoder | function | Declared here |
~MultiplexPacketEncoder | function | Declared here |
MultiplexPacketEncoder | function | Declared here |
operator= | function | Declared here |
MultiplexPacketEncoder | function | Declared here |
operator= | function | Declared here |
encode | function | Declared here |
encode | function | Declared here |
accepts | function | Declared here |
process | function | Declared here |
_mutex | variable | Declared here |
onStreamStateChange | function | Declared here |
emitter | variable | Inherited from MultiplexEncoder |
MultiplexEncoder | function | Inherited from MultiplexEncoder |
~MultiplexEncoder | function | Inherited from MultiplexEncoder |
MultiplexEncoder | function | Inherited from MultiplexEncoder |
operator= | function | Inherited from MultiplexEncoder |
MultiplexEncoder | function | Inherited from MultiplexEncoder |
operator= | function | Inherited from MultiplexEncoder |
init | function | Inherited from MultiplexEncoder |
uninit | function | Inherited from MultiplexEncoder |
cleanup | function | Inherited from MultiplexEncoder |
createVideo | function | Inherited from MultiplexEncoder |
freeVideo | function | Inherited from MultiplexEncoder |
encodeVideo | function | Inherited from MultiplexEncoder |
encodeVideo | function | Inherited from MultiplexEncoder |
encodeVideo | function | Inherited from MultiplexEncoder |
createAudio | function | Inherited from MultiplexEncoder |
freeAudio | function | Inherited from MultiplexEncoder |
encodeAudio | function | Inherited from MultiplexEncoder |
encodeAudio | function | Inherited from MultiplexEncoder |
flush | function | Inherited from MultiplexEncoder |
options | function | Inherited from MultiplexEncoder |
video | function | Inherited from MultiplexEncoder |
audio | function | Inherited from MultiplexEncoder |
_options | variable | Inherited from MultiplexEncoder |
_formatCtx | variable | Inherited from MultiplexEncoder |
_video | variable | Inherited from MultiplexEncoder |
_audio | variable | Inherited from MultiplexEncoder |
_ioCtx | variable | Inherited from MultiplexEncoder |
_ioBuffer | variable | Inherited from MultiplexEncoder |
_videoPts | variable | Inherited from MultiplexEncoder |
_audioPts | variable | Inherited from MultiplexEncoder |
_mutex | variable | Inherited from MultiplexEncoder |
writeOutputPacket | function | Inherited from MultiplexEncoder |
updateStreamPts | function | Inherited from MultiplexEncoder |
onVideoEncoded | function | Inherited from MultiplexEncoder |
onAudioEncoded | function | Inherited from MultiplexEncoder |
init | function | Inherited from IEncoder |
uninit | function | Inherited from IEncoder |
cleanup | function | Inherited from IEncoder |
options | function | Inherited from IEncoder |
createVideo | function | Inherited from IEncoder |
freeVideo | function | Inherited from IEncoder |
encodeVideo | function | Inherited from IEncoder |
createAudio | function | Inherited from IEncoder |
freeAudio | function | Inherited from IEncoder |
flush | function | Inherited from IEncoder |
isNone | function | Inherited from IEncoder |
isReady | function | Inherited from IEncoder |
isEncoding | function | Inherited from IEncoder |
isActive | function | Inherited from IEncoder |
isStopped | function | Inherited from IEncoder |
isError | function | Inherited from IEncoder |
Type | enum | Inherited from IEncoder |
StateChange | variable | Inherited from Stateful |
Stateful | function | Inherited from Stateful |
~Stateful | function | Inherited from Stateful |
stateEquals | function | Inherited from Stateful |
stateBetween | function | Inherited from Stateful |
state | function | Inherited from Stateful |
state | function | Inherited from Stateful |
_state | variable | Inherited from Stateful |
beforeStateChange | function | Inherited from Stateful |
onStateChange | function | Inherited from Stateful |
setState | function | Inherited from Stateful |
setState | function | Inherited from Stateful |
PacketProcessor | function | Inherited from PacketProcessor |
process | function | Inherited from PacketProcessor |
accepts | function | Inherited from PacketProcessor |
operator<< | function | Inherited from PacketProcessor |
PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
~PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
emit | function | Inherited from PacketStreamAdapter |
getEmitter | function | Inherited from PacketStreamAdapter |
retention | function | Inherited from PacketStreamAdapter |
onStreamStateChange | function | Inherited from PacketStreamAdapter |
_emitter | variable | Inherited from PacketStreamAdapter |
PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
operator= | function | Inherited from PacketStreamAdapter |
PacketStreamAdapter | function | Inherited from PacketStreamAdapter |
operator= | function | Inherited from PacketStreamAdapter |
Inherited from MultiplexEncoder
| Kind | Name | Description |
|---|---|---|
variable | emitter | |
function | MultiplexEncoder | Construct the encoder with the given options. |
function | ~MultiplexEncoder noexcept override | |
function | MultiplexEncoder | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | MultiplexEncoder | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | init virtual override | Open the output container, create codec streams, and write the format header. |
function | uninit virtual override | Flush encoded packets, write the format trailer, and close the output container. |
function | cleanup virtual override | Release all resources allocated by init() without writing a trailer. |
function | createVideo virtual override | Create the video encoder and add the stream to the output container. |
function | freeVideo virtual override | Flush and free the video encoder and its stream. |
function | encodeVideo virtual override | Encode a single video frame. All frame values must be set, such as size, pixel format, and PTS. |
function | encodeVideo virtual | Encode a single interleaved video frame. If the frame time is specified it should be the microseconds offset since the start of the input stream. If no time is specified a real-time value will be assigned to the frame. |
function | encodeVideo virtual | Encode a single planar video frame. |
function | createAudio virtual override | Create the audio encoder and add the stream to the output container. |
function | freeAudio virtual override | Flush and free the audio encoder and its stream. |
function | encodeAudio virtual | Encode a single interleaved audio frame. |
function | encodeAudio virtual | Encode a single planar audio frame. |
function | flush virtual override | Flush any buffered or queued packets to the output container. |
function | options virtual const override | |
function | video | |
function | audio | |
variable | _options | |
variable | _formatCtx | |
variable | _video | |
variable | _audio | |
variable | _ioCtx | |
variable | _ioBuffer | |
variable | _videoPts | |
variable | _audioPts | |
variable | _mutex | |
function | writeOutputPacket | |
function | updateStreamPts | Convert input microseconds to the stream time base. |
function | onVideoEncoded | |
function | onAudioEncoded |
Inherited from IEncoder
| Kind | Name | Description |
|---|---|---|
function | init virtual | Initialise the encoder, open codec contexts, and transition to Ready or Encoding state. |
function | uninit virtual | Flush remaining packets, close codec contexts, and release all encoder resources. |
function | cleanup virtual inline | Perform any additional cleanup after uninit(). Default is a no-op. |
function | options virtual const | |
function | createVideo virtual inline | Initialise the video codec context and stream. |
function | freeVideo virtual inline | Free the video codec context and stream. |
function | encodeVideo virtual inline | Encode a single AVFrame of video. |
function | createAudio virtual inline | Initialise the audio codec context and stream. |
function | freeAudio virtual inline | Free the audio codec context and stream. |
function | flush virtual inline | Flush any internally buffered packets to the output. |
function | isNone const inline | |
function | isReady const inline | |
function | isEncoding virtual const inline | |
function | isActive virtual const inline | |
function | isStopped virtual const inline | |
function | isError virtual const inline | |
enum | Type |
Inherited from Stateful
| Kind | Name | Description |
|---|---|---|
variable | StateChange | Signals when the state changes. |
function | Stateful inline | |
function | ~Stateful virtual inline | |
function | stateEquals virtual const inline | Returns true if the current state ID equals the given ID. |
function | stateBetween virtual const inline | Returns true if the current state ID is in the inclusive range [lid, rid]. |
function | state virtual inline | Returns a mutable reference to the current state. |
function | state virtual const inline | Returns a copy of the current state. |
variable | _state | |
function | beforeStateChange virtual inline | Override to handle pre state change logic. Return false to prevent state change. |
function | onStateChange virtual inline | Override to handle post state change logic. |
function | setState virtual inline | Sets the state and sends the state signal if the state change was successful. |
function | setState virtual inline | Sets the state and sends the state signal if the state change was successful. |
Inherited from PacketProcessor
| Kind | Name | Description |
|---|---|---|
function | PacketProcessor inline | |
function | process virtual | This method performs processing on the given packet and emits the result. |
function | accepts virtual inline | This method ensures compatibility with the given packet type. Return false to reject the packet. |
function | operator<< virtual inline | Stream operator alias for process() |
Inherited from PacketStreamAdapter
| Kind | Name | Description |
|---|---|---|
function | PacketStreamAdapter | Construct the adapter, binding it to the given packet signal. |
function | ~PacketStreamAdapter virtual inline | |
function | emit virtual | Emit a mutable raw buffer as a packet. |
function | emit virtual | Emit a read-only raw buffer as a packet (data is copied internally). |
function | emit virtual | Emit a string as a packet (data is copied internally). |
function | emit virtual | Emit a flag-only packet carrying no payload data. |
function | emit virtual | Emit an existing packet directly onto the outgoing signal. |
function | getEmitter | Returns a reference to the outgoing packet signal. |
function | retention virtual 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. |
function | onStreamStateChange virtual inline | 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. |
variable | _emitter | |
function | PacketStreamAdapter | NonCopyable and NonMovable. |
function | operator= | Deleted assignment operator. |
function | PacketStreamAdapter | Deleted constructor. |
function | operator= | Deleted assignment operator. |
Friends
| Name | Description |
|---|---|
PacketStream |
PacketStream
friend class PacketStreamDefined in src/av/include/icy/av/multiplexpacketencoder.h:61
Public Methods
| Return | Name | Description |
|---|---|---|
MultiplexPacketEncoder | Construct the encoder with the given options. | |
MultiplexPacketEncoder | Deleted constructor. | |
MultiplexPacketEncoder | Deleted constructor. | |
void | encode virtual | Encode a VideoPacket, dispatching to the planar or interleaved encode path as appropriate. |
void | encode virtual | Encode an AudioPacket, dispatching to the planar or interleaved encode path as appropriate. |
bool | accepts virtual override | |
void | process virtual override | Dispatch the incoming packet to encode(VideoPacket&) or encode(AudioPacket&). Throws std::invalid_argument if the packet type is unrecognised. |
MultiplexPacketEncoder
MultiplexPacketEncoder(const EncoderOptions & options = EncoderOptions())Defined in src/av/include/icy/av/multiplexpacketencoder.h:34
Construct the encoder with the given options.
Parameters
optionsThe encoder configuration (input/output formats and file paths).
MultiplexPacketEncoder
MultiplexPacketEncoder(const MultiplexPacketEncoder &) = deleteDefined in src/av/include/icy/av/multiplexpacketencoder.h:37
Deleted constructor.
MultiplexPacketEncoder
MultiplexPacketEncoder(MultiplexPacketEncoder &&) = deleteDefined in src/av/include/icy/av/multiplexpacketencoder.h:39
Deleted constructor.
encode
virtual
virtual void encode(VideoPacket & packet)Defined in src/av/include/icy/av/multiplexpacketencoder.h:44
Encode a VideoPacket, dispatching to the planar or interleaved encode path as appropriate.
Parameters
packetThe video packet to encode.
encode
virtual
virtual void encode(AudioPacket & packet)Defined in src/av/include/icy/av/multiplexpacketencoder.h:48
Encode an AudioPacket, dispatching to the planar or interleaved encode path as appropriate.
Parameters
packetThe audio packet to encode.
accepts
virtual override
virtual bool accepts(IPacket * packet) overrideDefined in src/av/include/icy/av/multiplexpacketencoder.h:51
Returns
True if the packet is an av::MediaPacket (audio or video).
Reimplements
process
virtual override
virtual void process(IPacket & packet) overrideDefined in src/av/include/icy/av/multiplexpacketencoder.h:56
Dispatch the incoming packet to encode(VideoPacket&) or encode(AudioPacket&). Throws std::invalid_argument if the packet type is unrecognised.
Parameters
packetThe incoming media packet.
Reimplements
Protected Attributes
| Return | Name | Description |
|---|---|---|
std::mutex | _mutex |
_mutex
std::mutex _mutexDefined in src/av/include/icy/av/multiplexpacketencoder.h:63
Protected Methods
| Return | Name | Description |
|---|---|---|
void | onStreamStateChange virtual override | 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. |
onStreamStateChange
virtual override
virtual void onStreamStateChange(const PacketStreamState &) overrideDefined in src/av/include/icy/av/multiplexpacketencoder.h:59
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.
