]> git.sesse.net Git - nageru/blob - video_encoder.h
Start pulling video orchestration logic into VideoEncoder.
[nageru] / video_encoder.h
1 // A class to orchestrate the concept of video encoding. Will keep track of
2 // the muxes to stream and disk, the QuickSyncEncoder, and also the X264Encoder
3 // (for the stream) if there is one.
4
5 #ifndef _VIDEO_ENCODER_H
6 #define _VIDEO_ENCODER_H
7
8 #include <stdint.h>
9 #include <memory>
10 #include <string>
11 #include <vector>
12
13 #include "ref_counted_frame.h"
14 #include "ref_counted_gl_sync.h"
15
16 class HTTPD;
17 class QSurface;
18 class QuickSyncEncoder;
19
20 class VideoEncoder {
21 public:
22         VideoEncoder(QSurface *surface, const std::string &va_display, int width, int height, HTTPD *httpd);
23         ~VideoEncoder();
24
25         void add_audio(int64_t pts, std::vector<float> audio);
26         bool begin_frame(GLuint *y_tex, GLuint *cbcr_tex);
27         RefCountedGLsync end_frame(int64_t pts, int64_t duration, const std::vector<RefCountedFrame> &input_frames);
28
29         // Does a cut of the disk stream immediately ("frame" is used for the filename only).
30         void do_cut(int frame);
31
32 private:
33         std::unique_ptr<QuickSyncEncoder> quicksync_encoder;
34         QSurface *surface;
35         std::string va_display;
36         int width, height;
37         HTTPD *httpd;
38 };
39
40 #endif