summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorHyunjun Ko <zzoon@igalia.com>2016-12-07 11:26:37 +0100
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2016-12-07 16:47:18 +0100
commit4e2049d108666d0670b3fb621aa230d7952dbdf1 (patch)
tree4aa3072b99957bce3ffa9481d4f15a807ca7a526 /gst-libs
parent72e26ed30b475553019e0b2952057cfd4b56e27a (diff)
libs: encoder: add gst_vaapi_encoder_get_surface_formats()
This method will return the valid surface formats in the current config. If the are no VAConfig it is created with the information available. https://bugzilla.gnome.org/show_bug.cgi?id=769266 Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder.c29
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder.h2
2 files changed, 31 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.c b/gst-libs/gst/vaapi/gstvaapiencoder.c
index eac90a81..a55f782b 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder.c
@@ -1153,6 +1153,35 @@ error:
}
}
+static gboolean
+gst_vaapi_encoder_ensure_context_config (GstVaapiEncoder * encoder)
+{
+ GstVaapiContextInfo *const cip = &encoder->context_info;
+
+ if (encoder->context)
+ return TRUE;
+
+ init_context_info (encoder);
+ encoder->context = gst_vaapi_context_new (encoder->display, cip);
+ return (encoder->context != NULL);
+}
+
+/**
+ * gst_vaapi_encoder_get_surface_formats:
+ * @encoder: a #GstVaapiEncoder instances
+ *
+ * Fetches the valid surface formats for the current VAConfig
+ *
+ * Returns: a #GArray of valid formats for the current VAConfig
+ **/
+GArray *
+gst_vaapi_encoder_get_surface_formats (GstVaapiEncoder * encoder)
+{
+ if (!gst_vaapi_encoder_ensure_context_config (encoder))
+ return NULL;
+ return gst_vaapi_context_get_surface_formats (encoder->context);
+}
+
/** Returns a GType for the #GstVaapiEncoderTune set */
GType
gst_vaapi_encoder_tune_get_type (void)
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.h b/gst-libs/gst/vaapi/gstvaapiencoder.h
index a90e26dc..3160036d 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder.h
+++ b/gst-libs/gst/vaapi/gstvaapiencoder.h
@@ -173,6 +173,8 @@ gst_vaapi_encoder_get_buffer_with_timeout (GstVaapiEncoder * encoder,
GstVaapiEncoderStatus
gst_vaapi_encoder_flush (GstVaapiEncoder * encoder);
+GArray *
+gst_vaapi_encoder_get_surface_formats (GstVaapiEncoder * encoder);
G_END_DECLS
#endif /* GST_VAAPI_ENCODER_H */