FunSDK2.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*********************************************************************************
  2. *Author: Yongjun Zhao(赵永军)
  3. *Description:
  4. *History:
  5. Date: 2014.01.01/Yongjun Zhao
  6. Action:Create
  7. **********************************************************************************/
  8. #pragma once
  9. #include "XTypes.h"
  10. #include "FunSDK.h"
  11. // 通知设备媒体准备(推流到服务器,保证打开时更快)
  12. void FUN_MediaPlayReady(const char *szDevId, int nChnIndex, int nStreamType);
  13. //加密
  14. char *FUN_EncDevInfo(char *szDevInfo, const char *szDevId, const char *szUser, const char *szPwd, int nType);
  15. //解密
  16. int FUN_DecDevInfo(const char *szDevInfo, char *szDevId, char *szUser, char *szPwd, int &nType,int &nInfoTime);
  17. char *FUN_DecDevInfo(const char *szDevInfo, char *szResult);
  18. /*********************************************
  19. * 方法名: 加密数据
  20. * 描 述: 加密数据
  21. * 返回值:
  22. * 加密得到的字符串
  23. * 参 数:
  24. * 输入(in)
  25. * [szDevInfo:设备信息(未加密的字符串)]
  26. * 输出(out)
  27. * 加密得到的字符串
  28. ****************************************************/
  29. char *FUN_EncGeneralDevInfo(const char *szDevInfo, char *szResult);
  30. /*********************************************
  31. * 方法名: 解密数据
  32. * 描 述: 解密数据
  33. * 返回值:
  34. * 解密得到的字符串
  35. * 参 数:
  36. * 输入(in)
  37. * [szDevInfo:加密的设备信息(加密过的字符串)]
  38. * 输出(out)
  39. * 解密得到的字符串
  40. ****************************************************/
  41. char *FUN_DecGeneralDevInfo(const char *szDevInfo, char *szResult);
  42. typedef struct SMediaFileInfo
  43. {
  44. uint64 tStart;
  45. uint64 tEnd;
  46. int nFrameRate;
  47. int nWidth;
  48. int nHeight;
  49. int nVFrameCount;
  50. int nAFrameCount;
  51. uint64 lFileSize;
  52. }SMediaFileInfo;
  53. int FUN_GetMediaFileInfo(const char *szFile, SMediaFileInfo *pInfo);
  54. namespace ENCFun
  55. {
  56. int ResToInt(const char *szRes);
  57. const char *ResToStr(int nRes);
  58. };
  59. using namespace ENCFun;
  60. // 主码流分辨率和帧率确定的情况下,检查现有的辅码流的分辨率
  61. // 如果不符合,找个合法的配置给出
  62. // nMaxPowerPerChannel: 总的编码编码能力级
  63. // nSupportResMark: 主码流对应的子码流分辨率掩码
  64. // nMainRes:主码流分辨率
  65. // nMainRate:主码流帧率
  66. // nSubRes:子码流现有分辨率(输入\输出)
  67. // nSubRate:子码流现有的帧率(输入\输出)
  68. int CheckSubResRate(int nMaxPowerPerChannel, int nSupportResMark, int nMainRes, int nMainRate, int &nSubRes, int &nSubRate);
  69. // 获取主码流的最大帧率
  70. // nMaxPowerPerChannel: 总的编码编码能力级
  71. // nSupportResMark: 主码流对应的子码流分辨率掩码
  72. // nMainRes:主码流分辨率
  73. // nMainRate:主码流帧率
  74. // bNTCS:制式是否NTCS
  75. int GetMainMaxRate(int nMaxPowerPerChannel, int nSupportResMark, int nMainRes, int bNTCS);
  76. //通过SSID名称来判断设备类型
  77. int CheckDevType(const char *szDevSSID);
  78. // 获取设置 0xffffffff ffffffff ffffffff: 31~0 63~32 95~64...
  79. bool Dev_IsSelectHex(const char *szHex, unsigned int nIndex);
  80. char *Dev_SetSelectHex(char szHex[48], unsigned int nIndex, bool bSelected);
  81. int GN_WriteFile(const char *szFileName, const char *pData, int nDataLen);
  82. int GN_DeleteFile(const char *szFileName);
  83. int GN_StartDecTest(UI_HANDLE hUser, const char *szFileName, LP_WND_OBJ hWnd, MEDIA_EX_PARAM int nType);
  84. void GN_StopDecTest();
  85. time_t GN_ToTime_t(int *tt);
  86. //XM私有加密,解密方法--部分协议会用到
  87. bool XM_EncodePassword(char* pPassword, char* dstPassword, int nDstSize);
  88. bool XM_DecodePassword(char* pPassword, char* dstPassword, int nDstSize);
  89. //使用示例
  90. //char szPwd[64] = {0}, szDes[128] = {0}, szDes2[64] = {0};
  91. //strcpy(szPwd, "1234567abcdefg .*#x");
  92. //XM_EncodePassword(szPwd, szDes, sizeof(szDes));
  93. //XM_DecodePassword(szDes, szDes2, sizeof(szDes2));