本文整理汇总了C++中BitStream::getSize方法的典型用法代码示例。如果您正苦于以下问题:C++ BitStream::getSize方法的具体用法?C++ BitStream::getSize怎么用?C++ BitStream::getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitStream
的用法示例。
在下文中一共展示了BitStream::getSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseImageOverlay
ImageOverlay parseImageOverlay(BitStream& input)
{
ImageOverlay iovl;
input.read8Bits(); // discard version
bool read32BitFields = input.read8Bits() & 1;
iovl.canvasFillValueR = input.read16Bits();
iovl.canvasFillValueG = input.read16Bits();
iovl.canvasFillValueB = input.read16Bits();
iovl.canvasFillValueA = input.read16Bits();
if (read32BitFields)
{
iovl.outputWidth = input.read32Bits();
iovl.outputHeight = input.read32Bits();
}
else
{
iovl.outputWidth = input.read16Bits();
iovl.outputHeight = input.read16Bits();
}
// Read as many offsets as there is. This should match to number of relevant 'dimg' references, but it is
// not feasible to verify it during reading.
while (input.getPos() < input.getSize())
{
ImageOverlay::Offset offsets;
if (read32BitFields)
{
offsets.horizontalOffset = static_cast<std::int32_t>(input.read32Bits());
offsets.verticalOffset = static_cast<std::int32_t>(input.read32Bits());
}
else
{
offsets.horizontalOffset = static_cast<std::int16_t>(input.read16Bits());
offsets.verticalOffset = static_cast<std::int16_t>(input.read16Bits());
}
iovl.offsets.push_back(offsets);
}
return iovl;
}
示例2: writeBox
void ElementaryStreamDescriptorBox::writeBox(BitStream& bitstr) const
{
writeFullBoxHeader(bitstr);
bitstr.write8Bits(mES_Descriptor.ES_DescrTag);
bool esSizeConverged = false;
std::uint64_t esSizeSize;
std::uint32_t esDescriptorSize = mES_Descriptor.size;
BitStream esBitstr;
/* Write the whole stuff, then figure out if we wrote the correct
* size for it (we allos mES_Descriptor to be incorrect); rewrite
* everything with the correct size. However, this may increase
* the size due to bigger size having been written and thus moving
* the remaining of the data forward, so we may need to loop even
* thrice. */
while (!esSizeConverged)
{
esBitstr.clear();
esSizeSize = writeSize(esBitstr, esDescriptorSize);
esBitstr.write16Bits(mES_Descriptor.ES_ID);
esBitstr.write8Bits(mES_Descriptor.flags);
if (mES_Descriptor.flags & 0x80) // streamDependenceFlag as defined in 7.2.6.5.1 of ISO/IEC 14486-1:2010(E)
{
esBitstr.write16Bits(mES_Descriptor.dependsOn_ES_ID);
}
if (mES_Descriptor.flags & 0x40) // URL_Flag as defined in 7.2.6.5.1 of ISO/IEC 14486-1:2010(E)
{
esBitstr.write8Bits(mES_Descriptor.URLlength);
if (mES_Descriptor.URLlength)
{
esBitstr.writeString(mES_Descriptor.URLstring);
}
}
if (mES_Descriptor.flags & 0x20) // OCRstreamFlag as defined in 7.2.6.5.1 of ISO/IEC 14486-1:2010(E)
{
esBitstr.write16Bits(mES_Descriptor.OCR_ES_Id);
}
esBitstr.write8Bits(mES_Descriptor.decConfigDescr.DecoderConfigDescrTag);
BitStream decConfigBitstr;
std::uint64_t decConfigSize = mES_Descriptor.decConfigDescr.size;
std::uint64_t decConfigSizeSize;
bool decConfigSizeConverged = false;
while (!decConfigSizeConverged)
{
decConfigBitstr.clear();
decConfigSizeSize = writeSize(decConfigBitstr, static_cast<uint32_t>(decConfigSize));
decConfigBitstr.write8Bits(mES_Descriptor.decConfigDescr.objectTypeIndication);
decConfigBitstr.write8Bits((mES_Descriptor.decConfigDescr.streamType << 2) | 0x01);
decConfigBitstr.write24Bits(mES_Descriptor.decConfigDescr.bufferSizeDB);
decConfigBitstr.write32Bits(mES_Descriptor.decConfigDescr.maxBitrate);
decConfigBitstr.write32Bits(mES_Descriptor.decConfigDescr.avgBitrate);
if (mES_Descriptor.decConfigDescr.decSpecificInfo.DecSpecificInfoTag == 5)
{
writeDecoderSpecificInfo(decConfigBitstr, mES_Descriptor.decConfigDescr.decSpecificInfo);
}
for (const auto& decSpecificInfo : mOtherDecSpecificInfo)
{
writeDecoderSpecificInfo(decConfigBitstr, decSpecificInfo);
}
decConfigSizeConverged = decConfigBitstr.getSize() == std::uint64_t(decConfigSize) + decConfigSizeSize;
if (!decConfigSizeConverged)
{
decConfigSize = decConfigBitstr.getSize() - decConfigSizeSize;
}
}
esBitstr.writeBitStream(decConfigBitstr);
esSizeConverged = esBitstr.getSize() == std::uint64_t(esDescriptorSize) + esSizeSize;
if (!esSizeConverged)
{
esDescriptorSize = std::uint32_t(esBitstr.getSize() - esSizeSize);
}
}
bitstr.writeBitStream(esBitstr);
updateSize(bitstr);
}