Пример #1
0
void
debugging_c::hexdump(memory_c const &buffer_to_dump,
                     boost::optional<std::size_t> max_length) {

  auto length = std::min<std::size_t>(max_length ? *max_length : buffer_to_dump.get_size(), buffer_to_dump.get_size());
  hexdump(buffer_to_dump.get_buffer(), length);
}
Пример #2
0
mm_mem_io_c::mm_mem_io_c(memory_c const &mem)
  : m_pos{}
  , m_mem_size{mem.get_size()}
  , m_allocated{mem.get_size()}
  , m_increase{}
  , m_mem{}
  , m_ro_mem{mem.get_buffer()}
  , m_free_mem{}
  , m_read_only{true}
{
  if (!m_ro_mem)
    throw mtx::invalid_parameter_x{};
}
Пример #3
0
void
mpeg4_p10_video_packetizer_c::remove_filler_nalus(memory_c &data)
  const {
  auto ptr        = data.get_buffer();
  auto total_size = data.get_size();
  auto idx        = 0u;

  while ((idx + m_nalu_size_len_dst) < total_size) {
    auto nalu_size = get_uint_be(&ptr[idx], m_nalu_size_len_dst) + m_nalu_size_len_dst;

    if ((idx + nalu_size) > total_size)
      break;

    if (ptr[idx + m_nalu_size_len_dst] == NALU_TYPE_FILLER_DATA) {
      memmove(&ptr[idx], &ptr[idx + nalu_size], total_size - idx - nalu_size);
      total_size -= nalu_size;
      continue;
    }

    idx += nalu_size;
  }

  data.resize(total_size);
}
Пример #4
0
uint64_t
calculate_as_uint(algorithm_e algorithm,
                  memory_c const &buffer,
                  uint64_t initial_value) {
  return calculate_as_uint(algorithm, buffer.get_buffer(), buffer.get_size(), initial_value);
}
Пример #5
0
void
set_initial_value_c::set_initial_value(memory_c const &initial_value) {
  set_initial_value_impl(initial_value.get_buffer(), initial_value.get_size());
}