From 96191d403c006af4097349368d4050c61f71ab95 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 14 May 2017 20:42:00 +0200 Subject: [PATCH] MP4 reader: support `nclx` colour type in `colr` atom An enhancement to #1804. --- NEWS.md | 2 ++ src/input/r_qtmp4.cpp | 3 ++- tests/results.txt | 3 ++- tests/test-599mp4_nclx_colour_type_in_colr_atom.rb | 5 +++++ 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100755 tests/test-599mp4_nclx_colour_type_in_colr_atom.rb diff --git a/NEWS.md b/NEWS.md index 6037b8e5e..34c5998fe 100644 --- a/NEWS.md +++ b/NEWS.md @@ -42,6 +42,8 @@ * mkvmerge: MP4 reader: fixed finding and parsing the `colr` atom if there are more than one video extension atoms and the `colr` atom is not the first one. +* mkvmerge: MP4 reader: the `nclx` colour type of the `colr` atom is now + recognized, too (as defined by ISO/IEC 14496-12, "ISO base media format"). # Version 11.0.0 "Alive" 2017-04-22 diff --git a/src/input/r_qtmp4.cpp b/src/input/r_qtmp4.cpp index b9c4906a6..833a47603 100644 --- a/src/input/r_qtmp4.cpp +++ b/src/input/r_qtmp4.cpp @@ -30,6 +30,7 @@ #include "common/hacks.h" #include "common/id_info.h" #include "common/iso639.h" +#include "common/list_utils.h" #include "common/math.h" #include "common/mp3.h" #include "common/strings/formatting.h" @@ -2719,7 +2720,7 @@ qtmp4_demuxer_c::handle_colr_atom(memory_cptr const &atom_content, auto &colr_atom = *reinterpret_cast(atom_content->get_buffer()); fourcc_c colour_type{reinterpret_cast(&colr_atom) + offsetof(colr_atom_t, colour_type)}; - if (colour_type != "nclc") + if (!mtx::included_in(colour_type, "nclc", "nclx")) return; v_colour_primaries = get_uint16_be(&colr_atom.colour_primaries); diff --git a/tests/results.txt b/tests/results.txt index 94c70f4a5..ae1ee3d73 100644 --- a/tests/results.txt +++ b/tests/results.txt @@ -286,7 +286,7 @@ T_437ac3_from_avi_with_garbage:56391fa45c37d9db2be1fa54c6b43485:passed:20140908- T_438pcm_in_vob:1868b20abd60a09ef111e07c06086a71:passed:20140917-213731:1.216717009 T_439pcm_in_m2ts:c55ea07add8d4dcf7477c4cad4b5e130-c76eed60c27198283a3b5090eb655159:passed:20140917-222633:4.736872644 T_440chapter_display_language_default_value:6dd844972d790ee741c58f5de5ff1555:passed:20140929-142306:0.021103552 -T_441mkvmerge_mp4_big_endian_pcm:7d8e29b86fa96934b1f4f16b5a43dac3:passed:20141104-190420:0.278181073 +T_441mkvmerge_mp4_big_endian_pcm:887d54fcd2216430429f07c8d15c248c:passed:20141104-190420:0.278181073 T_442ui_locale_ca_ES:b8b1ebb4a729cd34bac943b4a7eec4d5-efc218c7d73104f27e852a4d6b66412e:passed:20141105-201811:0.070000034 T_443hevc_keep_user_data:42bd85d67466b2c78a820684a78a3c7b:passed:20141105-202533:1.308417598 T_444pcm_statistics_from_packaged_sources:7fbfcd5dae796951c461de5aec60e3a9-7fbfcd5dae796951c461de5aec60e3a9-ffdebcc03419e30af6426dcb9310282b-833f726aa92853b669032182bc3fe56f-+++:passed:20141205-220805:0.604375231 @@ -444,3 +444,4 @@ T_595h264_bogus_timing_info:78c27e10b35f3bfea09d8c005dead342:passed:20170417-200 T_596mpeg_ts_aac_loas_latm_misdetected_as_adts:5ae490a6b1e59d5382aa887355b7d96e:passed:20170424-170304:0.084835812 T_597mpeg_ts_starting_with_avc_start_code:ae5233c238ef8ca33a713f3ab193864b:passed:20170510-145746:0.077795359 T_598aac_track_not_listed_in_pmt:444929dd4db38e68b59a3ebf833e5128-AAC:passed:20170511-221910:0.0849745 +T_599mp4_nclx_colour_type_in_colr_atom:3639a6fdf7a0e46d158188fdd932bd2b:passed:20170514-203828:0.018287634 diff --git a/tests/test-599mp4_nclx_colour_type_in_colr_atom.rb b/tests/test-599mp4_nclx_colour_type_in_colr_atom.rb new file mode 100755 index 000000000..e684151c8 --- /dev/null +++ b/tests/test-599mp4_nclx_colour_type_in_colr_atom.rb @@ -0,0 +1,5 @@ +#!/usr/bin/ruby -w + +# T_599mp4_nclx_colour_type_in_colr_atom +describe "mkvmerge / MP4 files with `nclx` colour type in the `colr` atom" +test_merge "data/mp4/colr_atom_with_nclx_colour_type.mp4"