Files
screen_cast/include/screencast/codec/decoder.h
T
fegger 71218b1b1f feat(codec): implement software H.264 encode/decode round-trip
Add FFmpeg-based encoder/decoder with SPS/PPS extradata, Annex-B output

normalization, low-latency libx264 settings, and a round-trip unit test.

Includes review hardening: cached SwsContext, bitrate-only rate control,

std::byte/uin8_t cast helpers, and richer test assertions.
2026-09-07 10:07:50 +02:00

41 lines
851 B
C++

#pragma once
#include "screencast/codec/encoder.h"
#include "screencast/codec/error.h"
#include <cstdint>
#include <memory>
#include <string>
#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 codec_name = "h264";
int width = 0;
int height = 0;
std::vector<std::byte> extradata; // SPS/PPS for H.264
};
class Decoder {
public:
virtual ~Decoder() = default;
// Feed one encoded frame. Returns decoded frames when available.
virtual CodecResult<std::vector<DecodedFrame>> decode(const EncodedFrame& frame) = 0;
};
class DecoderFactory {
public:
static CodecResult<std::unique_ptr<Decoder>> create(const DecoderConfig& config);
};
} // namespace sc