Tereius / libONVIF

Yet another ONVIF library
GNU General Public License v3.0
164 stars 47 forks source link

Media2 Service #17

Closed saeedsaeedi1994 closed 1 year ago

saeedsaeedi1994 commented 1 year ago

Hello! Thanks for the library!

I'm trying to use the media2 service through your library (e.g. GetVideoEncoderConfigurations() method of onvifmedia2). I traced the request and the response via Wireshark and both are correctly. I think this shows that response is being received at the network layer. And the XML format of the response with the successful code (HTTP 200 OK ) and the correct information received from the camera.
Also, the cameras support media2 service and ONVIF version 2.6 . But in the code execution output, I encounter the following error (with code 200 !!!!! ):

"HTTP Fault: SOAP-ENV:Sender: Error 200: HTTP 200 OK"

Also, after receiving the response and calling the GetResultObject() function, an empty value is returned. Another important point is that I tracked the request through Wireshark and I observed that the following statement is not written in the XML format of request: xmlns:tr2="http://www.onvif.org/ver20/media/wsdl"

libonvif version : 2.0.0 OS : ubuntu 22.04

Sample Code:

Request<tr2__GetConfiguration> rRequest3;
rRequest3.ConfigurationToken = new QString("VideoEncoderToken0s0");
rRequest3.ProfileToken = new QString("Profile0s0");
auto response2 = mpD->mpOnvifMedia2Client->GetVideoEncoderConfigurations(rRequest3);
qDebug() << "GetResultObject:  " << response2.GetResultObject();
qDebug() << "GetErrorCode:  " << response2.GetErrorCode();
qDebug() << "IsAuthFault:   " << response2.IsAuthFault();
qDebug() << "GetErrorCode:  " << response2.GetErrorCode();
qDebug() << "GetFaultSubcode: " << response2.GetFaultSubcode();
qDebug() << "GetCompleteFault: " << response2.GetCompleteFault();

Output:

GetResultObject:   0x0
GetErrorCode:   200
IsAuthFault:    false
GetErrorCode:   200
GetFaultSubcode:  ""
GetCompleteFault:  "HTTP Fault: SOAP-ENV:Sender: Error 200: HTTP 200 OK"

Thank you for your help.

Tereius commented 1 year ago

Hi,

I fixed the bug with the missing xml namespace xmlns:tr2="http://www.onvif.org/ver20/media/wsdl" on the branch fix-17-media2-service. Can you please check that it's working now with the fix.

PS.: Actually you don't need Wireshark to monitor the SOAP messages. Just call ctx->EnablePrintRawSoap();

Best wishes

saeedsaeedi1994 commented 1 year ago

Hi,

Yes that's right. Thank you for your attention and kindness.

saeedsaeedi1994 commented 1 year ago

I'm sorry, I had a question about setting the codec of the camera. Is it possible to set H265+(plus) /H264+(plus) codecs through ONVIF? If possible, which service and API should we use?

Tereius commented 1 year ago

To set the codec maybe use this call. But I have no experience with that: https://github.com/Tereius/libONVIF/blob/8dcfb0bfa4bf2f59d3261dc8fc549d113717feb0/src/OnvifMedia2Client.h#L55

Also have a look here https://www.onvif.org/wp-content/uploads/2016/12/ONVIF_WG-APG-Application_Programmers_Guide-1.pdf?441d4a&441d4a chapter 7.2.3

saeedsaeedi1994 commented 1 year ago

Hi. Thank you for your attention and kindness.