本文整理汇总了C++中DataBuffer::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ DataBuffer::Size方法的具体用法?C++ DataBuffer::Size怎么用?C++ DataBuffer::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBuffer
的用法示例。
在下文中一共展示了DataBuffer::Size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TESTCHECK
bool
DataBuffer::Test( )
{
bool ok = true;
cout << "Testing DataBuffer" << endl;
DataBuffer buff;
TESTCHECK( buff.Data() == 0, true, &ok );
TESTCHECK( buff.Size(), 0, &ok );
char sIn[ 10 ] = "123456789";
Foo fIn = { 127, 2.5f };
cout << "Add( char *, 10 )" << endl;
buff.Add( sIn, 10 );
TESTCHECK( *buff.Data(), '1', &ok );
TESTCHECK( buff.Size(), 10, &ok );
cout << "Add( Foo )" << endl;
buff.Add( fIn );
cout << "Read( 10 )" << endl;
const char * sOut = buff.Read( 10 );
TESTCHECK( (string( sIn ) == string( sOut )), true, &ok );
cout << "Read< Foo >()" << endl;
const Foo * pFoo = buff.Read< Foo >( );
TESTCHECK( pFoo->i, 127, &ok );
TESTCHECK( pFoo->f, 2.5f, &ok );
if ( ok )
cout << "DataBuffer PASSED." << endl << endl;
else
cout << "DataBuffer FAILED." << endl << endl;
return ok;
}
示例2: AddFrame
/*!
\todo handle flags
\todo hardcoded limit of the number of frames in a lace should be a parameter
\return true if more frames can be added to this Block
*/
bool KaxInternalBlock::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing, bool invisible)
{
SetValueIsSet();
if (myBuffers.size() == 0) {
// first frame
Timecode = timecode;
TrackNumber = track.TrackNumber();
mInvisible = invisible;
mLacing = lacing;
}
myBuffers.push_back(&buffer);
// we don't allow more than 8 frames in a Block because the overhead improvement is minimal
if (myBuffers.size() >= 8 || lacing == LACING_NONE)
return false;
if (lacing == LACING_XIPH)
// decide wether a new frame can be added or not
// a frame in a lace is not efficient when the place necessary to code it in a lace is bigger
// than the size of a simple Block. That means more than 6 bytes (4 in struct + 2 for EBML) to code the size
return (buffer.Size() < 6*0xFF);
else
return true;
}