88 lines
3.1 KiB
C++
88 lines
3.1 KiB
C++
#pragma once
|
|
|
|
#include "VideoPlayerControl2.g.h"
|
|
#include "VavCore/VavCore.h"
|
|
#include "src/Playback/PlaybackController.h"
|
|
#include "src/Playback/FrameProcessor.h"
|
|
#include "src/Rendering/SimpleGPURenderer.h"
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
namespace winrt::Vav2Player::implementation
|
|
{
|
|
struct VideoPlayerControl2 : VideoPlayerControl2T<VideoPlayerControl2>
|
|
{
|
|
VideoPlayerControl2();
|
|
~VideoPlayerControl2();
|
|
|
|
// XAML event handlers
|
|
void UserControl_Loaded(winrt::Windows::Foundation::IInspectable const& sender,
|
|
winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e);
|
|
void UserControl_Unloaded(winrt::Windows::Foundation::IInspectable const& sender,
|
|
winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e);
|
|
void UserControl_SizeChanged(winrt::Windows::Foundation::IInspectable const& sender,
|
|
winrt::Microsoft::UI::Xaml::SizeChangedEventArgs const& e);
|
|
void HoverDetector_PointerEntered(winrt::Windows::Foundation::IInspectable const& sender,
|
|
winrt::Microsoft::UI::Xaml::Input::PointerRoutedEventArgs const& e);
|
|
void HoverDetector_PointerExited(winrt::Windows::Foundation::IInspectable const& sender,
|
|
winrt::Microsoft::UI::Xaml::Input::PointerRoutedEventArgs const& e);
|
|
|
|
// Public properties (XAML binding)
|
|
winrt::hstring VideoSource();
|
|
void VideoSource(winrt::hstring const& value);
|
|
|
|
bool ShowControls();
|
|
void ShowControls(bool value);
|
|
|
|
bool AutoPlay();
|
|
void AutoPlay(bool value);
|
|
|
|
Vav2Player::VideoDecoderType DecoderType();
|
|
void DecoderType(Vav2Player::VideoDecoderType value);
|
|
|
|
// Public methods
|
|
void LoadVideo(winrt::hstring const& filePath);
|
|
void Play();
|
|
void Pause();
|
|
void Stop();
|
|
void Seek(double timeSeconds);
|
|
|
|
// Status queries
|
|
bool IsVideoPlaying();
|
|
bool IsVideoLoaded();
|
|
double CurrentTime();
|
|
double Duration();
|
|
winrt::hstring Status();
|
|
|
|
private:
|
|
// Core components (composition)
|
|
std::unique_ptr<::Vav2Player::PlaybackController> m_playbackController;
|
|
std::unique_ptr<::Vav2Player::FrameProcessor> m_frameProcessor;
|
|
std::unique_ptr<::Vav2Player::SimpleGPURenderer> m_gpuRenderer;
|
|
|
|
// UI state
|
|
winrt::hstring m_videoSource;
|
|
bool m_showControls = true;
|
|
bool m_autoPlay = false;
|
|
winrt::hstring m_status = L"Ready";
|
|
|
|
// Initialization state
|
|
bool m_initialized = false;
|
|
|
|
// Helper methods
|
|
void InitializeRenderer();
|
|
void CleanupRenderer();
|
|
void UpdateStatus(winrt::hstring const& message);
|
|
void UpdateVideoImageAspectFit(int videoWidth, int videoHeight);
|
|
void OnFrameReady(); // Callback from PlaybackController timing thread
|
|
};
|
|
}
|
|
|
|
namespace winrt::Vav2Player::factory_implementation
|
|
{
|
|
struct VideoPlayerControl2 : VideoPlayerControl2T<VideoPlayerControl2, implementation::VideoPlayerControl2>
|
|
{
|
|
};
|
|
}
|