libvideoqueue.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #pragma once
  2. #ifdef _WIN32
  3. #ifdef LIBVIDEOQUEUE_EXPORTS
  4. #define LIBVIDEOQUEUE_API __declspec(dllexport)
  5. #else
  6. #define LIBVIDEOQUEUE_API __declspec(dllimport)
  7. #endif
  8. # elif ( defined(__GNUC__) && __GNUC__ >= 4 )
  9. #define LIBVIDEOQUEUE_API __attribute__((visibility("default")))
  10. #else // RVC_OS_WIN
  11. #define LIBVIDEOQUEUE_API
  12. #endif // RVC_OS_WIN
  13. //using namespace std ;
  14. #define VIDEOQ_FORMAT_I420 0x01
  15. #define VIDEOQ_FORMAT_RGB24 0x02
  16. #define VIDEOQ_FORMAT_YUY2 0x03
  17. #define MAX_VIDEOQUEUE_LENS 1 //视频队列最大节点数量
  18. #define MAX_VIDEOQNODE_SIZE 640*360*3 //视频队列单个节点默认最大长度
  19. #define VIDEOQUEUE_FLAG_VERTICAL_FLIP 0x01
  20. #define VIDEOQUEUE_FLAG_HORIZONTAL_FLIP 0x02
  21. typedef struct videoq_frame
  22. {
  23. unsigned char *data;
  24. int width;
  25. int height;
  26. int framesize;
  27. int format; /* VIDEO_FORMAT_xxx */
  28. int iframeid;
  29. }videoq_frame;
  30. class libvideoqueue_impl; //桥接
  31. struct video_frame;
  32. // 此类是从 libvideoqueue.dll 导出的
  33. class LIBVIDEOQUEUE_API Clibvideoqueue
  34. {
  35. public:
  36. //videoqueuename:用于访问视频共享内存的共享内存文件名。framesize:默认最大长度,一般使用默认值即可
  37. Clibvideoqueue(const char* videoqueuename,int framesize=MAX_VIDEOQNODE_SIZE);
  38. ~Clibvideoqueue();
  39. // TODO: 在此添加您的方法。
  40. private:
  41. libvideoqueue_impl*m_pImpl;
  42. public:
  43. //插入图像到队头
  44. bool InsertVideo(videoq_frame* Video, int flags,unsigned int nowtime);
  45. //读取队头图像
  46. bool GetVideo(videoq_frame* Video, int flags);
  47. //读取队头图像,使用video_frame结构
  48. bool GetVideo2(video_frame* Video, int flags);
  49. //按行拷贝,用于横向摄像头图像的拼接
  50. bool GetVideo3(videoq_frame* Video, int flags);
  51. //读取队头图像并删除
  52. bool GetVideoAndDel(videoq_frame* Video, int flags);
  53. //获取最后的帧时间
  54. unsigned int GetLastFrameTime();
  55. //获取视频队列的长度
  56. int GetVideoLens(void);
  57. //获取单个视频帧的大小
  58. int GetFrameSize(int&width,int&height);
  59. //清空视频队列
  60. void ClearVideoQueue();
  61. //删除头部节点
  62. void DeleteHeadVideo();
  63. };