本文整理汇总了C++中FileHandle::size方法的典型用法代码示例。如果您正苦于以下问题:C++ FileHandle::size方法的具体用法?C++ FileHandle::size怎么用?C++ FileHandle::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHandle
的用法示例。
在下文中一共展示了FileHandle::size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void run()
{
bool doDecode = false;
static const int samples = 450*1024;
static const int inputBufferSize = samples;
static const int sampleSpaceBefore = 256;
static const int sampleSpaceAfter = 256;
FileHandle in = File("captured.zdr", true).openRead();
UInt64 inputFileSizeRemaining = in.size();
Array<Byte> inputBuffer(inputBufferSize);
int inputBufferRemaining = 0;
Byte* inputPointer = 0;
z_stream zs;
memset(&zs, 0, sizeof(z_stream));
if (inflateInit(&zs) != Z_OK)
throw Exception("inflateInit failed");
Array<Byte> buffer(sampleSpaceBefore + samples + sampleSpaceAfter);
Byte* b = &buffer[0] + sampleSpaceBefore;
for (int i = 0; i < sampleSpaceBefore; ++i)
b[i - sampleSpaceBefore] = 0;
for (int i = 0; i < sampleSpaceAfter; ++i)
b[i + samples] = 0;
int outputBytesRemaining = samples;
Vector outputSize;
NTSCCaptureDecoder<UInt32> decoder;
if (doDecode)
outputSize = Vector(1280, 720);
else
outputSize = Vector(1824, 253);
Bitmap<UInt32> decoded(outputSize);
if (doDecode)
decoder.setOutputBuffer(
decoded.subBitmap(Vector(160, 0), Vector(960, 720)));
else
decoder.setOutputBuffer(decoded);
decoded.fill(0);
decoder.setInputBuffer(b);
decoder.setOutputPixelsPerLine(1140);
decoder.setYScale(3);
decoder.setDoDecode(doDecode);
_handle = fopen("u:\\captured2.avi","wb");
if (!_handle)
throw Exception("Can't open file");
_VectorCount = 1;
_VectorTable[0].x = _VectorTable[0].y = 0;
for (int s = 1; s <= 10; ++s) {
for (int y = -s; y <= s; ++y)
for (int x = -s; x <= s; ++x) {
if (abs(x) == s || abs(y) == s) {
_VectorTable[_VectorCount].x = x;
_VectorTable[_VectorCount].y = y;
++_VectorCount;
}
}
}
memset(&_zstream, 0, sizeof(_zstream));
_pitch = outputSize.x + 2*MAX_VECTOR;
if (deflateInit(&_zstream, 4) != Z_OK)
throw Exception("deflateInit failed");
_bufSize = 4*outputSize.x*outputSize.y + 2*(1+(outputSize.x/8)) * (1+(outputSize.y/8))+1024;
_bufSize += _bufSize / 1000;
_buf = malloc(_bufSize);
if (!_buf)
throw Exception("Out of memory");
_index = (UInt8*)malloc(16*4096);
if (!_buf)
throw Exception("Out of memory");
_indexsize = 16*4096;
_indexused = 8;
for (int i = 0; i < AVI_HEADER_SIZE; ++i)
fputc(0, _handle);
_frames = 0;
_written = 0;
_audioused = 0;
_audiowritten = 0;
int blockwidth = 16;
int blockheight = 16;
_pixelsize = 4;
_bufsize = (outputSize.y + 2*MAX_VECTOR)*_pitch*_pixelsize+2048;
_buf1.allocate(_bufsize);
_buf2.allocate(_bufsize);
_work.allocate(_bufsize);
int xblocks = (outputSize.x/blockwidth);
int xleft = outputSize.x % blockwidth;
if (xleft)
++xblocks;
//.........这里部分代码省略.........