ImageProvider.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef IMAGEPROVIDER_H
  2. #define IMAGEPROVIDER_H
  3. #include "EgoInterface.h"
  4. #include <QImage>
  5. #include <QQuickImageProvider>
  6. #include <mutex>
  7. /*
  8. 请求视频数据类
  9. 提供数据图像给qt界面使用
  10. */
  11. class ImageProvider : public QQuickImageProvider {
  12. public:
  13. ImageProvider();
  14. QImage requestImage(const QString& id, QSize* size,
  15. const QSize& requestedSize);
  16. QPixmap requestPixmap(const QString& id, QSize* size,
  17. const QSize& requestedSize);
  18. QImage img;
  19. };
  20. /*
  21. 展示视频数据类
  22. 管理图像数据与qml界面的交互
  23. */
  24. class ShowImage : public QObject, public IRender {
  25. Q_OBJECT
  26. public:
  27. explicit ShowImage(QObject* parent, RenderPosition _pos);
  28. ImageProvider* m_pImgProvider;
  29. virtual void OnRender(std::unique_ptr<uint8_t>& pBuffer, int32_t width,
  30. int32_t height) override;
  31. virtual void Empty() override;
  32. public slots:
  33. void sendFrontImage();
  34. void sendBackImage();
  35. void sendLeftImage();
  36. void sendRightImage();
  37. void sendLeftAnchor();
  38. void sendRightAnchor();
  39. //void sendPanelImage(QImage);
  40. signals:
  41. void callQmlRefeshFrontImg();
  42. void callQmlRefeshBackImg();
  43. void callQmlRefeshRightImg();
  44. void callQmlRefeshLeftImg();
  45. void callQmlRefeshLeftAnchor();
  46. void callQmlRefeshRightAnchor();
  47. void callQmlRefeshPanelImg();
  48. //void sendPic(QImage image);
  49. private:
  50. QImage m_image;
  51. RenderPosition campos;
  52. std::mutex buffer_lock_;
  53. quint16 m_CountF = 0;
  54. };
  55. #endif // IMAGEPROVIDER_H