2021-08-31 19:06:39 +00:00
|
|
|
#ifndef TGCALLS_VIDEO_STREAMING_PART_H
|
|
|
|
#define TGCALLS_VIDEO_STREAMING_PART_H
|
|
|
|
|
|
|
|
#include "absl/types/optional.h"
|
|
|
|
#include <vector>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "api/video/video_frame.h"
|
|
|
|
#include "absl/types/optional.h"
|
|
|
|
|
2022-03-11 16:49:54 +00:00
|
|
|
#include "AudioStreamingPart.h"
|
|
|
|
#include "AudioStreamingPartInternal.h"
|
|
|
|
|
2021-08-31 19:06:39 +00:00
|
|
|
namespace tgcalls {
|
|
|
|
|
|
|
|
class VideoStreamingPartState;
|
|
|
|
|
|
|
|
struct VideoStreamingPartFrame {
|
|
|
|
std::string endpointId;
|
|
|
|
webrtc::VideoFrame frame;
|
|
|
|
double pts = 0;
|
|
|
|
int index = 0;
|
|
|
|
|
2022-04-16 14:43:17 +00:00
|
|
|
VideoStreamingPartFrame(std::string endpointId_, webrtc::VideoFrame const &frame_, double pts_, int index_) :
|
2021-08-31 19:06:39 +00:00
|
|
|
endpointId(endpointId_),
|
|
|
|
frame(frame_),
|
|
|
|
pts(pts_),
|
|
|
|
index(index_) {
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class VideoStreamingPart {
|
|
|
|
public:
|
2022-03-11 16:49:54 +00:00
|
|
|
enum class ContentType {
|
|
|
|
Audio,
|
|
|
|
Video
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit VideoStreamingPart(std::vector<uint8_t> &&data, VideoStreamingPart::ContentType contentType);
|
2021-08-31 19:06:39 +00:00
|
|
|
~VideoStreamingPart();
|
|
|
|
|
|
|
|
VideoStreamingPart(const VideoStreamingPart&) = delete;
|
|
|
|
VideoStreamingPart(VideoStreamingPart&& other) {
|
|
|
|
_state = other._state;
|
|
|
|
other._state = nullptr;
|
|
|
|
}
|
|
|
|
VideoStreamingPart& operator=(const VideoStreamingPart&) = delete;
|
|
|
|
VideoStreamingPart& operator=(VideoStreamingPart&&) = delete;
|
|
|
|
|
|
|
|
absl::optional<VideoStreamingPartFrame> getFrameAtRelativeTimestamp(double timestamp);
|
|
|
|
absl::optional<std::string> getActiveEndpointId() const;
|
2022-04-16 14:43:17 +00:00
|
|
|
bool hasRemainingFrames() const;
|
2021-08-31 19:06:39 +00:00
|
|
|
|
2022-03-11 16:49:54 +00:00
|
|
|
int getAudioRemainingMilliseconds();
|
|
|
|
std::vector<AudioStreamingPart::StreamingPartChannel> getAudio10msPerChannel(AudioStreamingPartPersistentDecoder &persistentDecoder);
|
|
|
|
|
2021-08-31 19:06:39 +00:00
|
|
|
private:
|
|
|
|
VideoStreamingPartState *_state = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|