Files
screen_cast/include/screencast/codec/error.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

37 lines
942 B
C++

#pragma once
#include <string>
#include <variant>
namespace sc {
struct CodecError {
std::string message;
};
// C++20 does not provide std::expected. Use a variant-based result type so
// fallible codec operations do not rely on exceptions.
template <typename T> using CodecResult = std::variant<T, CodecError>;
template <typename T> constexpr bool is_codec_error(const CodecResult<T>& result) noexcept {
return std::holds_alternative<CodecError>(result);
}
template <typename T> T& codec_value(CodecResult<T>& result) {
return std::get<T>(result);
}
template <typename T> const T& codec_value(const CodecResult<T>& result) {
return std::get<T>(result);
}
template <typename T> CodecError& codec_error(CodecResult<T>& result) {
return std::get<CodecError>(result);
}
template <typename T> const CodecError& codec_error(const CodecResult<T>& result) {
return std::get<CodecError>(result);
}
} // namespace sc