| #include <vector> |
| 6 | #include <stdint.h> |
| 7 |
| 8 | #include "api/video/video_frame.h" |
| 9 | #include "absl/types/optional.h" |
| 10 |
| 11 | namespace tgcalls { |
| 12 |
| 13 | class VideoStreamingPartState; |
| 14 |
| 15 | struct VideoStreamingPartFrame { |
| 16 | std::string endpointId; |
| 17 | webrtc::VideoFrame frame; |
| 18 | double pts = 0; |
| 19 | double duration = 0.0; |
| 20 | int index = 0; |
| 21 |
| 22 | VideoStreamingPartFrame(std::string endpointId_, webrtc::VideoFrame const &frame_, double pts_, double duration_, int index_) : |
| 23 | endpointId(endpointId_), |
| 24 | frame(frame_), |
| 25 | pts(pts_), |
| 26 | duration(duration_), |
| 27 | index(index_) { |
| 28 | } |
| 29 | }; |
| 30 |
| 31 | class VideoStreamingPart { |
| 32 | public: |
| 33 | explicit VideoStreamingPart(std::vector<uint8_t> &&data); |
| 34 | ~VideoStreamingPart(); |
| 35 |
| 36 | VideoStreamingPart(const VideoStreamingPart&) = delete; |
| 37 | VideoStreamingPart(VideoStreamingPart&& other) { |
| 38 | _state = other._state; |
| 39 | other._state = nullptr; |
| 40 | } |
| 41 | VideoStreamingPart& operator=(const VideoStreamingPart&) = delete; |
| 42 | VideoStreamingPart& operator=(VideoStreamingPart&&) = delete; |
| 43 |
| 44 | absl::optional<VideoStreamingPartFrame> getFrameAtRelativeTimestamp(double timestamp); |
| 45 | absl::optional<std::string> getActiveEndpointId() const; |
| 46 |
| 47 | private: |
| 48 | VideoStreamingPartState *_state = nullptr; |
| 49 | }; |
| 50 |
| 51 | } |
| 52 |
| 53 | #endif |
| 54 |