换ffmpeg

This commit is contained in:
2026-08-23 12:58:44 +08:00
parent b3af1c1b04
commit 73a3152733
235 changed files with 301216 additions and 741 deletions
+36
View File
@@ -0,0 +1,36 @@
#pragma once
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <span>
#include <vector>
namespace aethera::web {
enum class Video_Pixel_Layout : std::uint8_t {
bgra,
rgba
};
struct Encoded_Video_Frame {
std::vector<std::byte> annex_b{}; /* 带起始码的完整 H.264 access unit,可直接交给 RTP packetizer。 */
std::chrono::microseconds presentation_time{}; /* 从 Plot 帧时钟起点累计的媒体时间戳。 */
std::uint64_t sequence{}; /* 对应 Render_Frame 的单调序号。 */
bool key_frame{}; /* 本 access unit 是否可独立解码。 */
};
class H264_Encoder final {
public:
explicit H264_Encoder(double frame_rate);
~H264_Encoder();
H264_Encoder(const H264_Encoder&) = delete;
H264_Encoder& operator=(const H264_Encoder&) = delete;
[[nodiscard]] std::shared_ptr<const Encoded_Video_Frame> encode(
std::span<const std::byte> pixels, std::uint32_t width,
std::uint32_t height, Video_Pixel_Layout layout,
std::uint64_t sequence, std::chrono::microseconds presentation_time);
private:
struct Private;
std::unique_ptr<Private> d;
};
}