summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@hotmail.com>2020-03-05 12:44:45 +0800
committerHe Junyan <junyan.he@hotmail.com>2020-06-05 19:27:11 +0800
commit6c76e81cb6d08d54ae57b112c46541b6116ea9d3 (patch)
treeb9bf196f9fe2fe4318306016c66865d2162fce31 /gst-libs
parent85bc355019e716d74f6a0d973a0d446b382990f8 (diff)
downloadgstreamer-vaapi-6c76e81cb6d08d54ae57b112c46541b6116ea9d3.tar.gz
libs: encoder: Add a helper function to check the tile support.
Encoding by tiles separation now is a very common feature for all relative new codecs, such as HEVC, AV1, and VP9. Just make this check as a common helper function of the encoder base class. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/294>
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder.c37
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_priv.h5
2 files changed, 42 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.c b/gst-libs/gst/vaapi/gstvaapiencoder.c
index ec71fec2..22b0e248 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder.c
@@ -1679,6 +1679,43 @@ gst_vaapi_encoder_ensure_max_num_ref_frames (GstVaapiEncoder * encoder,
return TRUE;
}
+/**
+ * gst_vaapi_encoder_ensure_tile_support:
+ * @encoder: a #GstVaapiEncoder
+ * @profile: a #GstVaapiProfile
+ * @entrypoint: a #GstVaapiEntrypoint
+ *
+ * This function will query VAConfigAttribEncTileSupport to check
+ * whether the encoder support tile.
+ *
+ * We need to pass the @profile and the @entrypoint, because at the
+ * moment the encoder base class, still doesn't have them assigned,
+ * and this function is meant to be called by the derived classes
+ * while they are configured.
+ *
+ * Returns: %TRUE if supported, %FALSE if not.
+ **/
+gboolean
+gst_vaapi_encoder_ensure_tile_support (GstVaapiEncoder * encoder,
+ GstVaapiProfile profile, GstVaapiEntrypoint entrypoint)
+{
+ guint tile = 0;
+
+#if VA_CHECK_VERSION(1,0,1)
+ VAProfile va_profile;
+ VAEntrypoint va_entrypoint;
+
+ va_profile = gst_vaapi_profile_get_va_profile (profile);
+ va_entrypoint = gst_vaapi_entrypoint_get_va_entrypoint (entrypoint);
+
+ if (!gst_vaapi_get_config_attribute (encoder->display, va_profile,
+ va_entrypoint, VAConfigAttribEncTileSupport, &tile))
+ return FALSE;
+#endif
+
+ return tile > 0;
+}
+
GstVaapiProfile
gst_vaapi_encoder_get_profile (GstVaapiEncoder * encoder)
{
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_priv.h b/gst-libs/gst/vaapi/gstvaapiencoder_priv.h
index 0de0bbfa..189c3791 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_priv.h
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_priv.h
@@ -384,6 +384,11 @@ gboolean
gst_vaapi_encoder_ensure_max_num_ref_frames (GstVaapiEncoder * encoder,
GstVaapiProfile profile, GstVaapiEntrypoint entrypoint);
+G_GNUC_INTERNAL
+gboolean
+gst_vaapi_encoder_ensure_tile_support (GstVaapiEncoder * encoder,
+ GstVaapiProfile profile, GstVaapiEntrypoint entrypoint);
+
G_END_DECLS
#endif /* GST_VAAPI_ENCODER_PRIV_H */