#pragma once #include "h264_encoder.h" #include #include namespace piik::capture::windows { struct AdaptiveAccessUnit final { EncodedAccessUnit access_unit; UINT32 width = 0; UINT32 height = 0; UINT64 duration100ns = 0; }; // One complete WebRTC encoding/adaptation pipeline for one shared output. class AdaptiveEncoder final { public: using Factory = std::function(const VideoProfile&)>; using FrameProducer = std::function(UINT32, UINT32)>; AdaptiveEncoder(OutputKind kind, VideoProfile ceiling, ID3D11Device* device, Factory create, std::unique_ptr initial = nullptr, int output_index = -1); ~AdaptiveEncoder(); AdaptiveEncoder(const AdaptiveEncoder&) = delete; AdaptiveEncoder& operator=(const AdaptiveEncoder&) = delete; std::optional Encode( FrameProducer produce, UINT32 source_width, UINT32 source_height, UINT64 timestamp100ns, bool key_frame, UINT32 bitrate, EncoderClock::time_point deadline = EncoderClock::time_point::max()); private: class Impl; std::unique_ptr impl_; }; } // namespace piik::capture::windows