linux设备上的Onvif 实现12: 获取媒体配置数据

1 背景

通过GetProfiles命令可以获得设备的所有配置信息,这是比较全面的数据。通过GetVideoEncoderConfigurations()函数可以获得单独的媒体配置信息,返回的应答中包括主通道和子通道的数据。

2 函数原型

SOAP_FMAC5 int SOAP_FMAC6 soap_call___ns8__GetVideoEncoderConfigurations(struct soap *soap, const char *soap_endpoint, const char *soap_action, struct _ns8__GetVideoEncoderConfigurations *ns8__GetVideoEncoderConfigurations, struct _ns8__GetVideoEncoderConfigurationsResponse *ns8__GetVideoEncoderConfigurationsResponse)

这个函数用法简单,只需指定媒体信息地址URI即可。

3 我的代码实例:

struct _ns8__GetVideoEncoderConfigurations getConfigReq;
    struct _ns8__GetVideoEncoderConfigurationsResponse getConfigResponse;
    struct ns3__VideoEncoderConfiguration *Configurations;
    result = soap_call___ns8__GetVideoEncoderConfigurations(soap, deviceode->mediauri, NULL, &getConfigReq, &getConfigResponse);
    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(" GetVideoEncoderConfigurations  OK!  \n");
        count = getConfigResponse.__sizeConfigurations;
        Configurations = getConfigResponse.Configurations;
        printf(" getConfigResponse__sizeConfigurations=%d \n", count);
        for(i=0;i         {       
#if 1
            printf(" getConfigResponse.Configurations[%d]->Name=%s \n",                        i,Configurations->Name);
            printf(" getConfigResponse.Configurations[%d]->UseCount=%d \n",                    i,Configurations->UseCount);           
            printf(" getConfigResponse.Configurations[%d]->token=%s \n",                       i,Configurations->token);
            printf(" getConfigResponse.Configurations[%d]->Encoding=%d \n",                    i,Configurations->Encoding);
            printf(" getConfigResponse.Configurations[%d]->Resolution->Width=%d \n",           i,Configurations->Resolution->Width);
            printf(" getConfigResponse.Configurations[%d]->Resolution->Height=%d \n",          i,Configurations->Resolution->Height);
            printf(" getConfigResponse.Configurations[%d]->Quality=%f \n",                     i,Configurations->Quality);
            printf(" getConfigResponse.Configurations[%d]->RateControl->FrameRateLimit=%d \n", i,Configurations->RateControl->FrameRateLimit);
            printf(" getConfigResponse.Configurations[%d]->RateControl->EncodingInterval=%d\n",i,Configurations->RateControl->EncodingInterval); // ??±à?????à:??n??±à??????
            printf(" getConfigResponse.Configurations[%d]->RateControl->BitrateLimit=%d \n",   i,Configurations->RateControl->BitrateLimit);
            printf(" getConfigResponse.Configurations[%d]->H264->GovLength=%d \n",             i,Configurations->H264->GovLength);  //I??????
            printf(" getConfigResponse.Configurations[%d]->H264->H264Profile=%d \n",           i,Configurations->H264->H264Profile);          
#endif
            if(i+1             {
                Configurations++;  //指向下一个配置

            }
           
        }          
    }
 
4 命令应答报文:

linux服务器发出命令 GetVideoEncoderConfigurations,获取配置参数。

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