X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=quicksync_encoder_impl.h;h=0dcb9cb0e0a3a374af7ca2a7eb5ecd90b26a0b41;hb=327534a3031a332423411c9599c741f2f81657df;hp=18461328a6def27b1264e980bcace8c546cf2592;hpb=bd5b2de9a277b87c75d71d94bd8c5095ab14ecf7;p=nageru diff --git a/quicksync_encoder_impl.h b/quicksync_encoder_impl.h index 1846132..0dcb9cb 100644 --- a/quicksync_encoder_impl.h +++ b/quicksync_encoder_impl.h @@ -36,6 +36,7 @@ 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 audio); + bool is_zerocopy() const; bool begin_frame(int64_t pts, int64_t duration, movit::YCbCrLumaCoefficients ycbcr_coefficients, const std::vector &input_frames, GLuint *y_tex, GLuint *cbcr_tex); RefCountedGLsync end_frame(); void shutdown(); @@ -68,14 +69,13 @@ private: movit::YCbCrLumaCoefficients ycbcr_coefficients; }; struct GLSurface { - GLuint y_tex, cbcr_tex; - // Only if x264_video_to_disk == false. VASurfaceID src_surface, ref_surface; VABufferID coded_buf; VAImage surface_image; // Only if use_zerocopy == true (which implies x264_video_to_disk == false). + GLuint y_tex, cbcr_tex; EGLImage y_egl_image, cbcr_egl_image; // Only if use_zerocopy == false. @@ -135,7 +135,7 @@ private: bool is_shutdown = false; bool has_released_gl_resources = false; - bool use_zerocopy; + std::atomic use_zerocopy; int drm_fd = -1; std::thread encode_thread, storage_thread; @@ -162,6 +162,7 @@ private: std::map reorder_buffer; int quicksync_encoding_frame_num = 0; + std::mutex file_audio_encoder_mutex; std::unique_ptr file_audio_encoder; X264Encoder *x264_encoder; // nullptr if not using x264. @@ -213,7 +214,6 @@ private: int h264_entropy_mode = 1; /* cabac */ int ip_period = 3; - int rc_mode = -1; unsigned int current_ref_frame_num = 0; // Encoding frame order within this GOP, sans B-frames. int frame_width;