diff --git a/.github/workflows/run-cli-test.yml b/.github/workflows/run-cli-test.yml index cdd8b8c9..5ebd0e94 100644 --- a/.github/workflows/run-cli-test.yml +++ b/.github/workflows/run-cli-test.yml @@ -15,7 +15,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.4' + php-version: '8.1' extensions: curl, xdebug, xml - name: Setup Java uses: actions/setup-java@v3 diff --git a/CMAF/impl/checkAlignedSwitchingSets.php b/CMAF/impl/checkAlignedSwitchingSets.php index b4979ded..9ebbb061 100644 --- a/CMAF/impl/checkAlignedSwitchingSets.php +++ b/CMAF/impl/checkAlignedSwitchingSets.php @@ -8,7 +8,8 @@ //Todo:More generalized approach with many Aligned Sw Sets. //Here assumption is only two Sw Sets are aligned. $adaptationSets = $mpdHandler->getFeatures()['Period'][$mpdHandler->getSelectedPeriod()]['AdaptationSet']; -for ($z = 0; $z < count($adaptationSets); $z++) { +$adaptationCount = ($adaptationSets == null ? 0 : count($adaptationSets)); +for ($z = 0; $z < $adaptationCount; $z++) { $supplementalProperty = $adaptationSets[$z]['SupplementalProperty']; if ($supplementalProperty) { if ($supplementalProperty[0]['schemeIdUri'] == 'urn:mpeg:dash:adaptation-set-switching:2016') { diff --git a/CMAF/impl/checkCMAFPresentation.php b/CMAF/impl/checkCMAFPresentation.php index 8c42ada7..6ffad6fb 100644 --- a/CMAF/impl/checkCMAFPresentation.php +++ b/CMAF/impl/checkCMAFPresentation.php @@ -19,7 +19,8 @@ $presentationDuration = $period_timing_info["duration"]; $adaptationSets = $mpdHandler->getFeatures()['Period'][$mpdHandler->getSelectedPeriod()]['AdaptationSet']; -for ($adaptationSetIndex = 0; $adaptationSetIndex < sizeof($adaptationSets); $adaptationSetIndex++) { +$adaptationCount = ($adaptationSets == null ? 0 : count($adaptationSets)); +for ($adaptationSetIndex = 0; $adaptationSetIndex < $adaptationCount; $adaptationSetIndex++) { $adaptationSet = $adaptationSets[$adaptationSetIndex]; $location = $session->getAdaptationDir($mpdHandler->getSelectedPeriod(), $adaptationSetIndex); diff --git a/CMAF/impl/checkCMAFTracks.php b/CMAF/impl/checkCMAFTracks.php index 78c10bff..36a6d2dc 100644 --- a/CMAF/impl/checkCMAFTracks.php +++ b/CMAF/impl/checkCMAFTracks.php @@ -139,7 +139,7 @@ ); } - if ($mdatFile == null) { + if ($mdatFile === false) { continue; } @@ -169,7 +169,7 @@ "Representation $id, chunk $j not valid" ); } -if ($mdatFile !== null) { +if ($mdatFile !== false) { fclose($mdatFile); } @@ -185,7 +185,7 @@ ); $hdlrBox = $xml->getElementsByTagName('hdlr')->item(0); -$hdlrType = $hdlrBox->getAttribute('handler_type'); +$hdlrType = ($hdlrBox == null ? '' : $hdlrBox->getAttribute('handler_type')); $elstBoxes = $xml->getElementsByTagName('elstEntry'); if ($elstBoxes->length > 0 && $hdlrType == 'vide') { diff --git a/CMAF/impl/determineCMAFMediaProfiles.php b/CMAF/impl/determineCMAFMediaProfiles.php index c247e764..f938e00b 100644 --- a/CMAF/impl/determineCMAFMediaProfiles.php +++ b/CMAF/impl/determineCMAFMediaProfiles.php @@ -16,7 +16,7 @@ if ($nalUnits->length != 0) { $spsUnitIndex = -1; for ($nalIndex = 0; $nalIndex < $nalUnits->length; $nalIndex++) { - if ($nalUnits->item($nalIndex)->getAttribute("nal_type") == "0x07") { + if (hexdec($nalUnits->item($nalIndex)->getAttribute("nal_type")) == 7) { $spsUnitIndex = $nalIndex; break; } @@ -26,24 +26,30 @@ ///\Resiliency Add checks for existing spsUnit $avcC = $videoSampleDescription->getElementsByTagName('avcC')->item(0); $comment = $nalUnits->item($spsUnitIndex)->getElementsByTagName("comment")->item(0); - $mediaProfileParameters['profile'] = $avcC->getAttribute("profile"); + $mediaProfileParameters['profile'] = hexdec($avcC->getAttribute("profile")); $mediaProfileParameters['level'] = (float)($comment->getAttribute("level_idc")) / 10; $mediaProfileParameters['width'] = $videoSampleDescription->getAttribute("width"); $mediaProfileParameters['height'] = $videoSampleDescription->getAttribute("height"); - if ($comment->getAttribute("vui_parameters_present_flag") == "0x1") { - if ($comment->getAttribute("video_signal_type_present_flag") == "0x1") { - if ($comment->getAttribute("colour_description_present_flag") == "0x1") { - $mediaProfileParameters['color_primaries'] = $comment->getAttribute("colour_primaries"); - $mediaProfileParameters['transfer_char'] = $comment->getAttribute("transfer_characteristics"); - $mediaProfileParameters['matrix_coeff'] = $comment->getAttribute("matrix_coefficients"); - } elseif ($comment->getAttribute("colour_description_present_flag") == "0x0") { - $mediaProfileParameters['color_primaries'] = "0x1"; - $mediaProfileParameters['transfer_char'] = "0x1"; - $mediaProfileParameters['matrix_coeff'] = "0x1"; + if (hexdec($comment->getAttribute("vui_parameters_present_flag")) == 1) { + if (hexdec($comment->getAttribute("video_signal_type_present_flag")) == 1) { + if (hexdec($comment->getAttribute("colour_description_present_flag")) == 1) { + $mediaProfileParameters['color_primaries'] = hexdec( + $comment->getAttribute("colour_primaries") + ); + $mediaProfileParameters['transfer_char'] = hexdec( + $comment->getAttribute("transfer_characteristics") + ); + $mediaProfileParameters['matrix_coeff'] = hexdec( + $comment->getAttribute("matrix_coefficients") + ); + } elseif (hexdec($comment->getAttribute("colour_description_present_flag")) == 0) { + $mediaProfileParameters['color_primaries'] = 1; + $mediaProfileParameters['transfer_char'] = 1; + $mediaProfileParameters['matrix_coeff'] = 1; } } - if ($comment->getAttribute("timing_info_present_flag") == "0x1") { + if (hexdec($comment->getAttribute("timing_info_present_flag")) == 1) { $numUnitsInTick = $comment->getAttribute("num_units_in_tick"); $timeScale = $comment->getAttribute("time_scale"); $mediaProfileParameters['framerate'] = $timeScale / (2 * $numUnitsInTick); @@ -100,13 +106,19 @@ if ($sps->getAttribute("vui_parameters_present_flag") == "1") { if ($sps->getAttribute("video_signal_type_present_flag") == "1") { if ($sps->getAttribute("colour_description_present_flag") == "1") { - $mediaProfileParameters['color_primaries'] = $sps->getAttribute("colour_primaries"); - $mediaProfileParameters['transfer_char'] = $sps->getAttribute("transfer_characteristics"); - $mediaProfileParameters['matrix_coeff'] = $sps->getAttribute("matrix_coeffs"); + $mediaProfileParameters['color_primaries'] = hexdec( + $sps->getAttribute("colour_primaries") + ); + $mediaProfileParameters['transfer_char'] = hexdec( + $sps->getAttribute("transfer_characteristics") + ); + $mediaProfileParameters['matrix_coeff'] = hexdec( + $sps->getAttribute("matrix_coeffs") + ); } elseif ($sps->getAttribute("colour_description_present_flag") == "0") { - $mediaProfileParameters['color_primaries'] = "1"; - $mediaProfileParameters['transfer_char'] = "1"; - $mediaProfileParameters['matrix_coeff'] = "1"; + $mediaProfileParameters['color_primaries'] = 1; + $mediaProfileParameters['transfer_char'] = 1; + $mediaProfileParameters['matrix_coeff'] = 1; } } if ($sps->getAttribute("vui_timing_info_present_flag") == "1") { @@ -142,8 +154,8 @@ $mediaProfileParameters['codec'] = "AAC"; $decoderSpecificInfo = $audioSampleDescription->getElementsByTagName("DecoderSpecificInfo")->item(0); $mediaProfileParameters['sampleRate'] = $audioSampleDescription->getAttribute('sampleRate'); - $mediaProfileParameters['profile'] = $decoderSpecificInfo->getAttribute("audioObjectType"); - $mediaProfileParameters['channels'] = $decoderSpecificInfo->getAttribute("channelConfig"); + $mediaProfileParameters['profile'] = hexdec($decoderSpecificInfo->getAttribute("audioObjectType")); + $mediaProfileParameters['channels'] = hexdec($decoderSpecificInfo->getAttribute("channelConfig")); if (strpos($compatibleBrands, "caaa") !== false) { $mediaProfileParameters['brand'] = "caaa"; diff --git a/CMAF/impl/getAudioTrackMediaProfile.php b/CMAF/impl/getAudioTrackMediaProfile.php index 2525de06..bebb18df 100644 --- a/CMAF/impl/getAudioTrackMediaProfile.php +++ b/CMAF/impl/getAudioTrackMediaProfile.php @@ -10,7 +10,7 @@ "CMAF", "Section 10.4", "Each AAC elementary stream SHALL be encoded using MPEG-4 AAC LC, HE-AAC Level 2, or HE-AACv2 Level 2", - in_array($mpParameters['profile'], array("0x02", "0x05", "0x1d")), + in_array($mpParameters['profile'], array(2, 5, 29)), "FAIL", "Valid profile found", "Nonvalid profile found" @@ -38,7 +38,7 @@ "CMAF", "Section 10.4", "AAC Core CMAF tracks SHALL not exceed two audio channels", - $mpParameters['channels'] == "0x1" || $mpParameters['channels'] == "0x2", + $mpParameters['channels'] == 1 || $mpParameters['channels'] == 2, "FAIL", "Valid channel count found", "Nonvalid channel count found" diff --git a/CMAF/impl/getVideoTrackMediaProfile.php b/CMAF/impl/getVideoTrackMediaProfile.php index 16389500..a275c845 100644 --- a/CMAF/impl/getVideoTrackMediaProfile.php +++ b/CMAF/impl/getVideoTrackMediaProfile.php @@ -9,7 +9,6 @@ $level = $mpParameters['level']; $profile = $mpParameters['profile']; -$colorPrimaries = $mpParameters['color_primaries']; $transferCharacteristics = $mpParameters['transfer_char']; $matrixCoefficients = $mpParameters['matrix_coeff']; $height = $mpParameters['height']; @@ -38,9 +37,9 @@ $mpParameters, "A.2", "A.1", - array("0x1","0x5","0x6"), - array("0x1","0x6"), - array("0x1","0x5","0x6"), + array(1,5,6), + array(1,6), + array(1,5,6), 576, 864, 60 @@ -56,9 +55,9 @@ $mpParameters, "A.2", "A.1", - array("0x1"), - array("0x1"), - array("0x1"), + array(1), + array(1), + array(1), 1080, 1920, 60 @@ -74,9 +73,9 @@ $mpParameters, "A.2", "A.1", - array("0x1"), - array("0x1"), - array("0x1"), + array(1), + array(1), + array(1), 1080, 1920, 60 @@ -138,9 +137,9 @@ $mpParameters, "B.5", "B.1", - array("0x1"), - array("0x1"), - array("0x1"), + array(1), + array(1), + array(1), 1080, 1920, 60 @@ -156,9 +155,9 @@ $mpParameters, "B.5", "B.1", - array("0x1"), - array("0x1"), - array("0x1"), + array(1), + array(1), + array(1), 2160, 3840, 60 @@ -193,9 +192,9 @@ $mpParameters, "B.5", "B.1", - array("0x1"), - array("0x1"), - array("0x1"), + array(1), + array(1), + array(1), 1080, 1920, 60 @@ -211,9 +210,9 @@ $mpParameters, "B.5", "B.1", - array("0x1", "0x9"), - array("0x1", "0x14", "0x15"), - array("0x1", "0x9", "0x10"), + array(1, 9), + array(1, 20, 21), + array(1, 9, 16), 2160, 3840, 60 @@ -233,9 +232,9 @@ $mpParameters, "B.5", "B.1", - array("0x9"), - array("0x16"), - array("0x9", "0x10"), + array(9), + array(22), + array(9, 16), 2160, 3840, 60 @@ -249,9 +248,9 @@ $mpParameters, "B.5", "B.1", - array("0x9"), - array("0x14","0x18"), - array("0x9"), + array(9), + array(20,24), + array(9), 2160, 3840, 60 diff --git a/CTAWAVE/UnitTests/MediaProfilesTest.php b/CTAWAVE/UnitTests/MediaProfilesTest.php index bbff06cc..6b5ad6a1 100755 --- a/CTAWAVE/UnitTests/MediaProfilesTest.php +++ b/CTAWAVE/UnitTests/MediaProfilesTest.php @@ -1,4 +1,5 @@ "AVC", "profile" => "high", "level" => "4.0", - "height" => "1080" , "width"=> "1920" , "framerate" => "60","color_primaries" => "0x1", - "transfer_char" => "0x1", "matrix_coeff" => "0x1", "tier" => "", "brand"=>"" ); - - $this->assertSame("HD", checkAndGetConformingVideoProfile($xmlParamsTobeTested,$rep_count,$adapt_count)[0]); - + $xmlParamsTobeTested = array("codec" => "AVC", "profile" => "high", "level" => "4.0", + "height" => "1080" , "width" => "1920" , "framerate" => "60","color_primaries" => "0x1", + "transfer_char" => "0x1", "matrix_coeff" => "0x1", "tier" => "", "brand" => "" ); + + $this->assertSame("HD", checkAndGetConformingVideoProfile($xmlParamsTobeTested, $rep_count, $adapt_count)[0]); + //check that SD profile also conforms to HD profile of AVC. - $xmlParamsTobeTested=array("codec" => "AVC", "profile" => "main", "level" => "3.1", - "height" => "576" , "width"=> "864" , "framerate" => "30","color_primaries" => "0x1", - "transfer_char" => "0x1", "matrix_coeff" => "0x1", "tier" => "", "brand"=>"" ); - - $this->assertSame("HD", checkAndGetConformingVideoProfile($xmlParamsTobeTested,$rep_count,$adapt_count)[0]); - + $xmlParamsTobeTested = array("codec" => "AVC", "profile" => "main", "level" => "3.1", + "height" => "576" , "width" => "864" , "framerate" => "30","color_primaries" => "0x1", + "transfer_char" => "0x1", "matrix_coeff" => "0x1", "tier" => "", "brand" => "" ); + + $this->assertSame("HD", checkAndGetConformingVideoProfile($xmlParamsTobeTested, $rep_count, $adapt_count)[0]); } - + public function testNonAVCMediaProfile() { - $rep_count=0; - $adapt_count=0; + $rep_count = 0; + $adapt_count = 0; //Check for HD profile of AVC. - $xmlParamsTobeTested=array("codec" => "AVC", "profile" => "high", "level" => "4.2", - "height" => "1080" , "width"=> "1920" , "framerate" => "60","color_primaries" => "0x1", - "transfer_char" => "0x1", "matrix_coeff" => "0x1", "tier" => "", "brand"=>"" ); - - $this->assertSame("AVC_HDHF", checkAndGetConformingVideoProfile($xmlParamsTobeTested,$rep_count,$adapt_count)[0]); - + $xmlParamsTobeTested = array("codec" => "AVC", "profile" => "high", "level" => "4.2", + "height" => "1080" , "width" => "1920" , "framerate" => "60","color_primaries" => "0x1", + "transfer_char" => "0x1", "matrix_coeff" => "0x1", "tier" => "", "brand" => "" ); + + $this->assertSame("AVC_HDHF", checkAndGetConformingVideoProfile($xmlParamsTobeTested, $rep_count, $adapt_count)[0]); + //check unknown profile - $xmlParamsTobeTested=array("codec" => "AVC", "profile" => "high", "level" => "5.0", - "height" => "2160" , "width"=> "3840" , "framerate" => "80","color_primaries" => "", - "transfer_char" => "", "matrix_coeff" => "", "tier" => "", "brand"=>"" ); - - $this->assertNotSame("HD", checkAndGetConformingVideoProfile($xmlParamsTobeTested,$rep_count,$adapt_count)[0]); - + $xmlParamsTobeTested = array("codec" => "AVC", "profile" => "high", "level" => "5.0", + "height" => "2160" , "width" => "3840" , "framerate" => "80","color_primaries" => "", + "transfer_char" => "", "matrix_coeff" => "", "tier" => "", "brand" => "" ); + + $this->assertNotSame("HD", checkAndGetConformingVideoProfile($xmlParamsTobeTested, $rep_count, $adapt_count)[0]); } - - public function testHEVCMediaProfile() - { - - $rep_count=0; - $adapt_count=0; + public function testHEVCMediaProfile() + { + + + $rep_count = 0; + $adapt_count = 0; //Check for HD profile of AVC. - $xmlParamsTobeTested=array("codec" => "HEVC", "profile" => "Main10", "level" => "4.1", - "height" => "1080" , "width"=> "1920" , "framerate" => "60","color_primaries" => "1", - "transfer_char" => "1", "matrix_coeff" => "1", "tier" =>"0", "brand"=>"" ); - - $this->assertSame("HHD10", checkAndGetConformingVideoProfile($xmlParamsTobeTested,$rep_count,$adapt_count)[0]); - + $xmlParamsTobeTested = array("codec" => "HEVC", "profile" => "Main10", "level" => "4.1", + "height" => "1080" , "width" => "1920" , "framerate" => "60","color_primaries" => "1", + "transfer_char" => "1", "matrix_coeff" => "1", "tier" => "0", "brand" => "" ); + + $this->assertSame("HHD10", checkAndGetConformingVideoProfile($xmlParamsTobeTested, $rep_count, $adapt_count)[0]); + //Check for HD profile of AVC. - $xmlParamsTobeTested=array("codec" => "HEVC", "profile" => "Main10", "level" => "5.1", - "height" => "2160" , "width"=> "3840" , "framerate" => "60","color_primaries" => "9", - "transfer_char" => "18", "matrix_coeff" => "9", "tier" => "0", "brand"=>"" ); - - $this->assertSame("HLG10", checkAndGetConformingVideoProfile($xmlParamsTobeTested,$rep_count,$adapt_count)[0]); + $xmlParamsTobeTested = array("codec" => "HEVC", "profile" => "Main10", "level" => "5.1", + "height" => "2160" , "width" => "3840" , "framerate" => "60","color_primaries" => "9", + "transfer_char" => "18", "matrix_coeff" => "9", "tier" => "0", "brand" => "" ); + + $this->assertSame("HLG10", checkAndGetConformingVideoProfile($xmlParamsTobeTested, $rep_count, $adapt_count)[0]); //Check for HD profile of AVC. - $xmlParamsTobeTested=array("codec" => "HEVC", "profile" => "Main", "level" => "4.1", - "height" => "1080" , "width"=> "1920" , "framerate" => "60","color_primaries" => "1", - "transfer_char" => "1", "matrix_coeff" => "1", "tier" => "0", "brand"=>"" ); - - $this->assertSame("HHD10", checkAndGetConformingVideoProfile($xmlParamsTobeTested,$rep_count,$adapt_count)[0]); - + $xmlParamsTobeTested = array("codec" => "HEVC", "profile" => "Main", "level" => "4.1", + "height" => "1080" , "width" => "1920" , "framerate" => "60","color_primaries" => "1", + "transfer_char" => "1", "matrix_coeff" => "1", "tier" => "0", "brand" => "" ); + + $this->assertSame("HHD10", checkAndGetConformingVideoProfile($xmlParamsTobeTested, $rep_count, $adapt_count)[0]); } - + public function testNonHEVCMediaProfile() { - $rep_count=0; - $adapt_count=0; - + $rep_count = 0; + $adapt_count = 0; + //check unknown profile - $xmlParamsTobeTested=array("codec" => "HEVC", "profile" => "Main", "level" => "5.1", - "height" => "2160" , "width"=> "3840" , "framerate" => "80","color_primaries" => "1", - "transfer_char" => "5", "matrix_coeff" => "6", "tier" => "0", "brand"=>"" ); - - $this->assertNotSame("HHD10", checkAndGetConformingVideoProfile($xmlParamsTobeTested,$rep_count,$adapt_count)[0]); - + $xmlParamsTobeTested = array("codec" => "HEVC", "profile" => "Main", "level" => "5.1", + "height" => "2160" , "width" => "3840" , "framerate" => "80","color_primaries" => "1", + "transfer_char" => "5", "matrix_coeff" => "6", "tier" => "0", "brand" => "" ); + + $this->assertNotSame("HHD10", checkAndGetConformingVideoProfile($xmlParamsTobeTested, $rep_count, $adapt_count)[0]); } public function testAACMediaProfile() - { - - $rep_count=0; - $adapt_count=0; + { + + $rep_count = 0; + $adapt_count = 0; //Check for HD profile of AVC. - $xmlParamsTobeTested=array("codec" => "AAC", "profile" => "0x02", "level"=>"", - "channels" => "0x1" , "sampleRate" => "48000", "brand"=>"" ); - - $this->assertSame("AAC_Core", checkAndGetConformingAudioProfile($xmlParamsTobeTested,$rep_count,$adapt_count)[0]); - - + $xmlParamsTobeTested = array("codec" => "AAC", "profile" => "0x02", "level" => "", + "channels" => "0x1" , "sampleRate" => "48000", "brand" => "" ); + + $this->assertSame("AAC_Core", checkAndGetConformingAudioProfile($xmlParamsTobeTested, $rep_count, $adapt_count)[0]); } public function testNonAACMediaProfile() - { - - $rep_count=0; - $adapt_count=0; + { + + $rep_count = 0; + $adapt_count = 0; //Check for HD profile of AVC. - $xmlParamsTobeTested=array("codec" => "AAC", "profile" => "0x02", "level"=>"", - "channels" => "0x1" , "sampleRate" => "50000", "brand"=>"" ); - - $this->assertNotSame("AAC_Core", checkAndGetConformingAudioProfile($xmlParamsTobeTested,$rep_count,$adapt_count)[0]); - - + $xmlParamsTobeTested = array("codec" => "AAC", "profile" => "0x02", "level" => "", + "channels" => "0x1" , "sampleRate" => "50000", "brand" => "" ); + + $this->assertNotSame("AAC_Core", checkAndGetConformingAudioProfile($xmlParamsTobeTested, $rep_count, $adapt_count)[0]); } public function testAACMediaProfile2() - { - - $rep_count=0; - $adapt_count=0; + { + + $rep_count = 0; + $adapt_count = 0; //Check for HD profile of AVC. - $xmlParamsTobeTested=array("codec" => "AAC", "profile" => "0x02", "level"=>"AAC@L2", - "channels" => "0x1" , "sampleRate" => "48000", "brand"=>"" ); - - $this->assertSame("AAC_Core", checkAndGetConformingAudioProfile($xmlParamsTobeTested,$rep_count,$adapt_count)[0]); - - + $xmlParamsTobeTested = array("codec" => "AAC", "profile" => "0x02", "level" => "AAC@L2", + "channels" => "0x1" , "sampleRate" => "48000", "brand" => "" ); + + $this->assertSame("AAC_Core", checkAndGetConformingAudioProfile($xmlParamsTobeTested, $rep_count, $adapt_count)[0]); } - + public function testAACMultiChannelMediaProfile() - { - - $rep_count=0; - $adapt_count=0; + { + + $rep_count = 0; + $adapt_count = 0; //Check for AAC Multichannel. - $xmlParamsTobeTested=array("codec" => "AAC", "profile" => "0x02", "level"=>"High Quality Audio@L6", - "channels" => "0x5" , "sampleRate" => "48000", "brand"=>"camc" ); - - $this->assertSame("AAC_Multichannel", checkAndGetConformingAudioProfile($xmlParamsTobeTested,$rep_count,$adapt_count)[0]); - - - } -} + $xmlParamsTobeTested = array("codec" => "AAC", "profile" => "0x02", "level" => "High Quality Audio@L6", + "channels" => "0x5" , "sampleRate" => "48000", "brand" => "camc" ); + $this->assertSame("AAC_Multichannel", checkAndGetConformingAudioProfile($xmlParamsTobeTested, $rep_count, $adapt_count)[0]); + } +} diff --git a/CTAWAVE/UnitTests/PresentationProfileTest.php b/CTAWAVE/UnitTests/PresentationProfileTest.php index 2c597d09..81cf75d0 100755 --- a/CTAWAVE/UnitTests/PresentationProfileTest.php +++ b/CTAWAVE/UnitTests/PresentationProfileTest.php @@ -1,4 +1,5 @@ assertSame("CMFHD", CTACheckPresentation($adapts_count,$session_dir,$adaptation_set_template,$outfile,$current_period)); + $session_dir = "./CTAWAVE/UnitTests/Presention_examples/CMFHD_video/"; + $adaptation_set_template = 'Adapt$AS$'; + $outfile = fopen("out.txt", "w"); + $current_period = 0; + $this->assertSame("CMFHD", CTACheckPresentation($adapts_count, $session_dir, $adaptation_set_template, $outfile, $current_period)); } public function testNoCMAFPresentationProfile() - { - $adapts_count=1; + { + $adapts_count = 1; //The given directory contains a SwSet of video with two tracks not conforming to any Media profile // and hence expected not to conform to CMFHD or any other presentation profiles. - $session_dir="Presention_examples/noCMFHD_video/"; - $adaptation_set_template='Adapt$AS$'; - $outfile=fopen("out.txt","w"); - $current_period=0; + $session_dir = "Presention_examples/noCMFHD_video/"; + $adaptation_set_template = 'Adapt$AS$'; + $outfile = fopen("out.txt", "w"); + $current_period = 0; //CMFHD presentation profile is not expected, hence check notSame assertion. - $this->assertNotSame("CMFHD", CTACheckPresentation($adapts_count,$session_dir,$adaptation_set_template,$outfile,$current_period)); + $this->assertNotSame("CMFHD", CTACheckPresentation($adapts_count, $session_dir, $adaptation_set_template, $outfile, $current_period)); } - - - } diff --git a/CTAWAVE/UnitTests/ProgramsTest.php b/CTAWAVE/UnitTests/ProgramsTest.php index a2dc2c63..4c62179e 100644 --- a/CTAWAVE/UnitTests/ProgramsTest.php +++ b/CTAWAVE/UnitTests/ProgramsTest.php @@ -1,11 +1,12 @@ assertStringContainsString("contained in Sequential Sw Sets', overlap/gap in presenation time (non-sequential) is observed for Sw set", - checkSequentialSwSetAV($session_dir, $MediaProfDatabase, $adaptation_set_template, $representation_template)); + $this->assertStringContainsString( + "contained in Sequential Sw Sets', overlap/gap in presenation time (non-sequential) is observed for Sw set", + checkSequentialSwSetAV($session_dir, $MediaProfDatabase, $adaptation_set_template, $representation_template) + ); } public function testSequentialVideoSwSet() @@ -33,8 +36,10 @@ public function testSequentialVideoSwSet() $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Pass_case"; $adaptation_set_template = 'Adapt$AS$'; $representation_template = 'Adapt$AS$rep$R$'; - $this->assertStringNotContainsString("contained in Sequential Sw Sets', overlap/gap in presenation time (non-sequential) is observed for Sw set", - checkSequentialSwSetAV($session_dir, $MediaProfDatabase, $adaptation_set_template, $representation_template)); + $this->assertStringNotContainsString( + "contained in Sequential Sw Sets', overlap/gap in presenation time (non-sequential) is observed for Sw set", + checkSequentialSwSetAV($session_dir, $MediaProfDatabase, $adaptation_set_template, $representation_template) + ); } public function testCMFHDBaselineFailWAVEBaseline() @@ -45,8 +50,10 @@ public function testCMFHDBaselineFailWAVEBaseline() $adaptation_set_template = 'Adapt$AS$'; $representation_template = 'Adapt$AS$rep$R$'; $spliceConstraitsLog = "SampleErrorLog"; - $this->assertStringContainsString("contain splices conforming to WAVE Baseline Splice profile (section 7.2)', but violation observed in WAVE Baseline", - checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir, $adaptation_set_template, $spliceConstraitsLog)); + $this->assertStringContainsString( + "contain splices conforming to WAVE Baseline Splice profile (section 7.2)', but violation observed in WAVE Baseline", + checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir, $adaptation_set_template, $spliceConstraitsLog) + ); } public function testCMFHDBaselineFailCMFHDPresentation() @@ -57,8 +64,10 @@ public function testCMFHDBaselineFailCMFHDPresentation() $adaptation_set_template = 'Adapt$AS$'; $representation_template = 'Adapt$AS$rep$R$'; $spliceConstraitsLog = "SampleErrorLog"; - $this->assertStringContainsString("more CMAF Presentations conforming to CMAF CMFHD profile', violated as not all CMAF presentations conforms to CMFHD", - checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir, $adaptation_set_template, $spliceConstraitsLog)); + $this->assertStringContainsString( + "more CMAF Presentations conforming to CMAF CMFHD profile', violated as not all CMAF presentations conforms to CMFHD", + checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir, $adaptation_set_template, $spliceConstraitsLog) + ); } public function testCMFHDBaselinePass() @@ -69,10 +78,13 @@ public function testCMFHDBaselinePass() $adaptation_set_template = 'Adapt$AS$'; $representation_template = 'Adapt$AS$rep$R$'; $spliceConstraitsLog = "SampleNoErrorLog"; - $this->assertStringNotContainsString("more CMAF Presentations conforming to CMAF CMFHD profile', violated as not all CMAF presentations conforms to CMFHD", - checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir, $adaptation_set_template, $spliceConstraitsLog)); - $this->assertStringNotContainsString("contain splices conforming to WAVE Baseline Splice profile (section 7.2)', but violation observed in WAVE Baseline", - checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir, $adaptation_set_template, $spliceConstraitsLog)); + $this->assertStringNotContainsString( + "more CMAF Presentations conforming to CMAF CMFHD profile', violated as not all CMAF presentations conforms to CMFHD", + checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir, $adaptation_set_template, $spliceConstraitsLog) + ); + $this->assertStringNotContainsString( + "contain splices conforming to WAVE Baseline Splice profile (section 7.2)', but violation observed in WAVE Baseline", + checkCMFHDBaselineConstraints($MediaProfDatabase, $session_dir, $adaptation_set_template, $spliceConstraitsLog) + ); } - -} \ No newline at end of file +} diff --git a/CTAWAVE/UnitTests/SelectionSetTest.php b/CTAWAVE/UnitTests/SelectionSetTest.php index 4aa1fbef..48ea82df 100755 --- a/CTAWAVE/UnitTests/SelectionSetTest.php +++ b/CTAWAVE/UnitTests/SelectionSetTest.php @@ -1,4 +1,5 @@ assertStringContainsString("no Tracks found conforming to WAVE", CTACheckSelectionSet($adapts_count,$session_dir,$adaptation_set_template,$outfile,$current_period)); + { + $adapts_count = 1; + $session_dir = "./CTAWAVE/UnitTests/Selection_set_examples/SelSetVideoNoWaveTracks"; + $adaptation_set_template = 'Adapt$AS$'; + $outfile = fopen("out.txt", "w"); + $current_period = 0; + $this->assertStringContainsString("no Tracks found conforming to WAVE", CTACheckSelectionSet($adapts_count, $session_dir, $adaptation_set_template, $outfile, $current_period)); } //Test that no WAVE SwSet found in the SelSet. SwSet contains one WAVE track and one non-WAVE track. public function testNoWAVESwSetInSelSet() - { - $adapts_count=1; - $session_dir="./CTAWAVE/UnitTests/Selection_set_examples/SelSetVideoNoWaveSwSet"; - $adaptation_set_template='Adapt$AS$'; - $outfile=fopen("out.txt","w"); - $current_period=0; - $this->assertStringContainsString("no Switching Set found conforming to WAVE", CTACheckSelectionSet($adapts_count,$session_dir,$adaptation_set_template,$outfile,$current_period)); + { + $adapts_count = 1; + $session_dir = "./CTAWAVE/UnitTests/Selection_set_examples/SelSetVideoNoWaveSwSet"; + $adaptation_set_template = 'Adapt$AS$'; + $outfile = fopen("out.txt", "w"); + $current_period = 0; + $this->assertStringContainsString("no Switching Set found conforming to WAVE", CTACheckSelectionSet($adapts_count, $session_dir, $adaptation_set_template, $outfile, $current_period)); } // - //Test that a WAVE SwSet is found in the SelSet. The SwSet contains two Wave tracks. + //Test that a WAVE SwSet is found in the SelSet. The SwSet contains two Wave tracks. public function testWAVESwSetInSelSet() - { - $adapts_count=1; - $session_dir="./CTAWAVE/UnitTests/Selection_set_examples/SelSetVideoWaveSwSet"; - $adaptation_set_template='Adapt$AS$'; - $outfile=fopen("out.txt","w"); - $current_period=0; - $this->assertStringNotContainsString("no Switching Set found conforming to WAVE", CTACheckSelectionSet($adapts_count,$session_dir,$adaptation_set_template,$outfile,$current_period)); + { + $adapts_count = 1; + $session_dir = "./CTAWAVE/UnitTests/Selection_set_examples/SelSetVideoWaveSwSet"; + $adaptation_set_template = 'Adapt$AS$'; + $outfile = fopen("out.txt", "w"); + $current_period = 0; + $this->assertStringNotContainsString("no Switching Set found conforming to WAVE", CTACheckSelectionSet($adapts_count, $session_dir, $adaptation_set_template, $outfile, $current_period)); } - + public function testSingleInitSwSet() { - $adapts_count=1; - $session_dir="./CTAWAVE/UnitTests/Selection_set_examples/SwSetSingleInit"; - $adaptation_set_template='Adapt$AS$'; - $this->assertStringContainsString("reinitialization not req on Track switches', and found CMAF common header", CTACheckSingleInitSwSet($adapts_count,$session_dir,$adaptation_set_template)); + $adapts_count = 1; + $session_dir = "./CTAWAVE/UnitTests/Selection_set_examples/SwSetSingleInit"; + $adaptation_set_template = 'Adapt$AS$'; + $this->assertStringContainsString("reinitialization not req on Track switches', and found CMAF common header", CTACheckSingleInitSwSet($adapts_count, $session_dir, $adaptation_set_template)); } public function testNoSingleInitSwSet() { - $adapts_count=1; - $session_dir="./CTAWAVE/UnitTests/Selection_set_examples/SelSetVideoWaveSwSet"; - $adaptation_set_template='Adapt$AS$'; - $this->assertStringNotContainsString("reinitialization not req on Track switches', and found CMAF common header", CTACheckSingleInitSwSet($adapts_count,$session_dir,$adaptation_set_template)); + $adapts_count = 1; + $session_dir = "./CTAWAVE/UnitTests/Selection_set_examples/SelSetVideoWaveSwSet"; + $adaptation_set_template = 'Adapt$AS$'; + $this->assertStringNotContainsString("reinitialization not req on Track switches', and found CMAF common header", CTACheckSingleInitSwSet($adapts_count, $session_dir, $adaptation_set_template)); } } diff --git a/CTAWAVE/UnitTests/SpliceConstraintsTest.php b/CTAWAVE/UnitTests/SpliceConstraintsTest.php index 4b26c576..22da577a 100644 --- a/CTAWAVE/UnitTests/SpliceConstraintsTest.php +++ b/CTAWAVE/UnitTests/SpliceConstraintsTest.php @@ -1,14 +1,15 @@ assertStringContainsString("Sequential Switching Sets SHALL conform to the same CMAF Media Profile, voilated for Sw set", checkSequentialSwSetMProfile($MediaProfDatabase)); } public function testSameMediaProfile() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; $this->assertStringNotContainsString("Sequential Switching Sets SHALL conform to the same CMAF Media Profile, voilated for Sw set", checkSequentialSwSetMProfile($MediaProfDatabase)); } - + public function testNoDiscontinuitySplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Pass_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Pass_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringNotContainsString("Sequential Switching Sets can be discontinuous, and it is observed", checkDiscontinuousSplicePoints($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringNotContainsString("Sequential Switching Sets can be discontinuous, and it is observed", checkDiscontinuousSplicePoints($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } public function testDiscontinuitySplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Fail_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Fail_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringContainsString("Sequential Switching Sets can be discontinuous, and it is observed", checkDiscontinuousSplicePoints($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringContainsString("Sequential Switching Sets can be discontinuous, and it is observed", checkDiscontinuousSplicePoints($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } - + public function testNoEncryptionChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Pass_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Pass_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringNotContainsString("WAVE content SHALL contain one CENC Scheme per program', violated between", checkEncryptionChangeSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringNotContainsString("WAVE content SHALL contain one CENC Scheme per program', violated between", checkEncryptionChangeSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } public function testEncryptionChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Fail_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Fail_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringContainsString("WAVE content SHALL contain one CENC Scheme per program', violated between", checkEncryptionChangeSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringContainsString("WAVE content SHALL contain one CENC Scheme per program', violated between", checkEncryptionChangeSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } - + public function testNoSampleEntryChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Pass_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Pass_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringNotContainsString("Sequential Switching Sets Shall not change sample type at Splice points', but different sample types", checkSampleEntryChangeSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringNotContainsString("Sequential Switching Sets Shall not change sample type at Splice points', but different sample types", checkSampleEntryChangeSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } public function testSampleEntryChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Fail_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Fail_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringContainsString("Sequential Switching Sets Shall not change sample type at Splice points', but different sample types", checkSampleEntryChangeSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringContainsString("Sequential Switching Sets Shall not change sample type at Splice points', but different sample types", checkSampleEntryChangeSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } - + public function testNoDefaultKIDChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Pass_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Pass_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringNotContainsString("Default KID can change at Splice points', change is observed for ", checkDefaultKIDChangeSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringNotContainsString("Default KID can change at Splice points', change is observed for ", checkDefaultKIDChangeSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } public function testDefaultKIDChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Fail_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Fail_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringContainsString("Default KID can change at Splice points', change is observed for ", checkDefaultKIDChangeSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringContainsString("Default KID can change at Splice points', change is observed for ", checkDefaultKIDChangeSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } - + public function testNoTrackIDChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Pass_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Pass_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringNotContainsString("Track_ID can change at Splice points', change is observed ", checkTrackIDChangeSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringNotContainsString("Track_ID can change at Splice points', change is observed ", checkTrackIDChangeSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } public function testTrackIDChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Fail_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Fail_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringContainsString("Track_ID can change at Splice points', change is observed ", checkTrackIDChangeSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringContainsString("Track_ID can change at Splice points', change is observed ", checkTrackIDChangeSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } - + public function testNoTimescaleChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Pass_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Pass_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringNotContainsString("Timescale can change at Splice points', change is observed", checkTimeScaleChangeSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringNotContainsString("Timescale can change at Splice points', change is observed", checkTimeScaleChangeSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } public function testTimescaleChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Fail_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Fail_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringContainsString("Timescale can change at Splice points', change is observed", checkTimeScaleChangeSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringContainsString("Timescale can change at Splice points', change is observed", checkTimeScaleChangeSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } - + public function testNoPictureAspectRatioChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Pass_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Pass_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringNotContainsString("Picture Aspect Ratio (PAR) Should be the same between Sequential Sw Sets at the Splice point', violated for ", checkPicAspectRatioSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringNotContainsString("Picture Aspect Ratio (PAR) Should be the same between Sequential Sw Sets at the Splice point', violated for ", checkPicAspectRatioSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } public function testPictureAspectRatioChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Fail_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Fail_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringContainsString("Picture Aspect Ratio (PAR) Should be the same between Sequential Sw Sets at the Splice point', violated for ", checkPicAspectRatioSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringContainsString("Picture Aspect Ratio (PAR) Should be the same between Sequential Sw Sets at the Splice point', violated for ", checkPicAspectRatioSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } public function testNoFrameRateChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Pass_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Pass_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringNotContainsString("Frame rate Should be the same family of multiples between Sequential Sw Sets at the Splice point', violated for", checkFrameRateSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringNotContainsString("Frame rate Should be the same family of multiples between Sequential Sw Sets at the Splice point', violated for", checkFrameRateSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } public function testFrameRateChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Fail_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Fail_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringContainsString("Frame rate Should be the same family of multiples between Sequential Sw Sets at the Splice point', violated for", checkFrameRateSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringContainsString("Frame rate Should be the same family of multiples between Sequential Sw Sets at the Splice point', violated for", checkFrameRateSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } - + public function testNoAudioChannelChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Audio/Pass_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Audio/Pass_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringNotContainsString("Audio channel configuration Should allow the same stereo or multichannel config between Sequential Sw Sets at the Splice point', violated for", checkAudioChannelSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringNotContainsString("Audio channel configuration Should allow the same stereo or multichannel config between Sequential Sw Sets at the Splice point', violated for", checkAudioChannelSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } public function testAudioChannelChangeSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Audio/Fail_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Audio/Fail_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringContainsString("Audio channel configuration Should allow the same stereo or multichannel config between Sequential Sw Sets at the Splice point', violated for", checkAudioChannelSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringContainsString("Audio channel configuration Should allow the same stereo or multichannel config between Sequential Sw Sets at the Splice point', violated for", checkAudioChannelSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } public function testNoFragOverlapSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Pass_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Pass_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringNotContainsString("not overlap the same WAVE Program presentation time at the Splice point', overlap is observed", checkFragrmentOverlapSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringNotContainsString("not overlap the same WAVE Program presentation time at the Splice point', overlap is observed", checkFragrmentOverlapSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } public function testFragOverlapSplice() { - $MediaProfDatabase[0][0][0]="HD"; - $MediaProfDatabase[1][0][0]="HD"; - $session_dir="./CTAWAVE/UnitTests/Splice_examples/Fail_case"; - $adaptation_set_template='Adapt$AS$'; + $MediaProfDatabase[0][0][0] = "HD"; + $MediaProfDatabase[1][0][0] = "HD"; + $session_dir = "./CTAWAVE/UnitTests/Splice_examples/Fail_case"; + $adaptation_set_template = 'Adapt$AS$'; $reprsentation_template = 'Adapt$AS$rep$R$'; - $this->assertStringContainsString("not overlap the same WAVE Program presentation time at the Splice point', overlap is observed", checkFragrmentOverlapSplicePoint($session_dir,$MediaProfDatabase,$adaptation_set_template,$reprsentation_template)); + $this->assertStringContainsString("not overlap the same WAVE Program presentation time at the Splice point', overlap is observed", checkFragrmentOverlapSplicePoint($session_dir, $MediaProfDatabase, $adaptation_set_template, $reprsentation_template)); } -} \ No newline at end of file +} diff --git a/CTAWAVE/impl/CTACheckPresentation.php b/CTAWAVE/impl/CTACheckPresentation.php index 8990b33a..20efb157 100644 --- a/CTAWAVE/impl/CTACheckPresentation.php +++ b/CTAWAVE/impl/CTACheckPresentation.php @@ -123,8 +123,8 @@ array_push( $presentationProfileArray, - $this->getPresentationProfile($encryptedTrackFound, $cencSwSetFound, $cbcsSwSetFound)); - + $this->getPresentationProfile($encryptedTrackFound, $cencSwSetFound, $cbcsSwSetFound) + ); } if ($audioSelectionSetFound) { $conforms = $logger->test( @@ -142,7 +142,6 @@ $presentationProfileArray, $this->getPresentationProfile($encryptedTrackFound, $cencSwSetFound, $cbcsSwSetFound) ); - } if ($subtitleSelectionSetFound) { $conforms = $logger->test( diff --git a/CTAWAVE/impl/checkAndGetConformingAudioProfile.php b/CTAWAVE/impl/checkAndGetConformingAudioProfile.php index 5f9103d5..4a849a60 100644 --- a/CTAWAVE/impl/checkAndGetConformingAudioProfile.php +++ b/CTAWAVE/impl/checkAndGetConformingAudioProfile.php @@ -21,7 +21,7 @@ if (!$validSampleRate) { return "unknown"; } - if (in_array($channels, array("0x1", "0x2"))) { + if (in_array($channels, array(1, 2))) { //Level is checked here , however level can not be found always from the atom xml as the //IODS atom is not always present in the track. $validLevel = $logger->test( @@ -40,7 +40,7 @@ "CTAWAVE", "WAVE Content Spec 2018Ed-Section 4.3.1", "Each WAVE audio Media Profile SHALL conform to normative ref. listed in Table 2", - in_array($profile, array("0x02", "0x05", "0x1d")), + in_array($profile, array(2, 5, 29)), "FAIL", "Valid profile for track $representationIndex of switching set $adaptationIndex", "Invalid profile for track $representationIndex of switching set $adaptationIndex", @@ -55,12 +55,12 @@ return "AAC_Core"; } - if (in_array($channels, array("0x5","0x6","0x7","0xc","0xe"))) { + if (in_array($channels, array(5,6,7,12,14))) { $validProfile = $logger->test( "CTAWAVE", "WAVE Content Spec 2018Ed-Section 4.3.1", "Each WAVE audio Media Profile SHALL conform to normative ref. listed in Table 2", - $profile == "0x05" || ($profile == "0x02" && $level == "High Quality Audio@L6"), + $profile == 5 || ($profile == 2 && $level == "High Quality Audio@L6"), "FAIL", "Valid profile for track $representationIndex of switching set $adaptationIndex", "Invalid profile for track $representationIndex of switching set $adaptationIndex", diff --git a/CTAWAVE/impl/checkAndGetConformingVideoProfile.php b/CTAWAVE/impl/checkAndGetConformingVideoProfile.php index 3b9d510d..80d0c6f9 100644 --- a/CTAWAVE/impl/checkAndGetConformingVideoProfile.php +++ b/CTAWAVE/impl/checkAndGetConformingVideoProfile.php @@ -30,7 +30,7 @@ "CTAWAVE", "WAVE Content Spec 2018Ed-Section 4.2.1", "Each WAVE video Media Profile SHALL conform to normative ref. listed in Table 1", - $colorPrimaries == "0x1", + $colorPrimaries == 1, "FAIL", "Valid color primaries for track $representationIndex of switching set $adaptationIndex", "Invalid or missing color primaries for track $representationIndex of switching set $adaptationIndex", @@ -39,7 +39,7 @@ "CTAWAVE", "WAVE Content Spec 2018Ed-Section 4.2.1", "Each WAVE video Media Profile SHALL conform to normative ref. listed in Table 1", - $transferCharacteristics == "0x1", + $transferCharacteristics == 1, "FAIL", "Valid transfer characteristics for track $representationIndex of switching set $adaptationIndex", "Invalid or missing transfer characteristics for track $representationIndex of switching set $adaptationIndex", @@ -48,7 +48,7 @@ "CTAWAVE", "WAVE Content Spec 2018Ed-Section 4.2.1", "Each WAVE video Media Profile SHALL conform to normative ref. listed in Table 1", - $matrixCoefficients == "0x1", + $matrixCoefficients == 1, "FAIL", "Valid matrix coefficients for track $representationIndex of switching set $adaptationIndex", "Invalid or missing matrix coefficients for track $representationIndex of switching set $adaptationIndex", diff --git a/CTAWAVE/impl/getFrameRate.php b/CTAWAVE/impl/getFrameRate.php index 7151f1b3..8fe98211 100644 --- a/CTAWAVE/impl/getFrameRate.php +++ b/CTAWAVE/impl/getFrameRate.php @@ -8,7 +8,7 @@ $framerate = 0; } else { for ($nal_count = 0; $nal_count < $nal_unit->length; $nal_count++) { - if ($nal_unit->item($nal_count)->getAttribute("nal_type") == "0x07") { + if (hexdec($nal_unit->item($nal_count)->getAttribute("nal_type")) == 7) { $sps_unit = $nal_count; break; } @@ -17,8 +17,8 @@ $comment = $nal_unit->item($sps_unit)->getElementsByTagName("comment")->item(0); - if ($comment->getAttribute("vui_parameters_present_flag") == "0x1") { - if ($comment->getAttribute("timing_info_present_flag") == "0x1") { + if (hexdec($comment->getAttribute("vui_parameters_present_flag")) == 1) { + if (hexdec($comment->getAttribute("timing_info_present_flag")) == 1) { $num_units_in_tick = $comment->getAttribute("num_units_in_tick"); $time_scale = $comment->getAttribute("time_scale"); $framerate = $time_scale / (2 * $num_units_in_tick); diff --git a/CTAWAVE/impl/getMediaProfile.php b/CTAWAVE/impl/getMediaProfile.php index dbea191c..e3a441d0 100644 --- a/CTAWAVE/impl/getMediaProfile.php +++ b/CTAWAVE/impl/getMediaProfile.php @@ -28,7 +28,7 @@ } for ($nalIndex = 0; $nalIndex < $nalUnits->length; $nalIndex++) { - if ($nalUnits->item($nalIndex)->getAttribute("nal_type") == "0x07") { + if (hexdec($nalUnits->item($nalIndex)->getAttribute("nal_type")) == 7) { $spsIndex = $nalIndex; break; } @@ -40,19 +40,25 @@ $mediaProfileParameters['width'] = $videoSampleDescription->getAttribute("width"); $mediaProfileParameters['height'] = $videoSampleDescription->getAttribute("height"); - if ($comment->getAttribute("vui_parameters_present_flag") == "0x1") { - if ($comment->getAttribute("video_signal_type_present_flag") == "0x1") { - if ($comment->getAttribute("colour_description_present_flag") == "0x1") { - $mediaProfileParameters['color_primaries'] = $comment->getAttribute("colour_primaries"); - $mediaProfileParameters['transfer_char'] = $comment->getAttribute("transfer_characteristics"); - $mediaProfileParameters['matrix_coeff'] = $comment->getAttribute("matrix_coefficients"); - } elseif ($comment->getAttribute("colour_description_present_flag") == "0x0") { - $mediaProfileParameters['color_primaries'] = "0x1"; - $mediaProfileParameters['transfer_char'] = "0x1"; - $mediaProfileParameters['matrix_coeff'] = "0x1"; + if (hexdec($comment->getAttribute("vui_parameters_present_flag")) == 1) { + if (hexdec($comment->getAttribute("video_signal_type_present_flag")) == 1) { + if (hexdec($comment->getAttribute("colour_description_present_flag")) == 1) { + $mediaProfileParameters['color_primaries'] = hexdec( + $comment->getAttribute("colour_primaries") + ); + $mediaProfileParameters['transfer_char'] = hexdec( + $comment->getAttribute("transfer_characteristics") + ); + $mediaProfileParameters['matrix_coeff'] = hexdec( + $comment->getAttribute("matrix_coefficients") + ); + } elseif (hexdec($comment->getAttribute("colour_description_present_flag")) == 0) { + $mediaProfileParameters['color_primaries'] = 1; + $mediaProfileParameters['transfer_char'] = 1; + $mediaProfileParameters['matrix_coeff'] = 1; } } - if ($comment->getAttribute("timing_info_present_flag") == "0x1") { + if (hexdec($comment->getAttribute("timing_info_present_flag")) == 1) { $numberOfUnitsPerTick = $comment->getAttribute("num_units_in_tick"); $timeScale = $comment->getAttribute("time_scale"); $mediaProfileParameters['framerate'] = $timeScale / (2 * $numberOfUnitsPerTick); diff --git a/CTAWAVE/module.php b/CTAWAVE/module.php index 169461f1..e03e61cf 100644 --- a/CTAWAVE/module.php +++ b/CTAWAVE/module.php @@ -2,6 +2,8 @@ namespace DASHIF; +require_once __DIR__ . '/../Utils/moduleInterface.php'; + class ModuleCTAWAVE extends ModuleInterface { private $mediaProfileAttributesAudio; @@ -45,7 +47,9 @@ public function __construct() protected function addCLIArguments() { global $argumentParser; - $argumentParser->addOption("ctawave", "w", "ctawave", "Enable CTAWAVE checking"); + if ($argumentParser) { + $argumentParser->addOption("ctawave", "w", "ctawave", "Enable CTAWAVE checking"); + } } public function handleArguments() diff --git a/Conformance-Frontend-HLS/Conformancetest.php b/Conformance-Frontend-HLS/Conformancetest.php index 7b9a1778..208d0853 100755 --- a/Conformance-Frontend-HLS/Conformancetest.php +++ b/Conformance-Frontend-HLS/Conformancetest.php @@ -1,1167 +1,1166 @@ - - - - - -
-Validation (Conformance check) of HLS M3U8 Segments
- - - - -Loading....
-- - - | - -- | -