#ifndef VIDEO_STREAM_H_ #define VIDEO_STREAM_H_ #define FFMPEG_ENABLED #ifdef FFMPEG_ENABLED #include #include #include "Bitmap.h" extern "C" { # include # include # include # include # include # include # include } namespace alm { struct VideoExportException; } struct alm::VideoExportException : public std::runtime_error { VideoExportException(const std::string& err); }; class VideoStream { const AVCodec* codec; AVCodecContext* codecContext; AVFormatContext* formatContext; AVCodecParameters* params; //FILE* file; AVFrame* picture; AVPacket* pkt; AVStream* stream; SwsContext* swsContext; int width; int height; int fps; int64_t frameIndex = 0; public: VideoStream(int width, int height, const std::string& filename, int bitrate, int fps, const char* preset); ~VideoStream(void); void addFrame(const Bitmap& frame); private: void encode(AVFrame* frame); }; #endif // FFMPEG_ENABLED #endif // VIDEO_STREAM_H_