diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkenc.c b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkenc.c index 8eab51f57c..4b861989a5 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkenc.c +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkenc.c @@ -2049,18 +2049,10 @@ gst_msdkenc_set_common_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstMsdkEnc *thiz = GST_MSDKENC (object); - GstState state; gboolean ret = TRUE; 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) { case GST_MSDKENC_PROP_HARDWARE: thiz->hardware = g_value_get_boolean (value); @@ -2076,23 +2068,32 @@ gst_msdkenc_set_common_property (GObject * object, guint prop_id, break; case GST_MSDKENC_PROP_BITRATE: { - guint bitrate = g_value_get_uint (value); - /* Ensure that bitrate changed before triggering a reconfig */ - if (bitrate != thiz->bitrate) { - thiz->bitrate = bitrate; - thiz->reconfig = TRUE; - GST_DEBUG_OBJECT (thiz, "changed bitrate to %u", bitrate); + if (gst_msdkenc_check_update_property_uint (thiz, &thiz->bitrate, + g_value_get_uint (value))) { + GST_DEBUG_OBJECT (thiz, "changed bitrate to %u", thiz->bitrate); } break; } 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; 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; 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; case GST_MSDKENC_PROP_MAX_VBV_BITRATE: 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); break; 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; 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; 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; 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; case GST_MSDKENC_PROP_REF_FRAMES: 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); 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: diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkh264enc.c b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkh264enc.c index d860aa44f2..e6966b4410 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkh264enc.c +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkh264enc.c @@ -596,6 +596,7 @@ static void gst_msdkh264enc_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { + GstMsdkEnc *enc = GST_MSDKENC (object); GstMsdkH264Enc *thiz = GST_MSDKH264ENC (object); 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; break; 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; 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; 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; case PROP_MAX_QP: thiz->max_qp = g_value_get_uint (value); thiz->max_qp_i = thiz->max_qp_p = thiz->max_qp_b = thiz->max_qp; break; 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; 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; 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; 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; 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; 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; 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; case PROP_DBLK_IDC: thiz->dblk_idc = g_value_get_uint (value); break; 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; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkh265enc.c b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkh265enc.c index e442dfd088..2b9761cda9 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkh265enc.c +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkh265enc.c @@ -669,6 +669,7 @@ static void gst_msdkh265enc_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { + GstMsdkEnc *enc = GST_MSDKENC (object); GstMsdkH265Enc *thiz = GST_MSDKH265ENC (object); 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; 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; 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; 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; case PROP_MAX_QP: @@ -742,31 +752,56 @@ gst_msdkh265enc_set_property (GObject * object, guint prop_id, break; 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; 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; 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; 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; 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; 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; 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; case PROP_DBLK_IDC: @@ -774,7 +809,11 @@ gst_msdkh265enc_set_property (GObject * object, guint prop_id, break; 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; default: