From db59e67ddb904f0aac020ccf9801b3456a8572d8 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 17 Dec 2017 05:05:56 +1100 Subject: [PATCH] [host] update capture classes to return the pitch --- host/Capture/DXGI.cpp | 1 + host/Capture/NvFBC.cpp | 1 + host/ICapture.h | 1 + host/Service.cpp | 1 + 4 files changed, 4 insertions(+) diff --git a/host/Capture/DXGI.cpp b/host/Capture/DXGI.cpp index 06834a8f..e901e98b 100644 --- a/host/Capture/DXGI.cpp +++ b/host/Capture/DXGI.cpp @@ -260,6 +260,7 @@ GrabStatus DXGI::GrabFrame(FrameInfo & frame) // send the last frame again if we timeout to prevent the client stalling on restart frame.width = m_desc.Width; frame.height = m_desc.Height; + frame.pitch = m_rect.Pitch; frame.stride = m_rect.Pitch / 4; unsigned int size = m_height * m_rect.Pitch; diff --git a/host/Capture/NvFBC.cpp b/host/Capture/NvFBC.cpp index 2e2e2da4..3d21b069 100644 --- a/host/Capture/NvFBC.cpp +++ b/host/Capture/NvFBC.cpp @@ -289,6 +289,7 @@ enum GrabStatus NvFBC::GrabFrame(struct FrameInfo & frame) } frame.stride = frame.width; + frame.pitch = dataWidth; uint8_t *src = (uint8_t *)m_frameBuffer + dataOffset; uint8_t *dst = (uint8_t *)frame.buffer; for(unsigned int y = 0; y < frame.height; ++y, dst += dataWidth, src += m_grabInfo.dwBufferWidth * 4) diff --git a/host/ICapture.h b/host/ICapture.h index 37d8d41d..35062e12 100644 --- a/host/ICapture.h +++ b/host/ICapture.h @@ -42,6 +42,7 @@ struct FrameInfo unsigned int width; unsigned int height; unsigned int stride; + unsigned int pitch; void * buffer; size_t bufferSize; diff --git a/host/Service.cpp b/host/Service.cpp index c3627406..bf5f248f 100644 --- a/host/Service.cpp +++ b/host/Service.cpp @@ -268,6 +268,7 @@ bool Service::Process() m_detail.frame.width = frame.width; m_detail.frame.height = frame.height; m_detail.frame.stride = frame.stride; + m_detail.frame.pitch = frame.pitch; m_detail.frame.dataPos = m_dataOffset[m_frameIndex]; if (++m_frameIndex == 2) m_frameIndex = 0;