libvideoqueue.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // 下列 ifdef 块是创建使从 DLL 导出更简单的
  2. // 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 LIBVIDEOQUEUE_EXPORTS
  3. // 符号编译的。在使用此 DLL 的
  4. // 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
  5. // LIBVIDEOQUEUE_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
  6. // 符号视为是被导出的。
  7. #ifndef LIBVIDEOQUEUE
  8. #define LIBVIDEOQUEUE
  9. #ifdef LIBVIDEOQUEUE_EXPORTS
  10. #define LIBVIDEOQUEUE_API __declspec(dllexport)
  11. #else
  12. #define LIBVIDEOQUEUE_API __declspec(dllimport)
  13. #endif
  14. //using namespace std ;
  15. #define VIDEOQ_FORMAT_RGB24 0x01
  16. #define VIDEOQ_FORMAT_OPENCV 0x02
  17. #define VIDEOQ_FORMAT_I420 0x03
  18. #define MAX_VIDEOQUEUE_LENS 1 //视频队列最大节点数量
  19. #define MAX_VIDEOQNODE_SIZE 640*360*3 //视频队列单个节点默认最大长度
  20. #define VIDEOQUEUE_FLAG_VERTICAL_FLIP 0x01
  21. #define VIDEOQUEUE_FLAG_HORIZONTAL_FLIP 0x02
  22. typedef struct videoq_frame
  23. {
  24. unsigned char *data;
  25. int width;
  26. int height;
  27. int framesize;
  28. int format; /* VIDEO_FORMAT_xxx */
  29. int iframeid;
  30. }videoq_frame;
  31. class libvideoqueue_impl; //桥接
  32. struct video_frame;
  33. // 此类是从 libvideoqueue.dll 导出的
  34. class LIBVIDEOQUEUE_API Clibvideoqueue
  35. {
  36. public:
  37. //videoqueuename:用于访问视频共享内存的共享内存文件名。framesize:默认最大长度,一般使用默认值即可
  38. Clibvideoqueue(LPCTSTR videoqueuename,int framesize=MAX_VIDEOQNODE_SIZE);
  39. ~Clibvideoqueue();
  40. // TODO: 在此添加您的方法。
  41. private:
  42. libvideoqueue_impl*m_pImpl;
  43. public:
  44. //插入图像到队头
  45. bool InsertVideo(videoq_frame* Video, int flags,unsigned int nowtime);
  46. //读取队头图像
  47. bool GetVideo(videoq_frame* Video, int flags);
  48. //读取队头图像,使用video_frame结构
  49. bool GetVideo2(video_frame* Video, int flags);
  50. //按行拷贝,用于横向摄像头图像的拼接
  51. bool GetVideo3(videoq_frame* Video, int flags);
  52. //读取队头图像并删除
  53. bool GetVideoAndDel(videoq_frame* Video, int flags);
  54. //获取最后的帧时间
  55. unsigned int GetLastFrameTime();
  56. //获取视频队列的长度
  57. int GetVideoLens(void);
  58. //获取单个视频帧的大小
  59. int GetFrameSize(int&width,int&height);
  60. //清空视频队列
  61. void ClearVideoQueue();
  62. //删除头部节点
  63. void DeleteHeadVideo();
  64. };
  65. #endif