2021-08-31 19:06:39 +00:00
|
|
|
#ifndef TGCALLS_AUDIO_STREAMING_PART_H
|
|
|
|
#define TGCALLS_AUDIO_STREAMING_PART_H
|
|
|
|
|
|
|
|
#include "absl/types/optional.h"
|
|
|
|
#include <vector>
|
2022-03-11 16:49:54 +00:00
|
|
|
#include <string>
|
2021-08-31 19:06:39 +00:00
|
|
|
#include <map>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2022-03-11 16:49:54 +00:00
|
|
|
#include "AudioStreamingPartPersistentDecoder.h"
|
|
|
|
|
2021-08-31 19:06:39 +00:00
|
|
|
namespace tgcalls {
|
|
|
|
|
|
|
|
class AudioStreamingPartState;
|
|
|
|
|
|
|
|
class AudioStreamingPart {
|
|
|
|
public:
|
|
|
|
struct StreamingPartChannel {
|
|
|
|
uint32_t ssrc = 0;
|
|
|
|
std::vector<int16_t> pcmData;
|
2022-03-11 16:49:54 +00:00
|
|
|
int numSamples = 0;
|
2021-08-31 19:06:39 +00:00
|
|
|
};
|
2022-03-11 16:49:54 +00:00
|
|
|
|
|
|
|
explicit AudioStreamingPart(std::vector<uint8_t> &&data, std::string const &container, bool isSingleChannel);
|
2021-08-31 19:06:39 +00:00
|
|
|
~AudioStreamingPart();
|
2022-03-11 16:49:54 +00:00
|
|
|
|
2021-08-31 19:06:39 +00:00
|
|
|
AudioStreamingPart(const AudioStreamingPart&) = delete;
|
|
|
|
AudioStreamingPart(AudioStreamingPart&& other) {
|
|
|
|
_state = other._state;
|
|
|
|
other._state = nullptr;
|
|
|
|
}
|
|
|
|
AudioStreamingPart& operator=(const AudioStreamingPart&) = delete;
|
|
|
|
AudioStreamingPart& operator=(AudioStreamingPart&&) = delete;
|
|
|
|
|
|
|
|
std::map<std::string, int32_t> getEndpointMapping() const;
|
|
|
|
int getRemainingMilliseconds() const;
|
2022-03-11 16:49:54 +00:00
|
|
|
std::vector<StreamingPartChannel> get10msPerChannel(AudioStreamingPartPersistentDecoder &persistentDecoder);
|
|
|
|
|
2021-08-31 19:06:39 +00:00
|
|
|
private:
|
|
|
|
AudioStreamingPartState *_state = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|