本文整理汇总了C++中XElement::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ XElement::GetName方法的具体用法?C++ XElement::GetName怎么用?C++ XElement::GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XElement
的用法示例。
在下文中一共展示了XElement::GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckSources
void OBS::CheckSources()
{
XElement *curSceneElement = App->sceneElement;
XElement *sources = curSceneElement->GetElement(TEXT("sources"));
if(!sources)
return;
HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES);
UINT numSources = ListView_GetItemCount(hwndSources);
for(UINT i = 0; i < numSources; i++)
{
bool checked = ListView_GetCheckState(hwndSources, i) > 0;
XElement *source =sources->GetElementByID(i);
bool curRender = source->GetInt(TEXT("render"), 0) > 0;
if(curRender != checked)
{
source->SetInt(TEXT("render"), (checked)?1:0);
if(scene && i < scene->NumSceneItems())
{
SceneItem *sceneItem = scene->GetSceneItem(i);
sceneItem->bRender = checked;
sceneItem->SetRender(checked);
}
ReportSourceChanged(source->GetName(), source);
}
}
}
示例2: HandleGetSceneList
json_t* OBSAPIMessageHandler::HandleGetSceneList(OBSAPIMessageHandler* handler, json_t* message)
{
OBSEnterSceneMutex();
json_t* ret = GetOkResponse();
XElement* xscenes = OBSGetSceneListElement();
XElement* currentScene = OBSGetSceneElement();
json_object_set_new(ret, "current-scene", json_string_wchar(currentScene->GetName()));
json_t* scenes = json_array();
if(scenes != NULL)
{
int numScenes = xscenes->NumElements();
for(int i = 0; i < numScenes; i++)
{
XElement* scene = xscenes->GetElementByID(i);
json_array_append_new(scenes, getSceneJson(scene));
}
}
json_object_set_new(ret,"scenes", scenes);
OBSLeaveSceneMutex();
return ret;
}
示例3: GetGlobalSourceNames
void OBS::GetGlobalSourceNames(List<CTSTR> &globalSourceNames)
{
globalSourceNames.Clear();
XElement *globals = scenesConfig.GetElement(TEXT("global sources"));
if(globals)
{
UINT numSources = globals->NumElements();
for(UINT i=0; i<numSources; i++)
{
XElement *sourceElement = globals->GetElementByID(i);
globalSourceNames << sourceElement->GetName();
}
}
}
示例4: GetHandler
WebRequest* WProcessEngine::ParseRequest(XDocument* pxDoc, const char* mapName)
{
XElement *pxRoot = pxDoc->GetRootNode();
const char* request = pxRoot->GetName();
WebHandler* handler = GetHandler(request);
if(handler == NULL)
{
char msg[AUGE_MSG_MAX];
g_sprintf(msg, "%s doesn't support request [%s]", GetType(), request);
GLogger* pLogger = augeGetLoggerInstance();
pLogger->Error(msg, __FILE__, __LINE__);
GError* pError = augeGetErrorInstance();
pError->SetError(msg);
return NULL;
}
return handler->ParseRequest(pxDoc, mapName);
}
示例5: SceneHotkey
void STDCALL SceneHotkey(DWORD hotkey, UPARAM param, bool bDown)
{
if(!bDown) return;
XElement *scenes = API->GetSceneListElement();
if(scenes)
{
UINT numScenes = scenes->NumElements();
for(UINT i=0; i<numScenes; i++)
{
XElement *scene = scenes->GetElementByID(i);
DWORD sceneHotkey = (DWORD)scene->GetInt(TEXT("hotkey"));
if(sceneHotkey == hotkey)
{
App->SetScene(scene->GetName());
return;
}
}
}
}
示例6: SourceOrderChanged
void WebSocketOBSTriggerHandler::SourceOrderChanged()
{
json_t* update = json_object();
json_object_set_new(update, "update-type", json_string("SourceOrderChanged"));
XElement* xsources = OBSGetSceneElement()->GetElement(TEXT("sources"));
json_t* sources = json_array();
for(UINT i = 0; i < xsources->NumElements(); i++)
{
XElement* source = xsources->GetElementByID(i);
json_array_append_new(sources, json_string_wchar(source->GetName()));
}
json_object_set_new(update, "sources", sources);
OSEnterMutex(this->updateQueueMutex);
this->updates.Add(update);
OSLeaveMutex(this->updateQueueMutex);
}
示例7: SetSourceRender
void OBS::SetSourceRender(CTSTR sourceName, bool render)
{
XElement *curSceneElement = App->sceneElement;
XElement *sources = curSceneElement->GetElement(TEXT("sources"));
if(!sources)
return;
HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES);
UINT numSources = ListView_GetItemCount(hwndSources);
for(UINT i = 0; i < numSources; i++)
{
bool checked = ListView_GetCheckState(hwndSources, i) > 0;
XElement *source =sources->GetElementByID(i);
if(scmp(source->GetName(), sourceName) == 0 && checked != render)
{
if(scene && i < scene->NumSceneItems())
{
SceneItem *sceneItem = scene->GetSceneItem(i);
sceneItem->SetRender(render);
}
else
{
source->SetInt(TEXT("render"), (render)?1:0);
}
App->bChangingSources = true;
ListView_SetCheckState(hwndSources, i, render);
App->bChangingSources = false;
ReportSourceChanged(sourceName, source);
break;
}
}
}
示例8: HandleGetCurrentScene
json_t* OBSAPIMessageHandler::HandleGetCurrentScene(OBSAPIMessageHandler* handler, json_t* message)
{
OBSEnterSceneMutex();
json_t* ret = GetOkResponse();
XElement* scene = OBSGetSceneElement();
json_object_set_new(ret, "name", json_string_wchar(scene->GetName()));
XElement* sources = scene->GetElement(TEXT("sources"));
json_t* scene_items = json_array();
if(sources != NULL)
{
for(UINT i = 0; i < sources->NumElements(); i++)
{
XElement* source = sources->GetElementByID(i);
json_array_append_new(scene_items, getSourceJson(source));
}
}
json_object_set_new(ret, "sources", scene_items);
OBSLeaveSceneMutex();
return ret;
}
示例9: SetScene
bool OBS::SetScene(CTSTR lpScene)
{
if(bDisableSceneSwitching)
return false;
HWND hwndScenes = GetDlgItem(hwndMain, ID_SCENES);
UINT curSel = (UINT)SendMessage(hwndScenes, LB_GETCURSEL, 0, 0);
//-------------------------
if(curSel != LB_ERR)
{
UINT textLen = (UINT)SendMessage(hwndScenes, LB_GETTEXTLEN, curSel, 0);
String strLBName;
strLBName.SetLength(textLen);
SendMessage(hwndScenes, LB_GETTEXT, curSel, (LPARAM)strLBName.Array());
if(!strLBName.CompareI(lpScene))
{
UINT id = (UINT)SendMessage(hwndScenes, LB_FINDSTRINGEXACT, -1, (LPARAM)lpScene);
if(id == LB_ERR)
return false;
SendMessage(hwndScenes, LB_SETCURSEL, id, 0);
}
}
else
{
UINT id = (UINT)SendMessage(hwndScenes, LB_FINDSTRINGEXACT, -1, (LPARAM)lpScene);
if(id == LB_ERR)
return false;
SendMessage(hwndScenes, LB_SETCURSEL, id, 0);
}
//-------------------------
XElement *scenes = scenesConfig.GetElement(TEXT("scenes"));
XElement *newSceneElement = scenes->GetElement(lpScene);
if(!newSceneElement)
return false;
if(sceneElement == newSceneElement)
return true;
sceneElement = newSceneElement;
CTSTR lpClass = sceneElement->GetString(TEXT("class"));
if(!lpClass)
{
AppWarning(TEXT("OBS::SetScene: no class found for scene '%s'"), newSceneElement->GetName());
return false;
}
DWORD sceneChangeStartTime;
if(bRunning)
{
Log(TEXT("++++++++++++++++++++++++++++++++++++++++++++++++++++++"));
Log(TEXT(" New Scene"));
sceneChangeStartTime = OSGetTime();
}
XElement *sceneData = newSceneElement->GetElement(TEXT("data"));
//-------------------------
Scene *newScene = NULL;
if(bRunning)
newScene = CreateScene(lpClass, sceneData);
//-------------------------
HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES);
SendMessage(hwndSources, WM_SETREDRAW, (WPARAM)FALSE, (LPARAM) 0);
bChangingSources = true;
ListView_DeleteAllItems(hwndSources);
XElement *sources = sceneElement->GetElement(TEXT("sources"));
if(sources)
{
UINT numSources = sources->NumElements();
ListView_SetItemCount(hwndSources, numSources);
for(UINT i=0; i<numSources; i++)
{
XElement *sourceElement = sources->GetElementByID(i);
bool render = sourceElement->GetInt(TEXT("render"), 1) > 0;
InsertSourceItem(i, (LPWSTR)sourceElement->GetName(), render);
if(bRunning && newScene)
newScene->AddImageSource(sourceElement);
}
}
//.........这里部分代码省略.........
示例10: ProcMessage
INT_PTR SettingsPublish::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
HWND hwndTemp;
switch(message)
{
case WM_INITDIALOG:
{
LocalizeWindow(hwnd);
RECT serviceRect, saveToFileRect;
GetWindowRect(GetDlgItem(hwnd, IDC_SERVICE), &serviceRect);
GetWindowRect(GetDlgItem(hwnd, IDC_SAVEPATH), &saveToFileRect);
data.fileControlOffset = saveToFileRect.top-serviceRect.top;
//--------------------------------------------
hwndTemp = GetDlgItem(hwnd, IDC_MODE);
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)Str("Settings.Publish.Mode.LiveStream"));
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)Str("Settings.Publish.Mode.FileOnly"));
int mode = LoadSettingComboInt(hwndTemp, TEXT("Publish"), TEXT("Mode"), 0, 2);
data.mode = mode;
//--------------------------------------------
hwndTemp = GetDlgItem(hwnd, IDC_SERVICE);
int itemId = (int)SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("Custom"));
SendMessage(hwndTemp, CB_SETITEMDATA, itemId, 0);
UINT numServices = 0;
XConfig serverData;
if(serverData.Open(TEXT("services.xconfig")))
{
XElement *services = serverData.GetElement(TEXT("services"));
if(services)
{
numServices = services->NumElements();
for(UINT i=0; i<numServices; i++)
{
XElement *service = services->GetElementByID(i);
itemId = (int)SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)service->GetName());
SendMessage(hwndTemp, CB_SETITEMDATA, itemId, service->GetInt(TEXT("id")));
}
}
}
int serviceID = AppConfig->GetInt(TEXT("Publish"), TEXT("Service"), 0);
if(mode != 0) ShowWindow(hwndTemp, SW_HIDE);
//--------------------------------------------
hwndTemp = GetDlgItem(hwnd, IDC_PLAYPATH);
LoadSettingEditString(hwndTemp, TEXT("Publish"), TEXT("PlayPath"), NULL);
if(mode != 0) ShowWindow(hwndTemp, SW_HIDE);
if(serviceID == 0) //custom
{
ShowWindow(GetDlgItem(hwnd, IDC_SERVERLIST), SW_HIDE);
hwndTemp = GetDlgItem(hwnd, IDC_URL);
LoadSettingEditString(hwndTemp, TEXT("Publish"), TEXT("URL"), NULL);
SendDlgItemMessage(hwnd, IDC_SERVICE, CB_SETCURSEL, 0, 0);
}
else
{
ShowWindow(GetDlgItem(hwnd, IDC_URL), SW_HIDE);
hwndTemp = GetDlgItem(hwnd, IDC_SERVERLIST);
XElement *services = serverData.GetElement(TEXT("services"));
if(services)
{
XElement *service = NULL;
numServices = services->NumElements();
for(UINT i=0; i<numServices; i++)
{
XElement *curService = services->GetElementByID(i);
if(curService->GetInt(TEXT("id")) == serviceID)
{
SendDlgItemMessage(hwnd, IDC_SERVICE, CB_SETCURSEL, i+1, 0);
service = curService;
break;
}
}
if(service)
{
XElement *servers = service->GetElement(TEXT("servers"));
if(servers)
{
UINT numServers = servers->NumDataItems();
for(UINT i=0; i<numServers; i++)
{
XDataItem *server = servers->GetDataItemByID(i);
SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)server->GetName());
}
}
//.........这里部分代码省略.........
示例11: CreateConnectionThread
DWORD WINAPI RTMPPublisher::CreateConnectionThread(RTMPPublisher *publisher)
{
//------------------------------------------------------
// set up URL
bool bRetry = false;
bool bSuccess = false;
bool bCanRetry = false;
String failReason;
String strBindIP;
int serviceID = AppConfig->GetInt (TEXT("Publish"), TEXT("Service"));
String strURL = AppConfig->GetString(TEXT("Publish"), TEXT("URL"));
String strPlayPath = AppConfig->GetString(TEXT("Publish"), TEXT("PlayPath"));
strURL.KillSpaces();
strPlayPath.KillSpaces();
LPSTR lpAnsiURL = NULL, lpAnsiPlaypath = NULL;
RTMP *rtmp = NULL;
//--------------------------------
// unbelievably disgusting hack for elgato devices
String strOldDirectory;
UINT dirSize = GetCurrentDirectory(0, 0);
strOldDirectory.SetLength(dirSize);
GetCurrentDirectory(dirSize, strOldDirectory.Array());
OSSetCurrentDirectory(API->GetAppPath());
//--------------------------------
if(!strURL.IsValid())
{
failReason = TEXT("No server specified to connect to");
goto end;
}
if(serviceID != 0)
{
XConfig serverData;
if(!serverData.Open(TEXT("services.xconfig")))
{
failReason = TEXT("Could not open services.xconfig");
goto end;
}
XElement *services = serverData.GetElement(TEXT("services"));
if(!services)
{
failReason = TEXT("Could not find any services in services.xconfig");
goto end;
}
XElement *service = NULL;
DWORD numServices = services->NumElements();
for(UINT i=0; i<numServices; i++)
{
XElement *curService = services->GetElementByID(i);
if(curService->GetInt(TEXT("id")) == serviceID)
{
service = curService;
break;
}
}
if(!service)
{
failReason = TEXT("Could not find the service specified in services.xconfig");
goto end;
}
XElement *servers = service->GetElement(TEXT("servers"));
if(!servers)
{
failReason = TEXT("Could not find any servers for the service specified in services.xconfig");
goto end;
}
XDataItem *item = servers->GetDataItem(strURL);
if(!item)
item = servers->GetDataItemByID(0);
strURL = item->GetData();
Log(TEXT("Using RTMP service: %s"), service->GetName());
Log(TEXT(" Server selection: %s"), strURL.Array());
}
//------------------------------------------------------
// now back to the elgato directory if it needs the directory changed still to function *sigh*
OSSetCurrentDirectory(strOldDirectory);
//------------------------------------------------------
rtmp = RTMP_Alloc();
RTMP_Init(rtmp);
//.........这里部分代码省略.........
示例12: SetScene
bool OBS::SetScene(CTSTR lpScene)
{
if(bDisableSceneSwitching)
return false;
HWND hwndScenes = GetDlgItem(hwndMain, ID_SCENES);
UINT curSel = (UINT)SendMessage(hwndScenes, LB_GETCURSEL, 0, 0);
//-------------------------
if(curSel != LB_ERR)
{
UINT textLen = (UINT)SendMessage(hwndScenes, LB_GETTEXTLEN, curSel, 0);
String strLBName;
strLBName.SetLength(textLen);
SendMessage(hwndScenes, LB_GETTEXT, curSel, (LPARAM)strLBName.Array());
if(!strLBName.CompareI(lpScene))
{
UINT id = (UINT)SendMessage(hwndScenes, LB_FINDSTRINGEXACT, -1, (LPARAM)lpScene);
if(id == LB_ERR)
return false;
SendMessage(hwndScenes, LB_SETCURSEL, id, 0);
}
}
else
{
UINT id = (UINT)SendMessage(hwndScenes, LB_FINDSTRINGEXACT, -1, (LPARAM)lpScene);
if(id == LB_ERR)
return false;
SendMessage(hwndScenes, LB_SETCURSEL, id, 0);
}
//-------------------------
XElement *scenes = scenesConfig.GetElement(TEXT("scenes"));
XElement *newSceneElement = scenes->GetElement(lpScene);
if(!newSceneElement)
return false;
if(sceneElement == newSceneElement)
return true;
sceneElement = newSceneElement;
CTSTR lpClass = sceneElement->GetString(TEXT("class"));
if(!lpClass)
{
AppWarning(TEXT("OBS::SetScene: no class found for scene '%s'"), newSceneElement->GetName());
return false;
}
if(bRunning)
{
Log(TEXT("++++++++++++++++++++++++++++++++++++++++++++++++++++++"));
Log(TEXT(" New Scene"));
}
XElement *sceneData = newSceneElement->GetElement(TEXT("data"));
//-------------------------
Scene *newScene = NULL;
if(bRunning)
newScene = CreateScene(lpClass, sceneData);
//-------------------------
HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES);
SendMessage(hwndSources, WM_SETREDRAW, (WPARAM)FALSE, (LPARAM) 0);
bChangingSources = true;
ListView_DeleteAllItems(hwndSources);
XElement *sources = sceneElement->GetElement(TEXT("sources"));
if(sources)
{
UINT numSources = sources->NumElements();
ListView_SetItemCount(hwndSources, numSources);
for(UINT i=0; i<numSources; i++)
{
XElement *sourceElement = sources->GetElementByID(i);
bool render = sourceElement->GetInt(TEXT("render"), 1) > 0;
AddSourceItem((LPWSTR)sourceElement->GetName(), render, i);
if(bRunning && newScene)
newScene->AddImageSource(sourceElement);
}
}
bChangingSources = false;
SendMessage(hwndSources, WM_SETREDRAW, (WPARAM)TRUE, (LPARAM) 0);
RedrawWindow(hwndSources, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
//.........这里部分代码省略.........
示例13: 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)
{
//.........这里部分代码省略.........
示例14: 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"));
//ignore for non-livestreams
if (data->mode != 0)
{
SetDlgItemText(hwnd, IDC_WARNINGS, TEXT(""));
return;
}
int errors = 0;
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)
{
errors++;
strWarnings << Str("Settings.Publish.Warning.UseCBR");
}
}
if (r->HasItem(TEXT("max bitrate")))
{
int max_bitrate = r->GetInt(TEXT("max bitrate"));
if (maxBitRate > max_bitrate)
{
errors++;
strWarnings << FormattedString(Str("Settings.Publish.Warning.Maxbitrate"), max_bitrate);
}
}
if (r->HasItem(TEXT("profile")))
{
String expectedProfile = r->GetString(TEXT("profile"));
if (!expectedProfile.CompareI(currentx264Profile))
{
errors++;
strWarnings << Str("Settings.Publish.Warning.RecommendMainProfile");
}
}
if (r->HasItem(TEXT("max audio bitrate aac")) && (!scmp(currentAudioCodec, TEXT("AAC"))))
{
int maxaudioaac = r->GetInt(TEXT("max audio bitrate aac"));
if (audioBitRate > maxaudioaac)
{
errors++;
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)
{
errors++;
strWarnings << FormattedString(Str("Settings.Publish.Warning.MaxAudiobitrate"), maxaudiomp3);
}
}
if (r->HasItem(TEXT("keyint")))
{
int keyint = r->GetInt(TEXT("keyint"));
if (!keyframeInt || keyframeInt * 1000 > keyint)
//.........这里部分代码省略.........
示例15: SetScene
bool OBS::SetScene(CTSTR lpScene)
{
if(bDisableSceneSwitching)
return false;
HWND hwndScenes = GetDlgItem(hwndMain, ID_SCENES);
UINT curSel = (UINT)SendMessage(hwndScenes, LB_GETCURSEL, 0, 0);
//-------------------------
if(curSel != LB_ERR)
{
UINT textLen = (UINT)SendMessage(hwndScenes, LB_GETTEXTLEN, curSel, 0);
String strLBName;
strLBName.SetLength(textLen);
SendMessage(hwndScenes, LB_GETTEXT, curSel, (LPARAM)strLBName.Array());
if(!strLBName.CompareI(lpScene))
{
UINT id = (UINT)SendMessage(hwndScenes, LB_FINDSTRINGEXACT, -1, (LPARAM)lpScene);
if(id == LB_ERR)
return false;
SendMessage(hwndScenes, LB_SETCURSEL, id, 0);
}
}
else
{
UINT id = (UINT)SendMessage(hwndScenes, LB_FINDSTRINGEXACT, -1, (LPARAM)lpScene);
if(id == LB_ERR)
return false;
SendMessage(hwndScenes, LB_SETCURSEL, id, 0);
}
//-------------------------
XElement *scenes = scenesConfig.GetElement(TEXT("scenes"));
XElement *newSceneElement = scenes->GetElement(lpScene);
if(!newSceneElement)
return false;
if(sceneElement == newSceneElement)
return true;
sceneElement = newSceneElement;
CTSTR lpClass = sceneElement->GetString(TEXT("class"));
if(!lpClass)
{
AppWarning(TEXT("OBS::SetScene: no class found for scene '%s'"), newSceneElement->GetName());
return false;
}
DWORD sceneChangeStartTime;
if(bRunning)
{
Log(TEXT("++++++++++++++++++++++++++++++++++++++++++++++++++++++"));
Log(TEXT(" New Scene"));
sceneChangeStartTime = OSGetTime();
}
XElement *sceneData = newSceneElement->GetElement(TEXT("data"));
//-------------------------
Scene *newScene = NULL;
if(bRunning)
newScene = CreateScene(lpClass, sceneData);
//-------------------------
HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES);
SendMessage(hwndSources, WM_SETREDRAW, (WPARAM)FALSE, (LPARAM) 0);
App->scaleItem = NULL;
bChangingSources = true;
ListView_DeleteAllItems(hwndSources);
bool bSkipTransition = false;
XElement *sources = sceneElement->GetElement(TEXT("sources"));
if(sources)
{
UINT numSources = sources->NumElements();
ListView_SetItemCount(hwndSources, numSources);
for(UINT i=0; i<numSources; i++)
{
XElement *sourceElement = sources->GetElementByID(i);
String className = sourceElement->GetString(TEXT("class"));
if(className == "DeviceCapture") {
// There's a capture device in the next scene that isn't a global source,
// so let's skip the transition since it won't work anyway.
//.........这里部分代码省略.........