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


C++ BlockIterator::advance方法代码示例

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


在下文中一共展示了BlockIterator::advance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: disasmInstruction

uint64_t CorDisasm::disasmInstruction(BlockIterator &BIter,
                                      bool DumpAsm) const {
  uint64_t TotalSize = 0;
  bool ContinueDisasm;

  // On X86, LLVM disassembler does not handle instruction prefixes
  // correctly -- please see LLVM bug 7709.
  // The disassembler reports instruction prefixes separate from the
  // actual instruction. In order to work-around this problem, we
  // continue decoding  past the prefix bytes.

  do {

    if (!decodeInstruction(BIter)) {
      return 0;
    }

    uint64_t Size = BIter.InstrSize;
    TotalSize += Size;

    if (DumpAsm) {
      dumpInstruction(BIter);
    }

    ContinueDisasm = false;
    if ((TheTargetArch == Target_X86) || (TheTargetArch == Target_X64)) {

      // Check if the decoded instruction is a prefix byte, and if so,
      // continue decoding.
      if (Size == 1) {
        for (uint8_t Pfx = 0; Pfx < X86NumPrefixes; Pfx++) {
          if (BIter.Ptr[0] == X86Prefix[Pfx].MachineOpcode) {
            ContinueDisasm = true;
            BIter.advance();
            break;
          }
        }
      }
    }
  } while (ContinueDisasm);

  return TotalSize;
}
开发者ID:Anbu2388,项目名称:llilc,代码行数:43,代码来源:coredistools.cpp

示例2: read

status_t MatroskaSource::read(
        MediaBuffer **out, const ReadOptions *options) {
    *out = NULL;

    int64_t seekTimeUs;
    ReadOptions::SeekMode mode;
    if (options && options->getSeekTo(&seekTimeUs, &mode)) {
        mBlockIter.seek(seekTimeUs);
    }

    if (mBlockIter.eos()) {
        return ERROR_END_OF_STREAM;
    }

    const mkvparser::Block *block = mBlockIter.block();
    size_t size = block->GetSize();
    int64_t timeUs = mBlockIter.blockTimeUs();

    MediaBuffer *buffer = new MediaBuffer(size + 2);
    buffer->meta_data()->setInt64(kKeyTime, timeUs);
    buffer->meta_data()->setInt32(kKeyIsSyncFrame, block->IsKey());

    long res = block->Read(
            mExtractor->mReader, (unsigned char *)buffer->data() + 2);

    if (res != 0) {
        return ERROR_END_OF_STREAM;
    }

    buffer->set_range(2, size);

    if (mType == AVC) {
        CHECK(size >= 2);

        uint8_t *data = (uint8_t *)buffer->data();

        unsigned NALsize = data[2] << 8 | data[3];
        CHECK_EQ(size, NALsize + 2);

        memcpy(data, "\x00\x00\x00\x01", 4);
        buffer->set_range(0, size + 2);
    } else if (mType == AAC) {
        // There's strange junk at the beginning...

        const uint8_t *data = (const uint8_t *)buffer->data() + 2;
        size_t offset = 0;
        while (offset < size && data[offset] != 0x21) {
            ++offset;
        }
        buffer->set_range(2 + offset, size - offset);
    }

    *out = buffer;

#if 0
    hexdump((const uint8_t *)buffer->data() + buffer->range_offset(),
            buffer->range_length());
#endif

    mBlockIter.advance();

    return OK;
}
开发者ID:ConicalRom,项目名称:platform_frameworks_base,代码行数:63,代码来源:MatroskaExtractor.cpp


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