本文整理汇总了C++中IOCallback::read方法的典型用法代码示例。如果您正苦于以下问题:C++ IOCallback::read方法的具体用法?C++ IOCallback::read怎么用?C++ IOCallback::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOCallback
的用法示例。
在下文中一共展示了IOCallback::read方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadInternalHead
uint64 KaxInternalBlock::ReadInternalHead(IOCallback & input)
{
binary Buffer[5], *cursor = Buffer;
uint64 Result = input.read(cursor, 4);
if (Result != 4)
return Result;
// update internal values
TrackNumber = *cursor++;
if ((TrackNumber & 0x80) == 0) {
// there is extra data
if ((TrackNumber & 0x40) == 0) {
// We don't support track numbers that large !
return Result;
}
Result += input.read(&Buffer[4], 1);
TrackNumber = (TrackNumber & 0x3F) << 8;
TrackNumber += *cursor++;
} else {
TrackNumber &= 0x7F;
}
big_int16 b16;
b16.Eval(cursor);
assert(ParentCluster != NULL);
Timecode = ParentCluster->GetBlockGlobalTimecode(int16(b16));
bLocalTimecodeUsed = false;
cursor += 2;
return Result;
}
示例2: ReadData
filepos_t EbmlBinary::ReadData(IOCallback & input, ScopeMode ReadFully)
{
if (Data != NULL)
free(Data);
if (ReadFully == SCOPE_NO_DATA || !GetSize()) {
Data = NULL;
return GetSize();
}
Data = (binary *)malloc(GetSize());
if (Data == NULL)
throw CRTError(std::string("Error allocating data"));
SetValueIsSet();
return input.read(Data, GetSize());
}
示例3: ReadData
//.........这里部分代码省略.........
// get the size of the frame
SizeList[Index] = LastBufferSize / (FrameNum + 1);
}
break;
default: // other lacing not supported
assert(0);
}
FirstFrameLocation += Mem.GetPosition();
for (Index=0; Index<=FrameNum; Index++) {
DataBuffer * lacedFrame = new DataBuffer(BufferStart + Mem.GetPosition(), SizeList[Index]);
myBuffers.push_back(lacedFrame);
Mem.Skip(SizeList[Index]);
}
}
binary *BufferEnd = BufferStart + GetSize();
size_t NumFrames = myBuffers.size();
// Sanity checks for frame pointers and boundaries.
for (size_t Index = 0; Index < NumFrames; ++Index) {
binary *FrameStart = myBuffers[Index]->Buffer();
binary *FrameEnd = FrameStart + myBuffers[Index]->Size();
binary *ExpectedEnd = (Index + 1) < NumFrames ? myBuffers[Index + 1]->Buffer() : BufferEnd;
if ((FrameStart < BufferStart) || (FrameEnd > BufferEnd) || (FrameEnd != ExpectedEnd))
throw SafeReadIOCallback::EndOfStreamX(0);
}
SetValueIsSet();
} else if (ReadFully == SCOPE_PARTIAL_DATA) {
binary _TempHead[5];
Result = input.read(_TempHead, 5);
if (Result != 5)
throw SafeReadIOCallback::EndOfStreamX(0);
binary *cursor = _TempHead;
binary *_tmpBuf;
uint8 BlockHeadSize = 4;
// update internal values
TrackNumber = *cursor++;
if ((TrackNumber & 0x80) == 0) {
// there is extra data
if ((TrackNumber & 0x40) == 0) {
// We don't support track numbers that large !
return Result;
}
TrackNumber = (TrackNumber & 0x3F) << 8;
TrackNumber += *cursor++;
BlockHeadSize++;
} else {
TrackNumber &= 0x7F;
}
big_int16 b16;
b16.Eval(cursor);
LocalTimecode = int16(b16);
bLocalTimecodeUsed = true;
cursor += 2;
if (EbmlId(*this) == EBML_ID(KaxSimpleBlock)) {
bIsKeyframe = (*cursor & 0x80) != 0;
bIsDiscardable = (*cursor & 0x01) != 0;
}
mInvisible = (*cursor & 0x08) >> 3;