AV module

IEncoder

This is the abstract class for all encoders.

IEncoder

#include <icy/av/iencoder.h>

Inherits: Stateful< EncoderState > Subclassed by: MultiplexEncoder

This is the abstract class for all encoders.

Public Methods

ReturnNameDescription
voidinitInitialise the encoder, open codec contexts, and transition to Ready or Encoding state.
voiduninitFlush remaining packets, close codec contexts, and release all encoder resources.
voidcleanup virtual inlinePerform any additional cleanup after uninit(). Default is a no-op.
const EncoderOptions &options const#### Returns
voidcreateVideo virtual inlineInitialise the video codec context and stream.
voidfreeVideo virtual inlineFree the video codec context and stream.
boolencodeVideo virtual inlineEncode a single AVFrame of video.
voidcreateAudio virtual inlineInitialise the audio codec context and stream.
voidfreeAudio virtual inlineFree the audio codec context and stream.
voidflush virtual inlineFlush any internally buffered packets to the output.
boolisNone const inline#### Returns
boolisReady const inline#### Returns
boolisEncoding virtual const inline#### Returns
boolisActive virtual const inline#### Returns
boolisStopped virtual const inline#### Returns
boolisError virtual const inline#### Returns

init

void init()

Initialise the encoder, open codec contexts, and transition to Ready or Encoding state.


uninit

void uninit()

Flush remaining packets, close codec contexts, and release all encoder resources.


cleanup

virtual inline

virtual inline void cleanup()

Perform any additional cleanup after uninit(). Default is a no-op.


options

const

const EncoderOptions & options() const

Returns

A read-only view of the encoder's configuration options.


createVideo

virtual inline

virtual inline void createVideo()

Initialise the video codec context and stream.


freeVideo

virtual inline

virtual inline void freeVideo()

Free the video codec context and stream.


encodeVideo

virtual inline

virtual inline bool encodeVideo(AVFrame * frame)

Encode a single AVFrame of video.

Parameters

  • frame The source video frame; all fields (format, width, height, pts) must be set.

Returns

True if a packet was successfully encoded and written.


createAudio

virtual inline

virtual inline void createAudio()

Initialise the audio codec context and stream.


freeAudio

virtual inline

virtual inline void freeAudio()

Free the audio codec context and stream.


flush

virtual inline

virtual inline void flush()

Flush any internally buffered packets to the output.


isNone

const inline

inline bool isNone() const

Returns

True if the encoder is in the None state.


isReady

const inline

inline bool isReady() const

Returns

True if the encoder is ready but not yet encoding.


isEncoding

virtual const inline

virtual inline bool isEncoding() const

Returns

True if the encoder is actively encoding.


isActive

virtual const inline

virtual inline bool isActive() const

Returns

True if the encoder is in the Ready or Encoding state.


isStopped

virtual const inline

virtual inline bool isStopped() const

Returns

True if the encoder has stopped.


isError

virtual const inline

virtual inline bool isError() const

Returns

True if the encoder is in an error state.

Public Types

NameDescription
Type

Type

enum Type
ValueDescription
Nonehuh?
Videovideo only
Audioaudio only
Multiplexboth video & audio