diff options
-rw-r--r-- | xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp | 7 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.h | 1 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/VideoRenderers/WinRenderBuffer.cpp | 1 | ||||
-rw-r--r-- | xbmc/platform/linux/input/LibInputHandler.cpp | 3 | ||||
-rw-r--r-- | xbmc/platform/linux/input/LibInputPointer.cpp | 17 | ||||
-rw-r--r-- | xbmc/platform/linux/input/LibInputPointer.h | 1 | ||||
-rw-r--r-- | xbmc/windowing/win10/WinSystemWin10.cpp | 15 | ||||
-rw-r--r-- | xbmc/windowing/win10/WinSystemWin10.h | 1 | ||||
-rw-r--r-- | xbmc/windowing/win10/WinSystemWin10DX.cpp | 3 | ||||
-rw-r--r-- | xbmc/windowing/windows/WinSystemWin32.cpp | 11 | ||||
-rw-r--r-- | xbmc/windowing/windows/WinSystemWin32.h | 3 |
11 files changed, 43 insertions, 20 deletions
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp index c93409cfae..b6d6c92c4b 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp @@ -344,6 +344,7 @@ CDVDVideoCodecAndroidMediaCodec::CDVDVideoCodecAndroidMediaCodec(CProcessInfo &p , m_bitstream(nullptr) , m_render_surface(surface_render) , m_mpeg2_sequence(nullptr) +, m_useDTSforPTS(false) { m_videobuffer.Reset(); } @@ -418,6 +419,7 @@ bool CDVDVideoCodecAndroidMediaCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptio m_hints = hints; m_indexInputBuffer = -1; m_dtsShift = DVD_NOPTS_VALUE; + m_useDTSforPTS = false; CLog::Log(LOGDEBUG, LOGVIDEO, "CDVDVideoCodecAndroidMediaCodec::Open hints: fpsrate %d / fpsscale %d\n", m_hints.fpsrate, m_hints.fpsscale); CLog::Log(LOGDEBUG, LOGVIDEO, "CDVDVideoCodecAndroidMediaCodec::Open hints: CodecID %d \n", m_hints.codec); @@ -441,10 +443,9 @@ bool CDVDVideoCodecAndroidMediaCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptio m_formatname = "amc-mpeg2"; break; case AV_CODEC_ID_MPEG4: - if (hints.width <= 800) - goto FAIL; m_mime = "video/mp4v-es"; m_formatname = "amc-mpeg4"; + m_useDTSforPTS = true; break; case AV_CODEC_ID_H263: m_mime = "video/3gpp"; @@ -906,6 +907,8 @@ bool CDVDVideoCodecAndroidMediaCodec::AddData(const DemuxPacket &packet) int64_t presentationTimeUs = 0; if (pts != DVD_NOPTS_VALUE) presentationTimeUs = (pts - m_dtsShift); + else if (m_useDTSforPTS && dts != DVD_NOPTS_VALUE) + presentationTimeUs = (dts - m_dtsShift); int flags = 0; int offset = 0; diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.h index acfda364c0..b1577bb455 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.h +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.h @@ -183,6 +183,7 @@ protected: mpeg2_sequence *m_mpeg2_sequence; int m_src_offset[4]; int m_src_stride[4]; + bool m_useDTSforPTS; // CJNISurfaceHolderCallback interface public: diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderBuffer.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderBuffer.cpp index 7fdafe2f2d..a85da3735b 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderBuffer.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderBuffer.cpp @@ -85,6 +85,7 @@ void CRenderBuffer::Release() m_activePlanes = 0; texBits = 8; bits = 8; + m_locked = false; m_planes[0] = nullptr; m_planes[1] = nullptr; diff --git a/xbmc/platform/linux/input/LibInputHandler.cpp b/xbmc/platform/linux/input/LibInputHandler.cpp index c7dbac7d43..d2e93d308b 100644 --- a/xbmc/platform/linux/input/LibInputHandler.cpp +++ b/xbmc/platform/linux/input/LibInputHandler.cpp @@ -181,6 +181,9 @@ void CLibInputHandler::ProcessEvent(libinput_event *ev) case LIBINPUT_EVENT_POINTER_MOTION: m_pointer->ProcessMotion(libinput_event_get_pointer_event(ev)); break; + case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE: + m_pointer->ProcessMotionAbsolute(libinput_event_get_pointer_event(ev)); + break; case LIBINPUT_EVENT_POINTER_AXIS: m_pointer->ProcessAxis(libinput_event_get_pointer_event(ev)); break; diff --git a/xbmc/platform/linux/input/LibInputPointer.cpp b/xbmc/platform/linux/input/LibInputPointer.cpp index 82c1a25471..591a5c6fd0 100644 --- a/xbmc/platform/linux/input/LibInputPointer.cpp +++ b/xbmc/platform/linux/input/LibInputPointer.cpp @@ -96,6 +96,23 @@ void CLibInputPointer::ProcessMotion(libinput_event_pointer *e) appPort->OnEvent(event); } +void CLibInputPointer::ProcessMotionAbsolute(libinput_event_pointer *e) +{ + m_pos.X = static_cast<int>(libinput_event_pointer_get_absolute_x_transformed(e, CServiceBroker::GetWinSystem()->GetGfxContext().GetWidth())); + m_pos.Y = static_cast<int>(libinput_event_pointer_get_absolute_y_transformed(e, CServiceBroker::GetWinSystem()->GetGfxContext().GetHeight())); + + XBMC_Event event; + event.type = XBMC_MOUSEMOTION; + event.motion.x = static_cast<uint16_t>(m_pos.X); + event.motion.y = static_cast<uint16_t>(m_pos.Y); + + CLog::Log(LOGDEBUG, "CLibInputPointer::%s - event.type: %i, event.motion.x: %i, event.motion.y: %i", __FUNCTION__, event.type, event.motion.x, event.motion.y); + + std::shared_ptr<CAppInboundProtocol> appPort = CServiceBroker::GetAppPort(); + if (appPort) + appPort->OnEvent(event); +} + void CLibInputPointer::ProcessAxis(libinput_event_pointer *e) { unsigned char scroll = 0; diff --git a/xbmc/platform/linux/input/LibInputPointer.h b/xbmc/platform/linux/input/LibInputPointer.h index aa7c8b90a3..608b438abe 100644 --- a/xbmc/platform/linux/input/LibInputPointer.h +++ b/xbmc/platform/linux/input/LibInputPointer.h @@ -24,6 +24,7 @@ public: void ProcessButton(libinput_event_pointer *e); void ProcessMotion(libinput_event_pointer *e); + void ProcessMotionAbsolute(libinput_event_pointer *e); void ProcessAxis(libinput_event_pointer *e); private: diff --git a/xbmc/windowing/win10/WinSystemWin10.cpp b/xbmc/windowing/win10/WinSystemWin10.cpp index d2e2e8d90e..0ca1b684c9 100644 --- a/xbmc/windowing/win10/WinSystemWin10.cpp +++ b/xbmc/windowing/win10/WinSystemWin10.cpp @@ -119,11 +119,6 @@ bool CWinSystemWin10::CreateNewWindow(const std::string& name, bool fullScreen, // and hide UWP splash, without this the Kodi's splash will not be shown m_coreWindow.Dispatcher().ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); - // in some cases CoreWindow::SizeChanged isn't fired - // it causes mismatch between window actual size and UI - winrt::Rect winRect = m_coreWindow.Bounds(); - dynamic_cast<CWinEventsWin10&>(*m_winEvents).OnResize(winRect.Width, winRect.Height); - return true; } @@ -209,10 +204,8 @@ bool CWinSystemWin10::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool bool forceChange = false; // resolution/display is changed but window state isn't changed bool stereoChange = IsStereoEnabled() != (CServiceBroker::GetWinSystem()->GetGfxContext().GetStereoMode() == RENDER_STEREO_MODE_HARDWAREBASED); - if ( m_nWidth != res.iWidth - || m_nHeight != res.iHeight - || m_fRefreshRate != res.fRefreshRate - || stereoChange) + if ( m_nWidth != res.iWidth || m_nHeight != res.iHeight || m_fRefreshRate != res.fRefreshRate || + stereoChange || m_bFirstResChange) { forceChange = true; } @@ -239,6 +232,7 @@ bool CWinSystemWin10::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool m_IsAlteringWindow = true; ReleaseBackBuffer(); + m_bFirstResChange = false; m_bFullScreen = fullScreen; m_nWidth = res.iWidth; m_nHeight = res.iHeight; @@ -348,6 +342,9 @@ bool CWinSystemWin10::ChangeResolution(const RESOLUTION_INFO& res, bool forceCha // changing display mode doesn't fire CoreWindow::SizeChanged event if (changed && m_bWindowCreated) { + // dispatch all events currently pending in the queue to change window's content + m_coreWindow.Dispatcher().ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); + float dpi = DisplayInformation::GetForCurrentView().LogicalDpi(); float dipsW = DX::ConvertPixelsToDips(m_nWidth, dpi); float dipsH = DX::ConvertPixelsToDips(m_nHeight, dpi); diff --git a/xbmc/windowing/win10/WinSystemWin10.h b/xbmc/windowing/win10/WinSystemWin10.h index af3d7d3631..7e99e7e23c 100644 --- a/xbmc/windowing/win10/WinSystemWin10.h +++ b/xbmc/windowing/win10/WinSystemWin10.h @@ -143,6 +143,7 @@ protected: WINDOW_WINDOW_STATE m_windowState; // the state of the window when in windowed bool m_inFocus; bool m_bMinimized; + bool m_bFirstResChange = true; winrt::Windows::UI::Core::CoreWindow m_coreWindow = nullptr; }; diff --git a/xbmc/windowing/win10/WinSystemWin10DX.cpp b/xbmc/windowing/win10/WinSystemWin10DX.cpp index 928e57a4d0..2ac39b1d81 100644 --- a/xbmc/windowing/win10/WinSystemWin10DX.cpp +++ b/xbmc/windowing/win10/WinSystemWin10DX.cpp @@ -52,8 +52,7 @@ bool CWinSystemWin10DX::CreateNewWindow(const std::string& name, bool fullScreen if (CWinSystemWin10::CreateNewWindow(name, fullScreen, res) && m_deviceResources->HasValidDevice()) { CGenericTouchInputHandler::GetInstance().RegisterHandler(&CGenericTouchActionHandler::GetInstance()); - CGenericTouchInputHandler::GetInstance().SetScreenDPI(DX::DisplayMetrics::Dpi100); - ChangeResolution(res, true); + CGenericTouchInputHandler::GetInstance().SetScreenDPI(m_deviceResources->GetDpi()); return true; } return false; diff --git a/xbmc/windowing/windows/WinSystemWin32.cpp b/xbmc/windowing/windows/WinSystemWin32.cpp index 83d9de1269..7b2ae0331c 100644 --- a/xbmc/windowing/windows/WinSystemWin32.cpp +++ b/xbmc/windowing/windows/WinSystemWin32.cpp @@ -441,11 +441,8 @@ bool CWinSystemWin32::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool bool changeScreen = false; // display is changed bool stereoChange = IsStereoEnabled() != (CServiceBroker::GetWinSystem()->GetGfxContext().GetStereoMode() == RENDER_STEREO_MODE_HARDWAREBASED); - if ( m_nWidth != res.iWidth - || m_nHeight != res.iHeight - || m_fRefreshRate != res.fRefreshRate - || oldMonitor->hMonitor != newMonitor->hMonitor - || stereoChange) + if ( m_nWidth != res.iWidth || m_nHeight != res.iHeight || m_fRefreshRate != res.fRefreshRate || + oldMonitor->hMonitor != newMonitor->hMonitor || stereoChange || m_bFirstResChange) { if (oldMonitor->hMonitor != newMonitor->hMonitor) changeScreen = true; @@ -458,7 +455,8 @@ bool CWinSystemWin32::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool // entering to stereo mode, limit resolution to 1080p@23.976 if (stereoChange && !IsStereoEnabled() && res.iWidth > 1280) { - res = CDisplaySettings::GetInstance().GetResolutionInfo(CResolutionUtils::ChooseBestResolution(24.f / 1.001f, 1920, 1080, true)); + res = CDisplaySettings::GetInstance().GetResolutionInfo( + CResolutionUtils::ChooseBestResolution(24.f / 1.001f, 1920, 1080, true)); } if (m_state == WINDOW_STATE_WINDOWED) @@ -490,6 +488,7 @@ bool CWinSystemWin32::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool OnScreenChange(newMonitor->hMonitor); } + m_bFirstResChange = false; m_bFullScreen = fullScreen; m_hMonitor = newMonitor->hMonitor; m_nWidth = res.iWidth; diff --git a/xbmc/windowing/windows/WinSystemWin32.h b/xbmc/windowing/windows/WinSystemWin32.h index 5ee370ff35..39c218248d 100644 --- a/xbmc/windowing/windows/WinSystemWin32.h +++ b/xbmc/windowing/windows/WinSystemWin32.h @@ -185,7 +185,8 @@ protected: DWORD m_windowExStyle; // the ex style of the window bool m_inFocus; bool m_bMinimized; - bool m_bSizeMoveEnabled{ false }; + bool m_bSizeMoveEnabled = false; + bool m_bFirstResChange = true; std::unique_ptr<CIRServerSuite> m_irss; std::vector<MONITOR_DETAILS> m_displays; }; |