Fix botched merge in ONVIF.PM

This commit is contained in:
Isaac Connor 2020-05-09 12:22:11 -04:00
parent 8bebb2b890
commit 7938952a90
1 changed files with 25 additions and 34 deletions

View File

@ -185,16 +185,12 @@ sub discover {
push @responses, $response; push @responses, $response;
}; };
## try both soap versions
my $uuid_gen = Data::UUID->new(); my $uuid_gen = Data::UUID->new();
if ( ( ! $soap_version ) or ( $soap_version eq '1.1' ) ) { if ( ( ! $soap_version ) or ( $soap_version eq '1.1' ) ) {
my %services; my %services;
if ( $verbose ) { print "Probing for SOAP 1.1\n" if $verbose;
print "Probing for SOAP 1.1\n";
}
my $svc_discover = WSDiscovery10::Interfaces::WSDiscovery::WSDiscoveryPort->new({ my $svc_discover = WSDiscovery10::Interfaces::WSDiscovery::WSDiscoveryPort->new({
# no_dispatch => '1', # no_dispatch => '1',
}); });
@ -218,7 +214,7 @@ sub discover {
To => { value => 'urn:schemas-xmlsoap-org:ws:2005:04:discovery' }, To => { value => 'urn:schemas-xmlsoap-org:ws:2005:04:discovery' },
}) })
); );
print $result . "\n" if $verbose; print $result."\n" if $verbose;
push @results, interpret_messages($svc_discover, \%services, @responses); push @results, interpret_messages($svc_discover, \%services, @responses);
@responses = (); @responses = ();
@ -226,9 +222,7 @@ sub discover {
if ( ( ! $soap_version ) or ( $soap_version eq '1.2' ) ) { if ( ( ! $soap_version ) or ( $soap_version eq '1.2' ) ) {
my %services; my %services;
if ( $verbose ) { print "Probing for SOAP 1.2\n" if $verbose;
print "Probing for SOAP 1.2\n";
}
my $svc_discover = WSDiscovery10::Interfaces::WSDiscovery::WSDiscoveryPort->new({ my $svc_discover = WSDiscovery10::Interfaces::WSDiscovery::WSDiscoveryPort->new({
# no_dispatch => '1', # no_dispatch => '1',
}); });
@ -256,7 +250,7 @@ sub discover {
To => { value => 'urn:schemas-xmlsoap-org:ws:2005:04:discovery' }, To => { value => 'urn:schemas-xmlsoap-org:ws:2005:04:discovery' },
}) })
); );
print $result . "\n" if $verbose; print $result."\n" if $verbose;
push @results, interpret_messages($svc_discover, \%services, @responses); push @results, interpret_messages($svc_discover, \%services, @responses);
} # end if doing soap 1.2 } # end if doing soap 1.2
return @results; return @results;
@ -281,19 +275,16 @@ sub profiles {
} }
my @profiles; my @profiles;
foreach my $profile ( @{ $result->get_Profiles() } ) { foreach my $profile ( @{ $result->get_Profiles() } ) {
my $token = $profile->attr()->get_token() ;
my $Name = $profile->get_Name();
my $VideoEncoderConfiguration = $profile->get_VideoEncoderConfiguration(); my $VideoEncoderConfiguration = $profile->get_VideoEncoderConfiguration();
if ( ! $VideoEncoderConfiguration ) { if ( ! $VideoEncoderConfiguration ) {
print "Unknown profile $token $Name.\n"; print "No VideoEncoderConfiguration in profile $token $Name.\n";
next; next;
} }
my $token = $profile->attr()->get_token() ;
my $Name = $profile->get_Name();
# Specification gives conflicting values for unicast stream types, try both. # Specification gives conflicting values for unicast stream types, try both.
# http://www.onvif.org/onvif/ver10/media/wsdl/media.wsdl#op.GetStreamUri # http://www.onvif.org/onvif/ver10/media/wsdl/media.wsdl#op.GetStreamUri
foreach my $streamtype ( 'RTP_unicast', 'RTP-Unicast', 'RTP-multicast', 'RTP-Multicast' ) { foreach my $streamtype ( 'RTP_unicast', 'RTP-Unicast', 'RTP-multicast', 'RTP-Multicast' ) {
@ -305,25 +296,25 @@ sub profiles {
}, },
}, },
ProfileToken => $token, # ReferenceToken ProfileToken => $token, # ReferenceToken
} ); } );
next if ! ( $StreamUri and $StreamUri->can('get_MediaUri') ); next if ! ( $StreamUri and $StreamUri->can('get_MediaUri') );
my $MediaUri = $StreamUri->get_MediaUri(); my $MediaUri = $StreamUri->get_MediaUri();
next if ! $MediaUri; next if ! $MediaUri;
my $Uri = $MediaUri->get_Uri(); my $Uri = $MediaUri->get_Uri();
next if ! $Uri; next if ! $Uri;
my $Resolution = $VideoEncoderConfiguration->get_Resolution(); my $Resolution = $VideoEncoderConfiguration->get_Resolution();
my $Width = $Resolution ? $Resolution->get_Width() : 0; my $Width = $Resolution ? $Resolution->get_Width() : 0;
my $Height = $Resolution ? $Resolution->get_Height() : 0; my $Height = $Resolution ? $Resolution->get_Height() : 0;
push @profiles, { push @profiles, [
print join(', ', $token, $token,
$Name, $Name,
$VideoEncoderConfiguration->get_Encoding(), $VideoEncoderConfiguration->get_Encoding(),
$Width, $Width,
$Height, $Height,
$VideoEncoderConfiguration->get_RateControl()->get_FrameRateLimit(), $VideoEncoderConfiguration->get_RateControl()->get_FrameRateLimit(),
$Uri, $Uri,
) . "\n"; ];
} # end foreach streamtype } # end foreach streamtype
} # end foreach profile } # end foreach profile