#ifndef GDICAPTURER_H
#define GDICAPTURER_H

#include "IVideoCapturer.h"
#include <Windows.h>

namespace avrecorder {
namespace video {

class GdiCapturer : public IVideoCapturer {
public:
    GdiCapturer() = default;
    ~GdiCapturer() override { close(); }
    bool open(const CaptureTarget& target, int width, int height) override;
    void close() override;
    AVFrame* getFrame() override;
    void setDrawCursor(bool enable) override { m_drawCursor = enable; }
private:
    void drawCursor(HDC hdc);

    HDC _srcHdc = nullptr;
    HDC _dstHdc = nullptr;
    HBITMAP _bitmap = nullptr;
    BITMAPINFO _bitmapInfo;
    int m_width = 0;
    int m_height = 0;
    AVFrame* _frame = nullptr;
    bool m_drawCursor = true;
    HWND m_hwnd = nullptr;
};

} // namespace video
} // namespace avrecorder

#endif // GDICAPTURER_H 
