You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
805 B

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. MediaMtx (C++) - a unit of media data (MediaMTX: internal/unit)
  3. One H264 access unit (all NAL units of one picture) with its timestamps.
  4. */
  5. #pragma once
  6. #include <cstdint>
  7. #include <memory>
  8. #include <vector>
  9. namespace mtx {
  10. typedef std::vector<uint8_t> Bytes;
  11. struct Unit
  12. {
  13. int64_t pts = 0; // presentation time, 90 kHz clock, from the source's RTP timestamps (unwrapped)
  14. int64_t ntpUs = 0; // wall clock of the unit (us since the epoch)
  15. bool idr = false; // contains an IDR picture (random access point)
  16. std::vector<Bytes> nalus; // NAL units without start codes
  17. size_t byteSize() const
  18. {
  19. size_t n = 0;
  20. for (const Bytes & b : nalus)
  21. {
  22. n += b.size();
  23. }
  24. return n;
  25. }
  26. };
  27. typedef std::shared_ptr<const Unit> UnitPtr;
  28. } // namespace mtx