Fix timecode handling for MPEG TS with video packets without timecodes

This commit is contained in:
Moritz Bunkus 2011-11-28 22:56:23 +01:00
parent 3a6dc5b5ec
commit ac245bfaad
2 changed files with 9 additions and 10 deletions

View File

@ -52,24 +52,23 @@ int mpeg_ts_reader_c::potential_packet_sizes[] = { 188, 192, 204, 0 };
void
mpeg_ts_track_c::send_to_packetizer() {
int64_t timecode_to_use = (timecode < reader.m_global_timecode_offset) ? 0 : (timecode - reader.m_global_timecode_offset) * 100000ll / 9;
if ((type == ES_AUDIO_TYPE) && reader.m_dont_use_audio_pts)
timecode_to_use = -1;
int64_t timecode_to_use = (-1 == timecode) ? -1
: reader.m_dont_use_audio_pts && (ES_AUDIO_TYPE == type) ? -1
: m_apply_dts_timecode_fix && (m_previous_timecode == timecode) ? -1
: (timecode < reader.m_global_timecode_offset) ? 0
: (timecode - reader.m_global_timecode_offset) * 100000ll / 9;
mxverb(3, boost::format("mpeg_ts: PTS in nanoseconds: %1%\n") % timecode_to_use);
if (ptzr != -1) {
if (m_apply_dts_timecode_fix && (m_previous_timecode == timecode))
timecode_to_use = -1;
if (ptzr != -1)
reader.m_reader_packetizers[ptzr]->process(new packet_t(clone_memory(pes_payload->get_buffer(), pes_payload->get_size()), timecode_to_use));
}
pes_payload->remove(pes_payload->get_size());
processed = false;
data_ready = false;
pes_payload_size = 0;
m_previous_timecode = timecode;
timecode = -1;
reader.m_packet_sent_to_packetizer = true;
}

View File

@ -145,8 +145,8 @@ T_296video_frames_duration_0:5799836e2ff0742618d34a3e817f4c23:passed:20110709-14
T_297mpeg_transport_streams:5bf7b0adead3cbcae2737b878842dd5e-68a51f8c5cdefcca641c13d7db50a853:passed:20110913-112636:10.706480253
T_298ts_language:d600fae1d79a3fcb3d35066f938cd8c5:passed:20110915-221140:10.526064317
T_299ts_ghost_entries_in_pmt:5716a012cd61366198ec92772fd216ea:passed:20110917-004553:0.348880316
T_300ts_dts_duplicate_timestamps:174708cf0ba609f8015786640a1fd080:passed:20110918-154508:1.230918853
T_301ts_pgssub:15c8c5ed1098bb623f0316e383eef182:passed:20110918-154732:1.237027466
T_300ts_dts_duplicate_timestamps:20dc3a1cefa6b222f637d50a8e5009b0:passed:20110918-154508:1.230918853
T_301ts_pgssub:288073767e64ed273d1c7f528c673d25:passed:20110918-154732:1.237027466
T_302pat_pmt_only_once:073d3fe1f12db53521285ea4b5df8aed:passed:20110927-222121:0.240361843
T_303mpeg_ts_eac3_pmt_descriptor_tag_0x7a:5647f48b42ebb93f43d70523e08df7eb:passed:20111008-150823:2.078023996
T_304eac3_pes_private_but_no_pmt_descriptor_tag:4ed5e05b2f95f0cb75db433ed1040050:passed:20111009-113137:2.473216604