Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DASH/IOP/impl/validateSegment.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
if (!$xml) {
return;
}

$this->validateSegmentCommon($xml);
$this->validateSegmentOnDemand($xml);
// TODO: we should probably romove these checks for files existance.
$this->validateSegmentCommon($representation);
$this->validateSegmentOnDemand($representation);
56 changes: 29 additions & 27 deletions DASH/IOP/impl/validateSegmentCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

global $mpdHandler, $logger;

/** @var DASHIF\RepresentationInterface $representation */

$selectedPeriod = $mpdHandler->getSelectedPeriod();
$selectedAdaptation = $mpdHandler->getSelectedAdaptationSet();
$selectedRepresentation = $mpdHandler->getSelectedRepresentation();

$period = $mpdHandler->getFeatures()['Period'][$selectedPeriod];
$adaptation_set = $period['AdaptationSet'][$selectedAdaptationSet];
$representation = $adaptation_set['Representation'][$selectedRepresentation];
$codecs = ($representation['codecs']) ? $representation['codecs'] : $adaptation_set['codecs'];
$mimeType = ($representation['mimeType']) ? $representation['mimeType'] : $adaptation_set['mimeType'];
$adaptation_set = $period['AdaptationSet'][$selectedAdaptation];
$repinfo = $adaptation_set['Representation'][$selectedRepresentation];
$codecs = ($repinfo['codecs']) ? $repinfo['codecs'] : $adaptation_set['codecs'];
$mimeType = ($repinfo['mimeType']) ? $repinfo['mimeType'] : $adaptation_set['mimeType'];
$bitstreamSwitching = ($adaptation_set['bitstreamSwitching']) ?
$adaptation_set['bitstreamSwitching'] : $period['bitstreamSwitching'];

Expand Down Expand Up @@ -38,25 +40,25 @@
"Representation $selectedRepresentation (codecs $codecs)."
);

$codecBoxes = $xml->getElementsByTagName('avcC');
$codecBoxes = $representation->getAVCCBoxes();
$logger->test(
"DASH-IF IOP 4.3",
"Section 6.2.5.2",
"For AVC video data, if the @bitstreamswitching flag is set to true, all Representations SHALL include " .
"Initialization Segment containing 'avcC' box",
$codecBoxes->length > 0,
$codecBoxes && count($codecBoxes) > 0,
"FAIL",
$codecBoxes->length . " 'avcC' boxes found for Period $selectedPeriod Adaptation Set $selectedAdaptation " .
count($codecBoxes) . " 'avcC' boxes found for Period $selectedPeriod Adaptation Set $selectedAdaptation " .
"Representation $selectedRepresentation.",
"No 'avcC' boxes found for Period $selectedPeriod Adaptation Set $selectedAdaptation " .
"Representation $selectedRepresentation."
);
if ($codecBoxes->length > 0) {
if ($codecBoxes && count($codecBoxes) > 0) {
$spsFound = false;
$ppsFound = false;
$nalBoxes = $codec_box->item(0)->getElementsByTagName('NALUnit');
$nalBoxes = $codecBoxes[0]->NALUnits;
foreach ($nalBoxes as $nalBox) {
$unitType = $nalBox->getAttribute('nal_unit_type');
$unitType = $nalBox->type;
if (hexdec($unitType) == 7) {
$spsFound = true;
}
Expand Down Expand Up @@ -93,26 +95,26 @@
"Representation $selectedRepresentation (codecs $codecs)."
);

$codecBoxes = $xml->getElementsByTagName('hvcC');
$codecBoxes = $representation->getHVCCBoxes();
$logger->test(
"DASH-IF IOP 4.3",
"Section 6.2.5.2",
"For HEVC video data, if the @bitstreamswitching flag is set to true, all Representations SHALL include " .
"Initialization Segment containing 'hvcC' box",
$codecBoxes->length > 0,
$codecBoxes && count($codecBoxes) > 0,
"FAIL",
$codecBoxes->length . " 'hvcC' boxes found for Period $selectedPeriod Adaptation Set $selectedAdaptation " .
count($codecBoxes) . " 'hvcC' boxes found for Period $selectedPeriod Adaptation Set $selectedAdaptation " .
"Representation $selectedRepresentation.",
"No 'hvcC' boxes found for Period $selectedPeriod Adaptation Set $selectedAdaptation " .
"Representation $selectedRepresentation."
);
if ($codecBoxes->length > 0) {
$vps_found = false;
$sps_found = false;
$pps_found = false;
$nalBoxes = $codecBoxes->item(0)->getElementsByTagName('NALUnit');
if ($codecBoxes && count($codecBoxes) > 0) {
$vpsFound = false;
$spsFound = false;
$ppsFound = false;
$nalBoxes = $codecBoxes[0]->NALUnits;
foreach ($nalBoxes as $nalBox) {
$unitType = $nalBox->getAttribute('nal_unit_type');
$unitType = $nalBox->type;
if ($unitType == 32) {
$vpsFound = true;
}
Expand Down Expand Up @@ -140,7 +142,7 @@
}

if ($isAvc || $isHevc) {
$elstBoxes = $xml->getElementsByTagName('elst');
$elstBoxes = $representation->getELSTBoxes();
$representationProfiles = $mpdHandler->getProfiles[$selectedPeriod][$selectedAdaptation][$selectedRepresentation];
if (
!(strpos($representationProfiles, 'http://dashif.org/guidelines/dash-if-ondemand') !== false ||
Expand All @@ -151,7 +153,7 @@
"DASH-IF IOP 4.3",
"Section 6.2.5.2",
"Edit lists SHALL NOT be present in video Adaptation Sets unless they are offered in On-Demand profile",
$elstBoxes->length == 0,
!$elstBoxes || count($elstBoxes) == 0,
"FAIL",
"No edit lists found for Period $selectedPeriod Adaptation Set $selectedAdaptation " .
"Representation $selectedRepresentation",
Expand All @@ -160,15 +162,15 @@
);
}

$trunElements = $xml->getElementsByTagName('trun');
$tfdtElements = $xml->getElementsByTagName('tfdt');
$trunElements = $representation->getTRUNBoxes();
$tfdtElements = $representation->getTFDTBoxes();
$firstSampleCompTime = '';
$firstSampleDecTime = '';
if ($trunElements->length > 0) {
$firstSampleCompTime = $xml_trun[0]->getAttribute('earliestCompositionTime');
if ($trunElements && count($trunElements) > 0) {
$firstSampleCompTime = $trunElements[0]->earliestCompositionTime;
}
if ($tfdtElements->length > 0) {
$firstSampleDecTime = $tfdt[0]->getAttribute('baseMediaDecodeTime');
if ($tfdtElements && count($tfdtElements) > 0) {
$firstSampleDecTime = $tfdtElements[0]->baseMediaDecodeTime;
}

$logger->test(
Expand Down
6 changes: 3 additions & 3 deletions DASH/IOP/impl/validateSegmentOnDemand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
return;
}

$sidxBoxes = $xml->getElementsByTagName('sidx');
$sidxBoxes = $representation->getSIDXBoxes();

$logger->test(
"DASH-IF IOP 4.3",
"Section 3.10.3.2",
"Only a single 'sidx' SHALL be present",
$sidxBoxes->length == 1,
$sidxBoxes && count($sidxBoxes) == 1,
"FAIL",
"Exactly one 'sidx' box found for Period $selectedPeriod Adaptation Set $selectedAdaptation " .
"Representation $selectedRepresentation",
$sidxBoxes->length . " 'sidx' boxes found for Period $selectedPeriod Adaptation Set $selectedAdaptation " .
($sidxBoxes ? count($sidxBoxes) : 0) . " 'sidx' boxes found for Period $selectedPeriod Adaptation Set $selectedAdaptation " .
"Representation $selectedRepresentation"
);

Expand Down
24 changes: 17 additions & 7 deletions DASH/IOP/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,32 @@ private function validateMPDMixedOnDemand()
public function hookRepresentation()
{
parent::hookRepresentation();
$this->validateSegment();
global $validatorWrapper, $mpdHandler;
$thisRepresentation = [
$mpdHandler->getSelectedPeriod(),
$mpdHandler->getSelectedAdaptationSet(),
$mpdHandler->getSelectedRepresentation()
];
$validatorWrapper->analyzeSingle(
$thisRepresentation,
$this,
'validateSegment'
);
}

private function validateSegment()
public function validateSegment($representation)
{
include 'impl/validateSegment.php';
return include 'impl/validateSegment.php';
}

private function validateSegmentCommon($xml)
public function validateSegmentCommon($representation)
{
include 'impl/validateSegmentCommon.php';
return include 'impl/validateSegmentCommon.php';
}

private function validateSegmentOnDemand($xml)
public function validateSegmentOnDemand($representation)
{
include 'impl/validateSegmentOnDemand.php';
return include 'impl/validateSegmentOnDemand.php';
}

public function hookAdaptationSet()
Expand Down
31 changes: 31 additions & 0 deletions Utils/RepresentationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,35 @@ public function hasBox($boxName)
{
return false;
}

public function getAVCCBoxes(): array|null
{
return null;
}

public function getHVCCBoxes(): array|null
{
return null;
}

public function getELSTBoxes(): array|null
{
return null;
}

public function getTRUNBoxes(): array|null
{
return null;
}

public function getTFDTBoxes(): array|null
{
return null;
}

public function getSIDXBoxes(): array|null
{
return null;
}

}
12 changes: 12 additions & 0 deletions Utils/boxes/avccbox.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace DASHIF\Boxes;

class AVCCBox
{
public function __construct()
{
$this->NALUnits = array(); // array of NALUnit objects
}
public $NALUnits;
}
11 changes: 11 additions & 0 deletions Utils/boxes/elstbox.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace DASHIF\Boxes;

class ELSTBox
{
public function __construct()
{
// No fields needed for current logic (just presence/count)
}
}
12 changes: 12 additions & 0 deletions Utils/boxes/hvccbox.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace DASHIF\Boxes;

class HVCCBox
{
public function __construct()
{
$this->NALUnits = array(); // array of NALUnit objects
}
public $NALUnits;
}
12 changes: 12 additions & 0 deletions Utils/boxes/nalunitbox.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace DASHIF\Boxes;

class NALUnit
{
public function __construct()
{
$this->type = null;
}
public $type;
}
11 changes: 11 additions & 0 deletions Utils/boxes/sidxbox.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace DASHIF\Boxes;

class SIDXBox
{
public function __construct()
{
// No fields needed for current logic (just presence/count)
}
}
12 changes: 12 additions & 0 deletions Utils/boxes/tdtftbox.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace DASHIF\Boxes;

class TFDTBox
{
public function __construct()
{
$this->baseMediaDecodeTime = null;
}
public $baseMediaDecodeTime;
}
12 changes: 12 additions & 0 deletions Utils/boxes/trunbox.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace DASHIF\Boxes;

class TRUNBox
{
public function __construct()
{
$this->earliestCompositionTime = null;
}
public $earliestCompositionTime;
}
Loading