mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 05:59:10 +00:00
msdkenc: Apply update functions when setting property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4865>
This commit is contained in:
parent
1308b2f6e5
commit
b9ecd4e618
3 changed files with 134 additions and 51 deletions
|
@ -2049,18 +2049,10 @@ gst_msdkenc_set_common_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec)
|
const GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstMsdkEnc *thiz = GST_MSDKENC (object);
|
GstMsdkEnc *thiz = GST_MSDKENC (object);
|
||||||
GstState state;
|
|
||||||
gboolean ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (thiz);
|
GST_OBJECT_LOCK (thiz);
|
||||||
|
|
||||||
state = GST_STATE (thiz);
|
|
||||||
if ((state != GST_STATE_READY && state != GST_STATE_NULL) &&
|
|
||||||
!(pspec->flags & GST_PARAM_MUTABLE_PLAYING)) {
|
|
||||||
ret = FALSE;
|
|
||||||
goto wrong_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case GST_MSDKENC_PROP_HARDWARE:
|
case GST_MSDKENC_PROP_HARDWARE:
|
||||||
thiz->hardware = g_value_get_boolean (value);
|
thiz->hardware = g_value_get_boolean (value);
|
||||||
|
@ -2076,23 +2068,32 @@ gst_msdkenc_set_common_property (GObject * object, guint prop_id,
|
||||||
break;
|
break;
|
||||||
case GST_MSDKENC_PROP_BITRATE:
|
case GST_MSDKENC_PROP_BITRATE:
|
||||||
{
|
{
|
||||||
guint bitrate = g_value_get_uint (value);
|
if (gst_msdkenc_check_update_property_uint (thiz, &thiz->bitrate,
|
||||||
/* Ensure that bitrate changed before triggering a reconfig */
|
g_value_get_uint (value))) {
|
||||||
if (bitrate != thiz->bitrate) {
|
GST_DEBUG_OBJECT (thiz, "changed bitrate to %u", thiz->bitrate);
|
||||||
thiz->bitrate = bitrate;
|
|
||||||
thiz->reconfig = TRUE;
|
|
||||||
GST_DEBUG_OBJECT (thiz, "changed bitrate to %u", bitrate);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_MSDKENC_PROP_MAX_FRAME_SIZE:
|
case GST_MSDKENC_PROP_MAX_FRAME_SIZE:
|
||||||
thiz->max_frame_size = g_value_get_uint (value);
|
if (gst_msdkenc_check_update_property_uint (thiz, &thiz->max_frame_size,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed max-frame-size to %u",
|
||||||
|
thiz->max_frame_size);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GST_MSDKENC_PROP_MAX_FRAME_SIZE_I:
|
case GST_MSDKENC_PROP_MAX_FRAME_SIZE_I:
|
||||||
thiz->max_frame_size_i = g_value_get_uint (value);
|
if (gst_msdkenc_check_update_property_uint (thiz, &thiz->max_frame_size_i,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed max-frame-size-i to %u",
|
||||||
|
thiz->max_frame_size_i);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GST_MSDKENC_PROP_MAX_FRAME_SIZE_P:
|
case GST_MSDKENC_PROP_MAX_FRAME_SIZE_P:
|
||||||
thiz->max_frame_size_p = g_value_get_uint (value);
|
if (gst_msdkenc_check_update_property_uint (thiz, &thiz->max_frame_size_p,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed max-frame-size-p to %u",
|
||||||
|
thiz->max_frame_size_p);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GST_MSDKENC_PROP_MAX_VBV_BITRATE:
|
case GST_MSDKENC_PROP_MAX_VBV_BITRATE:
|
||||||
thiz->max_vbv_bitrate = g_value_get_uint (value);
|
thiz->max_vbv_bitrate = g_value_get_uint (value);
|
||||||
|
@ -2107,16 +2108,28 @@ gst_msdkenc_set_common_property (GObject * object, guint prop_id,
|
||||||
thiz->lookahead_depth = g_value_get_uint (value);
|
thiz->lookahead_depth = g_value_get_uint (value);
|
||||||
break;
|
break;
|
||||||
case GST_MSDKENC_PROP_QPI:
|
case GST_MSDKENC_PROP_QPI:
|
||||||
thiz->qpi = g_value_get_uint (value);
|
if (gst_msdkenc_check_update_property_uint (thiz, &thiz->qpi,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed qpi to %u", thiz->qpi);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GST_MSDKENC_PROP_QPP:
|
case GST_MSDKENC_PROP_QPP:
|
||||||
thiz->qpp = g_value_get_uint (value);
|
if (gst_msdkenc_check_update_property_uint (thiz, &thiz->qpp,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed qpp to %u", thiz->qpp);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GST_MSDKENC_PROP_QPB:
|
case GST_MSDKENC_PROP_QPB:
|
||||||
thiz->qpb = g_value_get_uint (value);
|
if (gst_msdkenc_check_update_property_uint (thiz, &thiz->qpb,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed qpb to %u", thiz->qpb);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GST_MSDKENC_PROP_GOP_SIZE:
|
case GST_MSDKENC_PROP_GOP_SIZE:
|
||||||
thiz->gop_size = g_value_get_uint (value);
|
if (gst_msdkenc_check_update_property_uint (thiz, &thiz->gop_size,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed gop-size to %u", thiz->gop_size);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GST_MSDKENC_PROP_REF_FRAMES:
|
case GST_MSDKENC_PROP_REF_FRAMES:
|
||||||
thiz->ref_frames = g_value_get_uint (value);
|
thiz->ref_frames = g_value_get_uint (value);
|
||||||
|
@ -2158,14 +2171,6 @@ gst_msdkenc_set_common_property (GObject * object, guint prop_id,
|
||||||
}
|
}
|
||||||
GST_OBJECT_UNLOCK (thiz);
|
GST_OBJECT_UNLOCK (thiz);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* ERROR */
|
|
||||||
wrong_state:
|
|
||||||
{
|
|
||||||
GST_WARNING_OBJECT (thiz, "setting property in wrong state");
|
|
||||||
GST_OBJECT_UNLOCK (thiz);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* gst_msdkenc_get_common_property:
|
/* gst_msdkenc_get_common_property:
|
||||||
|
|
|
@ -596,6 +596,7 @@ static void
|
||||||
gst_msdkh264enc_set_property (GObject * object, guint prop_id,
|
gst_msdkh264enc_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec)
|
const GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
|
GstMsdkEnc *enc = GST_MSDKENC (object);
|
||||||
GstMsdkH264Enc *thiz = GST_MSDKH264ENC (object);
|
GstMsdkH264Enc *thiz = GST_MSDKH264ENC (object);
|
||||||
|
|
||||||
if (gst_msdkenc_set_common_property (object, prop_id, value, pspec))
|
if (gst_msdkenc_set_common_property (object, prop_id, value, pspec))
|
||||||
|
@ -646,44 +647,82 @@ gst_msdkh264enc_set_property (GObject * object, guint prop_id,
|
||||||
thiz->min_qp_i = thiz->min_qp_p = thiz->min_qp_b = thiz->min_qp;
|
thiz->min_qp_i = thiz->min_qp_p = thiz->min_qp_b = thiz->min_qp;
|
||||||
break;
|
break;
|
||||||
case PROP_MIN_QP_I:
|
case PROP_MIN_QP_I:
|
||||||
thiz->min_qp_i = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->min_qp_i,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed min-qp-i to %u", thiz->min_qp_i);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_MIN_QP_P:
|
case PROP_MIN_QP_P:
|
||||||
thiz->min_qp_p = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->min_qp_p,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed min-qp-p to %u", thiz->min_qp_p);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_MIN_QP_B:
|
case PROP_MIN_QP_B:
|
||||||
thiz->min_qp_b = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->min_qp_b,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed min-qp-b to %u", thiz->min_qp_b);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_MAX_QP:
|
case PROP_MAX_QP:
|
||||||
thiz->max_qp = g_value_get_uint (value);
|
thiz->max_qp = g_value_get_uint (value);
|
||||||
thiz->max_qp_i = thiz->max_qp_p = thiz->max_qp_b = thiz->max_qp;
|
thiz->max_qp_i = thiz->max_qp_p = thiz->max_qp_b = thiz->max_qp;
|
||||||
break;
|
break;
|
||||||
case PROP_MAX_QP_I:
|
case PROP_MAX_QP_I:
|
||||||
thiz->max_qp_i = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->max_qp_i,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed max-qp-i to %u", thiz->max_qp_i);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_MAX_QP_P:
|
case PROP_MAX_QP_P:
|
||||||
thiz->max_qp_p = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->max_qp_p,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed max-qp-p to %u", thiz->max_qp_p);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_MAX_QP_B:
|
case PROP_MAX_QP_B:
|
||||||
thiz->max_qp_b = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->max_qp_b,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed max-qp-b to %u", thiz->max_qp_b);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_INTRA_REFRESH_TYPE:
|
case PROP_INTRA_REFRESH_TYPE:
|
||||||
thiz->intra_refresh_type = g_value_get_enum (value);
|
if (check_update_property_uint (enc, &thiz->intra_refresh_type,
|
||||||
|
g_value_get_enum (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed intra-refresh-type to %u",
|
||||||
|
thiz->intra_refresh_type);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_INTRA_REFRESH_CYCLE_SIZE:
|
case PROP_INTRA_REFRESH_CYCLE_SIZE:
|
||||||
thiz->intra_refresh_cycle_size = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->intra_refresh_cycle_size,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed intra-refresh-cycle-size to %u",
|
||||||
|
thiz->intra_refresh_cycle_size);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_INTRA_REFRESH_QP_DELTA:
|
case PROP_INTRA_REFRESH_QP_DELTA:
|
||||||
thiz->intra_refresh_qp_delta = g_value_get_int (value);
|
if (check_update_property_int (enc, &thiz->intra_refresh_qp_delta,
|
||||||
|
g_value_get_int (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed intra-refresh-qp-delta to %d",
|
||||||
|
thiz->intra_refresh_qp_delta);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_INTRA_REFRESH_CYCLE_DIST:
|
case PROP_INTRA_REFRESH_CYCLE_DIST:
|
||||||
thiz->intra_refresh_cycle_dist = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->intra_refresh_cycle_dist,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed intra-refresh-cycle-dist to %u",
|
||||||
|
thiz->intra_refresh_cycle_dist);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_DBLK_IDC:
|
case PROP_DBLK_IDC:
|
||||||
thiz->dblk_idc = g_value_get_uint (value);
|
thiz->dblk_idc = g_value_get_uint (value);
|
||||||
break;
|
break;
|
||||||
case PROP_PIC_TIMING_SEI:
|
case PROP_PIC_TIMING_SEI:
|
||||||
thiz->pic_timing_sei = g_value_get_boolean (value);
|
if (check_update_property_bool (enc, &thiz->pic_timing_sei,
|
||||||
|
g_value_get_boolean (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed pic-timimg-sei to %d",
|
||||||
|
thiz->pic_timing_sei);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
|
|
@ -669,6 +669,7 @@ static void
|
||||||
gst_msdkh265enc_set_property (GObject * object, guint prop_id,
|
gst_msdkh265enc_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec)
|
const GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
|
GstMsdkEnc *enc = GST_MSDKENC (object);
|
||||||
GstMsdkH265Enc *thiz = GST_MSDKH265ENC (object);
|
GstMsdkH265Enc *thiz = GST_MSDKH265ENC (object);
|
||||||
|
|
||||||
if (gst_msdkenc_set_common_property (object, prop_id, value, pspec))
|
if (gst_msdkenc_set_common_property (object, prop_id, value, pspec))
|
||||||
|
@ -725,15 +726,24 @@ gst_msdkh265enc_set_property (GObject * object, guint prop_id,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_MIN_QP_I:
|
case PROP_MIN_QP_I:
|
||||||
thiz->min_qp_i = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->min_qp_i,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed min-qp-i to %u", thiz->min_qp_i);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_MIN_QP_P:
|
case PROP_MIN_QP_P:
|
||||||
thiz->min_qp_p = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->min_qp_p,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed min-qp-p to %u", thiz->min_qp_p);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_MIN_QP_B:
|
case PROP_MIN_QP_B:
|
||||||
thiz->min_qp_b = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->min_qp_b,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed min-qp-b to %u", thiz->min_qp_b);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_MAX_QP:
|
case PROP_MAX_QP:
|
||||||
|
@ -742,31 +752,56 @@ gst_msdkh265enc_set_property (GObject * object, guint prop_id,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_MAX_QP_I:
|
case PROP_MAX_QP_I:
|
||||||
thiz->max_qp_i = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->max_qp_i,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed max-qp-i to %u", thiz->max_qp_i);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_MAX_QP_P:
|
case PROP_MAX_QP_P:
|
||||||
thiz->max_qp_p = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->max_qp_p,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed max-qp-p to %u", thiz->max_qp_p);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_MAX_QP_B:
|
case PROP_MAX_QP_B:
|
||||||
thiz->max_qp_b = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->max_qp_b,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed max-qp-b to %u", thiz->max_qp_b);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_INTRA_REFRESH_TYPE:
|
case PROP_INTRA_REFRESH_TYPE:
|
||||||
thiz->intra_refresh_type = g_value_get_enum (value);
|
if (check_update_property_uint (enc, &thiz->intra_refresh_type,
|
||||||
|
g_value_get_enum (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed intra-refresh-type to %u",
|
||||||
|
thiz->intra_refresh_type);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_INTRA_REFRESH_CYCLE_SIZE:
|
case PROP_INTRA_REFRESH_CYCLE_SIZE:
|
||||||
thiz->intra_refresh_cycle_size = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->intra_refresh_cycle_size,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed intra-refresh-cycle-size to %u",
|
||||||
|
thiz->intra_refresh_cycle_size);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_INTRA_REFRESH_QP_DELTA:
|
case PROP_INTRA_REFRESH_QP_DELTA:
|
||||||
thiz->intra_refresh_qp_delta = g_value_get_int (value);
|
if (check_update_property_int (enc, &thiz->intra_refresh_qp_delta,
|
||||||
|
g_value_get_int (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed intra-refresh-qp-delta to %d",
|
||||||
|
thiz->intra_refresh_qp_delta);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_INTRA_REFRESH_CYCLE_DIST:
|
case PROP_INTRA_REFRESH_CYCLE_DIST:
|
||||||
thiz->intra_refresh_cycle_dist = g_value_get_uint (value);
|
if (check_update_property_uint (enc, &thiz->intra_refresh_cycle_dist,
|
||||||
|
g_value_get_uint (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed intra-refresh-cycle-dist to %u",
|
||||||
|
thiz->intra_refresh_cycle_dist);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_DBLK_IDC:
|
case PROP_DBLK_IDC:
|
||||||
|
@ -774,7 +809,11 @@ gst_msdkh265enc_set_property (GObject * object, guint prop_id,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_PIC_TIMING_SEI:
|
case PROP_PIC_TIMING_SEI:
|
||||||
thiz->pic_timing_sei = g_value_get_boolean (value);
|
if (check_update_property_bool (enc, &thiz->pic_timing_sei,
|
||||||
|
g_value_get_boolean (value))) {
|
||||||
|
GST_DEBUG_OBJECT (thiz, "changed pic-timimg-sei to %d",
|
||||||
|
thiz->pic_timing_sei);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue