Skip to content

Commit 47c70bc

Browse files
committed
ADC-2691
1 parent d297dbd commit 47c70bc

35 files changed

+7939
-413
lines changed

OpenLive-Windows/.gitignore

Lines changed: 72 additions & 342 deletions
Large diffs are not rendered by default.
56.4 MB
Binary file not shown.
788 KB
Binary file not shown.

OpenLive-Windows/Language/ChineseSimplified/ChineseSimplified.vcxproj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
44
<ProjectConfiguration Include="Debug|Win32">
55
<Configuration>Debug</Configuration>
@@ -22,31 +22,32 @@
2222
<ProjectGuid>{898289D0-0D57-4B8E-97AE-013114F85DE9}</ProjectGuid>
2323
<Keyword>Win32Proj</Keyword>
2424
<RootNamespace>ChineseSimplified</RootNamespace>
25+
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
2526
</PropertyGroup>
2627
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2728
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
2829
<ConfigurationType>DynamicLibrary</ConfigurationType>
2930
<UseDebugLibraries>true</UseDebugLibraries>
30-
<PlatformToolset>v120</PlatformToolset>
31+
<PlatformToolset>v141</PlatformToolset>
3132
<CharacterSet>Unicode</CharacterSet>
3233
</PropertyGroup>
3334
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
3435
<ConfigurationType>DynamicLibrary</ConfigurationType>
3536
<UseDebugLibraries>true</UseDebugLibraries>
36-
<PlatformToolset>v120</PlatformToolset>
37+
<PlatformToolset>v141</PlatformToolset>
3738
<CharacterSet>Unicode</CharacterSet>
3839
</PropertyGroup>
3940
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
4041
<ConfigurationType>DynamicLibrary</ConfigurationType>
4142
<UseDebugLibraries>false</UseDebugLibraries>
42-
<PlatformToolset>v120_xp</PlatformToolset>
43+
<PlatformToolset>v141_xp</PlatformToolset>
4344
<WholeProgramOptimization>true</WholeProgramOptimization>
4445
<CharacterSet>Unicode</CharacterSet>
4546
</PropertyGroup>
4647
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
4748
<ConfigurationType>DynamicLibrary</ConfigurationType>
4849
<UseDebugLibraries>false</UseDebugLibraries>
49-
<PlatformToolset>v120</PlatformToolset>
50+
<PlatformToolset>v141_xp</PlatformToolset>
5051
<WholeProgramOptimization>true</WholeProgramOptimization>
5152
<CharacterSet>Unicode</CharacterSet>
5253
</PropertyGroup>

OpenLive-Windows/Language/English/English.vcxproj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
44
<ProjectConfiguration Include="Debug|Win32">
55
<Configuration>Debug</Configuration>
@@ -22,31 +22,32 @@
2222
<ProjectGuid>{DE1D9363-5455-4448-8D69-D22BE47F5A82}</ProjectGuid>
2323
<Keyword>Win32Proj</Keyword>
2424
<RootNamespace>English</RootNamespace>
25+
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
2526
</PropertyGroup>
2627
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2728
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
2829
<ConfigurationType>DynamicLibrary</ConfigurationType>
2930
<UseDebugLibraries>true</UseDebugLibraries>
30-
<PlatformToolset>v120</PlatformToolset>
31+
<PlatformToolset>v141</PlatformToolset>
3132
<CharacterSet>Unicode</CharacterSet>
3233
</PropertyGroup>
3334
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
3435
<ConfigurationType>DynamicLibrary</ConfigurationType>
3536
<UseDebugLibraries>true</UseDebugLibraries>
36-
<PlatformToolset>v120</PlatformToolset>
37+
<PlatformToolset>v141</PlatformToolset>
3738
<CharacterSet>Unicode</CharacterSet>
3839
</PropertyGroup>
3940
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
4041
<ConfigurationType>DynamicLibrary</ConfigurationType>
4142
<UseDebugLibraries>false</UseDebugLibraries>
42-
<PlatformToolset>v120_xp</PlatformToolset>
43+
<PlatformToolset>v141_xp</PlatformToolset>
4344
<WholeProgramOptimization>true</WholeProgramOptimization>
4445
<CharacterSet>Unicode</CharacterSet>
4546
</PropertyGroup>
4647
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
4748
<ConfigurationType>DynamicLibrary</ConfigurationType>
4849
<UseDebugLibraries>false</UseDebugLibraries>
49-
<PlatformToolset>v120_xp</PlatformToolset>
50+
<PlatformToolset>v141_xp</PlatformToolset>
5051
<WholeProgramOptimization>true</WholeProgramOptimization>
5152
<CharacterSet>Unicode</CharacterSet>
5253
</PropertyGroup>

OpenLive-Windows/OpenLive/AGConfig.cpp

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,87 @@ BOOL CAGConfig::IsAutoSaveEnabled()
6060
strSaveSetting.ReleaseBuffer();
6161

6262
return (_ttoi(strSaveSetting) == 1) ? TRUE : FALSE;
63+
}
64+
65+
BOOL CAGConfig::IsCustomFPS()
66+
{
67+
CString str;
68+
69+
::GetPrivateProfileString(_T("VideoConfig"), _T("CustomFPS"), _T("0"), str.GetBuffer(MAX_PATH), MAX_PATH, m_szConfigFile);
70+
71+
str.ReleaseBuffer();
72+
73+
return (_ttoi(str) == 1) ? TRUE : FALSE;
74+
}
75+
76+
BOOL CAGConfig::IsCustomBitrate()
77+
{
78+
CString str;
79+
80+
::GetPrivateProfileString(_T("VideoConfig"), _T("CustomBitrate"), _T("0"), str.GetBuffer(MAX_PATH), MAX_PATH, m_szConfigFile);
81+
82+
str.ReleaseBuffer();
83+
84+
return (_ttoi(str) == 1) ? TRUE : FALSE;
85+
}
86+
87+
BOOL CAGConfig::IsCustomRsolution()
88+
{
89+
CString str;
90+
91+
::GetPrivateProfileString(_T("VideoConfig"), _T("CustomRsolution"), _T("0"), str.GetBuffer(MAX_PATH), MAX_PATH, m_szConfigFile);
92+
str.ReleaseBuffer();
93+
94+
return (_ttoi(str) == 1) ? TRUE : FALSE;
95+
}
96+
97+
void CAGConfig::SetCustomFPS(int fps)
98+
{
99+
CString str = _itot(fps, NULL, 10);
100+
101+
::WritePrivateProfileString(_T("VideoConfig"), _T("FPS"), str, m_szConfigFile);
102+
}
103+
104+
int CAGConfig::GetCustomFPS()
105+
{
106+
CString str;
107+
108+
::GetPrivateProfileString(_T("VideoConfig"), _T("FPS"), _T("15"), str.GetBuffer(MAX_PATH), MAX_PATH, m_szConfigFile);
109+
110+
str.ReleaseBuffer();
111+
112+
return _ttoi(str);
113+
}
114+
115+
void CAGConfig::SetResolution(int w, int h)
116+
{
117+
118+
}
119+
120+
BOOL CAGConfig::GetResolution(int& w, int& h)
121+
{
122+
CString str;
123+
::GetPrivateProfileString(_T("VideoConfig"), _T("Width"), _T("640"), str.GetBuffer(MAX_PATH), MAX_PATH, m_szConfigFile);
124+
w = _ttoi(str);
125+
::GetPrivateProfileString(_T("VideoConfig"), _T("Height"), _T("480"), str.GetBuffer(MAX_PATH), MAX_PATH, m_szConfigFile);
126+
h = _ttoi(str);
127+
str.ReleaseBuffer();
128+
129+
return TRUE;
130+
}
131+
132+
void CAGConfig::SetCustomBitrate(int bitrate)
133+
{
134+
135+
}
136+
137+
int CAGConfig::GetCustomBitrate()
138+
{
139+
CString str;
140+
141+
::GetPrivateProfileString(_T("VideoConfig"), _T("Bitrate"), _T("800"), str.GetBuffer(MAX_PATH), MAX_PATH, m_szConfigFile);
142+
143+
str.ReleaseBuffer();
144+
145+
return _ttoi(str);
63146
}

OpenLive-Windows/OpenLive/AGConfig.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ class CAGConfig
1111
BOOL EnableAutoSave(BOOL bEnable);
1212
BOOL IsAutoSaveEnabled();
1313

14+
BOOL IsCustomFPS();
15+
BOOL IsCustomBitrate();
16+
BOOL IsCustomRsolution();
17+
18+
void SetCustomFPS(int fps);
19+
int GetCustomFPS();
20+
21+
void SetResolution(int w, int h);
22+
BOOL GetResolution(int& w, int& h);
23+
24+
void SetCustomBitrate(int bitrate);
25+
int GetCustomBitrate();
26+
1427
private:
1528
TCHAR m_szConfigFile[MAX_PATH];
1629
};
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#include "stdafx.h"
2+
#include "AGJson.h"
3+
#include <fstream>
4+
CAGJson::CAGJson()
5+
{
6+
TCHAR szFilePath[MAX_PATH];
7+
::GetModuleFileName(NULL, szFilePath, MAX_PATH);
8+
LPTSTR lpLastSlash = _tcsrchr(szFilePath, _T('\\')) + 1;
9+
szFilePath[lpLastSlash - szFilePath] = 0;
10+
CString strPath = szFilePath;
11+
strPath += _T("Parameters.json");
12+
13+
if (PathFileExists(strPath)) {
14+
char szFile[MAX_PATH] = { 0 };
15+
WideCharToMultiByte(CP_ACP, 0, strPath, -1, szFile, MAX_PATH, NULL, NULL);
16+
std::ifstream ifs(szFile);
17+
Json::CharReaderBuilder readerBuilder;
18+
JSONCPP_STRING errs;
19+
bSuccess = Json::parseFromStream(readerBuilder, ifs, &jsonParameters, &errs);
20+
}
21+
}
22+
23+
CAGJson::~CAGJson()
24+
{
25+
}
26+
27+
BOOL CAGJson::GetParameters(std::map<std::string, std::string>& mapStringParameters,
28+
std::map<std::string, bool>& mapBoolParameters,
29+
std::map<std::string, int>& mapIntParameters,
30+
std::map<std::string, std::string>& mapObjectParameters)
31+
{
32+
if (!bSuccess) {
33+
return FALSE;
34+
}
35+
36+
if (jsonParameters.isArray()) {
37+
int size = jsonParameters.size();
38+
for (size_t i = 0; i < size; i++) {
39+
Json::Value js = jsonParameters[(int)i];
40+
std::vector<std::string> keys = js.getMemberNames();
41+
if (js[keys[0].c_str()].isBool()) {
42+
bool b = js[keys[0].c_str()].asBool();
43+
mapBoolParameters.insert(std::make_pair(keys[0], b));
44+
}
45+
else if(js[keys[0].c_str()].isInt())
46+
mapIntParameters.insert(std::make_pair(keys[0], js[keys[0].c_str()].asInt()));
47+
else if (js[keys[0].c_str()].isString())
48+
mapStringParameters.insert(std::make_pair(keys[0], js[keys[0].c_str()].asString()));
49+
else if (js[keys[0].c_str()].isObject())
50+
mapObjectParameters.insert(std::make_pair(keys[0], js[keys[0].c_str()].toStyledString()));
51+
52+
}
53+
return TRUE;
54+
}
55+
else {
56+
AfxMessageBox(_T("json string must be array"));
57+
}
58+
59+
return FALSE;
60+
}

OpenLive-Windows/OpenLive/AGJson.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#pragma once
2+
#include <map>
3+
#include "json/json.h"
4+
class CAGJson
5+
{
6+
public:
7+
CAGJson();
8+
~CAGJson();
9+
BOOL GetParameters(std::map<std::string, std::string>& mapStringParameters,
10+
std::map<std::string, bool>& mapBoolParameters,
11+
std::map<std::string, int>& mapIntParameters,
12+
std::map<std::string, std::string>& mapObjectParameters);
13+
private:
14+
Json::Value jsonParameters;
15+
bool bSuccess = false;
16+
17+
};
18+

0 commit comments

Comments
 (0)