#ifndef SCAR_VIDEO_ENCODER_H #define SCAR_VIDEO_ENCODER_H #include #include #include extern "C" { #include #include #include #include } namespace scar { class VideoEncoder { public: VideoEncoder(); ~VideoEncoder(); // Initialize encoder with given parameters bool initialize(int width, int height, int fps = 30, int bitrate = 2000000); // Encode a raw frame (BGR0 format from PipeWire) // Returns encoded packet data, empty if error or no packet yet std::vector encode(const uint8_t* frame_data, uint32_t frame_size); // Flush any remaining frames std::vector flush(); // Cleanup void cleanup(); private: AVCodecContext* codec_ctx_; AVFrame* frame_; AVPacket* packet_; SwsContext* sws_ctx_; int width_; int height_; int frame_counter_; bool initialized_; }; } // namespace scar #endif // SCAR_VIDEO_ENCODER_H