From eb17703d43a91ea9a7c43e37a3182616a2e0f78f Mon Sep 17 00:00:00 2001 From: He Junyan Date: Mon, 26 Aug 2019 23:16:33 +0800 Subject: [PATCH] libs: encoder: implement get_view_ids for h264 encoder. --- gst-libs/gst/vaapi/gstvaapiencoder_h264.c | 19 +++++++++++++++++-- gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c | 19 +++++++++++++++++-- gst-libs/gst/vaapi/gstvaapifeienc_h264.c | 19 +++++++++++++++++-- 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c index 22ac7d239e..68e60f1c9b 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c @@ -3515,6 +3515,22 @@ set_default_ids: } } +static void +get_view_ids (GstVaapiEncoderH264 * const encoder, GValue * value) +{ + guint i; + GValue id = G_VALUE_INIT; + + g_value_reset (value); + g_value_init (&id, G_TYPE_UINT); + + for (i = 0; i < encoder->num_views; i++) { + g_value_set_uint (&id, encoder->view_ids[i]); + gst_value_array_append_value (value, &id); + } + g_value_unset (&id); +} + /** * @ENCODER_H264_PROP_RATECONTROL: Rate control (#GstVaapiRateControl). * @ENCODER_H264_PROP_TUNE: The tuning options (#GstVaapiEncoderTune). @@ -3770,8 +3786,7 @@ gst_vaapi_encoder_h264_get_property (GObject * object, guint prop_id, g_value_set_uint (value, encoder->num_views); break; case ENCODER_H264_PROP_VIEW_IDS: - // TODO: - //get_view_ids (encoder, value); + get_view_ids (encoder, value); break; case ENCODER_H264_PROP_AUD: g_value_set_boolean (value, encoder->use_aud); diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c index dc7b06869b..f462f8c4e3 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c @@ -3473,6 +3473,22 @@ set_default_ids: } } +static void +get_view_ids (GstVaapiEncoderH264Fei * const encoder, GValue * value) +{ + guint i; + GValue id = G_VALUE_INIT; + + g_value_reset (value); + g_value_init (&id, G_TYPE_UINT); + + for (i = 0; i < encoder->num_views; i++) { + g_value_set_uint (&id, encoder->view_ids[i]); + gst_value_array_append_value (value, &id); + } + g_value_unset (&id); +} + static GstVaapiEncoderStatus _gst_vaapi_encoder_h264_fei_set_property (GstVaapiEncoder * base_encoder, gint prop_id, const GValue * value) @@ -3854,8 +3870,7 @@ gst_vaapi_encoder_h264_fei_get_property (GObject * object, guint prop_id, g_value_set_uint (value, encoder->num_views); break; case ENCODER_H264_FEI_PROP_VIEW_IDS: - // TODO: - //get_view_ids (encoder, value); + get_view_ids (encoder, value); break; case ENCODER_H264_PROP_FEI_DISABLE: g_value_set_boolean (value, encoder->is_fei_disabled); diff --git a/gst-libs/gst/vaapi/gstvaapifeienc_h264.c b/gst-libs/gst/vaapi/gstvaapifeienc_h264.c index 0816bf96c2..24702b6c3e 100644 --- a/gst-libs/gst/vaapi/gstvaapifeienc_h264.c +++ b/gst-libs/gst/vaapi/gstvaapifeienc_h264.c @@ -1747,6 +1747,22 @@ set_default_ids: } } +static void +get_view_ids (GstVaapiFeiEncH264 * const encoder, GValue * value) +{ + guint i; + GValue id = G_VALUE_INIT; + + g_value_reset (value); + g_value_init (&id, G_TYPE_UINT); + + for (i = 0; i < encoder->num_views; i++) { + g_value_set_uint (&id, encoder->view_ids[i]); + gst_value_array_append_value (value, &id); + } + g_value_unset (&id); +} + GstVaapiEncoderStatus gst_vaapi_feienc_h264_set_property (GstVaapiEncoder * base_encoder, gint prop_id, const GValue * value) @@ -2029,8 +2045,7 @@ gst_vaapi_feienc_h264_get_property (GObject * object, guint prop_id, g_value_set_uint (value, feienc->num_views); break; case FEI_H264_ENC_PROP_VIEW_IDS: - // TODO: - //get_view_ids (feienc, value); + get_view_ids (feienc, value); break; case FEI_H264_ENC_PROP_NUM_REF: g_value_set_uint (value, feienc->num_ref_frames);