diff --git a/NEWS.md b/NEWS.md index 10cb8fbef..b7fe41c92 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,11 @@ # Version ? +## New features and enhancements + +* mkvmerge: AAC: added support for LOAS/LATM files with channel configuration + indexes 11–13 (channel counts 6.1, 7.1 & 22.2) according to Rec. ITU-R + BS.1196-7. Fixes #3081. + ## Bug fixes * mkvextract: AAC: mkvextract will now abort with an useful error message when diff --git a/src/common/aac.cpp b/src/common/aac.cpp index 2cb1ceb64..2a97f711a 100644 --- a/src/common/aac.cpp +++ b/src/common/aac.cpp @@ -36,8 +36,9 @@ static std::array const s_sampling_freq = { }; // See ISO/IEC 14496-3, table 1.17 — Channel Configuration -static std::array const s_aac_channel_configuration = { +static std::array const s_aac_channel_configuration = { 0, 1, 2, 3, 4, 5, 6, 8, + 0, 0, 0, 7, 8, 24, // from Rec. ITU-R BS.1196-7 }; static debugging_option_c s_debug_parse_data{"aac_parse_audio_specific_config|aac_full"}; @@ -51,6 +52,15 @@ get_sampling_freq_idx(unsigned int sampling_freq) { return 0; // should never happen } +static unsigned int +get_channel_configuration(unsigned int channels) { + for (auto i = 0u; i < s_aac_channel_configuration.size(); i++) + if (channels == s_aac_channel_configuration[i]) + return i; + + return 0; +} + bool parse_codec_id(const std::string &codec_id, int &id, @@ -119,7 +129,7 @@ create_audio_specific_config(audio_config_t const &audio_config) { write_object_type(audio_config.profile + 1); write_sampling_frequency(audio_config.sample_rate); - w.put_bits(4, audio_config.channels == 8 ? 7 : audio_config.channels); + w.put_bits(4, get_channel_configuration(audio_config.channels)); if (audio_config.ga_specific_config && audio_config.ga_specific_config_bit_size) { mtx::bits::reader_c r{audio_config.ga_specific_config->get_buffer(), audio_config.ga_specific_config->get_size()}; diff --git a/tests/results.txt b/tests/results.txt index 8135c7cf8..cb157e913 100644 --- a/tests/results.txt +++ b/tests/results.txt @@ -563,3 +563,4 @@ T_715byte_swapped_ac3:85b57a9ba0f29c8c1d280dfc53e8eaea:passed:20210207-115041:0. T_716X_hevc_parameter_sets_before_first_frame_differ_from_codecprivate:500a2ece86b5560e55806934d2bccce1:passed:20210218-194923:0.011528524 T_717bluray_identification:7eba7daecc266c0246cb0da127d2ac37-61d1928a57f92173893f38c070de9ba5:passed:20210219-160953:0.129931718 T_718non_ascii_characters_in_file_names:2ebcc8ab16429bde0266d3ef2c153942-c920ec2b2be96c0de5a59597779d964c-7535de2c43cbc270e2443220acb401eb-2a041e9b321d9271a5e8a3e612689995-fd026c48afdf123a9d500ad456f751d4-6cb00a6c0647b716e657969e666352f4-7684a8436bcca7a8885104e86c2dbf82-7535de2c43cbc270e2443220acb401eb-32751831418847d69442ffd5edb2103e-fd026c48afdf123a9d500ad456f751d4:passed:20210219-161442:0.12201246 +T_719aac_loas_channel_config_13:87ef2f9194c905d3e99e3912ca8c9000-true-6a479b3ecb989bfa4b143623c74faba6-true:passed:20210405-210312:0.034359504 diff --git a/tests/test-719aac_loas_channel_config_13.rb b/tests/test-719aac_loas_channel_config_13.rb new file mode 100755 index 000000000..ea93d557f --- /dev/null +++ b/tests/test-719aac_loas_channel_config_13.rb @@ -0,0 +1,18 @@ +#!/usr/bin/ruby -w + +# T_719aac_loas_channel_config_13 +describe "mkvmerge / LOAS/LATM AAC with channel config ≥ 8" + +[ [ "13-nishino", 24, 48000 ], [ "13-sun", 24, 48000 ] ].each do |spec| + file_name = "data/aac/channel-config-#{spec[0]}.aac" + + test_merge file_name + + test "identify #{file_name}" do + props = identify_json(file_name)["tracks"][0]["properties"] + ok = props["audio_channels"] == spec[1] and props["audio_sampling_frequency"] == spec[2] + + fail "audio specs don't match #{spec[1]} @ #{spec[2]}" if not ok + true + end +end