本文整理汇总了C++中VDASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ VDASSERT函数的具体用法?C++ VDASSERT怎么用?C++ VDASSERT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VDASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VDASSERT
void VDUIListViewW32::AddColumn(const wchar_t *name, int width, int affinity) {
VDASSERT(affinity >= 0);
VDASSERT(width >= 0);
if (VDIsWindowsNT()) {
LVCOLUMNW lvcw={0};
lvcw.mask = LVCF_TEXT | LVCF_WIDTH;
lvcw.pszText = (LPWSTR)name;
lvcw.cx = width;
SendMessageW(mhwnd, LVM_INSERTCOLUMNW, mColumns.size(), (LPARAM)&lvcw);
} else {
LVCOLUMNA lvca={0};
VDStringA nameA(VDTextWToA(name));
lvca.mask = LVCF_TEXT | LVCF_WIDTH;
lvca.pszText = (LPSTR)nameA.c_str();
lvca.cx = width;
SendMessageA(mhwnd, LVM_INSERTCOLUMNA, mColumns.size(), (LPARAM)&lvca);
}
mColumns.push_back(Column());
Column& col = mColumns.back();
col.mWidth = width;
col.mAffinity = affinity;
mTotalWidth += width;
mTotalAffinity += affinity;
OnResize();
}
示例2: catch
void VDAVIReadIndex::AddChunk(sint64 bytePos, uint32 sizeAndKeyFrameFlag) {
SectorEntry *sec = &mSectors.back();
// Note: Some (perhaps broken) AVI files have chunks out of order in the index. In
// that case, we must force a new sector.
if ((uint64)(bytePos - sec->mByteOffset) >= (uint64)0x100000000 || mSampleCount - sec->mChunkOffset >= 0x10000) {
sec = &mSectors.push_back();
sec->mByteOffset = bytePos;
sec->mSampleOffset = mSampleCount;
sec->mChunkOffset = mChunkCount;
sec->mbOneSamplePerChunk = true;
++mSectorCount;
}
if (mIndex.empty() || mBlockOffset >= kBlockSize) {
IndexEntry *newBlock = new IndexEntry[kBlockSize];
try {
mIndex.push_back(newBlock);
} catch(...) {
delete[] newBlock;
throw;
}
mBlockOffset = 0;
}
if ((sint32)sizeAndKeyFrameFlag < 0)
mPrevKey = mChunkCount;
IndexEntry& ient = mIndex.back()[mBlockOffset++];
ient.mByteOffset = (uint32)bytePos - (uint32)sec->mByteOffset;
ient.mSampleOffset = (uint32)mSampleCount - (uint32)sec->mSampleOffset;
ient.mSizeAndKeyFrameFlag = sizeAndKeyFrameFlag;
ient.mPrevKeyDistance = VDClampToUint16(mChunkCount - mPrevKey);
ient.mUnused0 = 0;
VDASSERT(ient.mByteOffset + sec->mByteOffset == bytePos);
VDASSERT(ient.mSampleOffset + sec->mSampleOffset == mSampleCount);
uint32 chunkSize = sizeAndKeyFrameFlag & 0x7FFFFFFF;
if (mSampleSize) {
uint32 roundedUpSize = chunkSize + (mSampleSize - 1);
uint32 sampleCountInChunk = roundedUpSize / mSampleSize;
if (chunkSize % mSampleSize)
mbVBR = true;
mSampleCount += sampleCountInChunk;
if (sampleCountInChunk != 1)
sec->mbOneSamplePerChunk = false;
} else
++mSampleCount;
++mChunkCount;
mByteCount += chunkSize;
}
示例3: FilterAddBuiltin
void FilterAddBuiltin(const FilterDefinition *pfd) {
VDASSERT(!pfd->stringProc || pfd->stringProc2);
VDASSERT(!pfd->copyProc || pfd->copyProc2);
vdautoptr<FilterDefinitionInstance> fdi(new FilterDefinitionInstance(NULL));
fdi->Assign(*pfd, sizeof(FilterDefinition));
g_filterDefs.AddTail(fdi.release());
}
示例4: TokenBegin
void VDScriptInterpreter::ExecuteLine(const char *s) {
int t;
mErrorExtraToken.clear();
TokenBegin(s);
while(t = Token()) {
if (isExprFirstToken(t)) {
TokenUnput(t);
VDASSERT(mStack.empty());
ParseExpression();
VDASSERT(!mStack.empty());
VDScriptValue& val = mStack.back();
mStack.pop_back();
VDASSERT(mStack.empty());
if (Token() != ';')
SCRIPT_ERROR(SEMICOLON_EXPECTED);
} else if (t == TOK_DECLARE) {
do {
t = Token();
if (t != TOK_IDENT)
SCRIPT_ERROR(IDENTIFIER_EXPECTED);
VariableTableEntry *vte = vartbl.Declare(szIdent);
t = Token();
if (t == '=') {
ParseExpression();
VDASSERT(!mStack.empty());
vte->v = mStack.back();
mStack.pop_back();
t = Token();
}
} while(t == ',');
if (t != ';')
SCRIPT_ERROR(SEMICOLON_EXPECTED);
} else
SCRIPT_ERROR(PARSE_ERROR);
}
VDASSERT(mStack.empty());
GC();
}
示例5: BitBltFromRGBToRGB
bool BitBltFromRGBToRGB(int w, int h, BYTE* dst, int dstpitch, int dbpp, BYTE* src, int srcpitch, int sbpp)
{
VDPixmap srcbm = {
(char *)src + srcpitch * (h - 1),
NULL,
w,
h,
-srcpitch
};
switch(sbpp) {
case 8:
srcbm.format = nsVDPixmap::kPixFormat_Pal8;
break;
case 16:
srcbm.format = nsVDPixmap::kPixFormat_RGB565;
break;
case 24:
srcbm.format = nsVDPixmap::kPixFormat_RGB888;
break;
case 32:
srcbm.format = nsVDPixmap::kPixFormat_XRGB8888;
break;
default:
VDASSERT(false);
}
VDPixmap dstpxm = {
(char *)dst + dstpitch * (h - 1),
NULL,
w,
h,
-dstpitch
};
switch(dbpp) {
case 8:
dstpxm.format = nsVDPixmap::kPixFormat_Pal8;
break;
case 16:
dstpxm.format = nsVDPixmap::kPixFormat_RGB565;
break;
case 24:
dstpxm.format = nsVDPixmap::kPixFormat_RGB888;
break;
case 32:
dstpxm.format = nsVDPixmap::kPixFormat_XRGB8888;
break;
default:
VDASSERT(false);
}
return VDPixmapBlt(dstpxm, srcbm);
}
示例6: BitBltFromRGBToRGBStretch
bool BitBltFromRGBToRGBStretch(int dstw, int dsth, BYTE* dst, int dstpitch, int dbpp, int srcw, int srch, BYTE* src, int srcpitch, int sbpp)
{
VDPixmap srcbm = {
src + srcpitch * (srch - 1),
nullptr,
srcw,
srch,
-srcpitch
};
switch (sbpp) {
case 8:
srcbm.format = nsVDPixmap::kPixFormat_Pal8;
break;
case 16:
srcbm.format = nsVDPixmap::kPixFormat_RGB565;
break;
case 24:
srcbm.format = nsVDPixmap::kPixFormat_RGB888;
break;
case 32:
srcbm.format = nsVDPixmap::kPixFormat_XRGB8888;
break;
default:
VDASSERT(false);
}
VDPixmap dstpxm = {
dst + dstpitch * (dsth - 1),
nullptr,
dstw,
dsth,
-dstpitch
};
switch (dbpp) {
case 8:
dstpxm.format = nsVDPixmap::kPixFormat_Pal8;
break;
case 16:
dstpxm.format = nsVDPixmap::kPixFormat_RGB565;
break;
case 24:
dstpxm.format = nsVDPixmap::kPixFormat_RGB888;
break;
case 32:
dstpxm.format = nsVDPixmap::kPixFormat_XRGB8888;
break;
default:
VDASSERT(false);
}
return VDPixmapStretchBltBilinear(dstpxm, srcbm);
}
示例7: VDDestroyFunctionThunk
void VDDestroyFunctionThunk(VDFunctionThunk *pFnThunk) {
// validate thunk
#if defined(_M_IX86)
VDASSERT(((const uint8 *)pFnThunk)[0] == 0xB9 || ((const uint8 *)pFnThunk)[0] == 0xE8);
VDFreeThunkMemory(pFnThunk, 16);
#elif defined(_M_AMD64)
VDFreeThunkMemory(pFnThunk, 44);
#else
VDASSERT(false);
#endif
}
示例8: VDASSERT
void VDStringW::reserve_slow(size_type n, size_type current_capacity) {
VDASSERT(current_capacity == (size_type)(mpEOS - mpBegin));
VDASSERT(n > current_capacity);
size_type current_size = (size_type)(mpEnd - mpBegin);
value_type *s = new value_type[n + 1];
memcpy(s, mpBegin, (current_size + 1) * sizeof(value_type));
if (mpBegin != sNull)
delete[] mpBegin;
mpBegin = s;
mpEnd = s + current_size;
mpEOS = s + n;
}
示例9: VDASSERTPTR
bool VDMPEGCache::Read(void *pData, int64 bytepos, int len, int offset) {
VDASSERTPTR(this);
VDASSERTPTR(pData);
VDASSERT(bytepos != 0);
VDASSERT(len > 0);
if (mpCacheMemory) {
int nBlocks = mCacheBlocks.size();
for(int i=0; i<nBlocks; ++i) {
if (mCacheBlocks[i].pos == bytepos) {
++mNextAgeValue;
// VDDEBUG2("Cache hit : %16I64x + %-5d (%5d)\n", bytepos, offset, len);
while(len > 0) {
VDASSERT(i>=0);
int blen = mCacheBlocks[i].len - offset;
if (blen > len)
blen = len;
VDASSERT(blen > 0);
memcpy(pData, mpCacheMemory + mBlockSize * i + offset, blen);
pData = (char *)pData + blen;
len -= blen;
mCacheBlocks[i].age = mNextAgeValue;
i = mCacheBlocks[i].next;
offset = 0;
}
VDASSERT(!len);
return true;
}
}
}
// VDDEBUG2("Cache miss : %16I64x + %-5d (%5d)\n", bytepos, offset, len);
return false;
}
示例10: VDASSERT
bool VDVideoDisplayMinidriverOpenGL::Update(UpdateMode mode) {
if (!mGL.IsInited())
return false;
if (!mSource.pixmap.data)
return false;
if (HDC hdc = GetDC(mhwndOGL)) {
if (mGL.Begin(hdc)) {
VDASSERT(mGL.glGetError() == GL_NO_ERROR);
if (mSource.bInterlaced) {
uint32 fieldmode = (mode & kModeFieldMask);
if (fieldmode == kModeAllFields || fieldmode == kModeEvenField) {
VDPixmap evenFieldSrc(mSource.pixmap);
evenFieldSrc.h = (evenFieldSrc.h+1) >> 1;
evenFieldSrc.pitch += evenFieldSrc.pitch;
Upload(evenFieldSrc, mTexPattern[0]);
}
if (fieldmode == kModeAllFields || fieldmode == kModeOddField) {
VDPixmap oddFieldSrc(mSource.pixmap);
oddFieldSrc.data = (char *)oddFieldSrc.data + oddFieldSrc.pitch;
oddFieldSrc.h = (oddFieldSrc.h+1) >> 1;
oddFieldSrc.pitch += oddFieldSrc.pitch;
Upload(oddFieldSrc, mTexPattern[1]);
}
示例11: PushStreams
VDStreamInterleaver::Action VDStreamInterleaver::GetNextAction(int& streamID, sint32& samples) {
const int nStreams = mStreams.size();
if (!mActiveStreams)
return kActionFinish;
for(;;) {
if (!mNextStream) {
Action act = PushStreams();
if (act != kActionWrite)
return act;
}
for(; mNextStream<nStreams; ++mNextStream) {
Stream& streaminfo = mStreams[mNextStream];
if (!mbInterleavingEnabled && mNextStream > mNonIntStream)
break;
if (streaminfo.mSamplesToWrite > 0) {
samples = streaminfo.mSamplesToWrite;
if (samples > streaminfo.mMaxPush)
samples = streaminfo.mMaxPush;
streaminfo.mSamplesToWrite -= samples;
streamID = mNextStream;
VDASSERT(samples < 2147483647);
streaminfo.mSamplesWrittenToSegment += samples;
return kActionWrite;
}
}
mNextStream = 0;
}
}
示例12: waveOutWrite
bool VDAudioOutputWaveOutW32::Flush() {
if (mCurState == kStateOpened) {
if (!Start())
return false;
}
if (mBlockWriteOffset <= 0)
return true;
WAVEHDR& hdr = mHeaders[mBlockTail];
hdr.dwBufferLength = mBlockWriteOffset;
hdr.dwFlags &= ~WHDR_DONE;
MMRESULT res = waveOutWrite(mhWaveOut, &hdr, sizeof hdr);
mBytesQueued += mBlockWriteOffset;
mBlockWriteOffset = 0;
if (res != MMSYSERR_NOERROR)
return false;
++mBlockTail;
if (mBlockTail >= mBlockCount)
mBlockTail = 0;
++mBlocksPending;
VDASSERT(mBlocksPending <= mBlockCount);
return true;
}
示例13: SendMessage
int VDUIComboBoxW32::GetItemCount() {
LRESULT lr = SendMessage(mhwnd, CB_GETCOUNT, 0, 0);
VDASSERT(lr != CB_ERR);
return (lr == CB_ERR) ? 0 : (int)lr;
}
示例14: VDASSERT
uint32 VDAudioFilterGain::Run() {
VDAudioFilterPin& pin = *mpContext->mpInputs[0];
const VDXWaveFormat& format = *pin.mpFormat;
// compute output samples
int samples = mpContext->mCommonSamples;
sint16 *dst = (sint16 *)mpContext->mpOutputs[0]->mpBuffer;
if (!samples) {
if (pin.mbEnded && !mpContext->mInputSamples)
return kVFARun_Finished;
return 0;
}
// read buffer
unsigned count = format.mChannels * samples;
int actual_samples = mpContext->mpInputs[0]->Read(dst, samples, false, kVFARead_PCM16);
VDASSERT(actual_samples == samples);
for(unsigned i=0; i<count; ++i) {
sint32 v = ((sint32)dst[i] * mScale16 + 0x800080) >> 8;
if ((uint32)v >= 0x10000)
v = ~v >> 31;
dst[i] = (sint16)(v - 0x8000);
}
mpContext->mpOutputs[0]->mSamplesWritten = samples;
return 0;
}
示例15: it
bool VDRegistryProviderMemory::Key::RemoveKey(const char *name) {
if (!name)
name = "";
// look up the subkey
KeyMap::iterator it(mKeyMap.find_as(name));
// fail if not found
if (it != mKeyMap.end())
return false;
// can't delete key if it has subkeys
Key& key = it->second;
if (!key.mKeyList.empty())
return false;
// if the key is open, we have to condemn it and delete it later
if (key.mRefCount) {
key.mbCondemned = true;
return true;
}
// delete the key
mKeyMap.erase(it);
KeyList::iterator it2(std::find(mKeyList.begin(), mKeyList.end(), &*it));
VDASSERT(it2 != mKeyList.end());
mKeyList.erase(it2);
return true;
}