我已经使用onvif实现了网络摄像头h264和h265码流RTSP地址的获取,现在我想用onvif去实现切换摄像头的编码,但是一直有问题,目前的实现方式是用media2的onvif协议去切换码流,功能可以实现但是onvif gsoap一直报错,而且这种方法也不是每个摄像头都是可以的,代码如下:
if(tr2__SetVideoEncoderConfiguration.Configuration->Encoding==NULL)
{
if(strcmp(piencoder,"H264") == 0)
{
tr2__SetVideoEncoderConfiguration.Configuration->Encoding=soap_strdup(psoap, "H264");
}
else
{
tr2__SetVideoEncoderConfiguration.Configuration->Encoding=soap_strdup(psoap, "H265");
}
}
soap_wsse_add_UsernameTokenDigest(soap, "user", m_strUserName.c_str(), m_strPassword.c_str());
int rv = soap_call___tr2__SetVideoEncoderConfiguration(soap, soap_endpoint, soap_action,
tr2__SetVideoEncoderConfiguration, tr2__SetVideoEncoderConfigurationResponse);
if (rv==0)
{
cout<<__FUNCTION__<<" success."<<endl;
return 0;
}
else
{
cout<<__FUNCTION__<<" failed,rv:"<<rv<<",soaperrorstr:"<<soaperrorstr(soap)<<endl;
return -1;
}
报错:
Media2SetVideoEncoderConfiguration failed,rv:-1,soaperrorstr: soap error: -1 ,faultcode: ,faultstring:
请问有知道该怎么做的吗?