Esempio n. 1
0
void VDVideoWindow::UpdateSourcePARMenuItem() {
	VDStringW s;

	if (mSourcePAR <= 0)
		s = L"Unknown ratio";
	else
		s.sprintf(L"%.4g:1 pixel", mSourcePAR);

	VDStringW t(mSourcePARTextPattern);
	VDStringW::size_type pos = t.find('?');

	if (pos != VDStringW::npos)
		t.replace(pos, 1, s.data(), s.size());
	
	VDSetMenuItemTextByCommandW32(mhmenu, ID_DISPLAY_AR_PIXEL_SOURCE, t.c_str());
}
Esempio n. 2
0
void VDLog(int severity, const VDStringW& s) {
	int strSize = s.size() + 1;

	if (strSize >= 16384) {
		VDASSERT(false);
		return;
	}

	vdsynchronized(g_csLog) {
		for(;;) {
			int currentSize = (g_logTail - g_logHead) & 16383;

			if (currentSize + strSize < 16384)	// NOTE: This means that the last byte in the ring buffer can never be used.
				break;

			while(g_log[g_logHead++ & 16383])
				;

			g_logHead &= 16383;
		}

		const wchar_t *ps = s.data();

		g_log[g_logTail++] = severity;

		for(int i=1; i<strSize; ++i)
			g_log[g_logTail++ & 16383] = *ps++;

		g_log[g_logTail++ & 16383] = 0;

		g_logTail &= 16383;

		VDThreadID currentThread = VDGetCurrentThreadID();
		for(tVDLoggers::const_iterator it(g_loggers.begin()), itEnd(g_loggers.end()); it!=itEnd; ++it) {
			if (!(*it).second || currentThread == (*it).second)
				(*it).first->AddLogEntry(severity, s);
		}
	}
}
Esempio n. 3
0
size_t vdhash<VDStringW>::operator()(const VDStringW& s) const {
	return VDHashString32(s.data(), s.length());
}