40 lines
761 B
C++
40 lines
761 B
C++
#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
|