本文整理汇总了C++中String::CompareI方法的典型用法代码示例。如果您正苦于以下问题:C++ String::CompareI方法的具体用法?C++ String::CompareI怎么用?C++ String::CompareI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::CompareI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateFLVFileStream
VideoFileStream *CreateFileStream(String strOutputFile)
{
String strFileExtension = GetPathExtension(strOutputFile);
if (strFileExtension.CompareI(TEXT("flv")))
return CreateFLVFileStream(strOutputFile);
else if (strFileExtension.CompareI(TEXT("mp4")))
return CreateMP4FileStream(strOutputFile);
return nullptr;
}
示例2: valid_x264_string
bool valid_x264_string(const String &str, const char **x264StringList)
{
do
{
if(str.CompareI(String(*x264StringList)))
return true;
} while (*++x264StringList != 0);
return false;
}
示例3: OSFileHasChanged
BOOL STDCALL OSFileHasChanged (OSFileChangeData *data)
{
BOOL hasModified = FALSE;
if(HasOverlappedIoCompleted(&data->directoryChange))
{
FILE_NOTIFY_INFORMATION *notify = (FILE_NOTIFY_INFORMATION*)data->changeBuffer;
for (;;)
{
if (notify->Action != FILE_ACTION_RENAMED_OLD_NAME && notify->Action != FILE_ACTION_REMOVED)
{
String strFileName;
strFileName.SetLength(notify->FileNameLength);
scpy_n(strFileName, notify->FileName, notify->FileNameLength/2);
strFileName.KillSpaces();
String strFileChanged;
strFileChanged << data->strDirectory << strFileName;
if(strFileChanged.CompareI(data->targetFileName))
{
hasModified = TRUE;
break;
}
}
if (!notify->NextEntryOffset)
break;
notify = (FILE_NOTIFY_INFORMATION*)((BYTE *)notify + notify->NextEntryOffset);
}
CloseHandle (data->directoryChange.hEvent);
DWORD test;
zero(&data->directoryChange, sizeof(data->directoryChange));
zero(data->changeBuffer, sizeof(data->changeBuffer));
data->directoryChange.hEvent = CreateEvent (NULL, TRUE, FALSE, NULL);
if(ReadDirectoryChangesW(data->hDirectory, data->changeBuffer, 2048, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_SIZE, &test, &data->directoryChange, NULL))
{
}
else
{
CloseHandle(data->directoryChange.hEvent);
CloseHandle(data->hDirectory);
return hasModified;
}
}
return hasModified;
}
示例4: Initialize
bool DeviceAudioSource::Initialize(DeviceSource *parent)
{
m_timeStart = 0;
device = parent;
if (!hAudioMutex)
hAudioMutex = OSCreateMutex();
m_bErrorLog = false;
lastTimestamp = 0;
//---------------------------------
bool bFloat = false;
UINT inputChannels;
UINT inputSamplesPerSec;
UINT inputBitsPerSample;
//UINT inputBlockSize;
DWORD inputChannelMask;
//---------------------------------
if(device->audioFormat.wFormatTag == WAVE_FORMAT_EXTENSIBLE)
{
WAVEFORMATEXTENSIBLE *wfext = (WAVEFORMATEXTENSIBLE*)&device->audioFormat;
if(wfext->SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)
bFloat = true;
}
else if(device->audioFormat.wFormatTag == WAVE_FORMAT_IEEE_FLOAT)
bFloat = true;
inputBitsPerSample = device->audioFormat.wBitsPerSample;
inputBlockSize = device->audioFormat.nBlockAlign;
inputChannelMask = 0;
inputChannels = device->audioFormat.nChannels;
inputSamplesPerSec = device->audioFormat.nSamplesPerSec;
sampleFrameCount = inputSamplesPerSec/100;
sampleSegmentSize = inputBlockSize*sampleFrameCount;
outputBuffer.SetSize(sampleSegmentSize);
InitAudioData(bFloat, inputChannels, inputSamplesPerSec, inputBitsPerSample, inputBlockSize, inputChannelMask);
if (m_pAudioWaveOut)
{
m_pAudioWaveOut->Uninitialize();
}
String strReanderName = GetDirectorMonitorDevices();
if (NULL == m_pAudioWaveOut)
{
if (!strReanderName.Compare(TEXT("禁用")) && !m_pAudioWaveOut)
{
m_pAudioWaveOut = new AudioWaveOut;
}
}
else
{
if ((strReanderName.Compare(TEXT("Disable")) || strReanderName.Compare(TEXT("禁用"))))
{
delete m_pAudioWaveOut;
m_pAudioWaveOut = NULL;
}
}
if (NULL != m_pAudioWaveOut)
{
m_pAudioWaveOut->Initialize(strReanderName.Array(), inputChannels, inputSamplesPerSec, inputBitsPerSample);
}
String SecRenderName = GetSecMonitorDevices();
if (m_pSecWaveOut)
{
m_pSecWaveOut->Uninitialize();
}
if (SecRenderName.CompareI(strReanderName.Array()) && (!SecRenderName.Compare(TEXT("Disable")) || !SecRenderName.Compare(TEXT("禁用"))))
{
bSameDevice = true;
}
else if (!SecRenderName.Compare(TEXT("禁用")) && !m_pSecWaveOut)
{
m_pSecWaveOut = new AudioWaveOut;
}
else if (m_pSecWaveOut)
{
if ((SecRenderName.Compare(TEXT("Disable")) || SecRenderName.Compare(TEXT("禁用"))))
{
delete m_pSecWaveOut;
m_pSecWaveOut = NULL;
}
}
if (m_pSecWaveOut)
{
m_pSecWaveOut->Initialize(SecRenderName.Array(), inputChannels, inputSamplesPerSec, inputBitsPerSample);
}
return true;
}
示例5: ProcessShader
BOOL ShaderProcessor::ProcessShader(CTSTR input)
{
String curToken;
BOOL bError = FALSE;
SetCodeStart(input);
TSTR lpLastPos = lpTemp;
DWORD curInsideCount = 0;
BOOL bNewCodeLine = TRUE;
while(GetNextToken(curToken))
{
TSTR lpCurPos = lpTemp-curToken.Length();
if(curToken[0] == '{')
++curInsideCount;
else if(curToken[0] == '}')
--curInsideCount;
else if(curToken[0] == '(')
++curInsideCount;
else if(curToken[0] == ')')
--curInsideCount;
else if(!curInsideCount && bNewCodeLine) //not inside any code, so this is some sort of declaration (function/struct/var)
{
if(curToken == TEXT("struct"))
{
//try to see if this is the vertex definition structure
bool bFoundDefinitionStruct = false;
HandMeAToken(curToken);
ExpectTokenIgnore(TEXT("{"));
curInsideCount = 1;
do
{
HandMeAToken(curToken);
if(curToken.Length() <= 6 && scmpi_n(curToken, TEXT("float"), 5) == 0)
{
String strType = curToken;
String strName;
HandMeAToken(strName);
HandMeAToken(curToken);
if(curToken[0] != ':') //cancel if not a vertex definition structure
{
bFoundDefinitionStruct = false;
break;
}
String strSemantic;
HandMeAToken(strSemantic);
SemanticInfo semanticInfo;
if(!GetSemanticInfo(strSemantic, semanticInfo))
{
bFoundDefinitionStruct = false;
break;
}
D3D10_INPUT_ELEMENT_DESC inputElement;
inputElement.SemanticName = semanticInfo.lpName;
inputElement.SemanticIndex = semanticInfo.index;
inputElement.InputSlot = 0;
inputElement.AlignedByteOffset = 0;
inputElement.InputSlotClass = D3D10_INPUT_PER_VERTEX_DATA;
inputElement.InstanceDataStepRate = 0;
if(strSemantic.CompareI(TEXT("color")))
inputElement.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
else
{
switch(strType[5])
{
case 0: inputElement.Format = DXGI_FORMAT_R32_FLOAT; break;
case '2': inputElement.Format = DXGI_FORMAT_R32G32_FLOAT; break;
case '3': inputElement.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; break; //todo: check this some time
case '4': inputElement.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; break;
}
}
ExpectToken(TEXT(";"), TEXT(";"));
PeekAtAToken(curToken);
generatedLayout << inputElement;
bFoundDefinitionStruct = true;
}
else
{
bFoundDefinitionStruct = false;
break; //vertex definition structures should really only ever have float values
}
} while (curToken[0] != '}');
//set up the slots so they match up with vertex buffers
//.........这里部分代码省略.........
示例6: Start
//.........这里部分代码省略.........
GetAudioDevices(playbackDevices, ADT_PLAYBACK);
String strPlaybackDevice = AppConfig->GetString(TEXT("Audio"), TEXT("PlaybackDevice"), TEXT("Default"));
if(strPlaybackDevice.IsEmpty() || !playbackDevices.HasID(strPlaybackDevice))
{
AppConfig->SetString(TEXT("Audio"), TEXT("PlaybackDevice"), TEXT("Default"));
strPlaybackDevice = TEXT("Default");
}
Log(TEXT("Playback device %s"), strPlaybackDevice.Array());
playbackDevices.FreeData();
desktopAudio = CreateAudioSource(false, strPlaybackDevice);
if(!desktopAudio) {
CrashError(TEXT("Cannot initialize desktop audio sound, more info in the log file."));
}
AudioDeviceList audioDevices;
GetAudioDevices(audioDevices, ADT_RECORDING);
String strDevice = AppConfig->GetString(TEXT("Audio"), TEXT("Device"), NULL);
if(strDevice.IsEmpty() || !audioDevices.HasID(strDevice))
{
AppConfig->SetString(TEXT("Audio"), TEXT("Device"), TEXT("Disable"));
strDevice = TEXT("Disable");
}
audioDevices.FreeData();
String strDefaultMic;
bool bHasDefault = GetDefaultMicID(strDefaultMic);
if(strDevice.CompareI(TEXT("Disable")))
EnableWindow(GetDlgItem(hwndMain, ID_MICVOLUME), FALSE);
else
{
bool bUseDefault = strDevice.CompareI(TEXT("Default")) != 0;
if(!bUseDefault || bHasDefault)
{
if(bUseDefault)
strDevice = strDefaultMic;
micAudio = CreateAudioSource(true, strDevice);
if(!micAudio)
MessageBox(hwndMain, Str("MicrophoneFailure"), NULL, 0);
else
micAudio->SetTimeOffset(AppConfig->GetInt(TEXT("Audio"), TEXT("MicTimeOffset"), 0));
EnableWindow(GetDlgItem(hwndMain, ID_MICVOLUME), micAudio != NULL);
}
else
EnableWindow(GetDlgItem(hwndMain, ID_MICVOLUME), FALSE);
}
//-------------------------------------------------------------
bool bDisableEncoding = false;
if (bTestStream)
bDisableEncoding = GlobalConfig->GetInt(TEXT("General"), TEXT("DisablePreviewEncoding"), false) != 0;
//-------------------------------------------------------------
UINT bitRate = (UINT)AppConfig->GetInt(TEXT("Audio Encoding"), TEXT("Bitrate"), 96);
示例7: Initialize
bool PipeAudioSource::Initialize(PipeVideo *parent, const AudioParam& param)
{
m_iLastPts = 0;
m_iBlockSize = 0;
Times = 0;
LimitGetData = 0;
m_PipeVideo = parent;
if (!hAudioMutex)
{
hAudioMutex = OSCreateMutex();
}
bool bFloat = false;
UINT inputChannels;
UINT inputSamplesPerSec;
UINT inputBitsPerSample;
DWORD inputChannelMask;
inputBitsPerSample = param.bitsPerSample; // 16;
inputChannelMask = 0;
inputChannels = param.channels; // 1;
inputSamplesPerSec = param.samplesPerSec; // 8000;
m_iBlockSize = inputChannels * inputBitsPerSample / 8;
sampleFrameCount = inputSamplesPerSec / 100;
sampleSegmentSize = m_iBlockSize * sampleFrameCount;
Param = param;
m_isFirstDiffTimeWithAPI = true;
m_lTimeDiffWithAPI = 0;
m_iLastTimeStamp = 0;
outputBuffer.SetSize(sampleSegmentSize);
InitAudioData(bFloat, inputChannels, inputSamplesPerSec, inputBitsPerSample, m_iBlockSize, inputChannelMask);
if (m_pAudioWaveOut)
{
m_pAudioWaveOut->Uninitialize();
}
String strReanderName = GetDirectorMonitorDevices();
if (NULL == m_pAudioWaveOut)
{
if (!strReanderName.Compare(TEXT("停用")) && !m_pAudioWaveOut)
{
m_pAudioWaveOut = new AudioWaveOut;
}
}
else
{
if ((strReanderName.Compare(TEXT("Disable")) || strReanderName.Compare(TEXT("停用"))))
{
delete m_pAudioWaveOut;
m_pAudioWaveOut = NULL;
}
}
if (NULL != m_pAudioWaveOut)
{
m_pAudioWaveOut->Initialize(strReanderName.Array(), 2, inputSamplesPerSec, inputBitsPerSample);
}
String SecRenderName = GetSecMonitorDevices();
if (m_pSecWaveOut)
{
m_pSecWaveOut->Uninitialize();
}
if (SecRenderName.CompareI(strReanderName.Array()) && (!SecRenderName.Compare(TEXT("Disable")) || !SecRenderName.Compare(TEXT("停用"))))
{
bSameDevice = true;
}
else if (!SecRenderName.Compare(TEXT("停用")) && !m_pSecWaveOut)
{
m_pSecWaveOut = new AudioWaveOut;
}
else if (m_pSecWaveOut)
{
if ((SecRenderName.Compare(TEXT("Disable")) || SecRenderName.Compare(TEXT("停用"))))
{
delete m_pSecWaveOut;
m_pSecWaveOut = NULL;
}
}
if (m_pSecWaveOut)
{
m_pSecWaveOut->Initialize(SecRenderName.Array(), 2, inputSamplesPerSec, inputBitsPerSample);
}
return true;
}
示例8: Start
//.........这里部分代码省略.........
for(UINT i=0; i<NUM_RENDER_BUFFERS; i++)
{
mainRenderTextures[i] = CreateRenderTarget(baseCX, baseCY, GS_BGRA, FALSE);
yuvRenderTextures[i] = CreateRenderTarget(outputCX, outputCY, GS_BGRA, FALSE);
}
//-------------------------------------------------------------
D3D10_TEXTURE2D_DESC td;
zero(&td, sizeof(td));
td.Width = outputCX;
td.Height = outputCY;
td.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
td.MipLevels = 1;
td.ArraySize = 1;
td.SampleDesc.Count = 1;
td.ArraySize = 1;
td.Usage = D3D10_USAGE_STAGING;
td.CPUAccessFlags = D3D10_CPU_ACCESS_READ;
for(UINT i=0; i<NUM_RENDER_BUFFERS; i++)
{
HRESULT err = GetD3D()->CreateTexture2D(&td, NULL, ©Textures[i]);
if(FAILED(err))
{
CrashError(TEXT("Unable to create copy texture"));
//todo - better error handling
}
}
//------------------------------------------------------------------
String strEncoder = AppConfig->GetString(TEXT("Audio Encoding"), TEXT("Codec"), TEXT("AAC"));
BOOL isAAC = strEncoder.CompareI(TEXT("AAC"));
UINT format = AppConfig->GetInt(L"Audio Encoding", L"Format", 1);
if (!isAAC)
format = 0;
switch (format) {
case 0: sampleRateHz = 44100; break;
default:
case 1: sampleRateHz = 48000; break;
}
Log(L"------------------------------------------");
Log(L"Audio Format: %u Hz", sampleRateHz);
//------------------------------------------------------------------
BOOL isStereo = AppConfig->GetInt(L"Audio Encoding", L"isStereo", 1);
switch (isStereo) {
case 0: audioChannels = 1; break;
default:
case 1: audioChannels = 2; break;
}
Log(L"------------------------------------------");
Log(L"Audio Channels: %u Ch", audioChannels);
//------------------------------------------------------------------
AudioDeviceList playbackDevices;
bool useInputDevices = AppConfig->GetInt(L"Audio", L"InputDevicesForDesktopSound", false) != 0;
示例9: Stop
//.........这里部分代码省略.........
delete auxAudioSources[i];
auxAudioSources.Clear();
//-------------------------------------------------------------
for(UINT i=0; i<NUM_RENDER_BUFFERS; i++)
{
delete mainRenderTextures[i];
delete yuvRenderTextures[i];
mainRenderTextures[i] = NULL;
yuvRenderTextures[i] = NULL;
}
for(UINT i=0; i<NUM_RENDER_BUFFERS; i++)
{
SafeRelease(copyTextures[i]);
}
delete transitionTexture;
transitionTexture = NULL;
//-------------------------------------------------------------
delete mainVertexShader;
delete mainPixelShader;
delete yuvScalePixelShader;
delete solidVertexShader;
delete solidPixelShader;
mainVertexShader = NULL;
mainPixelShader = NULL;
yuvScalePixelShader = NULL;
solidVertexShader = NULL;
solidPixelShader = NULL;
//-------------------------------------------------------------
delete GS;
GS = NULL;
//-------------------------------------------------------------
ResizeRenderFrame(false);
RedrawWindow(hwndRenderFrame, NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW);
//-------------------------------------------------------------
AudioDeviceList audioDevices;
GetAudioDevices(audioDevices, ADT_RECORDING, false, true);
String strDevice = AppConfig->GetString(TEXT("Audio"), TEXT("Device"), NULL);
if(strDevice.IsEmpty() || !audioDevices.HasID(strDevice))
{
AppConfig->SetString(TEXT("Audio"), TEXT("Device"), TEXT("Disable"));
strDevice = TEXT("Disable");
}
audioDevices.FreeData();
EnableWindow(GetDlgItem(hwndMain, ID_MICVOLUME), !strDevice.CompareI(TEXT("Disable")));
//-------------------------------------------------------------
ClearStreamInfo();
DumpProfileData();
FreeProfileData();
Log(TEXT("=====Stream End: %s================================================="), CurrentDateTimeString().Array());
//update notification icon to reflect current status
UpdateNotificationAreaIcon();
bEditMode = false;
SendMessage(GetDlgItem(hwndMain, ID_SCENEEDITOR), BM_SETCHECK, BST_UNCHECKED, 0);
EnableWindow(GetDlgItem(hwndMain, ID_SCENEEDITOR), FALSE);
ClearStatusBar();
InvalidateRect(hwndRenderFrame, NULL, TRUE);
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 1, 0, 0);
SetThreadExecutionState(ES_CONTINUOUS);
String processPriority = AppConfig->GetString(TEXT("General"), TEXT("Priority"), TEXT("Normal"));
if (scmp(processPriority, TEXT("Normal")))
SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
bTestStream = false;
ConfigureStreamButtons();
UpdateRenderViewMessage();
DisableMenusWhileStreaming(false);
OSLeaveMutex(hStartupShutdownMutex);
OSLeaveMutex(hHotkeyMutex);
}
示例10: SetWarningInfo
//.........这里部分代码省略.........
}
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)
{
hasErrors = true;
canOptimize = true;
strWarnings << FormattedString(Str("Settings.Publish.Warning.MaxAudiobitrate"), maxaudiomp3);
}
}
if (r->HasItem(L"video aspect ratio"))
{
String aspectRatio = r->GetString(L"video aspect ratio");
StringList numbers;
aspectRatio.GetTokenList(numbers, ':');
if (numbers.Num() == 2)
{
float aspect = numbers[0].ToInt() / max(1.f, numbers[1].ToFloat());
if (!CloseFloat(aspect, currentAspect))
{
String aspectLocalized = Str("Settings.Video.AspectRatioFormat");
aspectLocalized.FindReplace(L"$1", UIntString(numbers[0].ToInt()));
aspectLocalized.FindReplace(L"$2", UIntString(numbers[1].ToInt()));
String msg = Str("Settings.Publish.Warning.VideoAspectRatio");
msg.FindReplace(L"$1", aspectLocalized);
strWarnings << msg;
hasErrors = true;
}
}
}
if (r->HasItem(TEXT("profile")))
{
String expectedProfile = r->GetString(TEXT("profile"));
if (!expectedProfile.CompareI(currentx264Profile))
{
hasErrors = true;
canOptimize = true;
strWarnings << Str("Settings.Publish.Warning.RecommendMainProfile");
}
}
if (r->HasItem(TEXT("keyint")))
{
int keyint = r->GetInt(TEXT("keyint"));
if (!keyframeInt || keyframeInt * 1000 > keyint)
{
hasErrors = true;
canOptimize = true;
strWarnings << FormattedString(Str("Settings.Publish.Warning.Keyint"), keyint / 1000);
}
}
break;
}
}
}
}
if (hasErrors)
{
if (canOptimize)
strWarnings << Str("Settings.Publish.Warning.CanOptimize");
SetDlgItemText(hwnd, IDC_WARNINGS, strWarnings.Array());
}
else
SetDlgItemText(hwnd, IDC_WARNINGS, TEXT(""));
SetCanOptimizeSettings(canOptimize);
}
示例11: ProcMessage
//.........这里部分代码省略.........
case IDC_BROWSE:
{
TCHAR lpFile[512];
OPENFILENAME ofn;
zero(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFile = lpFile;
ofn.nMaxFile = 511;
ofn.lpstrFile[0] = 0;
ofn.lpstrFilter = TEXT("MP4 File (*.mp4)\0*.mp4\0Flash Video File (*.flv)\0*.flv\0");
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.nFilterIndex = 1;
String path = OSGetDefaultVideoSavePath();
ofn.lpstrInitialDir = AppConfig->GetStringPtr(TEXT("Publish"), TEXT("LastSaveDir"), path.IsValid() ? path.Array() : nullptr);
ofn.Flags = OFN_PATHMUSTEXIST;
TCHAR curDirectory[512];
GetCurrentDirectory(511, curDirectory);
BOOL bChoseFile = GetSaveFileName(&ofn);
SetCurrentDirectory(curDirectory);
if(*lpFile && bChoseFile)
{
String strFile = lpFile;
strFile.FindReplace(TEXT("\\"), TEXT("/"));
String strExtension = GetPathExtension(strFile);
if(strExtension.IsEmpty() || (!strExtension.CompareI(TEXT("flv")) && /*!strExtension.CompareI(TEXT("avi")) &&*/ !strExtension.CompareI(TEXT("mp4"))))
{
switch(ofn.nFilterIndex)
{
case 1:
strFile << TEXT(".mp4"); break;
case 2:
strFile << TEXT(".flv"); break;
/*case 3:
strFile << TEXT(".avi"); break;*/
}
}
String strFilePath = GetPathDirectory(strFile).FindReplace(TEXT("/"), TEXT("\\")) << TEXT("\\");
AppConfig->SetString(TEXT("Publish"), TEXT("LastSaveDir"), strFilePath);
strFile.FindReplace(TEXT("/"), TEXT("\\"));
SetWindowText(GetDlgItem(hwnd, IDC_SAVEPATH), strFile);
bDataChanged = true;
}
break;
}
case IDC_LOWLATENCYMODE:
case IDC_SAVETOFILE:
if(HIWORD(wParam) == BN_CLICKED)
bDataChanged = true;
break;
case IDC_STARTSTREAMHOTKEY:
case IDC_STOPSTREAMHOTKEY:
//case IDC_DASHBOARDLINK:
示例12: OSFileHasChanged
BOOL STDCALL OSFileHasChanged (OSFileChangeData *data)
{
BOOL hasModified = FALSE;
if (!data->hDirectory)
{
//we lost our directory handle for some reason, try to re-acquire it
data->hDirectory = CreateFile(data->strDirectory, FILE_LIST_DIRECTORY, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS|FILE_FLAG_OVERLAPPED, NULL);
if(data->hDirectory != INVALID_HANDLE_VALUE)
{
DWORD test;
zero(&data->directoryChange, sizeof(data->directoryChange));
data->directoryChange.hEvent = CreateEvent (NULL, TRUE, FALSE, NULL);
if(ReadDirectoryChangesW(data->hDirectory, data->changeBuffer, 2048, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_SIZE, &test, &data->directoryChange, NULL))
{
}
else
{
int i = GetLastError ();
CloseHandle(data->directoryChange.hEvent);
CloseHandle(data->hDirectory);
data->directoryChange.hEvent = NULL;
data->hDirectory = NULL;
return false;
}
}
}
if(HasOverlappedIoCompleted(&data->directoryChange))
{
FILE_NOTIFY_INFORMATION *notify = (FILE_NOTIFY_INFORMATION*)data->changeBuffer;
//change triggered, process the notifications
for (;;)
{
if (notify->Action == FILE_ACTION_ADDED || notify->Action == FILE_ACTION_MODIFIED || notify->Action == FILE_ACTION_RENAMED_NEW_NAME)
{
String strFileName;
strFileName.SetLength(notify->FileNameLength);
scpy_n(strFileName, notify->FileName, notify->FileNameLength/2);
strFileName.KillSpaces();
String strFileChanged;
strFileChanged << data->strDirectory << strFileName;
if(strFileChanged.CompareI(data->targetFileName))
{
hasModified = TRUE;
break;
}
}
if (!notify->NextEntryOffset)
break;
notify = (FILE_NOTIFY_INFORMATION*)((BYTE *)notify + notify->NextEntryOffset);
}
//prepare for next read
ResetEvent (data->directoryChange.hEvent);
zero(data->changeBuffer, sizeof(data->changeBuffer));
DWORD test;
if(ReadDirectoryChangesW(data->hDirectory, data->changeBuffer, 2048, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_SIZE, &test, &data->directoryChange, NULL))
{
}
else
{
int i = GetLastError ();
CloseHandle(data->directoryChange.hEvent);
CloseHandle(data->hDirectory);
data->directoryChange.hEvent = NULL;
data->hDirectory = NULL;
return hasModified;
}
}
return hasModified;
}
示例13: 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;
//.........这里部分代码省略.........
示例14: 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;
}
//.........这里部分代码省略.........
示例15: Start
//.........这里部分代码省略.........
GetAudioDevices(playbackDevices, ADT_PLAYBACK);
String strPlaybackDevice = AppConfig->GetString(TEXT("Audio"), TEXT("PlaybackDevice"), TEXT("Default"));
if(strPlaybackDevice.IsEmpty() || !playbackDevices.HasID(strPlaybackDevice))
{
AppConfig->SetString(TEXT("Audio"), TEXT("PlaybackDevice"), TEXT("Default"));
strPlaybackDevice = TEXT("Default");
}
Log(TEXT("Playback device %s"), strPlaybackDevice.Array());
playbackDevices.FreeData();
desktopAudio = CreateAudioSource(false, strPlaybackDevice);
if(!desktopAudio) {
CrashError(TEXT("Cannot initialize desktop audio sound, more info in the log file."));
}
AudioDeviceList audioDevices;
GetAudioDevices(audioDevices, ADT_RECORDING);
String strDevice = AppConfig->GetString(TEXT("Audio"), TEXT("Device"), NULL);
if(strDevice.IsEmpty() || !audioDevices.HasID(strDevice))
{
AppConfig->SetString(TEXT("Audio"), TEXT("Device"), TEXT("Disable"));
strDevice = TEXT("Disable");
}
audioDevices.FreeData();
String strDefaultMic;
bool bHasDefault = GetDefaultMicID(strDefaultMic);
if(strDevice.CompareI(TEXT("Disable")))
EnableWindow(GetDlgItem(hwndMain, ID_MICVOLUME), FALSE);
else
{
bool bUseDefault = strDevice.CompareI(TEXT("Default")) != 0;
if(!bUseDefault || bHasDefault)
{
if(bUseDefault)
strDevice = strDefaultMic;
micAudio = CreateAudioSource(true, strDevice);
if(!micAudio)
MessageBox(hwndMain, Str("MicrophoneFailure"), NULL, 0);
else
micAudio->SetTimeOffset(AppConfig->GetInt(TEXT("Audio"), TEXT("MicTimeOffset"), 0));
EnableWindow(GetDlgItem(hwndMain, ID_MICVOLUME), micAudio != NULL);
}
else
EnableWindow(GetDlgItem(hwndMain, ID_MICVOLUME), FALSE);
}
//-------------------------------------------------------------
UINT bitRate = (UINT)AppConfig->GetInt(TEXT("Audio Encoding"), TEXT("Bitrate"), 96);
String strEncoder = AppConfig->GetString(TEXT("Audio Encoding"), TEXT("Codec"), TEXT("AAC"));
#ifdef USE_AAC
if(strEncoder.CompareI(TEXT("AAC")) && OSGetVersion() >= 7)
audioEncoder = CreateAACEncoder(bitRate);
else
#endif