private/Functions/Hanwha/Get-HanwhaMediaProfile.ps1

<#
https://$($ip)/stw-cgi/media.cgi?msubmenu=videoprofile&action=update
EncodingType=H265
Resolution=$($resX)x$($resY)
FrameRate=$($framerate)
Bitrate=5120
H265.PriorityType=FrameRate
H265.GOVLength=8
H265.DynamicGOVLength=8
H265.EntropyCoding=CABAC
H265.Profile=Main
H265.BitrateControlType=VBR
H265.SmartCodecEnable=False
H265.DynamicFPSEnable=False
H265.MinDynamicFPS=1
Profile=1
Channel=$($channelnum)
#>


Function Get-HanwhaMediaProfile {
    [cmdletBinding()]
    Param(
        [Parameter()]
        [hashtable]$Object
    )
    
    <#
    Object Definition:
    @{
        IP = [String(Mandatory)]
        Credential = [PSCredential(Mandatory)]
        PofileId = [int] as [String(Optional)]
        Channel = [int] as [String(Optional)]
    }
    #>


    #Set basic Paramters for Invoke-HanwhaCommand
    $CamCmd = @{
        Arguments = @{
            IP = $Object.IP
            Menu = 'media'
            SubMenu = 'videoprofile'
            Action = 'view'
            Parameters = @()
        }
        Credential = $Object.Credential
    }

    #Add Action Parameters
    if($Object.ContainsKey('Channel') -and !$Object.ContainsKey('ProfileId')) {
        $CamCmd.Arguments.Parameters += "Channel=$($Object.Channel)"
    }
    elseif($Object.ContainsKey('ProfileId') -and !$Object.ContainsKey('Channel')) {
        $CamCmd.Arguments.Parameters += "Profile=$($Object.ProfileId)"
    }
    else {
        $CamCmd.Arguments.Parameters += "Channel.$($Object.Channel).Profile=$($Object.ProfileId)"
    }
    
    $output = (Invoke-HanwhaCommand @CamCmd).VideoProfiles

    if($Object.ContainsKey('ProfileId') -and $Object.ContainsKey('Channel')) {
        return $output.Profiles[0]
    }

    return $output
}