From 7a27f3bd9e433a04a2cb6640692608b4f78a1a1c Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 24 Aug 2005 20:31:04 +0000 Subject: [PATCH] Native MPEG-4 ASP: simplified and fixed the timecode/duration assignment -- hopefully! --- ChangeLog | 3 +++ src/output/p_video.cpp | 51 ++++++++++++------------------------------ 2 files changed, 17 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64e25c148..e224b0816 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-08-24 Moritz Bunkus + * mkvmerge: bug fix: Native MPEG-4 ASP storage was still bugged: + timecodes were assigned twice, frames referenced themselves. + * mkvmerge: bug fix: Embedded fonts and pictures in a SSA/ASS file are not discarded any longer. They are converted to Matroska attachments instead. Other sections that were discarded are added diff --git a/src/output/p_video.cpp b/src/output/p_video.cpp index c18e0ea48..5febf7dde 100644 --- a/src/output/p_video.cpp +++ b/src/output/p_video.cpp @@ -585,52 +585,29 @@ mpeg4_p2_video_packetizer_c::handle_missing_timecodes(bool end_of_file) { void mpeg4_p2_video_packetizer_c::flush_frames(bool end_of_file) { - int i, num_bframes, b_offset; - int64_t b_bref, b_fref; + int i; if ((available_timecodes.size() < queued_frames.size()) || (available_durations.size() < queued_frames.size())) handle_missing_timecodes(end_of_file); - if ((2 <= queued_frames.size()) && (FRAME_TYPE_B != queued_frames[1].type)) - b_offset = 1; + queued_frames[0].timecode = available_timecodes[queued_frames.size() - 1]; + queued_frames[0].duration = available_durations[queued_frames.size() - 1]; + queued_frames[0].fref = -1; + if (FRAME_TYPE_I == queued_frames[0].type) + queued_frames[0].bref = -1; else - b_offset = 0; + queued_frames[0].bref = last_i_p_frame; - num_bframes = 0; - b_fref = -1; - b_bref = last_i_p_frame; - for (i = 0; i < queued_frames.size(); ++i) { - if (FRAME_TYPE_I == queued_frames[i].type) { - queued_frames[i].timecode = available_timecodes[0]; - queued_frames[i].duration = available_durations[0]; - queued_frames[i].bref = -1; - queued_frames[i].fref = -1; - if (-1 == last_i_p_frame) { - last_i_p_frame = queued_frames[i].timecode; - b_bref = queued_frames[i].timecode; - } - b_fref = queued_frames[i].timecode; - - } else if (FRAME_TYPE_P == queued_frames[i].type) { - queued_frames[i].timecode = - available_timecodes[queued_frames.size() - 1]; - queued_frames[i].duration = - available_durations[queued_frames.size() - 1]; - queued_frames[i].bref = last_i_p_frame; - last_i_p_frame = queued_frames[i].timecode; - b_fref = last_i_p_frame; - queued_frames[i].fref = -1; - - } else { - queued_frames[i].timecode = available_timecodes[num_bframes + b_offset]; - queued_frames[i].duration = available_durations[num_bframes + b_offset]; - queued_frames[i].bref = b_bref; - queued_frames[i].fref = b_fref; - ++num_bframes; - } + for (i = 1; queued_frames.size() > i; ++i) { + queued_frames[i].timecode = available_timecodes[i - 1]; + queued_frames[i].duration = available_durations[i - 1]; + queued_frames[i].fref = queued_frames[0].timecode; + queued_frames[i].bref = last_i_p_frame; } + last_i_p_frame = queued_frames[0].timecode; + for (i = 0; i < queued_frames.size(); ++i) add_packet(new packet_t(new memory_c(queued_frames[i].data, queued_frames[i].size, true),