gst_vaapi_context_clear_overlay(context);
return FALSE;
}
+
+
+/**
+ * gst_vaapi_context_get_attribute:
+ * @context: a #GstVaapiContext
+ * @type: a VA config attribute type
+ * @out_value_ptr: return location for the config attribute value
+ *
+ * Determines the value for the VA config attribute @type.
+ *
+ * Note: this function only returns success if the VA driver does
+ * actually know about this config attribute type and that it returned
+ * a valid value for it.
+ *
+ * Return value: %TRUE if the VA driver knows about the requested
+ * config attribute and returned a valid value, %FALSE otherwise
+ */
+gboolean
+gst_vaapi_context_get_attribute(GstVaapiContext *context,
+ VAConfigAttribType type, guint *out_value_ptr)
+{
+ VAConfigAttrib attrib;
+ VAStatus status;
+
+ g_return_val_if_fail(context != NULL, FALSE);
+
+ GST_VAAPI_OBJECT_LOCK_DISPLAY(context);
+ attrib.type = type;
+ status = vaGetConfigAttributes(GST_VAAPI_OBJECT_VADISPLAY(context),
+ gst_vaapi_profile_get_va_profile(context->info.profile),
+ gst_vaapi_entrypoint_get_va_entrypoint(context->info.entrypoint),
+ &attrib, 1);
+ GST_VAAPI_OBJECT_UNLOCK_DISPLAY(context);
+ if (!vaapi_check_status(status, "vaGetConfiAttributes()"))
+ return FALSE;
+
+ if (out_value_ptr)
+ *out_value_ptr = attrib.value;
+ return TRUE;
+}
GstVideoOverlayComposition *composition
);
+G_GNUC_INTERNAL
+gboolean
+gst_vaapi_context_get_attribute(GstVaapiContext *context,
+ VAConfigAttribType type, guint *out_value_ptr);
+
G_END_DECLS
#endif /* GST_VAAPI_CONTEXT_H */
}
}
+/* Determines the set of required packed headers */
+static void
+ensure_packed_headers (GstVaapiEncoder * encoder)
+{
+ if (!gst_vaapi_context_get_attribute (encoder->context,
+ VAConfigAttribEncPackedHeaders, &encoder->packed_headers))
+ encoder->packed_headers = 0;
+ GST_INFO ("packed headers mask: 0x%08x", encoder->packed_headers);
+}
+
/* Updates video context */
static void
set_context_info (GstVaapiEncoder * encoder)
if (!gst_vaapi_encoder_ensure_context (encoder))
goto error_reset_context;
+ ensure_packed_headers (encoder);
codedbuf_size = encoder->codedbuf_pool ?
gst_vaapi_coded_buffer_pool_get_buffer_size (GST_VAAPI_CODED_BUFFER_POOL
goto error;
if (picture->type == GST_VAAPI_PICTURE_TYPE_I &&
- !add_packed_sequence_header (encoder, picture, sequence))
+ (GST_VAAPI_ENCODER_PACKED_HEADERS (encoder) & VAEncPackedHeaderH264_SPS)
+ && !add_packed_sequence_header (encoder, picture, sequence))
goto error;
gst_vaapi_enc_picture_set_sequence (picture, sequence);
gst_vaapi_codec_object_replace (&sequence, NULL);
return FALSE;
if (picture->type == GST_VAAPI_PICTURE_TYPE_I &&
- !add_packed_picture_header (encoder, picture)) {
+ (GST_VAAPI_ENCODER_PACKED_HEADERS (encoder) & VAEncPackedHeaderH264_PPS)
+ && !add_packed_picture_header (encoder, picture)) {
GST_ERROR ("set picture packed header failed");
return FALSE;
}
#define GST_VAAPI_ENCODER_GET_CLASS(obj) \
GST_VAAPI_ENCODER_CLASS(GST_VAAPI_MINI_OBJECT_GET_CLASS(obj))
+/**
+ * GST_VAAPI_ENCODER_PACKED_HEADERS:
+ * @encoder: a #GstVaapiEncoder
+ *
+ * Macro that evaluates to the required set of VA packed headers that
+ * need to be submitted along with the corresponding param buffers.
+ * This is an internal macro that does not do any run-time type check.
+ */
+#undef GST_VAAPI_ENCODER_PACKED_HEADERS
+#define GST_VAAPI_ENCODER_PACKED_HEADERS(encoder) \
+ GST_VAAPI_ENCODER_CAST(encoder)->packed_headers
+
/**
* GST_VAAPI_ENCODER_DISPLAY:
* @encoder: a #GstVaapiEncoder
GstVaapiContext *context;
GstVaapiContextInfo context_info;
GstVaapiEncoderTune tune;
+ guint packed_headers;
VADisplay va_display;
VAContextID va_context;