gst_va_h264_enc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
- GstVaH264Enc *const self = GST_VA_H264_ENC (object);
+ GstVaH264Enc *self = GST_VA_H264_ENC (object);
GstVaBaseEnc *base = GST_VA_BASE_ENC (self);
- if (base->encoder && gst_va_encoder_is_open (base->encoder)) {
- GST_ERROR_OBJECT (object,
- "failed to set any property after encoding started");
- return;
- }
-
GST_OBJECT_LOCK (self);
switch (prop_id) {
break;
case PROP_QP_I:
self->prop.qp_i = g_value_get_uint (value);
+ g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
break;
case PROP_QP_P:
self->prop.qp_p = g_value_get_uint (value);
+ g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
break;
case PROP_QP_B:
self->prop.qp_b = g_value_get_uint (value);
+ g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
break;
case PROP_DCT8X8:
self->prop.use_dct8x8 = g_value_get_boolean (value);
}
case PROP_BITRATE:
self->prop.bitrate = g_value_get_uint (value);
+ g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
break;
case PROP_TARGET_PERCENTAGE:
self->prop.target_percentage = g_value_get_uint (value);
+ g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
break;
case PROP_TARGET_USAGE:
self->prop.target_usage = g_value_get_uint (value);
+ g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
break;
case PROP_RATE_CONTROL:
self->prop.rc_ctrl = g_value_get_enum (value);
+ g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
break;
case PROP_CPB_SIZE:
self->prop.cpb_size = g_value_get_uint (value);
}
GST_OBJECT_UNLOCK (self);
+
+#ifndef GST_DISABLE_GST_DEBUG
+ if (!g_atomic_int_get (&GST_VA_BASE_ENC (self)->reconf)
+ && base->encoder && gst_va_encoder_is_open (base->encoder)) {
+ GST_WARNING_OBJECT (self, "Property `%s` change ignored while processing.",
+ pspec->name);
+ }
+#endif
+
}
static void
gchar *long_name;
const gchar *name, *desc;
gint n_props = N_PROPERTIES;
+ GParamFlags param_flags =
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT;
if (cdata->entrypoint == VAEntrypointEncSlice) {
desc = "VA-API based H.264 video encoder";
properties[PROP_KEY_INT_MAX] = g_param_spec_uint ("key-int-max",
"Key frame maximal interval",
"The maximal distance between two keyframes. It decides the size of GOP"
- " (0: auto-calculate)", 0, MAX_GOP_SIZE, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ " (0: auto-calculate)", 0, MAX_GOP_SIZE, 0, param_flags);
/**
* GstVaH264Enc:b-frames:
*/
properties[PROP_BFRAMES] = g_param_spec_uint ("b-frames", "B Frames",
"Number of B frames between I and P reference frames", 0, 31, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ param_flags);
/**
* GstVaH264Enc:i-frames:
*/
properties[PROP_IFRAMES] = g_param_spec_uint ("i-frames", "I Frames",
"Force the number of I frames insertion within one GOP, not including the "
- "first IDR frame", 0, 1023, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ "first IDR frame", 0, 1023, 0, param_flags);
/**
* GstVaH264Enc:ref-frames:
properties[PROP_NUM_REF_FRAMES] = g_param_spec_uint ("ref-frames",
"Number of Reference Frames",
"Number of reference frames, including both the forward and the backward",
- 0, 16, 3, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ 0, 16, 3, param_flags);
/**
* GstVaH264Enc:b-pyramid:
*/
properties[PROP_B_PYRAMID] = g_param_spec_boolean ("b-pyramid", "b pyramid",
"Enable the b-pyramid reference structure in the GOP", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ param_flags);
+
/**
* GstVaH264Enc:num-slices:
*
* The number of slices per frame.
*/
properties[PROP_NUM_SLICES] = g_param_spec_uint ("num-slices",
- "Number of Slices", "Number of slices per frame", 1, 200, 1,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ "Number of Slices", "Number of slices per frame", 1, 200, 1, param_flags);
/**
* GstVaH264Enc:max-qp:
* The maximum quantizer value.
*/
properties[PROP_MAX_QP] = g_param_spec_uint ("max-qp", "Maximum QP",
- "Maximum quantizer value for each frame", 0, 51, 51,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ "Maximum quantizer value for each frame", 0, 51, 51, param_flags);
/**
* GstVaH264Enc:min-qp:
* The minimum quantizer value.
*/
properties[PROP_MIN_QP] = g_param_spec_uint ("min-qp", "Minimum QP",
- "Minimum quantizer value for each frame", 0, 51, 1,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ "Minimum quantizer value for each frame", 0, 51, 1, param_flags);
/**
* GstVaH264Enc:qpi:
properties[PROP_QP_I] = g_param_spec_uint ("qpi", "I Frame QP",
"The quantizer value for I frame. In CQP mode, it specifies the QP of I "
"frame, in other mode, it specifies the init QP of all frames", 0, 51, 26,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ param_flags | GST_PARAM_MUTABLE_PLAYING);
/**
* GstVaH264Enc:qpp:
properties[PROP_QP_P] = g_param_spec_uint ("qpp",
"The quantizer value for P frame",
"The quantizer value for P frame. Available only in CQP mode",
- 0, 51, 26,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ 0, 51, 26, param_flags | GST_PARAM_MUTABLE_PLAYING);
/**
* GstVaH264Enc:qpb:
properties[PROP_QP_B] = g_param_spec_uint ("qpb",
"The quantizer value for B frame",
"The quantizer value for B frame. Available only in CQP mode",
- 0, 51, 26,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ 0, 51, 26, param_flags | GST_PARAM_MUTABLE_PLAYING);
/**
* GstVaH264Enc:dct8x8:
* Enable adaptive use of 8x8 transforms in I-frames. This improves
* the compression ratio but requires high profile at least.
*/
- properties[PROP_DCT8X8] = g_param_spec_boolean ("dct8x8",
- "Enable 8x8 DCT",
- "Enable adaptive use of 8x8 transforms in I-frames", TRUE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ properties[PROP_DCT8X8] = g_param_spec_boolean ("dct8x8", "Enable 8x8 DCT",
+ "Enable adaptive use of 8x8 transforms in I-frames", TRUE, param_flags);
/**
* GstVaH264Enc:cabac:
* but requires main profile at least.
*/
properties[PROP_CABAC] = g_param_spec_boolean ("cabac", "Enable CABAC",
- "Enable CABAC entropy coding mode", TRUE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ "Enable CABAC entropy coding mode", TRUE, param_flags);
/**
* GstVaH264Enc:trellis:
* quantization algorithm.
*/
properties[PROP_TRELLIS] = g_param_spec_boolean ("trellis", "Enable trellis",
- "Enable the trellis quantization method", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ "Enable the trellis quantization method", FALSE, param_flags);
/**
* GstVaH264Enc:aud:
* Insert the AU (Access Unit) delimeter for each frame.
*/
properties[PROP_AUD] = g_param_spec_boolean ("aud", "Insert AUD",
- "Insert AU (Access Unit) delimeter for each frame", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ "Insert AU (Access Unit) delimeter for each frame", FALSE, param_flags);
/**
* GstVaH264Enc:cc-insert:
properties[PROP_MBBRC] = g_param_spec_enum ("mbbrc",
"Macroblock level Bitrate Control",
"Macroblock level Bitrate Control. Not available in CQP mode",
- GST_TYPE_VA_FEATURE, GST_VA_FEATURE_AUTO,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ GST_TYPE_VA_FEATURE, GST_VA_FEATURE_AUTO, param_flags);
/**
* GstVaH264Enc:bitrate:
*/
properties[PROP_BITRATE] = g_param_spec_uint ("bitrate", "Bitrate (kbps)",
"The desired bitrate expressed in kbps (0: auto-calculate)",
- 0, 2000 * 1024, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ 0, 2000 * 1024, 0, param_flags | GST_PARAM_MUTABLE_PLAYING);
/**
* GstVaH264Enc:target-percentage:
properties[PROP_TARGET_PERCENTAGE] = g_param_spec_uint ("target-percentage",
"target bitrate percentage",
"The percentage for 'target bitrate'/'maximum bitrate' (Only in VBR)",
- 50, 100, 66,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ 50, 100, 66, param_flags | GST_PARAM_MUTABLE_PLAYING);
/**
* GstVaH264Enc:target-usage:
properties[PROP_TARGET_USAGE] = g_param_spec_uint ("target-usage",
"target usage",
"The target usage to control and balance the encoding speed/quality",
- 1, 7, 4, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ 1, 7, 4, param_flags | GST_PARAM_MUTABLE_PLAYING);
/**
* GstVaH264Enc:cpb-size:
properties[PROP_CPB_SIZE] = g_param_spec_uint ("cpb-size",
"max CPB size in Kb",
"The desired max CPB size in Kb (0: auto-calculate)", 0, 2000 * 1024, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ param_flags | GST_PARAM_MUTABLE_PLAYING);
if (vah264enc_class->rate_control_type > 0) {
properties[PROP_RATE_CONTROL] = g_param_spec_enum ("rate-control",
"rate control mode", "The desired rate control mode for the encoder",
vah264enc_class->rate_control_type,
vah264enc_class->rate_control[0].value,
- GST_PARAM_CONDITIONALLY_AVAILABLE | G_PARAM_READWRITE
- | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+ GST_PARAM_CONDITIONALLY_AVAILABLE | GST_PARAM_MUTABLE_PLAYING
+ | param_flags);
} else {
n_props--;
properties[PROP_RATE_CONTROL] = NULL;