rtspclientdown.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef RTSPCLIENTDOWN_H
  2. #define RTSPCLIENTDOWN_H
  3. extern "C"
  4. {
  5. #include <libavcodec/avcodec.h>
  6. #include <libavutil/opt.h>
  7. #include <libavutil/imgutils.h>
  8. #include <libavutil/common.h>
  9. #include "libavutil/error.h"
  10. #include "libavutil/hwcontext.h"
  11. #include "libavformat/avformat.h"
  12. #include "libavformat/avio.h"
  13. }
  14. #include <mutex>
  15. #include <condition_variable>
  16. #include <thread>
  17. #include <vector>
  18. namespace iv {
  19. struct h264rawframedata
  20. {
  21. std::shared_ptr<char> mpstr_ptr;
  22. int mdatasize;
  23. };
  24. }
  25. class rtspclientdown
  26. {
  27. public:
  28. rtspclientdown(std::string strrtspserver);
  29. ~rtspclientdown();
  30. private:
  31. std::thread * mpthread;
  32. bool mbthreadrun = true;
  33. std::vector<iv::h264rawframedata> mvectorframe;
  34. std::mutex mmutexframe;
  35. std::mutex mmutexcv;
  36. std::condition_variable mcv;
  37. int mretrycount = 0;
  38. private:
  39. void threadrtspdown(std::string strrtspserver);
  40. public:
  41. int Getrtspframe(iv::h264rawframedata & xframe,int nwaitms);
  42. int Getretrycount();
  43. };
  44. #endif // RTSPCLIENTDOWN_H