linux设备上的Onvif 实现13: 获取子通道的配置数据范围

1 背景

想要修改配置数据,必须知道摄像头支持的数据范围,这样才能设置成正确的数据。

2 函数原型

SOAP_FMAC5 int SOAP_FMAC6 soap_call___ns8__GetVideoEncoderConfigurationOptions(struct soap *soap, const char *soap_endpoint, const char *soap_action, struct _ns8__GetVideoEncoderConfigurationOptions *ns8__GetVideoEncoderConfigurationOptions, struct _ns8__GetVideoEncoderConfigurationOptionsResponse *ns8__GetVideoEncoderConfigurationOptionsResponse)

该函数需要指定通道代号、该通道的功能种类(例如本例中的编码器代号)

getOptionsReq.ConfigurationToken

getOptionsReq.ProfileToken

3 我的代码实例:

/*  读取子通道的配置数据范围.
        一般2通道,第1是主通道,第2是子通道。  */
    struct _ns8__GetVideoEncoderConfigurationOptions getOptionsReq;
    struct _ns8__GetVideoEncoderConfigurationOptionsResponse getOptionsResponse;
    if(count>1)
        channel=1;
    else
        channel=0;
    getOptionsReq.ConfigurationToken = deviceode->profile[channel].VideoEncoderConfigurationtoken;
    getOptionsReq.ProfileToken = deviceode->profile[channel].token;
    result = soap_call___ns8__GetVideoEncoderConfigurationOptions(soap, deviceode->mediauri, NULL, &getOptionsReq, &getOptionsResponse);
    if(result==-1)       
    {
        printf("soap error: %d, %s, %s\n", soap->error, *soap_faultcode(soap), *soap_faultstring(soap));
        result = soap->error;
        return FALSE;     
    }
    else
    {
        printf(" GetVideoEncoderConfigurationOptions  OK! \n");
        /* 有的摄像头应答无Extension字段,有的有Extension字段。
           Extension字段中含码率BitrateRange范围定义 */
#if 1
        printf(" getOptionsResponse.Options->QualityRange=(%d ~ %d) \n",                   getOptionsResponse.Options->QualityRange->Min,getOptionsResponse.Options->QualityRange->Max);         
        printf(" getOptionsResponse.Options->H264->__sizeResolutionsAvailable=%d \n",      getOptionsResponse.Options->H264->__sizeResolutionsAvailable);
        struct ns3__VideoResolution *ResolutionsAvailable;
        ResolutionsAvailable = getOptionsResponse.Options->H264->ResolutionsAvailable;
        count = getOptionsResponse.Options->H264->__sizeResolutionsAvailable;
        for(i=0; i<count;i++)
        {
            printf(" getOptionsResponse.Options->H264->ResolutionsAvailable[%d]=(%d x %d) \n", i,ResolutionsAvailable->Width,ResolutionsAvailable->Height);
            ResolutionsAvailable++;
        }
       
        printf(" getOptionsResponse.Options->H264->GovLengthRange=(%d ~ %d) \n",           getOptionsResponse.Options->H264->GovLengthRange->Min,getOptionsResponse.Options->H264->GovLengthRange->Max);
        printf(" getOptionsResponse.Options->H264->FrameRateRange=(%d ~ %d) \n",           getOptionsResponse.Options->H264->FrameRateRange->Min,getOptionsResponse.Options->H264->FrameRateRange->Max);
        printf(" getOptionsResponse.Options->H264->EncodingIntervalRange=(%d ~ %d)\n",     getOptionsResponse.Options->H264->EncodingIntervalRange->Min,getOptionsResponse.Options->H264->EncodingIntervalRange->Max);
        printf(" getOptionsResponse.Options->H264->__sizeH264ProfilesSupported=%d \n",     getOptionsResponse.Options->H264->__sizeH264ProfilesSupported);
        printf(" getOptionsResponse.Options->H264->H264ProfilesSupported=%d \n",           *getOptionsResponse.Options->H264->H264ProfilesSupported);
        if(getOptionsResponse.Options->Extension!=NULL)
            printf(" getOptionsResponse.Options->Extension->H264->BitrateRange=(%d ~ %d) \n",  getOptionsResponse.Options->Extension->H264->BitrateRange->Min,getOptionsResponse.Options->Extension->H264->BitrateRange->Max);
     
#endif      
    }   

4 命令及应答报文

linux服务器发出命令 GetVideoEncoderConfigurationOptions,获取配置参数的范围。

你可能感兴趣的:(linux,gsoap,onvif)