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.

This commit is contained in:
Moritz Bunkus 2005-08-25 09:17:25 +00:00
parent 56703d4959
commit 1a378a21e7
3 changed files with 17 additions and 7 deletions

View File

@ -1,3 +1,13 @@
2005-08-25 Moritz Bunkus <moritz@bunkus.org>
* 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 <moritz@bunkus.org>
* mkvmerge: bug fix: Native MPEG-4 ASP storage was still bugged:

View File

@ -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,9 +2076,6 @@ 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("default_track:%u ",

View File

@ -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;