AV module

VideoPacketEncoder

[PacketProcessor]({#ref classicy_1_1PacketProcessor #}) that encodes raw video frames ([PlanarVideoPacket]({#ref structicy_1_1av_1_1PlanarVideoPacket #}) or [VideoPacket]({#ref structicy_1_1av_1_1VideoPacket #})) into compressed packets via [VideoEncoder]({#ref structicy_1_1av_1_1VideoEncoder #}).

VideoPacketEncoder

#include <icy/av/videopacketencoder.h>

Inherits: VideoEncoder, PacketProcessor

PacketProcessor that encodes raw video frames (PlanarVideoPacket or VideoPacket) into compressed packets via VideoEncoder.

Drop this into a PacketStream between a source that emits raw frames (e.g. MediaCapture) and a sink that expects encoded data (e.g. WebRtcTrackSender or MultiplexPacketEncoder).

Example:

auto encoder = std::make_sharedav::VideoPacketEncoder(); encoder->iparams = capture->videoCodec(); // decoded format encoder->oparams = av::VideoCodec("H264", "libx264", 640, 480, 30);

PacketStream stream; stream.attachSource(capture); stream.attach(encoder, 1, true); stream.attach(&webrtcSender, 5, false); stream.start();

Public Methods

ReturnNameDescription
VideoPacketEncoder
VideoPacketEncoderDeleted constructor.
voidprocess virtualProcess a VideoPacket or PlanarVideoPacket from the stream. Encodes the frame and emits the resulting compressed packet.
boolaccepts virtualAccept VideoPacket and PlanarVideoPacket types.

VideoPacketEncoder

VideoPacketEncoder(AVFormatContext * format)

VideoPacketEncoder

VideoPacketEncoder(const VideoPacketEncoder &) = delete

Deleted constructor.


process

virtual

virtual void process(IPacket & packet)

Process a VideoPacket or PlanarVideoPacket from the stream. Encodes the frame and emits the resulting compressed packet.


accepts

virtual

virtual bool accepts(IPacket * packet)

Accept VideoPacket and PlanarVideoPacket types.

Protected Attributes

ReturnNameDescription
bool_initialized
std::mutex_mutex

_initialized

bool _initialized = false

_mutex

std::mutex _mutex

Protected Methods

ReturnNameDescription
voidonStreamStateChange virtualCalled 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

virtual 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.