当前位置: 首页>>代码示例>>C++>>正文


C++ BitStream::read8Bits方法代码示例

本文整理汇总了C++中BitStream::read8Bits方法的典型用法代码示例。如果您正苦于以下问题:C++ BitStream::read8Bits方法的具体用法?C++ BitStream::read8Bits怎么用?C++ BitStream::read8Bits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BitStream的用法示例。


在下文中一共展示了BitStream::read8Bits方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
开发者ID:jfiguinha,项目名称:Regards,代码行数:42,代码来源:imageoverlay.cpp

示例2: parseImageGrid

ImageGrid parseImageGrid(BitStream& input)
{
    ImageGrid grid;

    input.read8Bits();                             // discard version
    bool read32BitFields = input.read8Bits() & 1;  // flags

    grid.rowsMinusOne    = input.read8Bits();
    grid.columnsMinusOne = input.read8Bits();

    if (read32BitFields)
    {
        grid.outputWidth  = input.read32Bits();
        grid.outputHeight = input.read32Bits();
    }
    else
    {
        grid.outputWidth  = input.read16Bits();
        grid.outputHeight = input.read16Bits();
    }

    return grid;
}
开发者ID:jfiguinha,项目名称:Regards,代码行数:23,代码来源:imagegrid.cpp

示例3: parseBox

void ElementaryStreamDescriptorBox::parseBox(BitStream& bitstr)
{
    parseFullBoxHeader(bitstr);

    //////////////////////////////////////////////
    //      Fill in struct ES_Descriptor        //
    //////////////////////////////////////////////
    mES_Descriptor.ES_DescrTag = bitstr.read8Bits();
    if (mES_Descriptor.ES_DescrTag != 3)  // ES_DescrTag
    {
        throw RuntimeError("ElementaryStreamDescritorBox ES_Descriptor.ES_DescrTag not valid");
    }
    /* Expandable class... need to find out size based on (from ISO/IEC 14496-1)
     * int sizeOfInstance = 0;
     * bit(1) nextByte;
     * bit(7) sizeOfInstance;
     * while(nextByte) {
     *      bit(1) nextByte;
     *      bit(7) sizeByte;
     *      sizeOfInstance = sizeOfInstance<<7 | sizeByte; }
     */
    std::uint8_t readByte = 0;
    std::uint32_t size    = 0;
    do
    {
        readByte              = bitstr.read8Bits();
        std::uint8_t sizeByte = (readByte & 0x7F);
        size                  = (size << 7) | sizeByte;
    } while (readByte & 0x80);

    mES_Descriptor.size  = size;
    mES_Descriptor.ES_ID = bitstr.read16Bits();
    mES_Descriptor.flags = bitstr.read8Bits();

    if (mES_Descriptor.flags & 0x80)  // streamDependenceFlag as defined in 7.2.6.5.1 of ISO/IEC 14486-1:2010(E)
    {
        mES_Descriptor.dependsOn_ES_ID = bitstr.read16Bits();
    }

    if (mES_Descriptor.flags & 0x40)  // URL_Flag as defined in 7.2.6.5.1 of ISO/IEC 14486-1:2010(E)
    {
        mES_Descriptor.URLlength = bitstr.read8Bits();
        if (mES_Descriptor.URLlength)
        {
            bitstr.readStringWithLen(mES_Descriptor.URLstring, mES_Descriptor.URLlength);
        }
    }

    if (mES_Descriptor.flags & 0x20)  // OCRstreamFlag as defined in 7.2.6.5.1 of ISO/IEC 14486-1:2010(E)
    {
        mES_Descriptor.OCR_ES_Id = bitstr.read16Bits();
    }

    //////////////////////////////////////////////////////////////////
    //      Fill in struct ES_Descriptor.DecoderConfigDescriptor    //
    //////////////////////////////////////////////////////////////////
    mES_Descriptor.decConfigDescr.DecoderConfigDescrTag = bitstr.read8Bits();
    if (mES_Descriptor.decConfigDescr.DecoderConfigDescrTag != 4)  // DecoderConfigDescrTag
    {
        throw RuntimeError("ElementaryStreamDescritorBox DecoderConfigDescriptor.DecoderConfigDescrTag not valid");
    }

    readByte = 0;
    size     = 0;
    do
    {
        readByte              = bitstr.read8Bits();
        std::uint8_t sizeByte = (readByte & 0x7f);
        size                  = (size << 7) | sizeByte;
    } while (readByte & 0x80);

    mES_Descriptor.decConfigDescr.size                 = size;
    mES_Descriptor.decConfigDescr.objectTypeIndication = bitstr.read8Bits();
    mES_Descriptor.decConfigDescr.streamType           = (bitstr.read8Bits() >> 2);
    mES_Descriptor.decConfigDescr.bufferSizeDB         = bitstr.read24Bits();
    mES_Descriptor.decConfigDescr.maxBitrate           = bitstr.read32Bits();
    mES_Descriptor.decConfigDescr.avgBitrate           = bitstr.read32Bits();

    /////////////////////////////////////////////////////////////////////////////////////
    //      Fill in struct ES_Descriptor.DecoderConfigDescriptor.DecoderSpecificInfo   //
    /////////////////////////////////////////////////////////////////////////////////////
    while (bitstr.numBytesLeft())  // DecoderSpecificInfo is optional.
    {
        std::uint8_t tag = bitstr.read8Bits();

        readByte = 0;
        size     = 0;
        do
        {
            readByte              = bitstr.read8Bits();
            std::uint8_t sizeByte = (readByte & 0x7f);
            size                  = (size << 7) | sizeByte;
        } while (readByte & 0x80);

        DecoderSpecificInfo decSpecificInfo;

        decSpecificInfo.DecSpecificInfoTag = tag;
        decSpecificInfo.size               = size;
        bitstr.read8BitsArray(decSpecificInfo.DecSpecificInfo, decSpecificInfo.size);

//.........这里部分代码省略.........
开发者ID:jfiguinha,项目名称:Regards,代码行数:101,代码来源:elementarystreamdescriptorbox.cpp


注:本文中的BitStream::read8Bits方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。