本文整理汇总了C++中packet_cptr::has_timecode方法的典型用法代码示例。如果您正苦于以下问题:C++ packet_cptr::has_timecode方法的具体用法?C++ packet_cptr::has_timecode怎么用?C++ packet_cptr::has_timecode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类packet_cptr
的用法示例。
在下文中一共展示了packet_cptr::has_timecode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process_framed
int
mpeg1_2_video_packetizer_c::process(packet_cptr packet) {
if (0.0 > m_fps)
extract_fps(packet->data->get_buffer(), packet->data->get_size());
if (!m_aspect_ratio_extracted)
extract_aspect_ratio(packet->data->get_buffer(), packet->data->get_size());
if (m_framed)
return process_framed(packet);
int state = m_parser.GetState();
if ((MPV_PARSER_STATE_EOS == state) || (MPV_PARSER_STATE_ERROR == state))
return FILE_STATUS_DONE;
memory_cptr old_memory = packet->data;
unsigned char *data_ptr = old_memory->get_buffer();
int new_bytes = old_memory->get_size();
if (packet->has_timecode())
m_parser.AddTimecode(packet->timecode);
do {
int bytes_to_add = (m_parser.GetFreeBufferSpace() < new_bytes) ? m_parser.GetFreeBufferSpace() : new_bytes;
if (0 < bytes_to_add) {
m_parser.WriteData(data_ptr, bytes_to_add);
data_ptr += bytes_to_add;
new_bytes -= bytes_to_add;
}
state = m_parser.GetState();
while (MPV_PARSER_STATE_FRAME == state) {
MPEGFrame *frame = m_parser.ReadFrame();
if (NULL == frame)
break;
if (NULL == m_hcodec_private)
create_private_data();
packet_cptr new_packet = packet_cptr(new packet_t(new memory_c(frame->data, frame->size, true), frame->timecode, frame->duration, frame->firstRef, frame->secondRef));
new_packet->time_factor = MPEG2_PICTURE_TYPE_FRAME == frame->pictureStructure ? 1 : 2;
put_sequence_headers_into_codec_state(new_packet);
video_packetizer_c::process(new_packet);
frame->data = NULL;
delete frame;
state = m_parser.GetState();
}
} while (0 < new_bytes);
return FILE_STATUS_MOREDATA;
}
示例2: process_packaged
int
pcm_packetizer_c::process(packet_cptr packet) {
if (packet->has_timecode() && (packet->data->get_size() >= m_min_packet_size))
return process_packaged(packet);
m_buffer.add(packet->data->get_buffer(), packet->data->get_size());
while (m_buffer.get_size() >= m_packet_size) {
add_packet(new packet_t(memory_c::clone(m_buffer.get_buffer(), m_packet_size), m_samples_output * m_s2tc, m_samples_per_packet * m_s2tc));
m_buffer.remove(m_packet_size);
m_samples_output += m_samples_per_packet;
}
return FILE_STATUS_MOREDATA;
}
示例3: while
int
mpeg1_2_video_packetizer_c::process_unframed(packet_cptr packet) {
int state = m_parser.GetState();
if ((MPV_PARSER_STATE_EOS == state) || (MPV_PARSER_STATE_ERROR == state))
return FILE_STATUS_DONE;
auto old_memory = packet->data;
auto data_ptr = old_memory->get_buffer();
int new_bytes = old_memory->get_size();
if (packet->has_timecode())
m_parser.AddTimecode(packet->timecode);
do {
int bytes_to_add = std::min<int>(m_parser.GetFreeBufferSpace(), new_bytes);
if (0 < bytes_to_add) {
m_parser.WriteData(data_ptr, bytes_to_add);
data_ptr += bytes_to_add;
new_bytes -= bytes_to_add;
}
state = m_parser.GetState();
while (MPV_PARSER_STATE_FRAME == state) {
auto frame = std::shared_ptr<MPEGFrame>(m_parser.ReadFrame());
if (!frame)
break;
if (!m_hcodec_private)
create_private_data();
packet_cptr new_packet = packet_cptr(new packet_t(new memory_c(frame->data, frame->size, true), frame->timecode, frame->duration, frame->refs[0], frame->refs[1]));
new_packet->time_factor = MPEG2_PICTURE_TYPE_FRAME == frame->pictureStructure ? 1 : 2;
remove_stuffing_bytes_and_handle_sequence_headers(new_packet);
generic_video_packetizer_c::process(new_packet);
frame->data = nullptr;
state = m_parser.GetState();
}
} while (0 < new_bytes);
return FILE_STATUS_MOREDATA;
}
示例4: catch
int
opus_packetizer_c::process(packet_cptr packet) {
try {
auto toc = mtx::opus::toc_t::decode(packet->data);
mxdebug_if(m_debug, boost::format("TOC: %1%\n") % toc);
if (!packet->has_timecode() || (timecode_c::ns(packet->timecode) == m_previous_provided_timecode))
packet->timecode = m_next_calculated_timecode.to_ns();
else
m_previous_provided_timecode = timecode_c::ns(packet->timecode);
packet->duration = toc.packet_duration.to_ns();
m_next_calculated_timecode = timecode_c::ns(packet->timecode + packet->duration);
add_packet(packet);
} catch (mtx::opus::exception &ex) {
mxdebug_if(m_debug, boost::format("Exception: %1%\n") % ex.what());
}
return FILE_STATUS_MOREDATA;
}
示例5:
void
timestamp_calculator_c::add_timecode(packet_cptr const &packet) {
if (packet->has_timecode())
add_timecode(timestamp_c::ns(packet->timecode));
}