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