From 4f72d8aabd9127c4885db3d332cbd74952d61967 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Tue, 20 Jun 2017 12:39:02 +0200 Subject: [PATCH] Check only VPS, SPS, and PPS nal types for completeness. --- MP42/MP42FormatUtilites.mm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/MP42/MP42FormatUtilites.mm b/MP42/MP42FormatUtilites.mm index d669329..bf842a8 100644 --- a/MP42/MP42FormatUtilites.mm +++ b/MP42/MP42FormatUtilites.mm @@ -1166,6 +1166,9 @@ struct NAL_units{ UInt16 numNalus; }; +#define NAL_UNIT_VPS 32 +#define NAL_UNIT_SPS 33 +#define NAL_UNIT_PPS 34 typedef struct HEVCConfig { UInt8 configurationVersion; @@ -1241,9 +1244,10 @@ int analyze_HEVC(const uint8_t *cookie, uint32_t cookieLen, bool *completeness) info->NAL_units = (struct NAL_units *)malloc(sizeof(struct NAL_units) * info->numOfArrays); for (UInt8 j = 0; j < info->numOfArrays; j++) { + bool unitIsComplete = true; info->NAL_units[j].array_completeness = b.GetBits(1); if (info->NAL_units[j].array_completeness == 0) { - complete = false; + unitIsComplete = false; } b.SkipBits(1); // reserved 0 @@ -1251,6 +1255,12 @@ int analyze_HEVC(const uint8_t *cookie, uint32_t cookieLen, bool *completeness) info->NAL_units[j].NAL_unit_type = b.GetBits(6); info->NAL_units[j].numNalus = b.GetBits(16); + if (info->NAL_units[j].NAL_unit_type == NAL_UNIT_VPS || + info->NAL_units[j].NAL_unit_type == NAL_UNIT_SPS || + info->NAL_units[j].NAL_unit_type == NAL_UNIT_PPS) { + complete = unitIsComplete; + } + for (UInt8 i = 0; i < info->NAL_units[j].numNalus; i++) { UInt16 nalUnitLength = b.GetBits(16); b.SkipBits(8 * nalUnitLength);