X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=video_encoder.h;fp=video_encoder.h;h=1a5c97d0310525a49873a6a9900e7ab4e5eba720;hb=c4c5e2df2b1ef88fa20b71ae981ae6462d84b63c;hp=0000000000000000000000000000000000000000;hpb=dcbd18f44037f097b26aed93fde11392906d86ea;p=nageru diff --git a/video_encoder.h b/video_encoder.h new file mode 100644 index 0000000..1a5c97d --- /dev/null +++ b/video_encoder.h @@ -0,0 +1,40 @@ +// A class to orchestrate the concept of video encoding. Will keep track of +// the muxes to stream and disk, the QuickSyncEncoder, and also the X264Encoder +// (for the stream) if there is one. + +#ifndef _VIDEO_ENCODER_H +#define _VIDEO_ENCODER_H + +#include +#include +#include +#include + +#include "ref_counted_frame.h" +#include "ref_counted_gl_sync.h" + +class HTTPD; +class QSurface; +class QuickSyncEncoder; + +class VideoEncoder { +public: + VideoEncoder(QSurface *surface, const std::string &va_display, int width, int height, HTTPD *httpd); + ~VideoEncoder(); + + void add_audio(int64_t pts, std::vector audio); + bool begin_frame(GLuint *y_tex, GLuint *cbcr_tex); + RefCountedGLsync end_frame(int64_t pts, int64_t duration, const std::vector &input_frames); + + // Does a cut of the disk stream immediately ("frame" is used for the filename only). + void do_cut(int frame); + +private: + std::unique_ptr quicksync_encoder; + QSurface *surface; + std::string va_display; + int width, height; + HTTPD *httpd; +}; + +#endif