本文整理汇总了C++中StringList::Num方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::Num方法的具体用法?C++ StringList::Num怎么用?C++ StringList::Num使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringList
的用法示例。
在下文中一共展示了StringList::Num方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConfigureBitmapTransitionProc
INT_PTR CALLBACK ConfigureBitmapTransitionProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG:
{
ConfigBitmapInfo *configInfo = (ConfigBitmapInfo*)lParam;
SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)configInfo);
LocalizeWindow(hwnd);
//--------------------------
HWND hwndTemp = GetDlgItem(hwnd, IDC_BITMAPS);
StringList bitmapList;
configInfo->data->GetStringList(TEXT("bitmap"), bitmapList);
for(UINT i=0; i<bitmapList.Num(); i++)
{
CTSTR lpBitmap = bitmapList[i];
if(OSFileExists(lpBitmap))
SendMessage(hwndTemp, LB_ADDSTRING, 0, (LPARAM)lpBitmap);
}
//--------------------------
hwndTemp = GetDlgItem(hwnd, IDC_TRANSITIONTIME);
UINT transitionTime = configInfo->data->GetInt(TEXT("transitionTime"));
SendMessage(hwndTemp, UDM_SETRANGE32, MIN_TRANSITION_TIME, MAX_TRANSITION_TIME);
if(!transitionTime)
transitionTime = 10;
SendMessage(hwndTemp, UDM_SETPOS32, 0, transitionTime);
EnableWindow(GetDlgItem(hwnd, IDC_REPLACE), FALSE);
EnableWindow(GetDlgItem(hwnd, IDC_REMOVE), FALSE);
EnableWindow(GetDlgItem(hwnd, IDC_MOVEUPWARD), FALSE);
EnableWindow(GetDlgItem(hwnd, IDC_MOVEDOWNWARD), FALSE);
//--------------------------
BOOL bFadeInOnly = configInfo->data->GetInt(TEXT("fadeInOnly"), 1);
BOOL bDisableFading = configInfo->data->GetInt(TEXT("disableFading"));
BOOL bRandomize = configInfo->data->GetInt(TEXT("randomize"));
SendMessage(GetDlgItem(hwnd, IDC_FADEINONLY), BM_SETCHECK, bFadeInOnly ? BST_CHECKED : BST_UNCHECKED, 0);
SendMessage(GetDlgItem(hwnd, IDC_DISABLEFADING), BM_SETCHECK, bDisableFading ? BST_CHECKED : BST_UNCHECKED, 0);
SendMessage(GetDlgItem(hwnd, IDC_RANDOMIZE), BM_SETCHECK, bRandomize ? BST_CHECKED : BST_UNCHECKED, 0);
EnableWindow(GetDlgItem(hwnd, IDC_FADEINONLY), !bDisableFading);
return TRUE;
}
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_ADD:
{
TSTR lpFile = (TSTR)Allocate(32*1024*sizeof(TCHAR));
zero(lpFile, 32*1024*sizeof(TCHAR));
OPENFILENAME ofn;
zero(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFile = lpFile;
ofn.hwndOwner = hwnd;
ofn.nMaxFile = 32*1024*sizeof(TCHAR);
ofn.lpstrFilter = TEXT("All Formats (*.bmp;*.dds;*.jpg;*.png;*.gif)\0*.bmp;*.dds;*.jpg;*.png;*.gif\0");
ofn.nFilterIndex = 1;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_EXPLORER;
TCHAR curDirectory[MAX_PATH+1];
GetCurrentDirectory(MAX_PATH, curDirectory);
BOOL bOpenFile = GetOpenFileName(&ofn);
TCHAR newDirectory[MAX_PATH+1];
GetCurrentDirectory(MAX_PATH, newDirectory);
SetCurrentDirectory(curDirectory);
if(bOpenFile)
{
TSTR lpCurFile = lpFile+ofn.nFileOffset;
while(lpCurFile && *lpCurFile)
{
String strPath;
strPath << newDirectory << TEXT("\\") << lpCurFile;
SendMessage(GetDlgItem(hwnd, IDC_BITMAPS), LB_ADDSTRING, 0, (LPARAM)strPath.Array());
lpCurFile += slen(lpCurFile)+1;
}
}
Free(lpFile);
//.........这里部分代码省略.........
示例2: RefreshWindowList
void RefreshWindowList(HWND hwndCombobox, ConfigDialogData &configData)
{
SendMessage(hwndCombobox, CB_RESETCONTENT, 0, 0);
configData.ClearData();
BOOL bWindows64bit = Is64BitWindows();
BOOL bCurrentProcessIsWow64 = FALSE;
IsWow64Process(GetCurrentProcess(), &bCurrentProcessIsWow64);
HWND hwndCurrent = GetWindow(GetDesktopWindow(), GW_CHILD);
do
{
if(IsWindowVisible(hwndCurrent))
{
RECT clientRect;
GetClientRect(hwndCurrent, &clientRect);
HWND hwndParent = GetParent(hwndCurrent);
DWORD exStyles = (DWORD)GetWindowLongPtr(hwndCurrent, GWL_EXSTYLE);
DWORD styles = (DWORD)GetWindowLongPtr(hwndCurrent, GWL_STYLE);
if( (exStyles & WS_EX_TOOLWINDOW) == 0 && (styles & WS_CHILD) == 0 /*&& hwndParent == NULL*/)
{
String strWindowName;
strWindowName.SetLength(GetWindowTextLength(hwndCurrent));
GetWindowText(hwndCurrent, strWindowName, strWindowName.Length()+1);
bool b64bit = false;
//-------
DWORD processID;
GetWindowThreadProcessId(hwndCurrent, &processID);
if(processID == GetCurrentProcessId())
continue;
TCHAR fileName[MAX_PATH+1];
scpy(fileName, TEXT("unknown"));
HANDLE hProcess = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_VM_READ | PROCESS_VM_WRITE, FALSE, processID);
if(hProcess)
{
BOOL bTargetProcessIsWow64 = FALSE;
IsWow64Process(hProcess, &bTargetProcessIsWow64);
DWORD dwSize = MAX_PATH;
QueryFullProcessImageName(hProcess, 0, fileName, &dwSize);
StringList moduleList;
OSGetLoadedModuleList(hProcess, moduleList);
CloseHandle(hProcess);
//todo: remove later
if(bCurrentProcessIsWow64 != bTargetProcessIsWow64)
{
configData.opposingBitWindows << strWindowName;
continue;
}
BOOL bFoundModule = FALSE;
for(UINT i=0; i<moduleList.Num(); i++)
{
CTSTR moduleName = moduleList[i];
if (!scmp(moduleName, TEXT("d3d9.dll")) ||
!scmp(moduleName, TEXT("d3d10.dll")) ||
!scmp(moduleName, TEXT("d3d10_1.dll")) ||
!scmp(moduleName, TEXT("d3d11.dll")) ||
!scmp(moduleName, TEXT("opengl32.dll")))
{
bFoundModule = true;
break;
}
}
if (!bFoundModule)
continue;
b64bit = (bWindows64bit && !bTargetProcessIsWow64);
}
else
{
hProcess = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, processID);
if(hProcess)
{
BOOL bTargetProcessIsWow64 = FALSE;
IsWow64Process(hProcess, &bTargetProcessIsWow64);
if(bCurrentProcessIsWow64 != bTargetProcessIsWow64)
configData.opposingBitWindows << strWindowName;
configData.adminWindows << strWindowName;
CloseHandle(hProcess);
}
continue;
//.........这里部分代码省略.........
示例3: UpdateSettings
void UpdateSettings()
{
for(UINT i=0; i<bitmapImages.Num(); i++)
delete bitmapImages[i];
bitmapImages.Clear();
//------------------------------------
bool bFirst = true;
StringList bitmapList;
data->GetStringList(TEXT("bitmap"), bitmapList);
for(UINT i=0; i<bitmapList.Num(); i++)
{
String &strBitmap = bitmapList[i];
if(strBitmap.IsEmpty())
{
AppWarning(TEXT("BitmapTransitionSource::UpdateSettings: Empty path"));
continue;
}
BitmapImage *bitmapImage = new BitmapImage;
bitmapImage->SetPath(strBitmap);
bitmapImage->EnableFileMonitor(false);
bitmapImage->Init();
if(bFirst)
{
fullSize = bitmapImage->GetSize();
baseAspect = double(fullSize.x)/double(fullSize.y);
bFirst = false;
}
bitmapImages << bitmapImage;
}
//------------------------------------
transitionTime = data->GetFloat(TEXT("transitionTime"));
if(transitionTime < MIN_TRANSITION_TIME)
transitionTime = MIN_TRANSITION_TIME;
else if(transitionTime > MAX_TRANSITION_TIME)
transitionTime = MAX_TRANSITION_TIME;
//------------------------------------
bFadeInOnly = data->GetInt(TEXT("fadeInOnly"), 1) != 0;
bDisableFading = data->GetInt(TEXT("disableFading")) != 0;
bRandomize = data->GetInt(TEXT("randomize")) != 0;
//------------------------------------
curTransitionTime = 0.0f;
curTexture = 0;
if(bRandomize)
{
srand( (unsigned)time( NULL ) );
if(bitmapImages.Num() > 1)
{
curTexture = lrand(bitmapImages.Num());
while((nextTexture = lrand(bitmapImages.Num())) == curTexture);
}
}
else
nextTexture = (curTexture == bitmapImages.Num()-1) ? 0 : curTexture+1;
bTransitioning = false;
curFadeValue = 0.0f;
}
示例4: Init
void Init()
{
traceIn(ScriptCompilerEngine::Init);
Log(TEXT("Script Compiler Initialized"));
engine = this;
bEditor = TRUE;
locale = new LocaleStringLookup;
int numArgs;
TSTR *params = OSGetCommandLine(numArgs);
StringList CompileModules;
Scripting = new ScriptSystem;
DWORD timeID = TrackTimeBegin(FALSE);
StringList LoadFiles;
AppConfig->GetStringList(TEXT("Compiler"), TEXT("Load"), LoadFiles);
AppConfig->GetStringList(TEXT("Compiler"), TEXT("Compile"), CompileModules);
CompileModules.RemoveDupesI();
String errorList;
BOOL bGenerateHeaders = AppConfig->GetInt(TEXT("Compiler"), TEXT("Source"), 0);
BOOL bGenerateBytecode = FALSE;
BOOL bSetLoadModules = FALSE;
BOOL bGetHelp = FALSE; //meaning a psychiatrist.
int curArg = 1;
if(numArgs == 1 && !LoadFiles.Num() && !CompileModules.Num()) bGetHelp = TRUE;
while(curArg < numArgs)
{
if(params[curArg][0] == '-')
{
if(scmpi(params[curArg], TEXT("-source")) == 0)
bGenerateHeaders = TRUE;
else if(scmpi(params[curArg], TEXT("-bytecode")) == 0)
bGenerateBytecode = TRUE;
else if(scmpi(params[curArg], TEXT("-load")) == 0)
bSetLoadModules = TRUE;
else if(scmpi(params[curArg], TEXT("-compile")) == 0)
bSetLoadModules = FALSE;
else if( (scmpi(params[curArg], TEXT("-help")) == 0) ||
(scmpi(params[curArg], TEXT("-h")) == 0) )
{
bGetHelp = TRUE;
}
else
{
wprintf(TEXT("Unknown parameter '%s'\r\n"), params[curArg]);
Log(TEXT("Unknown parameter '%s'\r\n"), params[curArg]);
}
}
else if(bSetLoadModules)
LoadFiles.SafeAddI(params[curArg]);
else
CompileModules.SafeAddI(params[curArg]);
++curArg;
}
if(bGetHelp)
{
wprintf(TEXT("Syntax:\r\n ScriptCompiler [-source] [-load module1 module2 ...] [-compile module3 module4 ...]\r\n\r\n"));
wprintf(TEXT(" -source: Generates cpp/h files inside the ScriptOutput directory for\r\n native functions/classes\r\n\r\n"));
wprintf(TEXT(" -load [module-files]: Loads modules files to be used as dependancies\r\n for compiling.\r\n\r\n"));
wprintf(TEXT(" -compile [module-files]: Compiles modules and reports any\r\n errors/warnings, as well as generates source/heads if -source\r\n is used in conjunction.\r\n\r\n"));
TrackTimeEnd(timeID);
delete Scripting;
Scripting = NULL;
return;
}
for(int i=0; i<LoadFiles.Num(); i++)
LoadGameModule(LoadFiles[i]);
for(int i=0; i<CompileModules.Num(); i++)
{
wprintf(TEXT("Compiling %s...\r\n"), CompileModules[i].Array());
Log(TEXT("Compiling %s...\r\n"), CompileModules[i].Array());
Scripting->LoadModuleScriptData(CompileModules[i], errorList, bGenerateBytecode, bGenerateHeaders);
if(!errorList.IsEmpty())
{
wprintf(TEXT("%s"), errorList.Array());
Log(TEXT("%s"), errorList.Array());
}
else
{
DWORD totalTimeTaken = TrackTimeRestart(timeID);
float fSeconds = MSToSeconds(totalTimeTaken);
wprintf(TEXT("Compilation of module '%s' successful, compiled in %g seconds.\r\n"), CompileModules[i].Array(), fSeconds);
Log(TEXT("Compilation of module '%s' successful, compiled in %g seconds.\r\n"), CompileModules[i].Array(), fSeconds);
//.........这里部分代码省略.........
示例5: if
X264Encoder(int fps, int width, int height, int quality, CTSTR preset, bool bUse444, ColorDescription &colorDesc, int maxBitrate, int bufferSize, bool bUseCFR)
{
curPreset = preset;
fps_ms = 1000/fps;
StringList paramList;
curProfile = AppConfig->GetString(TEXT("Video Encoding"), TEXT("X264Profile"), TEXT("high"));
BOOL bUseCustomParams = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("UseCustomSettings"));
if(bUseCustomParams)
{
String strCustomParams = AppConfig->GetString(TEXT("Video Encoding"), TEXT("CustomSettings"));
strCustomParams.KillSpaces();
if(strCustomParams.IsValid())
{
Log(TEXT("Using custom x264 settings: \"%s\""), strCustomParams.Array());
strCustomParams.GetTokenList(paramList, ' ', FALSE);
for(UINT i=0; i<paramList.Num(); i++)
{
String &strParam = paramList[i];
if(!schr(strParam, '='))
continue;
String strParamName = strParam.GetToken(0, '=');
String strParamVal = strParam.GetTokenOffset(1, '=');
if(strParamName.CompareI(TEXT("preset")))
{
if(valid_x264_string(strParamVal, (const char**)x264_preset_names))
curPreset = strParamVal;
else
Log(TEXT("invalid preset: %s"), strParamVal.Array());
paramList.Remove(i--);
}
else if(strParamName.CompareI(TEXT("tune")))
{
if(valid_x264_string(strParamVal, (const char**)x264_tune_names))
curTune = strParamVal;
else
Log(TEXT("invalid tune: %s"), strParamVal.Array());
paramList.Remove(i--);
}
else if(strParamName.CompareI(TEXT("profile")))
{
if(valid_x264_string(strParamVal, (const char **)x264_profile_names))
curProfile = strParamVal;
else
Log(TEXT("invalid profile: %s"), strParamVal.Array());
paramList.Remove(i--);
}
}
}
}
zero(¶mData, sizeof(paramData));
LPSTR lpPreset = curPreset.CreateUTF8String();
LPSTR lpTune = curTune.CreateUTF8String();
if (x264_param_default_preset(¶mData, lpPreset, lpTune))
Log(TEXT("Failed to set x264 defaults: %s/%s"), curPreset.Array(), curTune.Array());
Free(lpTune);
Free(lpPreset);
this->width = width;
this->height = height;
paramData.b_deterministic = false;
bUseCBR = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("UseCBR"), 1) != 0;
bPadCBR = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("PadCBR"), 1) != 0;
this->bUseCFR = bUseCFR;
SetBitRateParams(maxBitrate, bufferSize);
if(bUseCBR)
{
if(bPadCBR) paramData.i_nal_hrd = X264_NAL_HRD_CBR;
paramData.rc.i_rc_method = X264_RC_ABR;
paramData.rc.f_rf_constant = 0.0f;
}
else
{
paramData.rc.i_rc_method = X264_RC_CRF;
paramData.rc.f_rf_constant = baseCRF+float(10-quality);
}
UINT keyframeInterval = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("KeyframeInterval"), 0);
paramData.b_vfr_input = !bUseCFR;
paramData.i_width = width;
paramData.i_height = height;
//.........这里部分代码省略.........
示例6: ProcMessage
INT_PTR SettingsGeneral::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG:
{
LocalizeWindow(hwnd);
//----------------------------------------------
HWND hwndTemp = GetDlgItem(hwnd, IDC_LANGUAGE);
OSFindData ofd;
HANDLE hFind;
if(hFind = OSFindFirstFile(TEXT("locale/*.txt"), ofd))
{
do
{
if(ofd.bDirectory) continue;
String langCode = GetPathFileName(ofd.fileName);
LocaleNativeName *langInfo = GetLocaleNativeName(langCode);
if(langInfo)
{
UINT id = (UINT)SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)langInfo->lpNative);
SendMessage(hwndTemp, CB_SETITEMDATA, id, (LPARAM)langInfo->lpCode);
if(App->strLanguage.CompareI(langCode))
SendMessage(hwndTemp, CB_SETCURSEL, id, 0);
}
} while(OSFindNextFile(hFind, ofd));
OSFindClose(hFind);
}
//----------------------------------------------
String strCurProfile = GlobalConfig->GetString(TEXT("General"), TEXT("Profile"));
hwndTemp = GetDlgItem(hwnd, IDC_PROFILE);
StringList profileList;
App->GetProfiles(profileList);
for(UINT i=0; i<profileList.Num(); i++)
{
UINT id = (UINT)SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)profileList[i].Array());
if(profileList[i].CompareI(strCurProfile))
SendMessage(hwndTemp, CB_SETCURSEL, id, 0);
}
EnableWindow(hwndTemp, !App->bRunning);
EnableWindow(GetDlgItem(hwnd, IDC_ADD), FALSE);
EnableWindow(GetDlgItem(hwnd, IDC_RENAME), FALSE);
UINT numItems = (UINT)SendMessage(hwndTemp, CB_GETCOUNT, 0, 0);
EnableWindow(GetDlgItem(hwnd, IDC_REMOVE), (numItems > 1) && !App->bRunning);
//----------------------------------------------
bool bShowNotificationAreaIcon = AppConfig->GetInt(TEXT("General"), TEXT("ShowNotificationAreaIcon"), 0) != 0;
SendMessage(GetDlgItem(hwnd, IDC_NOTIFICATIONICON), BM_SETCHECK, bShowNotificationAreaIcon ? BST_CHECKED : BST_UNCHECKED, 0);
bool bMinimizeToNotificationArea = AppConfig->GetInt(TEXT("General"), TEXT("MinimizeToNotificationArea"), 0) != 0;
SendMessage(GetDlgItem(hwnd, IDC_MINIZENOTIFICATION), BM_SETCHECK, bMinimizeToNotificationArea ? BST_CHECKED : BST_UNCHECKED, 0);
//----------------------------------------------
App->bEnableProjectorCursor = GlobalConfig->GetInt(L"General", L"EnableProjectorCursor", 1) != 0;
SendMessage(GetDlgItem(hwnd, IDC_ENABLEPROJECTORCURSOR), BM_SETCHECK,
App->bEnableProjectorCursor ? BST_CHECKED : BST_UNCHECKED, 0);
//----------------------------------------------
bool showLogWindowOnLaunch = GlobalConfig->GetInt(TEXT("General"), TEXT("ShowLogWindowOnLaunch")) != 0;
SendMessage(GetDlgItem(hwnd, IDC_SHOWLOGWINDOWONLAUNCH), BM_SETCHECK, showLogWindowOnLaunch ? BST_CHECKED : BST_UNCHECKED, 0);
//----------------------------------------------
SetChangedSettings(false);
return TRUE;
}
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_LANGUAGE:
{
if(HIWORD(wParam) != CBN_SELCHANGE)
break;
HWND hwndTemp = (HWND)lParam;
SetWindowText(GetDlgItem(hwnd, IDC_INFO), Str("Settings.General.Restart"));
ShowWindow(GetDlgItem(hwnd, IDC_INFO), SW_SHOW);
SetChangedSettings(true);
break;
}
//.........这里部分代码省略.........
示例7: if
QSVEncoder(int fps, int width, int height, int quality, CTSTR preset, bool bUse444, ColorDescription &colorDesc, int maxBitrate, int bufferSize, bool bUseCFR_)
: fps(fps), bFirstFrameProcessed(false), width(width), height(height), max_bitrate(maxBitrate)
{
bUseCBR = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("UseCBR")) != 0;
bUseCFR = bUseCFR_;
UINT keyframeInterval = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("KeyframeInterval"), 6);
int keyint = fps*keyframeInterval;
int bframes = 7;
int qsv_preset = AppConfig->GetInt(L"Video Encoding", L"QSVPreset", 1); // MFX_TARGETUSAGE_BEST_QUALITY
if (qsv_preset < MFX_TARGETUSAGE_1 || qsv_preset > MFX_TARGETUSAGE_7) qsv_preset = MFX_TARGETUSAGE_1;
profile = MFX_PROFILE_AVC_HIGH;
if (AppConfig->GetString(TEXT("Video Encoding"), TEXT("X264Profile"), TEXT("high")) != L"high")
profile = MFX_PROFILE_AVC_MAIN;
bHaveCustomImpl = false;
impl_parameters custom = { 0 };
BOOL bUseCustomParams = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("UseCustomSettings"))
&& AppConfig->GetInt(TEXT("Video Encoding"), TEXT("QSVUseVideoEncoderSettings"));
if(bUseCustomParams)
{
StringList paramList;
String strCustomParams = AppConfig->GetString(TEXT("Video Encoding"), TEXT("CustomSettings"));
strCustomParams.KillSpaces();
if(strCustomParams.IsValid())
{
Log(TEXT("Using custom encoder settings: \"%s\""), strCustomParams.Array());
strCustomParams.GetTokenList(paramList, ' ', FALSE);
for(UINT i=0; i<paramList.Num(); i++)
{
String &strParam = paramList[i];
if(!schr(strParam, '='))
continue;
String strParamName = strParam.GetToken(0, '=');
String strParamVal = strParam.GetTokenOffset(1, '=');
if(strParamName == "keyint")
{
int keyint_ = strParamVal.ToInt();
if(keyint_ < 0)
continue;
keyint = keyint_;
}
else if(strParamName == "bframes")
{
int bframes_ = strParamVal.ToInt();
if(bframes_ < 0)
continue;
bframes = bframes_;
}
else if(strParamName == "qsvimpl")
{
StringList bits;
strParamVal.GetTokenList(bits, ',', true);
if(bits.Num() < 3)
continue;
StringList version;
bits[2].GetTokenList(version, '.', false);
if(version.Num() != 2)
continue;
custom.type = bits[0].ToInt();
if(custom.type == 0)
custom.type = MFX_IMPL_HARDWARE_ANY;
auto &intf = bits[1].MakeLower();
custom.intf = intf == "d3d11" ? MFX_IMPL_VIA_D3D11 : (intf == "d3d9" ? MFX_IMPL_VIA_D3D9 : MFX_IMPL_VIA_ANY);
custom.version.Major = version[0].ToInt();
custom.version.Minor = version[1].ToInt();
bHaveCustomImpl = true;
}
else if (strParamName == "profile")
{
if (strParamVal == L"baseline")
profile = MFX_PROFILE_AVC_BASELINE;
else if (strParamVal == L"main")
profile = MFX_PROFILE_AVC_MAIN;
else if (strParamVal == L"high")
profile = MFX_PROFILE_AVC_HIGH;
else
{
profile = MFX_PROFILE_AVC_HIGH;
Log(L"QSV: Unrecognized profile '%s', profile reset to default", strParamName);
}
}
}
}
}
if(!spawn_helper(event_prefix, qsvhelper_process, qsvhelper_thread, process_waiter))
CrashError(TEXT("Couldn't launch QSVHelper: %u"), GetLastError()); //FIXME: convert to localized error
//.........这里部分代码省略.........
示例8: UpdateSettings
void UpdateSettings()
{
for(UINT i=0; i<textures.Num(); i++)
delete textures[i];
textures.Clear();
//------------------------------------
bool bFirst = true;
StringList bitmapList;
data->GetStringList(TEXT("bitmap"), bitmapList);
for(UINT i=0; i<bitmapList.Num(); i++)
{
String &strBitmap = bitmapList[i];
if(strBitmap.IsEmpty())
{
AppWarning(TEXT("BitmapTransitionSource::UpdateSettings: Empty path"));
continue;
}
Texture *texture = GS->CreateTextureFromFile(strBitmap, TRUE);
if(!texture)
{
AppWarning(TEXT("BitmapTransitionSource::UpdateSettings: could not create texture '%s'"), strBitmap.Array());
continue;
}
if(bFirst)
{
fullSize.x = float(texture->Width());
fullSize.y = float(texture->Height());
baseAspect = double(fullSize.x)/double(fullSize.y);
bFirst = false;
}
textures << texture;
}
if(textures.Num() == 0)
CreateErrorTexture();
//------------------------------------
transitionTime = data->GetFloat(TEXT("transitionTime"));
if(transitionTime < MIN_TRANSITION_TIME)
transitionTime = MIN_TRANSITION_TIME;
else if(transitionTime > MAX_TRANSITION_TIME)
transitionTime = MAX_TRANSITION_TIME;
//------------------------------------
bFadeInOnly = data->GetInt(TEXT("fadeInOnly")) != 0;
bDisableFading = data->GetInt(TEXT("disableFading")) != 0;
bRandomize = data->GetInt(TEXT("randomize")) != 0;
//------------------------------------
curTransitionTime = 0.0f;
curTexture = 0;
if(bRandomize)
{
srand( (unsigned)time( NULL ) );
if(textures.Num() > 1)
{
curTexture = lrand(textures.Num());
while((nextTexture = lrand(textures.Num())) == curTexture);
}
}
else
nextTexture = (curTexture == textures.Num()-1) ? 0 : curTexture+1;
bTransitioning = false;
curFadeValue = 0.0f;
}
示例9: sizeof
//.........这里部分代码省略.........
if (bUesBackConfig)
{
keyframeInterval = CSLiveManager::GetInstance()->BSParam.LiveSetting.KeyFrameSec;
}
paramData.b_vfr_input = !bUseCFR;
paramData.i_width = width;
paramData.i_height = height;
paramData.vui.b_fullrange = colorDesc.fullRange;
paramData.vui.i_colorprim = colorDesc.primaries;
paramData.vui.i_transfer = colorDesc.transfer;
paramData.vui.i_colmatrix = colorDesc.matrix;
if (keyframeInterval)
paramData.i_keyint_max = fps*keyframeInterval;
paramData.i_fps_num = fps;
paramData.i_fps_den = 1;
paramData.i_timebase_num = 1;
paramData.i_timebase_den = 1000;
paramData.pf_log = get_x264_log;
paramData.i_log_level = X264_LOG_WARNING;
//分主次直播
int nBFrameCount = CSLiveManager::GetInstance()->BSParam.LiveSetting.BFrameCount;
if (bUesBackConfig)
{
nBFrameCount = CSLiveManager::GetInstance()->BSParam.LiveSetting.BFrameCountSec;
}
if (-1 != nBFrameCount)
{
paramData.i_bframe = nBFrameCount;
}
//录制高品质不能播放
paramData.b_vfr_input = 0;
if (0 == nBFrameCount)
{
// http://bbs.csdn.net/topics/390922653
paramData.rc.i_lookahead = 0;
paramData.i_sync_lookahead = 0;
paramData.i_bframe = 0;
paramData.b_sliced_threads = 1;
paramData.rc.b_mb_tree = 0;
}
if (scmpi(curProfile, L"main") == 0)
paramData.i_level_idc = 41; // to ensure compatibility with portable devices
for (UINT i = 0; i<paramList.Num(); i++)
{
String &strParam = paramList[i];
if (!schr(strParam, '='))
continue;
String strParamName = strParam.GetToken(0, '=');
String strParamVal = strParam.GetTokenOffset(1, '=');
if (strParamName.CompareI(TEXT("fps")) ||
strParamName.CompareI(TEXT("force-cfr")))
{
Log(TEXT("The custom x264 command '%s' is unsupported, use the application settings instead"), strParam.Array());
continue;
}
else
{
LPSTR lpParam = strParamName.CreateUTF8String();
LPSTR lpVal = strParamVal.CreateUTF8String();
if (x264_param_parse(¶mData, lpParam, lpVal) != 0)
Log(TEXT("The custom x264 command '%s' failed"), strParam.Array());
Free(lpParam);
Free(lpVal);
}
}
if (bUse444) paramData.i_csp = X264_CSP_I444;
else paramData.i_csp = X264_CSP_I420;
colorDesc.fullRange = paramData.vui.b_fullrange;
colorDesc.primaries = paramData.vui.i_colorprim;
colorDesc.transfer = paramData.vui.i_transfer;
colorDesc.matrix = paramData.vui.i_colmatrix;
if (curProfile)
{
LPSTR lpProfile = curProfile.CreateUTF8String();
if (x264_param_apply_profile(¶mData, lpProfile))
Log::writeMessage(LOG_RTSPSERV,1,"LiveSDK_Log:Failed to set x264 profile: %s", curProfile.Array());
Free(lpProfile);
}
}
示例10: SetWarningInfo
void SettingsPublish::SetWarningInfo()
{
int serviceID = (int)SendMessage(GetDlgItem(hwnd, IDC_SERVICE), CB_GETITEMDATA, SendMessage(GetDlgItem(hwnd, IDC_SERVICE), CB_GETCURSEL, 0, 0), 0);
bool bUseCBR = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("UseCBR"), 1) != 0;
int maxBitRate = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("MaxBitrate"), 1000);
int keyframeInt = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("KeyframeInterval"), 0);
int audioBitRate = AppConfig->GetInt(TEXT("Audio Encoding"), TEXT("Bitrate"), 96);
String currentx264Profile = AppConfig->GetString(TEXT("Video Encoding"), TEXT("X264Profile"), L"high");
String currentAudioCodec = AppConfig->GetString(TEXT("Audio Encoding"), TEXT("Codec"), TEXT("AAC"));
float currentAspect = AppConfig->GetInt(L"Video", L"BaseWidth") / (float)max(1, AppConfig->GetInt(L"Video", L"BaseHeight"));
//ignore for non-livestreams
if (data.mode != 0)
{
SetDlgItemText(hwnd, IDC_WARNINGS, TEXT(""));
return;
}
bool hasErrors = false;
bool canOptimize = false;
String strWarnings;
XConfig serverData;
if(serverData.Open(TEXT("services.xconfig")))
{
XElement *services = serverData.GetElement(TEXT("services"));
if(services)
{
UINT numServices = services->NumElements();
for(UINT i=0; i<numServices; i++)
{
XElement *service = services->GetElementByID(i);
if (service->GetInt(TEXT("id")) == serviceID)
{
strWarnings = FormattedString(Str("Settings.Publish.Warning.BadSettings"), service->GetName());
//check to see if the service we're using has recommendations
if (!service->HasItem(TEXT("recommended")))
{
SetDlgItemText(hwnd, IDC_WARNINGS, TEXT(""));
return;
}
XElement *r = service->GetElement(TEXT("recommended"));
if (r->HasItem(TEXT("ratecontrol")))
{
CTSTR rc = r->GetString(TEXT("ratecontrol"));
if (!scmp (rc, TEXT("cbr")) && !bUseCBR)
{
hasErrors = true;
canOptimize = true;
strWarnings << Str("Settings.Publish.Warning.UseCBR");
}
}
if (r->HasItem(TEXT("max bitrate")))
{
int max_bitrate = r->GetInt(TEXT("max bitrate"));
if (maxBitRate > max_bitrate)
{
hasErrors = true;
canOptimize = true;
strWarnings << FormattedString(Str("Settings.Publish.Warning.Maxbitrate"), max_bitrate);
}
}
if (r->HasItem(L"supported audio codec"))
{
StringList codecs;
r->GetStringList(L"supported audio codec", codecs);
if (codecs.FindValueIndex(currentAudioCodec) == INVALID)
{
String msg = Str("Settings.Publish.Warning.UnsupportedAudioCodec"); //good thing OBS only supports MP3 (and AAC), otherwise I'd have to come up with a better translation solution
msg.FindReplace(L"$1", codecs[0].Array());
msg.FindReplace(L"$2", currentAudioCodec.Array());
hasErrors = true;
canOptimize = true;
strWarnings << msg;
}
}
if (r->HasItem(TEXT("max audio bitrate aac")) && (!scmp(currentAudioCodec, TEXT("AAC"))))
{
int maxaudioaac = r->GetInt(TEXT("max audio bitrate aac"));
if (audioBitRate > maxaudioaac)
{
hasErrors = true;
canOptimize = true;
strWarnings << FormattedString(Str("Settings.Publish.Warning.MaxAudiobitrate"), maxaudioaac);
}
}
if (r->HasItem(TEXT("max audio bitrate mp3")) && (!scmp(currentAudioCodec, TEXT("MP3"))))
{
int maxaudiomp3 = r->GetInt(TEXT("max audio bitrate mp3"));
if (audioBitRate > maxaudiomp3)
{
//.........这里部分代码省略.........