From e5cff5a3ef373a5090f45cd1dfb0b85d9c851d5d Mon Sep 17 00:00:00 2001
From: FuJuntang <strongtiger_001@163.com>
Date: 星期三, 06 七月 2022 10:04:09 +0800
Subject: [PATCH] Add video recorder and playback support.

---
 service/capabilities/capa.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/service/capabilities/capa.c b/service/capabilities/capa.c
index fd2033f..6fc0847 100644
--- a/service/capabilities/capa.c
+++ b/service/capabilities/capa.c
@@ -87,6 +87,49 @@
     return rep.__sizeProfiles;
 }
 
+int proto_GetVideoSource(const char *DeviceXAddr, char *buf, int len, const char *username, const char *passwd) {
+    int result = 0;
+    struct soap *soap = NULL;
+    struct _trt__GetVideoSources *getVideoSources;
+    struct _trt__GetVideoSourcesResponse *getVideoSourcesRes;
+
+    SOAP_ASSERT(NULL != DeviceXAddr);
+    SOAP_ASSERT(NULL != buf);
+    SOAP_ASSERT(NULL != (soap = proto_soap_new(SOAP_SOCK_TIMEOUT)));
+
+    getVideoSources = soap_new__trt__GetVideoSources(soap, 1);
+    getVideoSourcesRes = soap_new__trt__GetVideoSourcesResponse(soap, 1);
+
+    proto_SetAuthInfo(soap, username, passwd);
+
+    result = soap_call___trt__GetVideoSources(soap, DeviceXAddr, NULL, getVideoSources, getVideoSourcesRes);
+    SOAP_CHECK_ERROR(result, soap, "GetVideoSourc");
+
+    if (getVideoSourcesRes->__sizeVideoSources <= 0) {
+      
+      result = SOAP_NO_DATA;
+      SOAP_CHECK_ERROR(result, soap, "GetVideoSourc");
+
+    } else {
+
+      for (int i = 0; i < getVideoSourcesRes->__sizeVideoSources; i++) {
+
+        log_level_val(0, "get video source token: ", log_str, getVideoSourcesRes->VideoSources[i].token);
+
+        if (i == 0) {
+          strncpy(buf, getVideoSourcesRes->VideoSources[i].token, len);
+        }
+      }
+    }
+
+EXIT:
+    if (NULL != soap) {
+        proto_soap_delete(soap);
+    }
+
+    return result;
+}
+
 int proto_GetCapabilities(const char *DeviceXAddr, struct tagCapabilities *capa, const char *username, const char *passwd)
 {
     int result = 0;

--
Gitblit v1.8.0