From 1c37a0028c76082563015a02d8de5b1126f34466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Tr=C3=B6ger?= Date: Tue, 8 Aug 2023 12:28:07 +0200 Subject: [PATCH] no message --- ONVIF Configurator/module.php | 76 +++++++++++++++++------------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/ONVIF Configurator/module.php b/ONVIF Configurator/module.php index b149bae..1033849 100644 --- a/ONVIF Configurator/module.php +++ b/ONVIF Configurator/module.php @@ -151,51 +151,51 @@ public function GetConfigurationForm(): string $StreamValues = []; $IPSStreamInstances = $this->GetInstanceList(\ONVIF\GUID::Stream, ['Profile', 'VideoSource']); if ($Capabilities[\ONVIF\IO\Attribute::HasRTSPStreaming]) { - foreach ($Capabilities[\ONVIF\IO\Attribute::VideoSources] as $VideoSource) { - foreach ($VideoSource['Profile'] as $ProfileIndex => $Profile) { - $InstanceID = array_search($Profile['token'] . ':' . $VideoSource['VideoSourceToken'], $IPSStreamInstances); - if ($InstanceID !== false) { - unset($IPSStreamInstances[$InstanceID]); + foreach ($Capabilities[\ONVIF\IO\Attribute::VideoSources] as $VideoSource) { + foreach ($VideoSource['Profile'] as $ProfileIndex => $Profile) { + $InstanceID = array_search($Profile['token'] . ':' . $VideoSource['VideoSourceToken'], $IPSStreamInstances); + if ($InstanceID !== false) { + unset($IPSStreamInstances[$InstanceID]); + $Device = [ + 'instanceID' => $InstanceID, + 'type' => 'Media Stream', + 'VideoSource' => $VideoSource['VideoSourceToken'], + 'name' => IPS_GetName($InstanceID), + 'Location' => stristr(IPS_GetLocation($InstanceID), IPS_GetName($InstanceID), true), + 'create' => $StreamCreateParams, + ]; + $Device['create']['configuration'] = [ + 'VideoSource' => $VideoSource['VideoSourceToken'], + 'Profile' => $Profile['token'] + ]; + unset($VideoSource['Profile'][$ProfileIndex]); + $StreamValues[] = $Device; + } + } + if (count($VideoSource['Profile'])) { // weitere Profile vorhanden, dann nächste Instanz anbieten $Device = [ - 'instanceID' => $InstanceID, + 'instanceID' => 0, 'type' => 'Media Stream', 'VideoSource' => $VideoSource['VideoSourceToken'], - 'name' => IPS_GetName($InstanceID), - 'Location' => stristr(IPS_GetLocation($InstanceID), IPS_GetName($InstanceID), true), - 'create' => $StreamCreateParams, - ]; - $Device['create']['configuration'] = [ - 'VideoSource' => $VideoSource['VideoSourceToken'], - 'Profile' => $Profile['token'] + 'name' => $VideoSource['VideoSourceName'], + 'Location' => '' ]; - unset($VideoSource['Profile'][$ProfileIndex]); + $Create = []; + foreach ($VideoSource['Profile'] as $ProfileIndex => $Profile) { + $Create[$VideoSource['VideoSourceName'] . ' (' . $Profile['Name'] . ')'] = $StreamCreateParams; + $Create[$VideoSource['VideoSourceName'] . ' (' . $Profile['Name'] . ')']['configuration'] = [ + 'VideoSource' => $VideoSource['VideoSourceToken'], + 'Profile' => $Profile['token'] + ]; + } + if (count($Create) == 1) { + $Device['name'] = $VideoSource['VideoSourceName'] . ' (' . $Profile['Name'] . ')'; + $Create = array_shift($Create); + } + $Device['create'] = $Create; $StreamValues[] = $Device; } } - if (count($VideoSource['Profile'])) { // weitere Profile vorhanden, dann nächste Instanz anbieten - $Device = [ - 'instanceID' => 0, - 'type' => 'Media Stream', - 'VideoSource' => $VideoSource['VideoSourceToken'], - 'name' => $VideoSource['VideoSourceName'], - 'Location' => '' - ]; - $Create = []; - foreach ($VideoSource['Profile'] as $ProfileIndex => $Profile) { - $Create[$VideoSource['VideoSourceName'] . ' (' . $Profile['Name'] . ')'] = $StreamCreateParams; - $Create[$VideoSource['VideoSourceName'] . ' (' . $Profile['Name'] . ')']['configuration'] = [ - 'VideoSource' => $VideoSource['VideoSourceToken'], - 'Profile' => $Profile['token'] - ]; - } - if (count($Create) == 1) { - $Device['name'] = $VideoSource['VideoSourceName'] . ' (' . $Profile['Name'] . ')'; - $Create = array_shift($Create); - } - $Device['create'] = $Create; - $StreamValues[] = $Device; - } - } } foreach ($IPSStreamInstances as $InstanceID => $VideoSource) { $Device = [