/* *INDENT-OFF* */
VAConfigAttrib attribs[3] = {
{ .type = VAConfigAttribRTFormat, .value = rt_format, },
- { .type = VAConfigAttribRateControl, .value = rc_ctrl, },
};
/* *INDENT-ON* */
VAConfigID config = VA_INVALID_ID;
return FALSE;
}
+ if (rc_ctrl != VA_RC_NONE) {
+ attribs[attrib_idx].type = VAConfigAttribRateControl;
+ attribs[attrib_idx].value = rc_ctrl;
+ attrib_idx++;
+ }
+
if (packed_headers > 0) {
attribs[attrib_idx].type = VAConfigAttribEncPackedHeaders;
attribs[attrib_idx].value = packed_headers;
update_property (bool, obj, old_val, new_val, prop_id)
/* Estimates a good enough bitrate if none was supplied */
-static void
+static gboolean
_ensure_rate_control (GstVaH264Enc * self)
{
/* User can specify the properties of: "bitrate", "target-percentage",
/* Adjust the setting based on RC mode. */
switch (self->rc.rc_ctrl_mode) {
+ case VA_RC_NONE:
case VA_RC_CQP:
self->rc.max_bitrate = 0;
self->rc.target_bitrate = 0;
self->gop.b_pyramid = FALSE;
}
break;
+ default:
+ GST_WARNING_OBJECT (self, "Unsupported rate control");
+ return FALSE;
+ break;
}
- if (self->rc.rc_ctrl_mode != VA_RC_CQP)
+ GST_DEBUG_OBJECT (self, "Max bitrate: %u bits/sec, "
+ "Target bitrate: %u bits/sec", self->rc.max_bitrate,
+ self->rc.target_bitrate);
+
+ if (self->rc.rc_ctrl_mode != VA_RC_NONE && self->rc.rc_ctrl_mode != VA_RC_CQP)
_calculate_bitrate_hrd (self);
/* update & notifications */
update_property_uint (base, &self->prop.qp_i, self->rc.qp_i, PROP_QP_I);
update_property_uint (base, &self->prop.qp_p, self->rc.qp_p, PROP_QP_P);
update_property_uint (base, &self->prop.qp_b, self->rc.qp_b, PROP_QP_B);
+
+ return TRUE;
}
static guint
_validate_parameters (self);
- _ensure_rate_control (self);
+ if (!_ensure_rate_control (self))
+ return FALSE;
if (!_calculate_level (self))
return FALSE;