From 27b60750c240d9d8b785c03938e68cc8cf928454 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 7 Dec 2011 22:45:45 +0100 Subject: [PATCH] Fix MPEG audio detection problems due to invalid layer 4 --- ChangeLog | 6 ++++++ src/input/r_mpeg_ps.cpp | 2 +- tests/results.txt | 1 + tests/test-326mpeg_ps_mpeg_audio_layer4.rb | 13 +++++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 tests/test-326mpeg_ps_mpeg_audio_layer4.rb diff --git a/ChangeLog b/ChangeLog index ee6d7c4f6..0fde9006e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-12-07 Moritz Bunkus + + * mkvmerge: bug fix: Fixed a rare audio type mis-detection of + MP2/MP3 audio tracks in MPEG program streams causing mkvmerge to + abort with an error message. + 2011-12-04 Nils Maier * mkvmerge, mkvextract: enhancement: Implemented input file diff --git a/src/input/r_mpeg_ps.cpp b/src/input/r_mpeg_ps.cpp index 4e8217778..9458a1d2e 100644 --- a/src/input/r_mpeg_ps.cpp +++ b/src/input/r_mpeg_ps.cpp @@ -770,7 +770,7 @@ mpeg_ps_reader_c::new_stream_a_mpeg(mpeg_ps_id_t, decode_mp3_header(buf, &header); track->a_channels = header.channels; track->a_sample_rate = header.sampling_frequency; - track->fourcc = FOURCC('M', 'P', '0' + header.layer, ' '); + track->fourcc = FOURCC('M', 'P', '0' + std::max(2, std::min(3, header.layer)), ' '); } void diff --git a/tests/results.txt b/tests/results.txt index 436c53144..99a85abbd 100644 --- a/tests/results.txt +++ b/tests/results.txt @@ -171,3 +171,4 @@ T_322propedit_track_headers:785209f2dc35ad6177bea2ca6e43198f-e19a10295b0635a0581 T_323propedit_segment_info:785209f2dc35ad6177bea2ca6e43198f-2df9da2d502a7d5ad914966c27393844-c65579659de3fb44c74aed6965b5ce2e:passed:20111203-152845:0.320514946 T_324propedit_chapters:785209f2dc35ad6177bea2ca6e43198f-f240df9a576de2cc683e1f4ef0fa6e23-a6d99a5e779aa1c65ba4d03597754d37-88a693fa89e98cf778fb6abad09da08a-2a53e52d0e3b13d37f5e9f411a9e74eb-ca7f40c5103109873741d594e0bd94eb-ee5f4977886284f0d97519895fbab9d8-9f3dfc35e73e1061124b2b208a028e54-11d7efba28fe0cd85b03919dd87324e9-d41d8cd98f00b204e9800998ecf8427e:passed:20111203-154502:0.598148676 T_325propedit_tags:785209f2dc35ad6177bea2ca6e43198f-3f151ff52e43ed1df3c173e5b0c78ee2-e58a5937ac6e0dc71d6c8264c53535be-cde42f3a1204403bd9f825f6c408521e-e58a5937ac6e0dc71d6c8264c53535be-cde42f3a1204403bd9f825f6c408521e-e26ce3a9725c74e16b5be99a5a917ae2-1a6b0e586328c306d63e9d829c85dcbe-8aa2fda41ba5c0cfe6fec3d46611896c-15c4f84c3afd7b158c0c1cd372f898d9-8aa2fda41ba5c0cfe6fec3d46611896c-15c4f84c3afd7b158c0c1cd372f898d9-53f569add0f778e2813ba1f7e7e5a2b6-1e1f38bd64d26e8a38e45c39b8ef2f5b-54597c44d0938662d716edd21e4d6c68-d41d8cd98f00b204e9800998ecf8427e:passed:20111203-160727:1.442408716 +T_326mpeg_ps_mpeg_audio_layer4:ff06a9bda2235c9c834ef839344325af:passed:20111207-224511:2.60761265 diff --git a/tests/test-326mpeg_ps_mpeg_audio_layer4.rb b/tests/test-326mpeg_ps_mpeg_audio_layer4.rb new file mode 100644 index 000000000..130913378 --- /dev/null +++ b/tests/test-326mpeg_ps_mpeg_audio_layer4.rb @@ -0,0 +1,13 @@ +#!/usr/bin/ruby -w + +class T_326mpeg_ps_mpeg_audio_layer4 < Test + def description + "mkvmerge / MPEG PS with MPEG audio layer 4" + end + + def run + merge "data/mpeg12/mpeg_audio_layer4.mpg", 1 + hash_tmp + end +end +