flutter_texture_rgba_renderer/windows/texture_rgba.h
2023-02-17 11:54:26 +08:00

25 lines
645 B
C++

#include <flutter/texture_registrar.h>
#include <mutex>
#pragma once
class TextureRgba
{
public:
TextureRgba(flutter::TextureRegistrar* texture_registrar);
~TextureRgba();
void MarkVideoFrameAvailable(const std::vector<uint8_t>& buffer, size_t width, size_t height);
int64_t texture_id() const { return texture_id_; };
const FlutterDesktopPixelBuffer* buffer();
private:
FlutterDesktopPixelBuffer flutter_pixel_buffer_{};
flutter::TextureRegistrar* texture_registrar_ = nullptr;
std::unique_ptr<flutter::TextureVariant> texture_ = nullptr;
int64_t texture_id_;
mutable std::mutex mutex_;
// std::vector<uint8_t> buffer_tmp_;
};