2025-12-01 15:30:28 +01:00
|
|
|
#ifndef MPV_CONTAINER_H_
|
|
|
|
|
#define MPV_CONTAINER_H_
|
|
|
|
|
|
|
|
|
|
#include <Windows.h>
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
namespace mpv {
|
|
|
|
|
|
|
|
|
|
// Container window that holds the mpv video window behind Flutter.
|
|
|
|
|
// This is a singleton that creates a hidden window with no taskbar entry.
|
|
|
|
|
class MpvContainer {
|
|
|
|
|
public:
|
|
|
|
|
static MpvContainer* GetInstance();
|
|
|
|
|
|
|
|
|
|
MpvContainer() = default;
|
2026-03-10 22:24:14 +01:00
|
|
|
~MpvContainer() = default;
|
2025-12-01 15:30:28 +01:00
|
|
|
|
|
|
|
|
// Creates the container window.
|
|
|
|
|
HWND Create();
|
|
|
|
|
|
|
|
|
|
// Gets the container window handle, positioning it relative to the Flutter window.
|
|
|
|
|
HWND Get(HWND flutter_window);
|
|
|
|
|
|
|
|
|
|
// Returns the raw handle.
|
|
|
|
|
HWND handle() const { return handle_; }
|
|
|
|
|
|
|
|
|
|
private:
|
2026-05-01 05:47:13 +02:00
|
|
|
static LRESULT CALLBACK WindowProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam) noexcept;
|
2025-12-01 15:30:28 +01:00
|
|
|
|
|
|
|
|
HWND handle_ = nullptr;
|
|
|
|
|
|
|
|
|
|
static constexpr wchar_t kClassName[] = L"MPV_CONTAINER";
|
2026-01-13 22:42:57 +01:00
|
|
|
static constexpr wchar_t kWindowName[] = L"";
|
2025-12-01 15:30:28 +01:00
|
|
|
|
|
|
|
|
static std::unique_ptr<MpvContainer> instance_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace mpv
|
|
|
|
|
|
|
|
|
|
#endif // MPV_CONTAINER_H_
|