Add -profile [profile] command line option
A user requested it, and it was super quick and easy, so I did it. Also, renamed an unusual variable isSTEREO to isStereo.
This commit is contained in:
parent
a1db3bd683
commit
dfc96d088e
@ -207,14 +207,17 @@ void InvertPre47Scenes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupIni()
|
void SetupIni(CTSTR profile)
|
||||||
{
|
{
|
||||||
//first, find out which profile we're using
|
//first, find out which profile we're using
|
||||||
|
|
||||||
String strProfile = GlobalConfig->GetString(TEXT("General"), TEXT("Profile"));
|
String strProfile = profile ? profile : GlobalConfig->GetString(TEXT("General"), TEXT("Profile"));
|
||||||
DWORD lastVersion = GlobalConfig->GetInt(TEXT("General"), TEXT("LastAppVersion"));
|
DWORD lastVersion = GlobalConfig->GetInt(TEXT("General"), TEXT("LastAppVersion"));
|
||||||
String strIni;
|
String strIni;
|
||||||
|
|
||||||
|
if (profile)
|
||||||
|
GlobalConfig->SetString(TEXT("General"), TEXT("Profile"), profile);
|
||||||
|
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
// 0.47a fix (invert sources in all scenes)
|
// 0.47a fix (invert sources in all scenes)
|
||||||
|
|
||||||
@ -291,7 +294,7 @@ void SetupIni()
|
|||||||
|
|
||||||
AppConfig->SetInt (TEXT("Audio Encoding"), TEXT("Format"), 1);
|
AppConfig->SetInt (TEXT("Audio Encoding"), TEXT("Format"), 1);
|
||||||
AppConfig->SetString(TEXT("Audio Encoding"), TEXT("Bitrate"), TEXT("128"));
|
AppConfig->SetString(TEXT("Audio Encoding"), TEXT("Bitrate"), TEXT("128"));
|
||||||
AppConfig->SetInt (TEXT("Audio Encoding"), TEXT("isSTEREO"), 1);
|
AppConfig->SetInt (TEXT("Audio Encoding"), TEXT("isStereo"), 1);
|
||||||
|
|
||||||
AppConfig->SetInt (TEXT("Publish"), TEXT("Service"), 0);
|
AppConfig->SetInt (TEXT("Publish"), TEXT("Service"), 0);
|
||||||
AppConfig->SetInt (TEXT("Publish"), TEXT("Mode"), 0);
|
AppConfig->SetInt (TEXT("Publish"), TEXT("Mode"), 0);
|
||||||
@ -413,6 +416,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
|
|
||||||
int numArgs;
|
int numArgs;
|
||||||
LPWSTR *args = CommandLineToArgvW(GetCommandLineW(), &numArgs);
|
LPWSTR *args = CommandLineToArgvW(GetCommandLineW(), &numArgs);
|
||||||
|
LPWSTR profile = NULL;
|
||||||
|
|
||||||
bool bDisableMutex = false;
|
bool bDisableMutex = false;
|
||||||
|
|
||||||
@ -424,10 +428,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
bIsPortable = true;
|
bIsPortable = true;
|
||||||
else if (scmpi(args[i], TEXT("-start")) == 0)
|
else if (scmpi(args[i], TEXT("-start")) == 0)
|
||||||
bStreamOnStart = true;
|
bStreamOnStart = true;
|
||||||
|
else if (scmpi(args[i], L"-profile") == 0)
|
||||||
|
{
|
||||||
|
if (++i < numArgs)
|
||||||
|
profile = args[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalFree(args);
|
|
||||||
|
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
//make sure only one instance of the application can be open at a time
|
//make sure only one instance of the application can be open at a time
|
||||||
|
|
||||||
@ -552,7 +559,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
|
|
||||||
AppConfig = new ConfigFile;
|
AppConfig = new ConfigFile;
|
||||||
SetupIni();
|
SetupIni(profile);
|
||||||
|
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
|
|
||||||
@ -680,5 +687,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
|
|
||||||
CloseHandle(hOBSMutex);
|
CloseHandle(hOBSMutex);
|
||||||
|
|
||||||
|
LocalFree(args);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -588,7 +588,7 @@ class OBS
|
|||||||
|
|
||||||
UINT sampleRateHz;
|
UINT sampleRateHz;
|
||||||
UINT audioChannels;
|
UINT audioChannels;
|
||||||
BOOL isSTEREO;
|
BOOL isStereo;
|
||||||
|
|
||||||
AudioEncoder *audioEncoder;
|
AudioEncoder *audioEncoder;
|
||||||
|
|
||||||
|
@ -477,9 +477,9 @@ retryHookTestV2:
|
|||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
BOOL isSTEREO = AppConfig->GetInt(L"Audio Encoding", L"isSTEREO", 1);
|
BOOL isStereo = AppConfig->GetInt(L"Audio Encoding", L"isStereo", 1);
|
||||||
|
|
||||||
switch (isSTEREO) {
|
switch (isStereo) {
|
||||||
case 0: audioChannels = 1; break;
|
case 0: audioChannels = 1; break;
|
||||||
default:
|
default:
|
||||||
case 1: audioChannels = 2; break;
|
case 1: audioChannels = 2; break;
|
||||||
|
@ -116,7 +116,7 @@ void SettingsEncoding::ApplySettings()
|
|||||||
|
|
||||||
int curSelCh = (int)SendMessage(GetDlgItem(hwnd, IDC_AUDIOCHANNEL), CB_GETCURSEL, 0, 0);
|
int curSelCh = (int)SendMessage(GetDlgItem(hwnd, IDC_AUDIOCHANNEL), CB_GETCURSEL, 0, 0);
|
||||||
if(curSelCh != CB_ERR)
|
if(curSelCh != CB_ERR)
|
||||||
AppConfig->SetInt(TEXT("Audio Encoding"), TEXT("isSTEREO"), curSelCh);
|
AppConfig->SetInt(TEXT("Audio Encoding"), TEXT("isStereo"), curSelCh);
|
||||||
|
|
||||||
bool bUseCBR = SendMessage(GetDlgItem(hwnd, IDC_USECBR), BM_GETCHECK, 0, 0) == BST_CHECKED;
|
bool bUseCBR = SendMessage(GetDlgItem(hwnd, IDC_USECBR), BM_GETCHECK, 0, 0) == BST_CHECKED;
|
||||||
AppConfig->SetInt(TEXT("Video Encoding"), TEXT("UseCBR"), bUseCBR);
|
AppConfig->SetInt(TEXT("Video Encoding"), TEXT("UseCBR"), bUseCBR);
|
||||||
@ -277,15 +277,15 @@ INT_PTR SettingsEncoding::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam
|
|||||||
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("mono"));
|
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("mono"));
|
||||||
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("stereo"));
|
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("stereo"));
|
||||||
|
|
||||||
LoadSettingComboInt(hwndTemp, TEXT("Audio Encoding"), TEXT("isSTEREO"), 1, 1);
|
LoadSettingComboInt(hwndTemp, TEXT("Audio Encoding"), TEXT("isStereo"), 1, 1);
|
||||||
|
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
|
|
||||||
hwndTemp = GetDlgItem(hwnd, IDC_AUDIOBITRATE);
|
hwndTemp = GetDlgItem(hwnd, IDC_AUDIOBITRATE);
|
||||||
|
|
||||||
BOOL isSTEREO = SendMessage(GetDlgItem(hwnd, IDC_AUDIOCHANNEL), CB_GETCURSEL, 0, 0) == 1;
|
BOOL isStereo = SendMessage(GetDlgItem(hwnd, IDC_AUDIOCHANNEL), CB_GETCURSEL, 0, 0) == 1;
|
||||||
|
|
||||||
if (isSTEREO)
|
if (isStereo)
|
||||||
{
|
{
|
||||||
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("48"));
|
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("48"));
|
||||||
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("64"));
|
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("64"));
|
||||||
@ -309,7 +309,7 @@ INT_PTR SettingsEncoding::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam
|
|||||||
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("160"));
|
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("160"));
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadSettingComboString(hwndTemp, TEXT("Audio Encoding"), TEXT("Bitrate"), isSTEREO ? TEXT("96") : TEXT("48"));
|
LoadSettingComboString(hwndTemp, TEXT("Audio Encoding"), TEXT("Bitrate"), isStereo ? TEXT("96") : TEXT("48"));
|
||||||
|
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
|
|
||||||
@ -351,9 +351,9 @@ INT_PTR SettingsEncoding::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam
|
|||||||
HWND hwndAudioBitrate = GetDlgItem(hwnd, IDC_AUDIOBITRATE);
|
HWND hwndAudioBitrate = GetDlgItem(hwnd, IDC_AUDIOBITRATE);
|
||||||
SendMessage(hwndAudioBitrate, CB_RESETCONTENT, 0, 0);
|
SendMessage(hwndAudioBitrate, CB_RESETCONTENT, 0, 0);
|
||||||
|
|
||||||
BOOL isSTEREO = SendMessage(GetDlgItem(hwnd, IDC_AUDIOCHANNEL), CB_GETCURSEL, 0, 0) == 1;
|
BOOL isStereo = SendMessage(GetDlgItem(hwnd, IDC_AUDIOCHANNEL), CB_GETCURSEL, 0, 0) == 1;
|
||||||
|
|
||||||
if (isSTEREO)
|
if (isStereo)
|
||||||
{
|
{
|
||||||
SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("48"));
|
SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("48"));
|
||||||
SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("64"));
|
SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("64"));
|
||||||
@ -377,7 +377,7 @@ INT_PTR SettingsEncoding::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam
|
|||||||
SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("160"));
|
SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("160"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessage(hwndAudioBitrate, CB_SETCURSEL, isSTEREO ? 3 : 2, 0);
|
SendMessage(hwndAudioBitrate, CB_SETCURSEL, isStereo ? 3 : 2, 0);
|
||||||
|
|
||||||
bDataChanged = true;
|
bDataChanged = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user