2018-11-09 16:44:01 +01:00
|
|
|
//
|
|
|
|
// Created by Grishka on 10.08.2018.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef LIBTGVOIP_VIDEOSOURCE_H
|
|
|
|
#define LIBTGVOIP_VIDEOSOURCE_H
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <functional>
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
2019-04-15 01:43:10 +02:00
|
|
|
#include <stdint.h>
|
2020-01-22 12:43:51 +01:00
|
|
|
#include "../tools/tools/Buffers.h"
|
2018-11-09 16:44:01 +01:00
|
|
|
|
|
|
|
namespace tgvoip{
|
|
|
|
namespace video {
|
|
|
|
class VideoSource{
|
|
|
|
public:
|
|
|
|
virtual ~VideoSource(){};
|
|
|
|
static std::shared_ptr<VideoSource> Create();
|
2019-02-05 12:41:00 +01:00
|
|
|
static std::vector<uint32_t> GetAvailableEncoders();
|
2019-04-15 01:43:10 +02:00
|
|
|
void SetCallback(std::function<void(const Buffer& buffer, uint32_t flags, uint32_t rotation)> callback){
|
|
|
|
this->callback=callback;
|
|
|
|
};
|
|
|
|
void SetStreamStateCallback(std::function<void(bool)> callback){
|
|
|
|
streamStateCallback=callback;
|
|
|
|
}
|
2018-11-09 16:44:01 +01:00
|
|
|
virtual void Start()=0;
|
|
|
|
virtual void Stop()=0;
|
2019-02-05 12:41:00 +01:00
|
|
|
virtual void Reset(uint32_t codec, int maxResolution)=0;
|
|
|
|
virtual void RequestKeyFrame()=0;
|
2019-03-10 23:12:09 +01:00
|
|
|
virtual void SetBitrate(uint32_t bitrate)=0;
|
2018-11-09 16:44:01 +01:00
|
|
|
bool Failed();
|
|
|
|
std::string GetErrorDescription();
|
|
|
|
std::vector<Buffer>& GetCodecSpecificData(){
|
|
|
|
return csd;
|
|
|
|
}
|
|
|
|
unsigned int GetFrameWidth(){
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
unsigned int GetFrameHeight(){
|
|
|
|
return height;
|
|
|
|
}
|
2019-04-15 01:43:10 +02:00
|
|
|
void SetRotation(unsigned int rotation){
|
|
|
|
this->rotation=rotation;
|
|
|
|
}
|
2018-11-09 16:44:01 +01:00
|
|
|
|
|
|
|
protected:
|
2019-04-15 01:43:10 +02:00
|
|
|
std::function<void(const Buffer &, uint32_t, uint32_t)> callback;
|
|
|
|
std::function<void(bool)> streamStateCallback;
|
2018-11-09 16:44:01 +01:00
|
|
|
bool failed;
|
|
|
|
std::string error;
|
|
|
|
unsigned int width=0;
|
|
|
|
unsigned int height=0;
|
2019-04-15 01:43:10 +02:00
|
|
|
unsigned int rotation=0;
|
2018-11-09 16:44:01 +01:00
|
|
|
std::vector<Buffer> csd;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //LIBTGVOIP_VIDEOSOURCE_H
|