Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ ipch/

# Archives
*.7z
.DS_Store
1 change: 1 addition & 0 deletions 3rdparty/Configuru
Submodule Configuru added at 593188
6 changes: 6 additions & 0 deletions config/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"fullscreen": false,
"videoConversionOverride": false,
"hdrColorSpace": "Follow Input",
"hdrLuminance": "Follow Input"
}
72 changes: 43 additions & 29 deletions src/VideoProcessor-GUI/VideoProcessorApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>.
*/
#define CONFIGURU_IMPLEMENTATION 1
#include <configuru.hpp>

#include <pch.h>

Expand Down Expand Up @@ -53,37 +55,49 @@ BOOL CVideoProcessorApp::InitInstance()
if (FAILED(CoInitializeEx(nullptr, COINIT_MULTITHREADED)))
throw std::runtime_error("Failed to initialize com objects");

// Parse command line
// https://docs.microsoft.com/en-us/cpp/c-runtime-library/argc-argv-wargv
int iNumOfArgs;
LPWSTR* pArgs = CommandLineToArgvW(GetCommandLine(), &iNumOfArgs);
for (int i = 1; i < iNumOfArgs; i++)
// Parse configuration file
Config config = configuru::parse_file("settings.json", JSON);

bool isFullScreen = config.get_or("fullscreen", false);
bool videoConversionOverride = config.get_or("videoConversionOverride", false);
std::string colorSpace = config.get_or("colorSpace", "Follow Input");
std::string rendererName = config.get_or("renderer", "");
std::string frameOffset = config.get_or("frameOffset", "auto");
std::string hdrLuminance = config.get_or("luminance", "Follow input");
std::string hdrColorSpace = config.get_or("hdrColorSpace", "Follow input")
std::string dsStartStopTime = config.get_or("dsStartStopTime", "Clock-Smart");
std::string dsNominalRange = config.get_or("dsNominalRange", "Auto");
std::string dsTransferFunction = config.get_or("dsTransferFunction", "Auto");
std::string dsTransferMatrix = config.get_or("dsTransferMatrix", "Auto");
std::string dsPrimaries = config.get_or("dsNominalRange", "Auto");

if (isFullScreen) {
dlg.StartFullScreen();
}

if (videoConversionOverride) {
dlg.SetVideoConversionOverride();
}
if (rendererName != "") {
dlg.rendererName(rendererName);
}
if (frameOffset == "auto")
{
// /fullscreen
if (wcscmp(pArgs[i], L"/fullscreen") == 0)
{
dlg.StartFullScreen();
}

// /renderer "name"
if (wcscmp(pArgs[i], L"/renderer") == 0 && (i + 1) < iNumOfArgs)
{
dlg.DefaultRendererName(pArgs[i + 1]);
}

// /frame_offset [-value|"auto"]
if (wcscmp(pArgs[i], L"/frame_offset") == 0 && (i + 1) < iNumOfArgs)
{
if (wcscmp(pArgs[i + 1], L"auto") == 0)
{
dlg.StartFrameOffsetAuto();
}
else
{
dlg.StartFrameOffset(pArgs[i + 1]);
}
}
dlg.StartFrameOffsetAuto();
}
else
{
dlg.StartFrameOffset(frameOffset);
}

dlg.SetColorSpace(colorSpace)
dlg.SetHdrLuminance(hdrLuminance);
dlg.SetHdrColorSpace(colorSpace);
dlg.SetStartStopTime(dsStartStopTime);
dlg.SetNominalRange(dsNominalRange);
dlg.SetTransferFunction(dsTransferFunction);
dlg.SetTransferMatrix(dsTransferMatrix);
dlg.SetPrimaries(dsNominalRange);

// Set set ourselves to high prio.
if (!SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS))
Expand Down
60 changes: 58 additions & 2 deletions src/VideoProcessor-GUI/VideoProcessorDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,55 @@ CVideoProcessorDlg::~CVideoProcessorDlg()
//


void CVideoProcessorDlg::SetHdrLuminance(const CString& hdrLuminance)
{
m_hdrLuminance = hdrLuminance;
}

void CVideoProcessorDlg::SetHdrColorSpace(const CString& colorSpace)
{
m_hdrColorSpace = colorSpace;
}

void CVideoProcessorDlg::StartFullScreen()
{
m_rendererFullScreenStart = true;
}

void CVideoProcessorDlg::SetVideoConversionOverride()
{
m_videoConversionOverride = true;
}

void CVideoProcessorDlg::SetColorSpace(const CString& colorSpace)
{
m_colorSpace = colorSpace;
}

void CVideoProcessorDlg::SetStartStopTime(const CString& startStopTime)
{
m_startStopTime = startStopTime;
}

void CVideoProcessorDlg::SetNominalRange(const CString& nominalRange)
{
m_nominalRange = nominalRange;
}

void CVideoProcessorDlg::SetTransferFunction(const CString& transferFunction)
{
m_transferFunction = transferFunction;
}

void CVideoProcessorDlg::SetTransferMatrix(const CString& transferMatrix)
{
m_transferMatrix = transferMatrix;
}

void CVideoProcessorDlg::SetPrimaries(const CString& primaries)
{
m_primaries = primaries;
}

void CVideoProcessorDlg::DefaultRendererName(const CString& rendererName)
{
Expand Down Expand Up @@ -2058,15 +2102,23 @@ BOOL CVideoProcessorDlg::OnInitDialog()
{
int index = m_hdrColorspaceCombo.AddString(p.first);
m_hdrColorspaceCombo.SetItemData(index, (int)p.second);

if (p.first.CompareNoCase(m_hdrColorSpace) == 0)
{
m_hdrColorspaceCombo.SetCurSel(index);
}
}
m_hdrColorspaceCombo.SetCurSel(0);

for (auto p : HDR_LUMINANCE_OPTIONS)
{
int index = m_hdrLuminanceCombo.AddString(p.first);
m_hdrLuminanceCombo.SetItemData(index, (int)p.second);

if (p.first.CompareNoCase(m_hdrLuminance) == 0)
{
m_hdrLuminanceCombo.SetCurSel(index);
}
}
m_hdrLuminanceCombo.SetCurSel(0);

for (auto p : RENDERER_DIRECTSHOW_START_STOP_TIME_OPTIONS)
{
Expand Down Expand Up @@ -2108,6 +2160,10 @@ BOOL CVideoProcessorDlg::OnInitDialog()
int index = m_rendererVideoConversionCombo.AddString(ToString(p));
m_rendererVideoConversionCombo.SetItemData(index, (int)p);
}
if (p.first.CompareNoCase(m_hdrLuminance) == 0)
{
m_hdrLuminanceCombo.SetCurSel(index);
}
m_rendererVideoConversionCombo.SetCurSel(0);

// Start discovery services
Expand Down
12 changes: 10 additions & 2 deletions src/VideoProcessor-GUI/VideoProcessorDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,18 @@ class CVideoProcessorDlg:

// Startup options
bool m_rendererFullScreenStart = false;
CString m_defaultRendererName;
bool m_videoConversionOverride = false;
bool m_frameOffsetAutoStart = false;
CString m_colorSpace;
CString m_defaultFrameOffset = TEXT("90");

CString m_hdrColorSpace;
CString m_hdrLuminance;
CString m_defaultRendererName;
CString m_dsStartStopTime;
CString m_dsNominalRange;
CString m_dsTransferFunction;
CString m_dsTransferMatrix;
CString m_dsNominalRange;

IVideoRenderer* m_videoRenderer = nullptr;
RendererState m_rendererState = RendererState::RENDERSTATE_UNKNOWN;
Expand Down
4 changes: 0 additions & 4 deletions src/VideoProcessor-Test/VideoProcessor-Test.vcxproj.user

This file was deleted.

This file was deleted.