本文整理汇总了C++中memory_cptr类的典型用法代码示例。如果您正苦于以下问题:C++ memory_cptr类的具体用法?C++ memory_cptr怎么用?C++ memory_cptr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了memory_cptr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
xtr_oggvorbis_c::handle_frame(memory_cptr &frame,
KaxBlockAdditions *,
int64_t,
int64_t,
int64_t,
int64_t,
bool,
bool,
bool) {
m_content_decoder.reverse(frame, CONTENT_ENCODING_SCOPE_BLOCK);
ogg_packet op;
op.packet = frame->get_buffer();
op.bytes = frame->get_size();
int64_t this_block_size = vorbis_packet_blocksize(&m_vorbis_info, &op);
if (-1 != m_previous_block_size) {
m_queued_granulepos = m_samples;
m_samples += (this_block_size + m_previous_block_size) / 4;
}
m_previous_end = m_samples * 1000000000 / m_sfreq;
m_previous_block_size = this_block_size;
queue_frame(frame, 0);
}
示例2: extract_vorbis_comments
static std::shared_ptr<std::vector<std::string> >
extract_vorbis_comments(const memory_cptr &mem) {
std::shared_ptr<std::vector<std::string> > comments(new std::vector<std::string>);
mm_mem_io_c in(mem->get_buffer(), mem->get_size());
uint32_t i, n, len;
try {
in.skip(7); // 0x03 "vorbis"
n = in.read_uint32_le(); // vendor_length
in.skip(n); // vendor_string
n = in.read_uint32_le(); // user_comment_list_length
comments->reserve(n);
for (i = 0; i < n; i++) {
len = in.read_uint32_le();
memory_cptr buffer(new memory_c((unsigned char *)safemalloc(len + 1), len + 1));
if (in.read(buffer->get_buffer(), len) != len)
throw false;
comments->push_back(std::string((char *)buffer->get_buffer(), len));
}
} catch(...) {
}
return comments;
}
示例3: mxverb
void
xtr_ivf_c::handle_frame(memory_cptr &frame,
KaxBlockAdditions *,
int64_t timecode,
int64_t,
int64_t,
int64_t,
bool,
bool,
bool) {
m_content_decoder.reverse(frame, CONTENT_ENCODING_SCOPE_BLOCK);
uint64_t frame_number = timecode * m_frame_rate_num / m_frame_rate_den / 1000000000ull;
mxverb(2, boost::format("timecode %1% num %2% den %3% frame_number %4% calculated back %5%\n")
% timecode % m_frame_rate_num % m_frame_rate_den % frame_number
% (frame_number * 1000000000ull * m_frame_rate_den / m_frame_rate_num));
ivf::frame_header_t frame_header;
put_uint32_le(&frame_header.frame_size, frame->get_size());
put_uint32_le(&frame_header.timestamp, frame_number);
m_out->write(&frame_header, sizeof(frame_header));
m_out->write(frame->get_buffer(), frame->get_size());
++m_frame_count;
}
示例4: compression_x
void
header_removal_compressor_c::compress(memory_cptr &buffer) {
if (!m_bytes.is_set() || (0 == m_bytes->get_size()))
return;
size_t size = m_bytes->get_size();
if (buffer->get_size() < size)
throw mtx::compression_x(boost::format(Y("Header removal compression not possible because the buffer contained %1% bytes "
"which is less than the size of the headers that should be removed, %2%.")) % buffer->get_size() % size);
unsigned char *buffer_ptr = buffer->get_buffer();
unsigned char *bytes_ptr = m_bytes->get_buffer();
if (memcmp(buffer_ptr, bytes_ptr, size)) {
std::string b_buffer, b_bytes;
size_t i;
for (i = 0; size > i; ++i) {
b_buffer += (boost::format(" %|1$02x|") % static_cast<unsigned int>(buffer_ptr[i])).str();
b_bytes += (boost::format(" %|1$02x|") % static_cast<unsigned int>(bytes_ptr[i])).str();
}
throw mtx::compression_x(boost::format(Y("Header removal compression not possible because the buffer did not start with the bytes that should be removed. "
"Wanted bytes:%1%; found:%2%.")) % b_bytes % b_buffer);
}
size_t new_size = buffer->get_size() - size;
if (buffer->is_free()) {
memmove(buffer_ptr, buffer_ptr + size, new_size);
buffer->set_size(new_size);
} else
buffer = clone_memory(buffer_ptr + size, new_size);
}
示例5:
size_t
mm_io_c::write(const memory_cptr &buffer,
size_t size,
size_t offset) {
size = std::min(buffer->get_size() - offset, size);
if (write(buffer->get_buffer() + offset, size) != size)
throw mtx::mm_io::end_of_file_x();
return size;
}
示例6:
void
generic_packetizer_c::set_codec_private(memory_cptr const &buffer) {
if (buffer && buffer->get_size()) {
m_hcodec_private = buffer->clone();
if (m_track_entry)
GetChild<KaxCodecPrivate>(*m_track_entry).CopyBuffer(static_cast<binary *>(m_hcodec_private->get_buffer()), m_hcodec_private->get_size());
} else
m_hcodec_private.reset();
}
示例7: memcpy
void
header_removal_compressor_c::decompress(memory_cptr &buffer) {
if (!m_bytes.is_set() || (0 == m_bytes->get_size()))
return;
memory_cptr new_buffer = memory_c::alloc(buffer->get_size() + m_bytes->get_size());
memcpy(new_buffer->get_buffer(), m_bytes->get_buffer(), m_bytes->get_size());
memcpy(new_buffer->get_buffer() + m_bytes->get_size(), buffer->get_buffer(), buffer->get_size());
buffer = new_buffer;
}
示例8: memcpy
memory_cptr
header_removal_compressor_c::do_decompress(memory_cptr const &buffer) {
if (!m_bytes || (0 == m_bytes->get_size()))
return buffer;
memory_cptr new_buffer = memory_c::alloc(buffer->get_size() + m_bytes->get_size());
memcpy(new_buffer->get_buffer(), m_bytes->get_buffer(), m_bytes->get_size());
memcpy(new_buffer->get_buffer() + m_bytes->get_size(), buffer->get_buffer(), buffer->get_size());
return new_buffer;
}
示例9: mxinfo
void
vc1_info_c::handle_sequence_header_packet(memory_cptr packet) {
std::string checksum = create_checksum_info(packet);
mxinfo(boost::format(Y("Sequence header at %1% size %2%%3%\n")) % m_stream_pos % packet->get_size() % checksum);
m_seqhdr_found = vc1::parse_sequence_header(packet->get_buffer(), packet->get_size(), m_seqhdr);
if (g_opt_sequence_headers) {
if (m_seqhdr_found)
dump_sequence_header(m_seqhdr);
else
mxinfo(Y(" parsing failed\n"));
}
}
示例10: return
std::string
vc1_info_c::create_checksum_info(memory_cptr packet) {
if (!g_opt_checksum)
return "";
return (boost::format(Y(" checksum 0x%|1$08x|")) % calc_adler32(packet->get_buffer(), packet->get_size())).str();
}
示例11: add_pre_frame_extra_data
void
vc1::es_parser_c::handle_entrypoint_packet(memory_cptr packet) {
add_pre_frame_extra_data(packet);
if (!m_raw_entrypoint.is_set())
m_raw_entrypoint = memory_cptr(packet->clone());
}
示例12: switch
void
vc1::es_parser_c::handle_packet(memory_cptr packet) {
uint32_t marker = get_uint32_be(packet->get_buffer());
switch (marker) {
case VC1_MARKER_SEQHDR:
handle_sequence_header_packet(packet);
break;
case VC1_MARKER_ENTRYPOINT:
handle_entrypoint_packet(packet);
break;
case VC1_MARKER_FRAME:
handle_frame_packet(packet);
break;
case VC1_MARKER_SLICE:
handle_slice_packet(packet);
break;
case VC1_MARKER_FIELD:
handle_field_packet(packet);
break;
case VC1_MARKER_ENDOFSEQ:
handle_end_of_sequence_packet(packet);
break;
default:
handle_unknown_packet(marker, packet);
break;
}
}
示例13: add_pre_frame_extra_data
void
vc1::es_parser_c::handle_entrypoint_packet(memory_cptr packet) {
if (!postpone_processing(packet))
add_pre_frame_extra_data(packet);
if (!m_raw_entrypoint)
m_raw_entrypoint = memory_cptr(packet->clone());
}
示例14:
hdmv_textst_packetizer_c::hdmv_textst_packetizer_c(generic_reader_c *p_reader,
track_info_c &p_ti,
memory_cptr const &dialog_style_segment)
: generic_packetizer_c{p_reader, p_ti}
{
m_ti.m_private_data = dialog_style_segment->clone();
set_track_type(track_subtitle);
// set_default_compression_method(COMPRESSION_ZLIB);
}
示例15:
bool
vc1::es_parser_c::postpone_processing(memory_cptr &packet) {
if (m_seqhdr_found)
return false;
packet->grab();
m_unparsed_packets.push_back(packet);
return true;
}