You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.6 KiB

  1. #include "XNetSDKTest.h"
  2. #include "XNetSDKSyn.h"
  3. #include "AVEnc_VideoWidget.h"
  4. USE_NS_NETSDK_CFG
  5. int TestOSDInfo()
  6. {
  7. printf("%s\r\n", __FUNCTION__);
  8. char c = 0;
  9. while((c = getchar()) != 'q')
  10. {
  11. switch(c)
  12. {
  13. //获取视频叠加
  14. case 'a':
  15. {
  16. char szOutBuffer[4096] = {0};
  17. char outbuffer[100] = {0};
  18. int len = 0;
  19. int nInOutSize = sizeof(szOutBuffer);
  20. int nRet = 0;
  21. nRet =XSDK_DevGetSysConfigSyn(g_hDevice, JK_AVEnc_VideoWidget, szOutBuffer, &nInOutSize, 4000, EXCMD_CONFIG_GET);
  22. if(nRet >= 0)
  23. {
  24. JObjArrayObject<AVEnc_VideoWidget> cfg(NULL, JK_AVEnc_VideoWidget);
  25. cfg.Parse(szOutBuffer);
  26. if(cfg.objs.Size() > 0)
  27. {
  28. printf("CoversNum = %d\r\n", cfg.objs[0].CoversNum.Value());
  29. ///设置通道名称
  30. cfg.objs[0].mChannelTitle.Name.SetValue("CAM02");
  31. /////设置通道名称的左位置(时间位置设置类似)
  32. int left = (1 / 20) * 8192;
  33. cfg.objs[0].mChannelTitleAttribute.RelativePos[0].SetValue(left);
  34. const char *pCfg = cfg.ToString();
  35. nRet = XSDK_DevSetChnConfigSyn(g_hDevice, 0, JK_Camera_Param, pCfg, strlen(pCfg), outbuffer, &len, 5000, EXCMD_CONFIG_SET);
  36. if(nRet >= 0)
  37. {
  38. printf("Set Success!\r\n");
  39. }
  40. }
  41. }
  42. }
  43. break;
  44. ////设置设备时间
  45. case 'b':
  46. {
  47. char buf[32] = {0};
  48. time_t tNow = time(NULL);
  49. struct tm tmNow = *localtime(&tNow);
  50. sprintf(buf, "%04d-%02d-%02d %d:%d:%d", tmNow.tm_year + 1900, tmNow.tm_mon + 1, tmNow.tm_mday, tmNow.tm_hour, tmNow.tm_min, tmNow.tm_sec);
  51. XSDK_DevSynTime(g_hDevice, buf, 1);
  52. }
  53. break;
  54. }
  55. }
  56. return 0;
  57. }