From 1a378a21e7bc95598dfeab6540530c6ced3f5a91 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 25 Aug 2005 09:17:25 +0000 Subject: [PATCH] Default display width/height to pixel width/height for video tracks read from Matroska files. Do not extract the AR from a MPEG-4 part 2 track if the display dimensions are given. --- ChangeLog | 10 ++++++++++ src/input/r_matroska.cpp | 13 ++++++------- src/output/p_video.cpp | 1 + 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index e224b0816..beb747ed6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-08-25 Moritz Bunkus + + * mkvmerge: bug fix: If a Matroska file with a MPEG-4 part 2 video + track was muxed into a Matroska file and the source file did not + contain the display width/height elements for that track then the + aspect ratio was extracted from the video data itself which + clashes with the Matroska specs which say that display + width/height default to the pixel width/height if they're not + present. + 2005-08-24 Moritz Bunkus * mkvmerge: bug fix: Native MPEG-4 ASP storage was still bugged: diff --git a/src/input/r_matroska.cpp b/src/input/r_matroska.cpp index 24ef34ea2..b6d31e9a3 100644 --- a/src/input/r_matroska.cpp +++ b/src/input/r_matroska.cpp @@ -1060,14 +1060,16 @@ kax_reader_c::read_headers() { track->v_dwidth = uint64(*kv_dwidth); if (verbose > 1) mxinfo(PFX "| + Display width: %llu\n", track->v_dwidth); - } + } else + track->v_dwidth = track->v_width; kv_dheight = FINDFIRST(ktvideo, KaxVideoDisplayHeight); if (kv_dheight != NULL) { track->v_dheight = uint64(*kv_dheight); if (verbose > 1) mxinfo(PFX "| + Display height: %llu\n", track->v_dheight); - } + } else + track->v_dheight = track->v_height; // For older files. kv_frate = FINDFIRST(ktvideo, KaxVideoFrameRate); @@ -2074,11 +2076,8 @@ kax_reader_c::identify() { if (tracks[i]->track_name != "") info += mxsprintf("track_name:%s ", escape(tracks[i]->track_name).c_str()); - if ((tracks[i]->v_dwidth != 0) && (tracks[i]->v_dheight != 0) && - ((tracks[i]->v_dwidth != tracks[i]->v_width) || - (tracks[i]->v_dheight != tracks[i]->v_height))) - info += mxsprintf("display_dimensions:%llux%llu ", - tracks[i]->v_dwidth, tracks[i]->v_dheight); + info += mxsprintf("display_dimensions:%llux%llu ", + tracks[i]->v_dwidth, tracks[i]->v_dheight); info += mxsprintf("default_track:%u ", tracks[i]->default_track ? 1 : 0); info += "]"; diff --git a/src/output/p_video.cpp b/src/output/p_video.cpp index 9c2da0be9..b8e5aa528 100644 --- a/src/output/p_video.cpp +++ b/src/output/p_video.cpp @@ -202,6 +202,7 @@ mpeg1_2_video_packetizer_c(generic_reader_c *_reader, set_codec_id(mxsprintf("V_MPEG%d", _version)); if (!ti.aspect_ratio_given && !ti.display_dimensions_given) { if ((_dwidth > 0) && (_dheight > 0)) { + aspect_ratio_extracted = true; ti.display_dimensions_given = true; ti.display_width = _dwidth; ti.display_height = _dheight;