本文整理汇总了C++中String::CreateUTF8String方法的典型用法代码示例。如果您正苦于以下问题:C++ String::CreateUTF8String方法的具体用法?C++ String::CreateUTF8String怎么用?C++ String::CreateUTF8String使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::CreateUTF8String方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetOutputParameters
void AudioOutputStreamHandler::SetOutputParameters(String type, String typeDevice, String device, bool isAudioOutputToStream)
{
this->isAudioOutputToStream = isAudioOutputToStream;
if (isAudioOutputToStream) {
libvlc_audio_set_callbacks(mediaPlayer, audioPlayCallbackProxy, nullptr, nullptr, nullptr, nullptr, this);
} else {
auto *node = libvlc_audio_output_list_get(vlc);
char *_type = type.CreateUTF8String();
char *_typeDevice = typeDevice.CreateUTF8String();
char *_device = device.CreateUTF8String();
if (_type) {
int i = libvlc_audio_output_set(mediaPlayer, _type);
if (_device) {
libvlc_audio_output_device_set(mediaPlayer, _typeDevice, _device);
}
}
if (_type != nullptr) {
Free(_type);
}
if (_typeDevice != nullptr) {
Free(_typeDevice);
}
if (_device != nullptr) {
Free(_device);
}
}
}
示例2: getPluginConfigPath
LPSTR getPluginConfigPath()
{
if(configPath == NULL)
{
String pluginPath = OBSGetPluginDataPath();
pluginPath << TEXT("\\OBSRemote.xconfig");
configPath = pluginPath.CreateUTF8String();
}
return configPath;
}
示例3: InitSEIUserData
void InitSEIUserData()
{
List<mfxU8> payload;
const mfxU8 UUID[] = { 0x6d, 0x1a, 0x26, 0xa0, 0xbd, 0xdc, 0x11, 0xe2, //ISO-11578 UUID
0x90, 0x24, 0x00, 0x50, 0xc2, 0x49, 0x00, 0x48 }; //6d1a26a0-bddc-11e2-9024-0050c2490048
payload.AppendArray(UUID, 16);
String str;
str << TEXT("QSV hardware encoder options:")
<< TEXT(" rate control: ") << (bUseCBR ? TEXT("cbr") : TEXT("vbr"))
<< TEXT("; target bitrate: ") << params.mfx.TargetKbps
<< TEXT("; max bitrate: ") << query.mfx.MaxKbps
<< TEXT("; buffersize: ") << query.mfx.BufferSizeInKB*8
<< TEXT("; API level: ") << ver.Major << TEXT(".") << ver.Minor;
LPSTR info = str.CreateUTF8String();
payload.AppendArray((LPBYTE)info, (unsigned)strlen(info)+1);
Free(info);
AddSEIData(payload, SEI_USER_DATA_UNREGISTERED);
}
示例4: CreateConnectionThread
//.........这里部分代码省略.........
}
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);
RTMP_LogSetCallback(librtmpErrorCallback);
//RTMP_LogSetLevel(RTMP_LOGERROR);
lpAnsiURL = strURL.CreateUTF8String();
lpAnsiPlaypath = strPlayPath.CreateUTF8String();
if(!RTMP_SetupURL2(rtmp, lpAnsiURL, lpAnsiPlaypath))
{
failReason = Str("Connection.CouldNotParseURL");
goto end;
}
char *rtmpUser = AppConfig->GetString(TEXT("Publish"), TEXT("Username")).CreateUTF8String();
char *rtmpPass = AppConfig->GetString(TEXT("Publish"), TEXT("Password")).CreateUTF8String();
if (rtmpUser)
{
rtmp->Link.pubUser.av_val = rtmpUser;
rtmp->Link.pubUser.av_len = (int)strlen(rtmpUser);
}
if (rtmpPass)
{
rtmp->Link.pubPasswd.av_val = rtmpPass;
rtmp->Link.pubPasswd.av_len = (int)strlen(rtmpPass);
}
RTMP_EnableWrite(rtmp); //set it to publish
rtmp->Link.swfUrl.av_len = rtmp->Link.tcUrl.av_len;
rtmp->Link.swfUrl.av_val = rtmp->Link.tcUrl.av_val;
/*rtmp->Link.pageUrl.av_len = rtmp->Link.tcUrl.av_len;
rtmp->Link.pageUrl.av_val = rtmp->Link.tcUrl.av_val;*/
rtmp->Link.flashVer.av_val = "FMLE/3.0 (compatible; FMSc/1.0)";
rtmp->Link.flashVer.av_len = (int)strlen(rtmp->Link.flashVer.av_val);
示例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: sizeof
X264Encoder(int fps, int width, int height, int quality, CTSTR preset, CTSTR ProFile, bool bUse444, ColorDescription &colorDesc, int maxBitrate, int bufferSize, bool bUseCFR, bool bUesBackConfig)
{
frameShift = 0;
curPreset = preset;
FPS = fps;
fps_ms = 1000 / fps;
StringList paramList;
curProfile = ProFile;
zero(¶mData, sizeof(paramData));
LPSTR lpPreset = curPreset.CreateUTF8String();
LPSTR lpTune = curTune.CreateUTF8String();
if (x264_param_default_preset(¶mData, lpPreset, lpTune))
Log::writeError(LOG_RTSPSERV,1,"LiveSDK_Log: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;
//分主次直播
if (bUesBackConfig)
{
bUseCBR = CSLiveManager::GetInstance()->BSParam.LiveSetting.bUseCBRSec;
}
else
{
bUseCBR = CSLiveManager::GetInstance()->BSParam.LiveSetting.bUseCBR;
}
bPadCBR = true;
this->bUseCFR = bUseCFR;
SetBitRateParams(maxBitrate, bufferSize);
if (bUseCBR)
{
if (bPadCBR) paramData.rc.b_filler = 1;
//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.i_frame_reference = 5;
paramData.rc.i_rc_method = X264_RC_CRF;
paramData.rc.f_rf_constant = baseCRF + float(10 - quality);
}
//分主次直播
UINT keyframeInterval = CSLiveManager::GetInstance()->BSParam.LiveSetting.KeyFrame;
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)
{
//.........这里部分代码省略.........