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