+struct VADisplayWithCleanup {
+ ~VADisplayWithCleanup();
+
+ VADisplay va_dpy;
+ Display *x11_display = nullptr;
+ bool can_use_zerocopy = true;
+ int drm_fd = -1;
+};
+std::unique_ptr<VADisplayWithCleanup> va_open_display(const std::string &va_display); // Can return nullptr on failure.
+
class QuickSyncEncoderImpl {
public:
QuickSyncEncoderImpl(const std::string &filename, movit::ResourcePool *resource_pool, QSurface *surface, const std::string &va_display, int width, int height, AVOutputFormat *oformat, X264Encoder *x264_encoder, DiskSpaceEstimator *disk_space_estimator);
~QuickSyncEncoderImpl();
void add_audio(int64_t pts, std::vector<float> audio);
class QuickSyncEncoderImpl {
public:
QuickSyncEncoderImpl(const std::string &filename, movit::ResourcePool *resource_pool, QSurface *surface, const std::string &va_display, int width, int height, AVOutputFormat *oformat, X264Encoder *x264_encoder, DiskSpaceEstimator *disk_space_estimator);
~QuickSyncEncoderImpl();
void add_audio(int64_t pts, std::vector<float> audio);
bool begin_frame(int64_t pts, int64_t duration, movit::YCbCrLumaCoefficients ycbcr_coefficients, const std::vector<RefCountedFrame> &input_frames, GLuint *y_tex, GLuint *cbcr_tex);
RefCountedGLsync end_frame();
void shutdown();
bool begin_frame(int64_t pts, int64_t duration, movit::YCbCrLumaCoefficients ycbcr_coefficients, const std::vector<RefCountedFrame> &input_frames, GLuint *y_tex, GLuint *cbcr_tex);
RefCountedGLsync end_frame();
void shutdown();
EGLImage y_egl_image, cbcr_egl_image;
// Only if use_zerocopy == false.
EGLImage y_egl_image, cbcr_egl_image;
// Only if use_zerocopy == false.
int build_packed_seq_buffer(movit::YCbCrLumaCoefficients ycbcr_coefficients, unsigned char **header_buffer);
int build_packed_slice_buffer(unsigned char **header_buffer);
int init_va(const std::string &va_display);
int build_packed_seq_buffer(movit::YCbCrLumaCoefficients ycbcr_coefficients, unsigned char **header_buffer);
int build_packed_slice_buffer(unsigned char **header_buffer);
int init_va(const std::string &va_display);
std::map<int, PendingFrame> reorder_buffer;
int quicksync_encoding_frame_num = 0;
std::map<int, PendingFrame> reorder_buffer;
int quicksync_encoding_frame_num = 0;
std::unique_ptr<AudioEncoder> file_audio_encoder;
X264Encoder *x264_encoder; // nullptr if not using x264.
std::unique_ptr<AudioEncoder> file_audio_encoder;
X264Encoder *x264_encoder; // nullptr if not using x264.
VAProfile h264_profile = (VAProfile)~0;
VAConfigAttrib config_attrib[VAConfigAttribTypeMax];
int config_attrib_num = 0, enc_packed_header_idx;
VAProfile h264_profile = (VAProfile)~0;
VAConfigAttrib config_attrib[VAConfigAttribTypeMax];
int config_attrib_num = 0, enc_packed_header_idx;