Frame.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. #ifndef __DAHUA_GENICAM_CFRAME_H__
  2. #define __DAHUA_GENICAM_CFRAME_H__
  3. #include "Defs.h"
  4. #include "Memory/Block.h"
  5. #include "Infra/Vector.h"
  6. #include "Infra/String.h"
  7. #include "PixelType.h"
  8. GENICAM_NAMESPACE_BEGIN
  9. /// \~chinese
  10. /// \brief 数据帧对象接口
  11. /// \defgroup Frame 数据帧操作接口
  12. /// @{
  13. /// \~english
  14. /// \brief data frame object interface
  15. /// \defgroup data Frame Buffer Operation interface
  16. /// @{
  17. /// \~chinese
  18. /// \brief Class CFrame 数据帧对象接口,帧的长、宽以及数据格式可从该对象中获取
  19. /// \~english
  20. /// \brief Class CFrame frame object interface
  21. class GENICAM_API CFrame : public Memory::CBlock
  22. {
  23. public:
  24. enum EPayloadType
  25. {
  26. payloadImage = 1, ///< \~chinese 图片 \~english Image
  27. payloadRawdata, ///< \~chinese 裸数据 \~english Raw Data
  28. payloadFile, ///< \~chinese 文件 \~english File
  29. payloadChunkData, ///< \~chinese 块数据 \~english Chunk Data
  30. payloadExtChunkData, ///< \~chinese 扩展块数据 \~english Extension Chunk Data
  31. payloadJpeg, ///< \~chinese jpeg数据 \~english jpeg Data
  32. payloadDevSpecBase = 0x8000, ///< \~chinese 设备特有 \~english Device specific payload type
  33. payloadUndefined ///< \~chinese 未定义 \~english Undefined
  34. };
  35. /// \~chinese
  36. /// brief 空构造函数
  37. /// \~english
  38. /// brief Empty Constructor function
  39. CFrame();
  40. /// \~chinese
  41. /// brief 帧对象构造函数
  42. /// \param [in] other 构造帧对象的原始数据块对象
  43. /// \~english
  44. /// brief Frame object constructor function
  45. /// \param [in] other raw data object used to contruct frame
  46. explicit CFrame(Memory::CBlock const& other);
  47. /// \~chinese
  48. /// \brief 帧深拷贝克隆接口
  49. /// \return 新的一帧对象
  50. /// \~english
  51. /// \brief frame deep clone interface
  52. /// \return new frame object
  53. CFrame clone();
  54. /// \~chinese
  55. /// \brief 外面不使用时需要调用此接口释放Image相关内存
  56. /// \return none
  57. /// \~english
  58. /// \brief It is required to call this interface to release the image related memory when it is not needed externally
  59. /// \return none
  60. void reset();
  61. /// brief 是否有效
  62. /// \return 返回该帧是否有效
  63. /// \~english
  64. /// brief check frame valid or not
  65. /// \retval < 0 frame invalid
  66. /// \retval 0 frame valid
  67. bool valid() const;
  68. /// \~chinese
  69. /// \brief 获取该帧图片数据的内存首地址
  70. /// \return 返回该帧图片数据的内存首地址
  71. /// \~english
  72. /// \brief Get the starting address of memory of this image data
  73. /// \return Return the starting address of memory of this image data
  74. const void * getImage() const;
  75. /// \~chinese
  76. /// \brief 获取数据帧状态
  77. /// \return 返回数据帧状态
  78. /// \~english
  79. /// \brief Get status of data frame
  80. /// \return Return status of data frame
  81. uint32_t getFrameStatus() const;
  82. /// \~chinese
  83. /// \brief 获取图片宽度
  84. /// \return 返回图片宽度
  85. /// \~english
  86. /// \brief get the width of image
  87. /// \return the width of image, return 0 when failed
  88. uint32_t getImageWidth() const;
  89. /// \~chinese
  90. /// \brief 获取图片高度
  91. /// \return 返回图片高度
  92. /// \~english
  93. /// \brief get the height of image
  94. /// \return the height of image, return 0 when failed
  95. uint32_t getImageHeight() const;
  96. /// \~chinese
  97. /// \brief 获取图片大小
  98. /// \return 返回图片大小
  99. /// \~english
  100. /// \brief get the size of image
  101. /// \return the size of image, return 0 when failed
  102. uint32_t getImageSize() const;
  103. /// \~chinese
  104. /// \brief 获取图片像素格式
  105. /// \return 返回图片像素格式
  106. /// \~english
  107. /// \brief get image pixel format
  108. /// \return image pixel format
  109. EPixelType getImagePixelFormat() const;
  110. /// \~chinese
  111. /// \brief 获取图片时间戳
  112. /// \return 返回图片时间戳
  113. /// \~english
  114. /// \brief get timestamp of image
  115. /// return image time stamp, return 0 when failed
  116. uint64_t getImageTimeStamp() const;
  117. /// \~chinese
  118. /// \brief 获取图片对应的BlockId
  119. /// \return 返回图片对应的BlockId
  120. /// \~english
  121. /// \brief get the block ID of image
  122. /// \return the image's block ID, return 0 when failed
  123. uint64_t getBlockId() const;
  124. /// \~chinese
  125. /// \brief 获取当前帧数据净荷类型
  126. /// \param [out] payloadTypes 当前帧数据类型种类集
  127. /// \return 返回是否成功
  128. /// \~english
  129. /// \brief get pay load type of current frame
  130. /// \param [out] payloadTypes Current frame data type set
  131. /// \retval false failure
  132. /// \retval true success
  133. bool getPayLoadTypes(Infra::TVector<EPayloadType>& payloadTypes) const;
  134. /// \~chinese
  135. /// \brief 获取Buffer中包含的Chunk个数
  136. /// \return Chunk个数
  137. /// \~english
  138. /// \brief get the number of chunk in buffer
  139. /// \return the number of chunk
  140. uint32_t getChunkCount() const;
  141. /// \~chinese
  142. /// \brief 获取Chunk数据
  143. /// \param [in] aIndex 索引ID
  144. /// \param [out] aID ChunkID
  145. /// \param [out] paramNames Chunk数据对应的属性名
  146. /// \return 是否成功
  147. /// \~english
  148. /// \brief get chunk data
  149. /// \param [in] aIndex index ID
  150. /// \param [out] aID ChunkID
  151. /// \param [out] paramNames Corresponding property name of chunk data
  152. /// \return success or fail
  153. bool getChunkDataByIndex(uint32_t aIndex, uint32_t &aID, Infra::TVector<Infra::CString>& paramNames) const;
  154. /// \~chinese
  155. /// \brief 获取图片paddingX
  156. /// \return 返回图片paddingX
  157. /// \~english
  158. /// \brief get image paddingX
  159. /// \return paddingX
  160. uint32_t getImagePadddingX() const;
  161. /// \~chinese
  162. /// \brief 获取图片paddingY
  163. /// \return 返回图片paddingY
  164. /// \~english
  165. /// \brief get image paddingY
  166. /// \return paddingY
  167. uint32_t getImagePadddingY() const;
  168. };
  169. /// @}
  170. GENICAM_NAMESPACE_END
  171. #endif //__DAHUA_GENICAM_CFRAME_H__