| 123456789101112131415161718192021222324252627282930313233343536373839 |
- #include "DxgiCapturer.h"
- #include <cassert>
- namespace avrecorder {
- namespace video {
- DxgiCapturer::DxgiCapturer() : d(nullptr) {}
- DxgiCapturer::~DxgiCapturer() { close(); }
- bool DxgiCapturer::open(const CaptureTarget& target, int width, int height) {
- #ifdef PLATFORM_WINDOWS
- close();
- if (target.type != CaptureTargetType::Monitor) return false;
- // 这里只做简单示例,实际应根据 monitorIdx 获取坐标
- m_left = 0; m_top = 0; m_width = width; m_height = height;
- // TODO: 初始化 d,创建 D3D 设备等
- return true;
- #else
- return false;
- #endif
- }
- void DxgiCapturer::close() {
- #ifdef PLATFORM_WINDOWS
- // TODO: 释放 d
- #endif
- }
- AVFrame* DxgiCapturer::getFrame() {
- #ifdef PLATFORM_WINDOWS
- // TODO: 获取帧
- return nullptr;
- #else
- return nullptr;
- #endif
- }
- } // namespace video
- } // namespace avrecorder
|