MultiplexEncoder
#include <icy/av/multiplexencoder.h>
class MultiplexEncoderDefined in src/av/include/icy/av/multiplexencoder.h:41
- Inherits
IEncoder- Subclassed by
MultiplexPacketEncoder
List of all members
| Name | Kind | Owner |
|---|---|---|
emitter | variable | Declared here |
MultiplexEncoder | function | Declared here |
~MultiplexEncoder | function | Declared here |
MultiplexEncoder | function | Declared here |
operator= | function | Declared here |
MultiplexEncoder | function | Declared here |
operator= | function | Declared here |
init | function | Declared here |
uninit | function | Declared here |
cleanup | function | Declared here |
createVideo | function | Declared here |
freeVideo | function | Declared here |
encodeVideo | function | Declared here |
encodeVideo | function | Declared here |
encodeVideo | function | Declared here |
createAudio | function | Declared here |
freeAudio | function | Declared here |
encodeAudio | function | Declared here |
encodeAudio | function | Declared here |
flush | function | Declared here |
options | function | Declared here |
video | function | Declared here |
audio | function | Declared here |
_options | variable | Declared here |
_formatCtx | variable | Declared here |
_video | variable | Declared here |
_audio | variable | Declared here |
_ioCtx | variable | Declared here |
_ioBuffer | variable | Declared here |
_videoPts | variable | Declared here |
_audioPts | variable | Declared here |
_mutex | variable | Declared here |
writeOutputPacket | function | Declared here |
updateStreamPts | function | Declared here |
onVideoEncoded | function | Declared here |
onAudioEncoded | function | Declared here |
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 |
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. |
Public Attributes
| Return | Name | Description |
|---|---|---|
PacketSignal | emitter |
emitter
PacketSignal emitterType: PacketSignal
Defined in src/av/include/icy/av/multiplexencoder.h:130
Public Methods
| Return | Name | Description |
|---|---|---|
MultiplexEncoder | Construct the encoder with the given options. | |
~MultiplexEncoder noexcept override | ||
MultiplexEncoder | Deleted constructor. | |
MultiplexEncoder & | operator= | Deleted assignment operator. |
MultiplexEncoder | Deleted constructor. | |
MultiplexEncoder & | operator= | Deleted assignment operator. |
void | init virtual override | Open the output container, create codec streams, and write the format header. |
void | uninit virtual override | Flush encoded packets, write the format trailer, and close the output container. |
void | cleanup virtual override | Release all resources allocated by init() without writing a trailer. |
void | createVideo virtual override | Create the video encoder and add the stream to the output container. |
void | freeVideo virtual override | Flush and free the video encoder and its stream. |
bool | encodeVideo virtual override | Encode a single video frame. All frame values must be set, such as size, pixel format, and PTS. |
bool | 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. |
bool | encodeVideo virtual | Encode a single planar video frame. |
void | createAudio virtual override | Create the audio encoder and add the stream to the output container. |
void | freeAudio virtual override | Flush and free the audio encoder and its stream. |
bool | encodeAudio virtual | Encode a single interleaved audio frame. |
bool | encodeAudio virtual | Encode a single planar audio frame. |
void | flush virtual override | Flush any buffered or queued packets to the output container. |
const EncoderOptions & | options virtual const override | |
VideoEncoder * | video | |
AudioEncoder * | audio |
MultiplexEncoder
MultiplexEncoder(const EncoderOptions & options = EncoderOptions())Defined in src/av/include/icy/av/multiplexencoder.h:46
Construct the encoder with the given options.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | const EncoderOptions & | The encoder configuration (input/output formats and file paths). |
~MultiplexEncoder
noexcept override
~MultiplexEncoder() noexcept overrideDefined in src/av/include/icy/av/multiplexencoder.h:47
MultiplexEncoder
MultiplexEncoder(const MultiplexEncoder &) = deleteDefined in src/av/include/icy/av/multiplexencoder.h:49
Deleted constructor.
operator=
MultiplexEncoder & operator=(const MultiplexEncoder &) = deleteDefined in src/av/include/icy/av/multiplexencoder.h:50
Deleted assignment operator.
MultiplexEncoder
MultiplexEncoder(MultiplexEncoder &&) = deleteDefined in src/av/include/icy/av/multiplexencoder.h:51
Deleted constructor.
operator=
MultiplexEncoder & operator=(MultiplexEncoder &&) = deleteDefined in src/av/include/icy/av/multiplexencoder.h:52
Deleted assignment operator.
init
virtual override
virtual void init() overrideDefined in src/av/include/icy/av/multiplexencoder.h:55
Open the output container, create codec streams, and write the format header.
Reimplements
uninit
virtual override
virtual void uninit() overrideDefined in src/av/include/icy/av/multiplexencoder.h:58
Flush encoded packets, write the format trailer, and close the output container.
Reimplements
cleanup
virtual override
virtual void cleanup() overrideDefined in src/av/include/icy/av/multiplexencoder.h:61
Release all resources allocated by init() without writing a trailer.
Reimplements
createVideo
virtual override
virtual void createVideo() overrideDefined in src/av/include/icy/av/multiplexencoder.h:64
Create the video encoder and add the stream to the output container.
Reimplements
freeVideo
virtual override
virtual void freeVideo() overrideDefined in src/av/include/icy/av/multiplexencoder.h:67
Flush and free the video encoder and its stream.
Reimplements
encodeVideo
virtual override
virtual bool encodeVideo(AVFrame * frame) overrideDefined in src/av/include/icy/av/multiplexencoder.h:71
Encode a single video frame. All frame values must be set, such as size, pixel format, and PTS.
Reimplements
encodeVideo
virtual
virtual bool encodeVideo(uint8_t * buffer, int bufferSize, int width, int height, int64_t time = AV_NOPTS_VALUE)Defined in src/av/include/icy/av/multiplexencoder.h:83
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.
Parameters
| Parameter | Type | Description |
|---|---|---|
buffer | uint8_t * | The raw video frame buffer. |
bufferSize | int | The buffer size in bytes. |
width | int | The frame width in pixels. |
height | int | The frame height in pixels. |
time | int64_t | The timestamp in microseconds, or AV_NOPTS_VALUE for realtime. |
encodeVideo
virtual
virtual bool encodeVideo(uint8_t * data, int linesize, int width, int height, int64_t time = AV_NOPTS_VALUE)Defined in src/av/include/icy/av/multiplexencoder.h:93
Encode a single planar video frame.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | uint8_t * | Array of per-plane data pointers (up to 4 planes). |
linesize | int | Array of per-plane byte strides. |
width | int | The frame width in pixels. |
height | int | The frame height in pixels. |
time | int64_t | The timestamp in microseconds, or AV_NOPTS_VALUE for realtime. |
createAudio
virtual override
virtual void createAudio() overrideDefined in src/av/include/icy/av/multiplexencoder.h:97
Create the audio encoder and add the stream to the output container.
Reimplements
freeAudio
virtual override
virtual void freeAudio() overrideDefined in src/av/include/icy/av/multiplexencoder.h:100
Flush and free the audio encoder and its stream.
Reimplements
encodeAudio
virtual
virtual bool encodeAudio(uint8_t * buffer, int numSamples, int64_t time = AV_NOPTS_VALUE)Defined in src/av/include/icy/av/multiplexencoder.h:107
Encode a single interleaved audio frame.
Parameters
| Parameter | Type | Description |
|---|---|---|
buffer | uint8_t * | The interleaved audio sample buffer. |
numSamples | int | The number of samples per channel. |
time | int64_t | The timestamp in microseconds, or AV_NOPTS_VALUE for realtime. |
encodeAudio
virtual
virtual bool encodeAudio(uint8_t * data, int numSamples, int64_t time = AV_NOPTS_VALUE)Defined in src/av/include/icy/av/multiplexencoder.h:115
Encode a single planar audio frame.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | uint8_t * | Array of per-plane sample buffers (one per channel). |
numSamples | int | The number of samples per channel. |
time | int64_t | The timestamp in microseconds, or AV_NOPTS_VALUE for realtime. |
flush
virtual override
virtual void flush() overrideDefined in src/av/include/icy/av/multiplexencoder.h:119
Flush any buffered or queued packets to the output container.
Reimplements
options
virtual const override
virtual const EncoderOptions & options() const overrideDefined in src/av/include/icy/av/multiplexencoder.h:122
Returns
A read-only view of the encoder's configuration options.
Reimplements
video
VideoEncoder * video()Defined in src/av/include/icy/av/multiplexencoder.h:125
Returns
The active VideoEncoder, or nullptr if video has not been created.
audio
AudioEncoder * audio()Defined in src/av/include/icy/av/multiplexencoder.h:128
Returns
The active AudioEncoder, or nullptr if audio has not been created.
Protected Attributes
| Return | Name | Description |
|---|---|---|
EncoderOptions | _options | |
AVFormatContext * | _formatCtx | |
std::unique_ptr< VideoEncoder > | _video | |
std::unique_ptr< AudioEncoder > | _audio | |
AVIOContext * | _ioCtx | |
std::unique_ptr< uint8_t[]> | _ioBuffer | |
int64_t | _videoPts | |
int64_t | _audioPts | |
std::mutex | _mutex |
_options
EncoderOptions _optionsType: EncoderOptions
Defined in src/av/include/icy/av/multiplexencoder.h:144
_formatCtx
AVFormatContext * _formatCtxDefined in src/av/include/icy/av/multiplexencoder.h:145
_video
std::unique_ptr< VideoEncoder > _videoType: std::unique_ptr< VideoEncoder >
Defined in src/av/include/icy/av/multiplexencoder.h:146
_audio
std::unique_ptr< AudioEncoder > _audioType: std::unique_ptr< AudioEncoder >
Defined in src/av/include/icy/av/multiplexencoder.h:147
_ioCtx
AVIOContext * _ioCtxDefined in src/av/include/icy/av/multiplexencoder.h:148
_ioBuffer
std::unique_ptr< uint8_t[]> _ioBufferDefined in src/av/include/icy/av/multiplexencoder.h:149
_videoPts
int64_t _videoPtsDefined in src/av/include/icy/av/multiplexencoder.h:150
_audioPts
int64_t _audioPtsDefined in src/av/include/icy/av/multiplexencoder.h:151
_mutex
std::mutex _mutexDefined in src/av/include/icy/av/multiplexencoder.h:152
Protected Methods
| Return | Name | Description |
|---|---|---|
bool | writeOutputPacket | |
bool | updateStreamPts | Convert input microseconds to the stream time base. |
void | onVideoEncoded | |
void | onAudioEncoded |
writeOutputPacket
bool writeOutputPacket(AVPacket & packet)Defined in src/av/include/icy/av/multiplexencoder.h:133
updateStreamPts
bool updateStreamPts(AVStream * stream, int64_t * pts)Defined in src/av/include/icy/av/multiplexencoder.h:139
Convert input microseconds to the stream time base.
Parameters
| Parameter | Type | Description |
|---|---|---|
stream | AVStream * | The target stream for time base conversion. |
pts | int64_t * | Pointer to the timestamp; converted in place. |
onVideoEncoded
void onVideoEncoded(av::VideoPacket & packet)Defined in src/av/include/icy/av/multiplexencoder.h:141
onAudioEncoded
void onAudioEncoded(av::AudioPacket & packet)