feat(capture): add Phase 3 PipeWire capture stub and config string safety
Add a linkable CaptureFactory stub so the capture API can be consumed without unresolved symbols. Change remaining config string_view fields to std::string to prevent dangling references. Update handoff memory.
This commit is contained in:
@@ -3,26 +3,31 @@
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string_view>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
namespace sc {
|
||||
|
||||
enum class PixelFormat {
|
||||
Rgba,
|
||||
Yuv420p,
|
||||
};
|
||||
|
||||
// Opaque resource owned by the capture implementation.
|
||||
struct CapturedFrame {
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
uint64_t timestamp_ns = 0; // capture clock, monotonic
|
||||
PixelFormat pixel_format = PixelFormat::Rgba;
|
||||
int stride = 0; // bytes per row for the first plane; 0 means packed
|
||||
std::vector<std::byte> pixels;
|
||||
// TODO: pixel format, stride, FD handle for dmabuf
|
||||
};
|
||||
|
||||
// Capture target: whole monitor, specific window, or a region.
|
||||
struct CaptureTargetWholeScreen {};
|
||||
struct CaptureTargetWindow {
|
||||
std::string_view window_id;
|
||||
std::string window_id;
|
||||
};
|
||||
struct CaptureTargetRegion {
|
||||
int x = 0;
|
||||
@@ -31,13 +36,10 @@ struct CaptureTargetRegion {
|
||||
int height = 0;
|
||||
};
|
||||
|
||||
using CaptureTarget = std::variant<
|
||||
CaptureTargetWholeScreen,
|
||||
CaptureTargetWindow,
|
||||
CaptureTargetRegion>;
|
||||
using CaptureTarget = std::variant<CaptureTargetWholeScreen, CaptureTargetWindow, CaptureTargetRegion>;
|
||||
|
||||
class CaptureSession {
|
||||
public:
|
||||
public:
|
||||
virtual ~CaptureSession() = default;
|
||||
|
||||
// Blocking call to acquire one frame. Returns std::nullopt on graceful stop.
|
||||
@@ -49,7 +51,7 @@ public:
|
||||
|
||||
// Factory for the PipeWire / xdg-desktop-portal capture backend.
|
||||
class CaptureFactory {
|
||||
public:
|
||||
public:
|
||||
static std::unique_ptr<CaptureSession> create(CaptureTarget target);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user