From d733714ef85db8c66cb8e36d2438cff9b899358a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Mon, 5 Jun 2017 20:33:27 +0200 Subject: [PATCH] libs: encoder: h264,h265,mpeg2: add framerate parameter https://bugzilla.gnome.org/show_bug.cgi?id=783449 --- gst-libs/gst/vaapi/gstvaapiencoder_h264.c | 6 ++++++ gst-libs/gst/vaapi/gstvaapiencoder_h265.c | 8 ++++++++ gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c | 6 ++++++ 3 files changed, 20 insertions(+) diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c index 6ffbd96623..e75a2ca958 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c @@ -2171,6 +2171,12 @@ ensure_control_rate_params (GstVaapiEncoderH264 * encoder) /* HRD params */ fill_hrd_params (encoder, &GST_VAAPI_ENCODER_VA_HRD (encoder)); + + /* FrameRate params */ + GST_VAAPI_ENCODER_VA_FRAME_RATE (encoder) = (VAEncMiscParameterFrameRate) { + .framerate = (guint) GST_VAAPI_ENCODER_FPS_D (encoder) << 16 | + GST_VAAPI_ENCODER_FPS_N (encoder), + }; /* *INDENT-ON* */ return TRUE; diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c index e8bc289d99..33975ab2e1 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c @@ -1771,9 +1771,17 @@ ensure_control_rate_params (GstVaapiEncoderH265 * encoder) if (GST_VAAPI_ENCODER_RATE_CONTROL (encoder) == GST_VAAPI_RATECONTROL_CQP) return TRUE; + /* *INDENT-OFF* */ /* HRD params */ fill_hrd_params (encoder, &GST_VAAPI_ENCODER_VA_HRD (encoder)); + /* FrameRate params */ + GST_VAAPI_ENCODER_VA_FRAME_RATE (encoder) = (VAEncMiscParameterFrameRate) { + .framerate = (guint) GST_VAAPI_ENCODER_FPS_D (encoder) << 16 | + GST_VAAPI_ENCODER_FPS_N (encoder), + }; + /* *INDENT-ON* */ + return TRUE; } diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c b/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c index 2c284ee4b5..798c00f079 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c @@ -473,6 +473,12 @@ ensure_control_rate_params (GstVaapiEncoderMpeg2 * encoder) .buffer_size = base_encoder->bitrate * 1000 * 8, .initial_buffer_fullness = base_encoder->bitrate * 1000 * 4, }; + + /* FrameRate params */ + GST_VAAPI_ENCODER_VA_FRAME_RATE (encoder) = (VAEncMiscParameterFrameRate) { + .framerate = (guint) GST_VAAPI_ENCODER_FPS_D (encoder) << 16 | + GST_VAAPI_ENCODER_FPS_N (encoder), + }; /* *INDENT-ON* */ return TRUE;