ImageProvider.h 1.3 KB

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