Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

53 lines
1.3KB

  1. #ifndef _h265_file_source_h_
  2. #define _h265_file_source_h_
  3. #include "h265-file-reader.h"
  4. #include "media-source.h"
  5. #include "sys/process.h"
  6. #include "time64.h"
  7. #include "rtp.h"
  8. #include <string>
  9. class H265FileSource : public IMediaSource
  10. {
  11. public:
  12. H265FileSource(const char *file);
  13. virtual ~H265FileSource();
  14. public:
  15. virtual int Play();
  16. virtual int Pause();
  17. virtual int Seek(int64_t pos);
  18. virtual int SetSpeed(double speed);
  19. virtual int GetDuration(int64_t& duration) const;
  20. virtual int GetSDPMedia(std::string& sdp) const;
  21. virtual int GetRTPInfo(const char* uri, char *rtpinfo, size_t bytes) const;
  22. virtual int SetTransport(const char* track, std::shared_ptr<IRTPTransport> transport);
  23. private:
  24. static void OnRTCPEvent(void* param, const struct rtcp_msg_t* msg);
  25. void OnRTCPEvent(const struct rtcp_msg_t* msg);
  26. int SendRTCP();
  27. static void* RTPAlloc(void* param, int bytes);
  28. static void RTPFree(void* param, void *packet);
  29. static int RTPPacket(void* param, const void *packet, int bytes, uint32_t timestamp, int flags);
  30. private:
  31. void* m_rtp;
  32. uint32_t m_timestamp;
  33. time64_t m_rtp_clock;
  34. time64_t m_rtcp_clock;
  35. H265FileReader m_reader;
  36. std::shared_ptr<IRTPTransport> m_transport;
  37. int m_status;
  38. int64_t m_pos;
  39. double m_speed;
  40. void *m_rtppacker;
  41. unsigned char m_packet[MAX_UDP_PACKET+14];
  42. };
  43. #endif /* !_h265_file_source_h_ */