-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathavtransmitter.hpp
38 lines (29 loc) · 933 Bytes
/
avtransmitter.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef AVTRANSMITTER_HPP_A9X5A3XE
#define AVTRANSMITTER_HPP_A9X5A3XE
#include "avutils.hpp"
#include <opencv2/core.hpp>
#include <vector>
class AVTransmitter {
std::vector<std::uint8_t> imgbuf;
AVFormatContext *ofmt_ctx = nullptr;
AVCodec *out_codec = nullptr;
AVStream *out_stream = nullptr;
AVCodecContext *out_codec_ctx = nullptr;
SwsContext *swsctx = nullptr;
cv::Mat canvas_;
unsigned int height_;
unsigned int width_;
unsigned int fps_;
AVFrame *frame_ = nullptr;
std::string sdp_;
unsigned int gop_size_;
unsigned int target_bitrate_;
public:
AVTransmitter(const std::string &host, const unsigned int port,
unsigned int fps, unsigned int gop_size = 10, unsigned int target_bitrate = 4e6);
void encode_frame(const cv::Mat &image);
~AVTransmitter();
void frame_ended();
std::string get_sdp() const;
};
#endif /* end of include guard: AVTRANSMITTER_HPP_A9X5A3XE */