diff --git a/vav2/Vav2Player/Vav2Player/VideoPlayerControl.xaml.cpp b/vav2/Vav2Player/Vav2Player/VideoPlayerControl.xaml.cpp index 93e547b..c627520 100644 --- a/vav2/Vav2Player/Vav2Player/VideoPlayerControl.xaml.cpp +++ b/vav2/Vav2Player/Vav2Player/VideoPlayerControl.xaml.cpp @@ -56,10 +56,7 @@ namespace winrt::Vav2Player::implementation OutputDebugStringA("VideoPlayerControl loaded successfully\n"); - // Show purple outline placeholder while waiting - ShowPurpleOutlinePlaceholder(); // Re-enabled to test - - // Ready for user interaction - no automatic video loading + // Ready for user interaction } catch (...) { @@ -67,75 +64,6 @@ namespace winrt::Vav2Player::implementation } } - void VideoPlayerControl::ShowPurpleOutlinePlaceholder() - { - try - { - OutputDebugStringA("Showing purple outline placeholder...\n"); - - // Get container size for full screen placeholder - auto container = VideoDisplayArea(); - if (!container) return; - - int width = static_cast(container.ActualWidth()); - int height = static_cast(container.ActualHeight()); - - // Wait for container to be ready - don't use arbitrary fallback sizes - if (width <= 0 || height <= 0) { - OutputDebugStringA("[DEBUG] Container size not ready, deferring rendering initialization\n"); - return; // Wait for layout to complete - } - - m_renderBitmap = winrt::Microsoft::UI::Xaml::Media::Imaging::WriteableBitmap(width, height); - - auto buffer = m_renderBitmap.PixelBuffer(); - auto bufferByteAccess = buffer.as<::Windows::Storage::Streams::IBufferByteAccess>(); - uint8_t* bufferData = nullptr; - winrt::check_hresult(bufferByteAccess->Buffer(&bufferData)); - - // Fill with transparent background - for (int i = 0; i < width * height; i++) - { - bufferData[i * 4 + 0] = 0; // Blue - bufferData[i * 4 + 1] = 0; // Green - bufferData[i * 4 + 2] = 0; // Red - bufferData[i * 4 + 3] = 0; // Alpha (transparent) - } - - VideoImage().Source(m_renderBitmap); - VideoImage().Visibility(winrt::Microsoft::UI::Xaml::Visibility::Visible); - VideoImage().Width(width); - VideoImage().Height(height); - - // Draw purple outline (border thickness = 4 pixels) - int borderThickness = 4; - for (int y = 0; y < height; y++) - { - for (int x = 0; x < width; x++) - { - bool isOutline = (x < borderThickness || x >= width - borderThickness || - y < borderThickness || y >= height - borderThickness); - - if (isOutline) - { - int index = (y * width + x) * 4; - bufferData[index + 0] = 128; // Blue - bufferData[index + 1] = 0; // Green - bufferData[index + 2] = 128; // Red (Purple = Red + Blue) - bufferData[index + 3] = 255; // Alpha (opaque) - } - } - } - - buffer.Length(width * height * 4); - m_renderBitmap.Invalidate(); - OutputDebugStringA("Purple outline placeholder completed\n"); - } - catch (...) - { - OutputDebugStringA("Purple outline placeholder failed\n"); - } - } void VideoPlayerControl::UserControl_Unloaded(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::RoutedEventArgs const&) { @@ -151,7 +79,6 @@ namespace winrt::Vav2Player::implementation { m_playbackTimer.Stop(); } - StopControlsHideTimer(); if (m_gpuRenderer) { @@ -188,19 +115,12 @@ namespace winrt::Vav2Player::implementation void VideoPlayerControl::HoverDetector_PointerEntered(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::Input::PointerRoutedEventArgs const&) { - if (m_showControls && m_isLoaded) - { - ShowControlsInternal(); - StopControlsHideTimer(); - } + // Controls are disabled for now } void VideoPlayerControl::HoverDetector_PointerExited(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::Input::PointerRoutedEventArgs const&) { - if (m_showControls && m_isLoaded && m_isPlaying) - { - StartControlsHideTimer(); - } + // Controls are disabled for now } // Public Properties @@ -598,19 +518,8 @@ namespace winrt::Vav2Player::implementation void VideoPlayerControl::ProcessSingleFrame() { - // Enhanced safety checks to prevent crashes during transitions - if (!m_isLoaded || !m_fileReader || !m_decoder || !m_isInitialized || !m_isPlaying) { - OutputDebugStringA("[DEBUG] ProcessSingleFrame: Not ready or stopping - skipping frame\n"); - return; - } - - // Additional check for file reader state - if (!m_fileReader->IsFileOpen()) { - OutputDebugStringA("[DEBUG] ProcessSingleFrame: File not open - stopping playback\n"); - m_isPlaying = false; - if (m_playbackTimer) m_playbackTimer.Stop(); - return; - } + // Simple validation + if (!m_isPlaying || !m_fileReader || !m_decoder) return; VideoPacket packet; if (!m_fileReader->ReadNextPacket(packet)) @@ -781,10 +690,6 @@ namespace winrt::Vav2Player::implementation OutputDebugStringA(("[DEBUG] Status: " + winrt::to_string(message) + "\n").c_str()); } - void VideoPlayerControl::ShowControlsInternal() - { - // Show video controls - simplified implementation - } void VideoPlayerControl::InitializeVideoRenderer() { @@ -996,7 +901,5 @@ namespace winrt::Vav2Player::implementation double VideoPlayerControl::Duration() { return m_duration; } winrt::hstring VideoPlayerControl::Status() { return m_status; } - void VideoPlayerControl::StartControlsHideTimer() { /* Simplified implementation */ } - void VideoPlayerControl::StopControlsHideTimer() { /* Simplified implementation */ } } \ No newline at end of file diff --git a/vav2/Vav2Player/Vav2Player/VideoPlayerControl.xaml.h b/vav2/Vav2Player/Vav2Player/VideoPlayerControl.xaml.h index ab27cf6..b60871a 100644 --- a/vav2/Vav2Player/Vav2Player/VideoPlayerControl.xaml.h +++ b/vav2/Vav2Player/Vav2Player/VideoPlayerControl.xaml.h @@ -102,13 +102,9 @@ namespace winrt::Vav2Player::implementation void UpdateVideoImageAspectFit(int videoWidth, int videoHeight); void ApplyAspectFitIfReady(); void UpdateStatus(winrt::hstring const& message); - void ShowControlsInternal(); - void StartControlsHideTimer(); - void StopControlsHideTimer(); void ResetVideoState(); bool CreateDecoder(); bool InitializeDecoder(); - void ShowPurpleOutlinePlaceholder(); }; } diff --git a/vav2/todo3.txt b/vav2/todo3.txt index 9f478d3..378eb90 100644 --- a/vav2/todo3.txt +++ b/vav2/todo3.txt @@ -3,3 +3,73 @@ 현재 D3D12 에러는 대폭 줄어들었지만, 실제 비디오 렌더링을 위해서는 YUV→RGB 변환 셰이더와 텍스처 업로드 로직을 구현해야 합니다. + + + +비디오 렌더링에서 뭔가 빠진 부분이 있을까? + + +● 🚨 비디오 렌더링에서 빠진 중요한 부분들 + + 1. SwapChainPanel ↔ D3D12 연결이 구현되지 않음 ⚠️ + + + + 문제: SwapChainPanel이 준비되어 있지만 D3D12VideoRenderer와 연결되지 않음 + + 2. 실제 프레임 표시 로직 부재 ❌ + + - VideoPlayerControl에서 디코딩된 프레임을 GPU로 전달하는 코드 없음 + - Present() 호출로 실제 화면에 표시하는 부분 없음 + - 30fps 타이밍 제어 메커니즘 없음 + + 3. CPU↔GPU 렌더링 전환 로직 미완성 ⚠️ + + bool m_useHardwareRendering = false; // 항상 false로 설정됨 + 문제: GPU 렌더링으로 전환하는 로직이 구현되지 않음 + + 4. 프레임 디스플레이 파이프라인 연결 부재 ❌ + + 현재 상황: + [AV1 Decoder] → [YUV Frame] → [🚫 연결 끊어짐] → [사용자 화면] + + 필요한 연결: + [AV1 Decoder] → [YUV Frame] → [GPU YUV→RGB] → [SwapChain] → [화면 표시] + + 🛠️ 구현해야 할 핵심 컴포넌트들 + + 1. SwapChainPanel 초기화 및 연결 + + // VideoPlayerControl.xaml.cpp에 추가 필요 + HRESULT InitializeVideoRenderer() { + // SwapChainPanel을 D3D12VideoRenderer에 연결 + // D3D12 SwapChain 생성 및 바인딩 + } + + 2. 실제 프레임 렌더링 메서드 + + // 실제 비디오 프레임을 화면에 표시 + void DisplayVideoFrame(const VideoFrame& frame) { + // YUV → RGB GPU 변환 + // SwapChain Present() 호출 + // 30fps 타이밍 제어 + } + + 3. GPU 렌더링 활성화 로직 + + // 하드웨어 렌더링으로 전환 + void EnableHardwareRendering() { + m_useHardwareRendering = true; + VideoSwapChainPanel().Visibility(Visibility::Visible); + VideoImage().Visibility(Visibility::Collapsed); + } + + 4. 프레임 타이밍 제어 + + // 30fps에 맞춰 정확한 타이밍으로 Present() 호출 + void PresentFrame() { + m_swapChain->Present(1, 0); // VSync 활성화 + } + + 이 부분들을 구현하면 완전한 GPU 가속 비디오 재생이 가능해집니다. 현재는 모든 GPU 인프라가 준비되어 있지만 실제로 + 화면에 표시하는 마지막 연결고리가 빠져있는 상황입니다.