libs: encoder: implement get_view_ids for h264 encoder.

This commit is contained in:
He Junyan 2019-08-26 23:16:33 +08:00
parent 1256680486
commit eb17703d43
3 changed files with 51 additions and 6 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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);