VideoPacketEncoder
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
| Return | Name | Description |
|---|---|---|
VideoPacketEncoder | ||
VideoPacketEncoder | Deleted constructor. | |
void | process virtual | Process a VideoPacket or PlanarVideoPacket from the stream. Encodes the frame and emits the resulting compressed packet. |
bool | accepts virtual | Accept VideoPacket and PlanarVideoPacket types. |
VideoPacketEncoder
VideoPacketEncoder(AVFormatContext * format)VideoPacketEncoder
VideoPacketEncoder(const VideoPacketEncoder &) = deleteDeleted 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
| Return | Name | Description |
|---|---|---|
bool | _initialized | |
std::mutex | _mutex |
_initialized
bool _initialized = false_mutex
std::mutex _mutexProtected Methods
| Return | Name | Description |
|---|---|---|
void | onStreamStateChange virtual | 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
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.
