Skip to content

Commit

Permalink
Resolution setting
Browse files Browse the repository at this point in the history
Move SetResolution to after registry check
Update binaries
  • Loading branch information
leadedge committed Oct 1, 2020
1 parent f294365 commit 36e52df
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
Binary file modified release/win32/SpoutCam32.ax
Binary file not shown.
Binary file modified release/x64/SpoutCam64.ax
Binary file not shown.
27 changes: 17 additions & 10 deletions source/cam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@
Change back to simple timing in FillBuffer due to freeze with Zoom
Add duration and Sleep to keep cycle correct
TODO : compatibility check with other hosts
01.10.20 Move SetResolution to after registry check
Version 2.015
*/
Expand Down Expand Up @@ -265,6 +266,7 @@ CUnknown * WINAPI CVCam::CreateInstance(LPUNKNOWN lpunk, HRESULT *phr)
{
ASSERT(phr);


/*
// debug console window
FILE * pCout = NULL;
Expand Down Expand Up @@ -447,7 +449,7 @@ CVCamStream::CVCamStream(HRESULT *phr, CVCam *pParent, LPCWSTR pPinName) :
g_SenderName[0] = 0;
g_ActiveSender[0] = 0;


//
// Retrieve fps and resolution from registry "SpoutCamConfig"
// o Fps
// 10 0
Expand All @@ -457,6 +459,7 @@ CVCamStream::CVCamStream(HRESULT *phr, CVCam *pParent, LPCWSTR pPinName) :
// Compatibility problems with some software if > 60 fps
// 50 4
// 60 5
//
dwFps = 3; // Fps from SpoutCamConfig (default 3 = 30)
if (!ReadDwordFromRegistry(HKEY_CURRENT_USER, "Software\\Leading Edge\\SpoutCam", "fps", &dwFps)) {
dwFps = 3;
Expand All @@ -480,28 +483,32 @@ CVCamStream::CVCamStream(HRESULT *phr, CVCam *pParent, LPCWSTR pPinName) :
// 1920 x 1080 10
//
dwResolution = 0; // Resolution from SpoutCamConfig (default 0 = active sender)
if (ReadDwordFromRegistry(HKEY_CURRENT_USER, "Software\\Leading Edge\\SpoutCam", "resolution", &dwResolution)) {
// if there is no Sender, getmediatype will use
// the default resolution set by the user
SetResolution(dwResolution);
}

// No resolution pre-defined - is a sender running ?
ReadDwordFromRegistry(HKEY_CURRENT_USER, "Software\\Leading Edge\\SpoutCam", "resolution", &dwResolution);
// if there is no Sender, getmediatype will use
// the default resolution set by the user
// SetResolution(dwResolution);

// Resolution index 0 means that the user has selected "Active sender"
if(dwResolution == 0) {
// Use the active sender if any
// Use the resolution of the active sender if one is running
if(receiver.GetActiveSender(g_SenderName)) {
unsigned int width, height;
HANDLE sharehandle;
DWORD format;
if (receiver.GetSenderInfo(g_SenderName, width, height, sharehandle, format)) {
// If not fixed to the selected resolution, use the sender width and height
// If not fixed to the a selected resolution, use the sender width and height
g_Width = width;
g_Height = height;
}
}
}
else {
// Set g_WIdth and g_Height according to the registry setting
SetResolution(dwResolution);
}

// Find out whether memoryshare mode is selected by SpoutSettings
// TODO : Memoryshare not supported by DirectX
bMemoryMode = receiver.GetMemoryShareMode();

m_Fps = dwFps;
Expand Down

0 comments on commit 36e52df

Please sign in to comment.