Skip to content

Commit

Permalink
Merge pull request #585 from Dash-Industry-Forum/feature/refactorProg…
Browse files Browse the repository at this point in the history
…ress

Feature/refactor progress
  • Loading branch information
aldafu authored Jun 8, 2022
2 parents d434fb9 + bff1e13 commit 11c309f
Show file tree
Hide file tree
Showing 70 changed files with 6,824 additions and 4,699 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ Conformance-Frontend/visitorLogs/*.txt
Conformance-Frontend/temp
*.log
*log*.txt
vendor/*
html-log/*
10 changes: 10 additions & 0 deletions DASH/IOP/impl/validateCross.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

global $mpd_features, $current_period;

$period = $mpd_features['Period'][$current_period];
$adaptationSets = $period['AdaptationSet'];

foreach ($adaptationSets as $id => $adaptationSet) {
$this->validateCrossAvcHevc($adaptationSet, $id);
}
145 changes: 145 additions & 0 deletions DASH/IOP/impl/validateCrossAvcHevc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<?php

global $mpd_features, $session_dir, $current_period, $adaptation_set_template, $reprsentation_template, $logger;

$period = $mpd_features['Period'][$current_period];
$representations = $adaptation_set['Representation'];
$bitstreamSwitching = ($adaptation_set['bitstreamSwitching']) ?
$adaptation_set['bitstreamSwitching'] : $period['bitstreamSwitching'];
$mimeType = ($representations[0]['mimeType']) ? $representations[0]['mimeType'] : $adaptation_set['mimeType'];

if ($bitstreamSwitching != 'true' || strpos($mimeType, 'video') === false) {
return;
}

$profiles = array();
$levels = array();
$elsts = array();
foreach ($representations as $representationId => $representation) {
$adapt_dir = str_replace('$AS$', $adaptationSetId, $adaptation_set_template);
$rep_dir = str_replace(array('$AS$', '$R$'), array($adaptationSetId, $representationId), $reprsentation_template);
$rep_xml = $session_dir . '/Period' . $current_period . '/' . $adapt_dir . '/' . $rep_dir . '.xml';

if (!file_exists($rep_xml)) {
return;
}

$xml = get_DOM($rep_xml, 'atomlist');
if (!$xml) {
return;
}

$codecs = ($representation['codecs']) ? $representation['codecs'] : $adaptation_set['codecs'];
$isAvc = strpos($codecs, 'avc') !== false;
$isHevc = strpos($codecs, 'hev') !== false || strpos($codecs, 'hvc') !== false;
if ($isAvc) {
$codec_box = $xml->getElementsByTagName('avcC');
if ($codec_box->length > 0) {
$codec = $codec_box->item(0);
$profiles[] = $codec->getAttribute('profile');
$levels[] = $codec->getElementsByTagName('Comment')->item(0)->getAttribute('level');
}
}
if ($isHevc) {
$codec_box = $xml->getElementsByTagName('hvcC');
if ($codec_box->length > 0) {
$codec = $codec_box->item(0);
$profiles[] = $codec->getAttribute('profile_idc');
$levels[] = $codec->getAttribute('level_idc');
}
}

if ($isAvc || $isHevc) {
$elst = $xml->getElementsByTagName('elst');
if ($elst->length > 0) {
$elsts[] = $elst->item(0);
}
}
}

$maxProfile = (int)max($profiles);
$maxLevel = (int)max($levels);

$adaptationSetCodecs = $adaptationSet['codecs'];
if ($adaptationSetCodecs != null) {
$codecArray = explode(',', $adaptationSetCodecs);
foreach ($codecArray as $codecEntry) {
$entryIsAvc = strpos($codecEntry, 'avc') !== false;
$entryIsHevc = strpos($codecEntry, 'hev') !== false || strpos($codecEntry, 'hvc') !== false;
if ($entryIsAvc) {
$logger->test(
"DASH-IF IOP 4.3",
"Section 6.2.5.2",
"For AVC video data, if the @bitstreamswitching flag is set to true, the AdaptationSet@codecs " .
"attribute SHALL equal to the maximum profile and level of any Representation in the Adaptation Set",
(int) (substr($codecEntry, 5, 2)) == dechex($maxProfile),
"FAIL",
"Profile is set to maximum profile for Period $current_period Adaptation Set $adaptationSetId",
"Profile is not set to maximum profile for Period $current_period Adaptation Set $adaptationSetId"
);
$logger->test(
"DASH-IF IOP 4.3",
"Section 6.2.5.2",
"For AVC video data, if the @bitstreamswitching flag is set to true, the AdaptationSet@codecs " .
"attribute SHALL equal to the maximum profile and level of any Representation in the Adaptation Set",
(int) (substr($codecEntry, 9, 2)) == dechex($maxLevel),
"FAIL",
"Level is set to maximum level for Period $current_period Adaptation Set $adaptationSetId ",
"Level is not set to maximum level for Period $current_period Adaptation Set $adaptationSetId"
);
}
if ($entryIsHevc) {
$entryParts = explode('.', $codecEntry);
$logger->test(
"DASH-IF IOP 4.3",
"Section 6.2.5.2",
"For HEVC video data, if the @bitstreamswitching flag is set to true, the AdaptationSet@codecs " .
"attribute SHALL equal to the maximum profile and level of any Representation in the Adaptation Set",
$entryParts[1] == $maxProfile,
"FAIL",
"Profile is set to maximum profile for Period $current_period Adaptation Set $adaptationSetId",
"Profile is not set to maximum profile for Period $current_period Adaptation Set $adaptationSetId"
);
$logger->test(
"DASH-IF IOP 4.3",
"Section 6.2.5.2",
"For HEVC video data, if the @bitstreamswitching flag is set to true, the AdaptationSet@codecs " .
"attribute SHALL equal to the maximum profile and level of any Representation in the Adaptation Set",
$entryParts[3] == $maxLevel,
"FAIL",
"Level is set to maximum level for Period $current_period Adaptation Set $adaptationSetId ",
"Level is not set to maximum level for Period $current_period Adaptation Set $adaptationSetId"
);
}
}
}

$elstCount = sizeof($elsts);
if ($elstCount > 0) {
$logger->test(
"DASH-IF IOP 4.3",
"Section 6.2.5.2",
"For AVC/HEVC video data, if the @bitstreamswitching flag is set to true, the edit list, " .
"if present in any Representation in the Adaptation Set, SHALL be identical in all Representations",
$elstCount == sizeof($representations),
"FAIL",
"Edit list found for all representations of Period $current_period Adaptation Set $adaptationSetId ",
"Edit list missing in some representations of Period $current_period Adaptation Set $adaptationSetId"
);
if ($elstCount == sizeof($representations)) {
for ($i = 0; $i < $elstCount; $i++) {
for ($j = $i + 1; $j < $elstCount; $j++) {
$logger->test(
"DASH-IF IOP 4.3",
"Section 6.2.5.2",
"For AVC/HEVC video data, if the @bitstreamswitching flag is set to true, the edit list, if " .
"present in any Representation in the Adaptation Set, SHALL be identical in all Representations",
nodes_equal($elsts[$i], $elsts[$j]),
"FAIL",
"Edit list $i and $j equal in Period $current_period Adaptation Set $adaptationSetId ",
"Edit list $i and $j different in Period $current_period Adaptation Set $adaptationSetId "
);
}
}
}
}
20 changes: 20 additions & 0 deletions DASH/IOP/impl/validateMPD.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

global $mpd_features;

$mpd_profiles = $mpd_features['profiles'];
if (strpos($mpd_profiles, 'http://dashif.org/guidelines/dash') !== false) {
$this->validateMPDCommon();
}
if (
strpos($mpd_profiles, 'http://dashif.org/guidelines/dash') !== false &&
strpos($mpd_profiles, 'urn:mpeg:dash:profile:isoff-live:2011') !== false
) {
$this->validateMPDLiveOnDemand();
}
if (strpos($mpd_profiles, 'http://dashif.org/guidelines/dash-if-ondemand') !== false) {
$this->validateMPDOnDemand();
}
if (strpos($mpd_profiles, 'http://dashif.org/guidelines/dash-if-mixed') !== false) {
$this->validateMPDMixedOnDemand();
}
66 changes: 66 additions & 0 deletions DASH/IOP/impl/validateMPDCommmon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

global $mpd_dom, $logger;

$validateYearMonth = function ($property, $location) {
$logger->test(
"DASH-IF IOP",
"Section 3.2.7.4",
"MPD fields having datatype xs:duration shall not use year or month units",
!checkYearMonth($property),
"FAIL",
"$location is valid",
"$location contains year and/or month units",
);
}

$validateYearMonth($mpd_dom->getAttribute('mediaPresentationDuration'), "@mediaPresentationDuration in MPD");
$validateYearMonth($mpd_dom->getAttribute('minimumUpdatePeriod'), "@minimumUpdatePeriod in MPD");
$validateYearMonth($mpd_dom->getAttribute('minBufferTime'), "@minBufferTime in MPD");
$validateYearMonth($mpd_dom->getAttribute('timeShiftBufferDepth'), "@timeShiftBufferDepth in MPD");
$validateYearMonth($mpd_dom->getAttribute('suggestedPresentationDelay'), "@suggestedPresentationDelay in MPD");
$validateYearMonth($mpd_dom->getAttribute('maxSegmentDuration'), "@maxSegmentDuration in MPD");
$validateYearMonth($mpd_dom->getAttribute('maxSubSegmentDuration'), "@maxSubSegmentDuration in MPD");

foreach ($mpd_dom->getElementsByTagName('Period') as $period) {
$validateYearMonth(
$period->getAttribute('start'),
"@start for " . $period->getNodePath()
);
$validateYearMonth(
$period->getAttribute('duration'),
"@duration for " . $period->getNodePath()
);
}

foreach ($mpd_dom->getElementsByTagName('RandomAccess') as $access) {
$validateYearMonth(
$access->getAttribute('minBufferTime'),
"@minBufferTime for " . $access->getNodePath()
);
}

foreach ($mpd_dom->getElementsByTagName('SegmentTemplate') as $template) {
$validateYearMonth(
$template->getAttribute('timeShiftBufferDepth'),
"@timeShiftBufferDepth for " . $template->getNodePath()
);
}
foreach ($mpd_dom->getElementsByTagName('SegmentBase') as $base) {
$validateYearMonth(
$base->getAttribute('timeShiftBufferDepth'),
"@timeShiftBufferDepth for " . $base->getNodePath()
);
}
foreach ($mpd_dom->getElementsByTagName('SegmentList') as $list) {
$validateYearMonth(
$list->getAttribute('timeShiftBufferDepth'),
"@timeShiftBufferDepth for " . $list->getNodePath()
);
}


foreach ($mpd_dom->getElementsByTagName('Range') as $range) {
$validateYearMonth($range->getAttribute('time'), "@time for " . $range->getNodePath());
$validateYearMonth($range->getAttribute('duration'), "@duration for " . $range->getNodePath());
}
31 changes: 31 additions & 0 deletions DASH/IOP/impl/validateMPDLiveOnDemand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

global $mpd_features, $profiles, $logger;

$periods = $mpd_features['Period'];
foreach ($periods as $periodIndex => $period) {
$adaptationSets = $period['AdaptationSet'];
foreach ($adaptationSets as $adaptationSetIndex => $adaptationSet) {
$representations = $adaptationSet['Representation'];
foreach ($representations as $representationIndex => $representation) {
$representationProfiles = $profiles[$periodIndex][$adaptationSetIndex][$representationIndex];
if (strpos($representationProfiles, 'http://dashif.org/guidelines/dash-if-ondemand') !== false) {
$segmentTemplate = DASHIF\Utility\getSegmentAccess(
$segmentTemplate,
$representation['SegmentTemplate']
);
$logger->test(
"DASH-IF IOP 4.3",
"Section 3.10.3",
"SegmentTemplate@media attribute SHALL be present",
$segmentTemplate != null && $segmentTemplate['media'] != null,
"FAIL",
"SegmentTemplate@media found for period $periodIndex, adaptation $adaptationSetIndex, " .
"representation $representationIndex",
"SegmentTemplate@media not found for period $periodIndex, adaptation $adaptationSetIndex, " .
"representation $representationIndex"
);
}
}
}
}
16 changes: 16 additions & 0 deletions DASH/IOP/impl/validateMPDMixedOnDemand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

global $mpd_features, $logger;

foreach ($mpd_features['Period'] as $periodIndex => $period) {
$logger->test(
"DASH-IF IOP 4.3",
"Section 3.10.4",
"For on-demand content that offers a mixture of periods, the @profiles signaling shall be present " .
"in each Period",
$period['profiles'] != null,
"FAIL",
"@profiles signaling found in period $periodIndex",
"@profiles signaling not found in period $periodIndex"
);
}
31 changes: 31 additions & 0 deletions DASH/IOP/impl/validateMPDOnDemand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

global $mpd_features, $profiles, $logger;

$periods = $mpd_features['Period'];
foreach ($periods as $periodIndex => $period) {
$adaptationSets = $period['AdaptationSet'];
foreach ($adaptationSets as $adaptationSetIndex => $adaptationSet) {
$representations = $adaptationSet['Representation'];
foreach ($representations as $representationIndex => $representation) {
$representationProfiles = $profiles[$periodIndex][$adaptationSetIndex][$representationIndex];
if (strpos($representationProfiles, 'http://dashif.org/guidelines/dash-if-ondemand') !== false) {
$segmentTemplate = DASHIF\Utility\getSegmentAccess(
$segmentTemplate,
$representation['SegmentTemplate']
);
$logger->test(
"DASH-IF IOP 4.3",
"Section 3.10.3",
"SegmentTemplate@indexRange attribute SHALL be present",
$segmentTemplate != null && $segmentTemplate['indexRange'] != null,
"FAIL",
"SegmentTemplate@indexRange found for period $periodIndex, adaptation $adaptationSetIndex, " .
"representation $representationIndex",
"SegmentTemplate@indexRange not found for period $periodIndex, adaptation $adaptationSetIndex, " .
"representation $representationIndex"
);
}
}
}
}
25 changes: 25 additions & 0 deletions DASH/IOP/impl/validateSegment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

global $session_dir, $current_period, $current_adaptation_set, $current_representation,
$adaptation_set_template, $reprsentation_template, $reprsentation_error_log_template,
$string_info, $progress_xml, $progress_report, $logger;

$adapt_dir = str_replace('$AS$', $current_adaptation_set, $adaptation_set_template);
$rep_dir = str_replace(
array('$AS$', '$R$'),
array($current_adaptation_set, $current_representation),
$reprsentation_template
);
$rep_xml = $session_dir . '/Period' . $current_period . '/' . $adapt_dir . '/' . $rep_dir . '.xml';

if (!file_exists($rep_xml)) {
return;
}

$xml = get_DOM($rep_xml, 'atomlist');
if (!$xml) {
return;
}

$this->validateSegmentCommon($xml);
$this->validateSegmentOnDemand($xml);
Loading

0 comments on commit 11c309f

Please sign in to comment.