Scaffold C++20 screencast project with Meson, agent workflow, and phase plan

This commit is contained in:
2026-08-28 21:54:32 +02:00
commit 742611b841
25 changed files with 1322 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
#pragma once
#include "screencast/codec/encoder.h"
#include <cstdint>
#include <memory>
#include <optional>
#include <span>
#include <vector>
namespace sc {
struct DecodedFrame {
int width = 0;
int height = 0;
uint64_t capture_timestamp_ns = 0;
std::vector<std::byte> rgba_pixels;
};
struct DecoderConfig {
std::string_view codec_name = "h264";
int width = 0;
int height = 0;
};
class Decoder {
public:
virtual ~Decoder () = default;
// Feed one encoded frame. Returns decoded frames when available.
virtual std::vector<DecodedFrame> decode ( const EncodedFrame &frame ) = 0;
};
class DecoderFactory {
public:
static std::unique_ptr<Decoder> create ( const DecoderConfig &config );
};
} // namespace sc
+47
View File
@@ -0,0 +1,47 @@
#pragma once
#include "screencast/capture/capture.h"
#include <cstdint>
#include <memory>
#include <span>
#include <string_view>
#include <vector>
namespace sc {
struct EncodedFrame {
uint64_t capture_timestamp_ns = 0;
uint32_t rtp_timestamp = 0;
bool is_keyframe = false;
std::vector<std::byte> data; // Annex-B or AVCC depending on config
};
struct EncoderConfig {
std::string_view codec_name = "h264";
int width = 0;
int height = 0;
int frame_rate_num = 30;
int frame_rate_den = 1;
int bitrate_kbps = 4000;
bool hardware_accel = false;
};
class Encoder {
public:
virtual ~Encoder () = default;
// Encode one captured frame. Returns empty if the encoder emits no packet
// for this frame.
virtual std::vector<EncodedFrame> encode ( const CapturedFrame &frame ) = 0;
// Force the next output to be a keyframe.
virtual void request_keyframe () = 0;
};
class EncoderFactory {
public:
static std::unique_ptr<Encoder> create ( const EncoderConfig &config );
};
} // namespace sc