1
0
mirror of https://github.com/danog/libtgvoip.git synced 2024-11-27 12:44:37 +01:00
libtgvoip/video/VideoSource.h

50 lines
1.1 KiB
C
Raw Normal View History

//
// Created by Grishka on 10.08.2018.
//
#ifndef LIBTGVOIP_VIDEOSOURCE_H
#define LIBTGVOIP_VIDEOSOURCE_H
#include <vector>
#include <functional>
#include <memory>
#include <string>
#include "../Buffers.h"
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();
void SetCallback(std::function<void(const Buffer& buffer, uint32_t flags)> callback);
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;
bool Failed();
std::string GetErrorDescription();
std::vector<Buffer>& GetCodecSpecificData(){
return csd;
}
unsigned int GetFrameWidth(){
return width;
}
unsigned int GetFrameHeight(){
return height;
}
protected:
2019-02-05 12:41:00 +01:00
std::function<void(const Buffer &, uint32_t)> callback;
bool failed;
std::string error;
unsigned int width=0;
unsigned int height=0;
std::vector<Buffer> csd;
};
}
}
#endif //LIBTGVOIP_VIDEOSOURCE_H