From d338c5dd120cbfa445ed2e63e7d79a29ee9355e9 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 19 Sep 2005 07:49:22 +0000 Subject: [PATCH] Also fix the BITMAPINFOHEADER with the new pixel dimenions after getting them from the bitstream. Added a test case for this feature. --- src/output/p_video.cpp | 7 +++++++ tests/results.txt | 1 + tests/test-213mp4_broken_pixel_dimensions.rb | 13 +++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 tests/test-213mp4_broken_pixel_dimensions.rb diff --git a/src/output/p_video.cpp b/src/output/p_video.cpp index e78d6b4b8..e0b6e8d6e 100644 --- a/src/output/p_video.cpp +++ b/src/output/p_video.cpp @@ -684,6 +684,13 @@ mpeg4_p2_video_packetizer_c::extract_size(const unsigned char *buffer, if ((width != hvideo_pixel_width) || (height != hvideo_pixel_height)) { set_video_pixel_width(width); set_video_pixel_height(height); + if (!output_is_native && + (ti.private_size >= sizeof(alBITMAPINFOHEADER))) { + alBITMAPINFOHEADER *bih = (alBITMAPINFOHEADER *)ti.private_data; + put_uint32_le(&bih->bi_width, width); + put_uint32_le(&bih->bi_height, height); + set_codec_private(ti.private_data, ti.private_size); + } generic_packetizer_c::set_headers(); rerender_track_headers(); mxinfo("Track %lld of '%s': The extracted values for video width and " diff --git a/tests/results.txt b/tests/results.txt index e63f14ac3..698cb61ba 100644 --- a/tests/results.txt +++ b/tests/results.txt @@ -59,3 +59,4 @@ T_209ac3misdeetected_as_mpeges:4ba8d5b8e4e847c5f74ca58f69ad3c69:passed:20050315- T_210splitting_and_chapters:1b7f8527b18911d49a1be6d1a06facd1-94ff3b0066760b32fd6a270daa9f5fca-509fabbe60c9520b6551b4fe27cd7bd5-c7a9564d80552c041177a0ed2661df28:passed:20050406-165104 T_211bug_segfault_reading_mp4:c6f3431d945dd85c766b4e68085ec270:passed:20050728-083402 T_212ssa_attachments:39c5b51454faea3ba07a7e6f61c52796-9a5a5ed80808c9d448ca5b44b640d8aa-c9a562c38a809df96ba6bd78220bb930-6ee73fb6f296ec5a9d9322c8ec556bc3-eda62b7022283f6ea28f28833331b00d:passed:20050824-131320 +T_213mp4_broken_pixel_dimensions:a39778c6feb6144d7035b7556042e85f:passed:20050919-094831 diff --git a/tests/test-213mp4_broken_pixel_dimensions.rb b/tests/test-213mp4_broken_pixel_dimensions.rb new file mode 100644 index 000000000..9d8bbf0f6 --- /dev/null +++ b/tests/test-213mp4_broken_pixel_dimensions.rb @@ -0,0 +1,13 @@ +#!/usr/bin/ruby -w + +class T_213mp4_broken_pixel_dimensions < Test + def description + return "mkvmerge / MP4 with wrong pixel dimensions / in(MP4)" + end + + def run + merge("data/mp4/P4230041.MP4") + return hash_tmp + end +end +