#pragma once #include "screencast/codec/encoder.h" #include "screencast/codec/error.h" #include #include #include #include namespace sc { struct DecodedFrame { int width = 0; int height = 0; uint64_t capture_timestamp_ns = 0; std::vector rgba_pixels; }; struct DecoderConfig { std::string codec_name = "h264"; int width = 0; int height = 0; std::vector extradata; // SPS/PPS for H.264 // Probe a hardware decoder (v4l2 mem2mem) first and fall back to the // software decoder automatically. Disable with --swdecode. bool hardware_accel = true; }; class Decoder { public: virtual ~Decoder() = default; // Feed one encoded frame. Returns decoded frames when available. virtual CodecResult> decode(const EncodedFrame& frame) = 0; }; class DecoderFactory { public: static CodecResult> create(const DecoderConfig& config); }; } // namespace sc