From d69983987af110eb45d73158fdf0f10dbe2a0f11 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 10 Aug 2003 20:13:40 +0000 Subject: [PATCH] The aspect ratio setting will only cause upscaling of the current video dimensions which are then put into KaxVideoDisplayWidth and KaxVideoDisplayHeight. --- ChangeLog | 4 ++++ src/pr_generic.cpp | 36 +++++++++++++++++++++--------------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index a63b2766f..cf1ea35cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2003-08-10 Moritz Bunkus + * mkvmerge: The aspect ratio setting will only cause upscaling of + the current video dimensions which are then put into + KaxVideoDisplayWidth and KaxVideoDisplayHeight. + * mkvextract: Changed how the global elements are handled by taking the parent's size into account. This re-enables processing of files produced with the latest VirtualDubMod. diff --git a/src/pr_generic.cpp b/src/pr_generic.cpp index 6d02b9bc9..ed10b58f5 100644 --- a/src/pr_generic.cpp +++ b/src/pr_generic.cpp @@ -336,7 +336,7 @@ void generic_packetizer_c::set_language(char *language) { } void generic_packetizer_c::set_headers() { - int idx; + int idx, disp_width, disp_height; KaxTag *tag; if (track_entry == NULL) { @@ -408,26 +408,32 @@ void generic_packetizer_c::set_headers() { KaxTrackVideo &video = GetChild(*track_entry); - if (hvideo_pixel_height != -1) { - *(static_cast - (&GetChild(video))) = hvideo_pixel_height; - KaxVideoDisplayHeight &dheight = - GetChild(video); - *(static_cast(&dheight)) = hvideo_pixel_height; - dheight.SetDefaultSize(4); - } + if ((hvideo_pixel_height != -1) && (hvideo_pixel_width != -1)) { + if (ti->aspect_ratio > + ((float)hvideo_pixel_width / (float)hvideo_pixel_height)) { + disp_width = (int)(hvideo_pixel_height * ti->aspect_ratio); + disp_height = hvideo_pixel_height; + + } else { + disp_width = hvideo_pixel_width; + disp_height = (int)(hvideo_pixel_width * ti->aspect_ratio); + + } - if (hvideo_pixel_width != -1) { *(static_cast (&GetChild(video))) = hvideo_pixel_width; + *(static_cast + (&GetChild(video))) = hvideo_pixel_height; + KaxVideoDisplayWidth &dwidth = GetChild(video); - if (ti->aspect_ratio != 1.0) - *(static_cast(&dwidth)) = - (uint64_t)(hvideo_pixel_height * ti->aspect_ratio); - else - *(static_cast(&dwidth)) = hvideo_pixel_width; + *(static_cast(&dwidth)) = disp_width; dwidth.SetDefaultSize(4); + + KaxVideoDisplayHeight &dheight = + GetChild(video); + *(static_cast(&dheight)) = disp_height; + dheight.SetDefaultSize(4); } } else if (htrack_type == track_audio) {