示例#1
0
void
VideoEngine::CreateVideoCapture(int32_t& id, const char* deviceUniqueIdUTF8) {
  LOG((__PRETTY_FUNCTION__));
  MOZ_ASSERT(deviceUniqueIdUTF8);

  id = GenerateId();
  LOG(("CaptureDeviceInfo.type=%s id=%d",mCaptureDevInfo.TypeName(),id));

  for (auto &it : mCaps) {
    if (it.second.VideoCapture() &&
        it.second.VideoCapture()->CurrentDeviceName() &&
        strcmp(it.second.VideoCapture()->CurrentDeviceName(), deviceUniqueIdUTF8) == 0) {
      mIdMap.emplace(id, it.first);
      return;
    }
  }

  CaptureEntry entry = {-1, nullptr};

  if (mCaptureDevInfo.type == webrtc::CaptureDeviceType::Camera) {
    entry = CaptureEntry(id,
		         webrtc::VideoCaptureFactory::Create(deviceUniqueIdUTF8));
  } else {
#ifndef WEBRTC_ANDROID
    entry = CaptureEntry(
	      id,
	      webrtc::DesktopCaptureImpl::Create(id, deviceUniqueIdUTF8, mCaptureDevInfo.type));
#else
    MOZ_ASSERT("CreateVideoCapture NO DESKTOP CAPTURE IMPL ON ANDROID" == nullptr);
#endif
  }
  mCaps.emplace(id, std::move(entry));
  mIdMap.emplace(id, id);
}
示例#2
0
文件: ID.cpp 项目: AnnRe/archive
std::string ID::Get()
{
	std::string id= GenerateId();

	//std::string key=GenerateKey(id);
	//LicenseKeyCorrect(id, key);
	return id;
}
示例#3
0
/*! @brief Default time constructor

    This constructor requires a creation time.

 */
WeightedModel::WeightedModel(float time)
{
    const unsigned int history_depth = 5;
    m_id = GenerateId();    // calculate unique id.
    m_creation_time = time;
    m_alpha = 1.0f;
    m_parent_history_buffer = boost::circular_buffer<unsigned int>(history_depth);
    return;
}
示例#4
0
void VideoEngine::CreateVideoCapture(int32_t& id,
                                     const char* deviceUniqueIdUTF8) {
  LOG((__PRETTY_FUNCTION__));
  MOZ_ASSERT(deviceUniqueIdUTF8);

  id = GenerateId();
  LOG(("CaptureDeviceInfo.type=%s id=%d", mCaptureDevInfo.TypeName(), id));

  for (auto& it : mCaps) {
    if (it.second.VideoCapture() &&
        it.second.VideoCapture()->CurrentDeviceName() &&
        strcmp(it.second.VideoCapture()->CurrentDeviceName(),
               deviceUniqueIdUTF8) == 0) {
      mIdMap.emplace(id, it.first);
      return;
    }
  }

  CaptureEntry entry = {-1, nullptr};

  if (mCaptureDevInfo.type == webrtc::CaptureDeviceType::Camera) {
    entry = CaptureEntry(
        id, webrtc::VideoCaptureFactory::Create(deviceUniqueIdUTF8));
    if (entry.VideoCapture()) {
      entry.VideoCapture()->SetApplyRotation(true);
    }
  } else {
#ifndef WEBRTC_ANDROID
#  ifdef MOZ_X11
    webrtc::VideoCaptureModule* captureModule;
    auto type = mCaptureDevInfo.type;
    nsresult result = NS_DispatchToMainThread(
        media::NewRunnableFrom([&captureModule, id, deviceUniqueIdUTF8,
                                type]() -> nsresult {
          captureModule =
              webrtc::DesktopCaptureImpl::Create(id, deviceUniqueIdUTF8, type);
          return NS_OK;
        }),
        nsIEventTarget::DISPATCH_SYNC);

    if (result == NS_OK) {
      entry = CaptureEntry(id, captureModule);
    } else {
      return;
    }
#  else
    entry = CaptureEntry(id, webrtc::DesktopCaptureImpl::Create(
                                 id, deviceUniqueIdUTF8, mCaptureDevInfo.type));
#  endif
#else
    MOZ_ASSERT("CreateVideoCapture NO DESKTOP CAPTURE IMPL ON ANDROID" ==
               nullptr);
#endif
  }
  mCaps.emplace(id, std::move(entry));
  mIdMap.emplace(id, id);
}
示例#5
0
/*! @brief Child constructor.
    Creates a child model from the given parent.
    @param parent The parent model.
    @param time Creation time (current time).
 */
WeightedModel::WeightedModel(const WeightedModel& parent, float time)
{
    m_active = false;
    m_alpha = parent.alpha();
    m_id = GenerateId();
    m_parent_id = parent.id();
    m_creation_time = time;
    m_parent_history_buffer = parent.m_parent_history_buffer; // Get parents history.
    m_parent_history_buffer.push_back(m_parent_id);    // Add parent to the history.
}
示例#6
0
文件: ONWhile.cpp 项目: melbcat/CSCO
// main function. Obufuscator will call this function
void ONWhile::Action(Node *node)
{
	if ( !JudgeType(node) ) {
		return;
	}
// before Obfuscated
/* 
	WHILE '(' expression ')' 
		statement
*/
// after Obfuscated
/*
	l_continue:
		if (!(expression))
			goto l_break;
		statement;
		goto l_continue;
	l_break:;
*/
	string l_continue = GenerateId();
	string l_break = GenerateId();

	Node *expression = node->getChild(2);
	Node *statement = node->getChild(4);

	stringstream ss;
	ss << l_continue << ":";
	ss << "if(!(" << expression->ToSourceCode(isRemoveTypeset) << "))";
	ss << "goto " << l_break << ";";
	ss << statement->ToSourceCode(isRemoveTypeset) ;
	ss << "goto " << l_continue << ";";
	ss << l_break << ":;";

	string code = ss.str();

	node->isObfuscated = true;
	node->obfuscatedTokenString = code;
}
示例#7
0
UIBase::UIBase(){
    mother = nullptr;
    Show();
    SetFocused(false);
    close = false;
    alpha = 255;
    Color[0] = 100;
    Color[1] = 100;
    Color[2] = 110;
    Color[3] = 255;
    style = UIStyle::BaseStyle;
    MouseInside = false;
    GenerateId();
    UiName = utils::format("uiobj%.4d",ID);
}
示例#8
0
bool GetSubmitterId(const char *name, uint64_t &id)
{
	uint32_t mgmtId;

	if (GetAttributeInt(HEADER_CLUSTER, HEADER_PROC, name,
						(int *) &mgmtId) < 0) {
		if (!GenerateId(mgmtId)) {
				// Failed to generate a new id, this seems fatal
			return false;
		}

		if (SetAttributeInt(HEADER_CLUSTER, HEADER_PROC, name,
							(int) mgmtId)) {
				// Failed to record the new id, this seems fatal
			return false;
		}
	}

		// The ((uint64_t) 0) << 32 id space is reserved for us
	id = (uint64_t) mgmtId;

	return true;
}
示例#9
0
//-------------------------------------
//
//-------------------------------------
unsigned long int IdFactory::GetId()
{
    return GenerateId();
}
示例#10
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
QCLog* QCLog::Create() {
	QCLog* object = new QCLog();
	return static_cast<QCLog*>(GenerateId(object));
}
示例#11
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
SensorLocation* SensorLocation::Create() {
	SensorLocation* object = new SensorLocation();
	return static_cast<SensorLocation*>(GenerateId(object));
}
示例#12
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Network* Network::Create() {
	Network* object = new Network();
	return static_cast<Network*>(GenerateId(object));
}
示例#13
0
文件: AnyPtr.hpp 项目: okard/cul
 static const int TypeId()
 {
     static const int typeId = GenerateId();
     return typeId;
 }
示例#14
0
void Channel::UnsubscribeFromNotification(std::string notification)
{
    Json::Value params;
    params["propertyName"] = notification;
    sendRequest(GenerateId(),"MB.unsubscribeTo",params);
}
示例#15
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ArclinkRequest* ArclinkRequest::Create() {
	ArclinkRequest* object = new ArclinkRequest();
	return static_cast<ArclinkRequest*>(GenerateId(object));
}
示例#16
0
 CRenderBuffer::CRenderBuffer()
 :m_uID(GenerateId()),m_iSaveID(0)
 {
 }
示例#17
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Route* Route::Create() {
	Route* object = new Route();
	return static_cast<Route*>(GenerateId(object));
}
示例#18
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ConfigStation* ConfigStation::Create() {
    ConfigStation* object = new ConfigStation();
    return static_cast<ConfigStation*>(GenerateId(object));
}