UDPSocketCapture.h 968 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* UDPSocketCapture.h/Open GoPro, Version 2.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro). */
  2. /* This copyright was auto-generated on Sat Mar 5 01:05:53 UTC 2022 */
  3. #pragma once
  4. #include "GPWNetwork.h"
  5. #include <thread>
  6. #include <mutex>
  7. #define BIG_BUF_SIZE 3110400
  8. class UDPSocketCapture
  9. {
  10. public:
  11. UDPSocketCapture();
  12. virtual ~UDPSocketCapture();
  13. void Start(int height = 1080);
  14. void Stop();
  15. void GetBuffer(uint8_t* buf, long bufsize, long&bytesReturned);
  16. void WriteBuffer(uint8_t* buf, int bufsize);
  17. protected:
  18. static void CaptureThread(UDPSocketCapture* me);
  19. static void OutputThread(UDPSocketCapture* me);
  20. static int FindCamera(std::string& address);
  21. void StopCapture();
  22. std::thread mCaptureThread;
  23. std::thread mOutputThread;
  24. bool mStarted = false;
  25. bool mQuitNow = false;
  26. uint8_t* mBigBuf = NULL;
  27. int mBigBufPos = 0;
  28. std::mutex mBufMutex;
  29. int mHeight = 1080;
  30. };