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.

105 lines
2.8 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __VIDEO_WIDGET_HEADER__
  2. #define __VIDEO_WIDGET_HEADER__
  3. //#define USE_OPENGL
  4. #include <vector>
  5. #include "../guiClass.h"
  6. #include <opencv2/opencv.hpp>
  7. #include "../../components/base/basicLIBAV.h"
  8. #include "../../components/base/basicMediaDestination.h"
  9. #include "../../components/base/basicMutex.h"
  10. #include "../../components/base/basicCameraPTZ.h"
  11. #include "../../components/base/basicStatus.h"
  12. #include "../../hardware/stick/joystick.h"
  13. #ifdef USE_OPENGL
  14. #include "FSGLVideoWidget.h"
  15. #else
  16. #include "FSVideoWidget.h"
  17. #endif
  18. class VideoWidget : public QWidget, public basicMediaDestination {
  19. private:
  20. U8 m_bStatus;
  21. int m_nMouseX;
  22. int m_nMouseY;
  23. U32 m_nKeyCode;
  24. U32 m_nOldKeyCode;
  25. ControlDirection m_nManualControlMode;
  26. #ifndef NO_JOYSTICK
  27. joysticObject *m_pJO;
  28. #endif
  29. bool m_bMouseActive;
  30. int m_nMenuActivityCounter;
  31. bool m_bGrayScale;
  32. bool m_bEnhanced;
  33. bool m_bDirectDrawing;
  34. bool m_bFullScreenView;
  35. objectCaps m_nCameraCaps;
  36. basicCamera *m_pCamera;
  37. QFrame *m_pBorder;
  38. QDialog *m_pFullScreenView;
  39. FrameAspectRatio m_eWidgetAspectRatio;
  40. FrameAspectRatio m_eStreamAspectRatio;
  41. IplImage *m_pGraber;
  42. cv::Mat *m_mFrame;
  43. cv::Mat *m_mOutput;
  44. //basicVideoSource *m_pCapture;
  45. basicMutex *m_pPropertiesProtectorMutex;
  46. basicMutex *m_pWidgetProtectorMutex;
  47. void m_fThreadProc(void);
  48. protected:
  49. //QPixmap *m_pFSPixmap;
  50. virtual void resizeEvent(QResizeEvent *event);
  51. #ifdef USE_OPENGL
  52. FSGLVideoWidget *m_pFSVideoWidget;
  53. #else
  54. FSVideoWidget *m_pFSVideoWidget;
  55. #endif
  56. QPixmap *m_pPixmap;
  57. //QPixmap *m_pOverlayPixmap;
  58. QPixmap *m_pManualMode;
  59. QPixmap *m_pPixUp;
  60. QPixmap *m_pPixDown;
  61. QPixmap *m_pPixLeft;
  62. QPixmap *m_pPixRight;
  63. QPixmap *m_pPixWide;
  64. QPixmap *m_pPixTele;
  65. public:
  66. explicit VideoWidget(QWidget *parent = NULL);
  67. ~VideoWidget();
  68. virtual void render(QPainter *painter);
  69. bool init( void );
  70. virtual void pushFrame(cv::Mat *Frame, void *src = NULL);
  71. void showFullScreen(void);
  72. void hideFullScreen(void);
  73. void showSettingsWindow( bool doModal );
  74. void setCameraControl(basicCamera *C, objectCaps CC);
  75. void setGrayScale( bool AAA );
  76. void setEnhanced( bool AAA );
  77. void setSoutceType( int Type );
  78. //public slots:
  79. void renderLater();
  80. void renderNow();
  81. QSize sizeHint() const;
  82. protected:
  83. bool event(QEvent *event);
  84. //void resizeEvent(QResizeEvent *event);
  85. void exposeEvent(QExposeEvent *event);
  86. void paintEvent(QPaintEvent *event);
  87. //void drawContents(QPainter * p, const QRectF & rect = QRectF());
  88. private:
  89. bool m_bUpdateIsPending;
  90. QTimer *m_pTimer;
  91. };
  92. #endif