summaryrefslogtreecommitdiff
path: root/gst-libs/gst
diff options
context:
space:
mode:
Diffstat (limited to 'gst-libs/gst')
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder.c65
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder.h8
2 files changed, 52 insertions, 21 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.c b/gst-libs/gst/vaapi/gstvaapidecoder.c
index 0b60b877..093fcc05 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder.c
@@ -1125,24 +1125,6 @@ gst_vaapi_decoder_decode_codec_data (GstVaapiDecoder * decoder)
}
/**
- * gst_vaapi_decoder_get_surface_formats:
- * @decoder: a #GstVaapiDecoder
- *
- * Retrieves an array of #GstVideoFormat which the output surfaces of
- * the @decoder can handle.
- *
- * Return value: (transfer full): a #GArray of #GstVideoFormat or
- * %NULL
- */
-GArray *
-gst_vaapi_decoder_get_surface_formats (GstVaapiDecoder * decoder)
-{
- if (decoder && decoder->context)
- return gst_vaapi_context_get_surface_formats (decoder->context);
- return NULL;
-}
-
-/**
* gst_vaapi_decoder_update_caps:
* @decoder: a #GstVaapiDecoder
* @caps: a #GstCaps
@@ -1189,3 +1171,50 @@ gst_vaapi_decoder_update_caps (GstVaapiDecoder * decoder, GstCaps * caps)
return FALSE;
}
+
+/**
+ * gst_vaapi_decoder_get_surface_attributres:
+ * @decoder: a #GstVaapiDecoder instances
+ * @min_width (out): the minimal surface width
+ * @min_height (out): the minimal surface height
+ * @max_width (out): the maximal surface width
+ * @max_height (out): the maximal surface height
+ *
+ * Fetches the valid surface's attributes for the current context.
+ *
+ * Returns: a #GArray of valid formats we get or %NULL if failed.
+ **/
+GArray *
+gst_vaapi_decoder_get_surface_attributes (GstVaapiDecoder * decoder,
+ gint * min_width, gint * min_height, gint * max_width, gint * max_height,
+ guint * mem_types)
+{
+ gboolean ret;
+ GstVaapiConfigSurfaceAttributes attribs = { 0, };
+
+ g_return_val_if_fail (decoder != NULL, FALSE);
+
+ if (!decoder->context)
+ return NULL;
+
+ ret = gst_vaapi_context_get_surface_attributes (decoder->context, &attribs);
+ if (ret)
+ attribs.formats = gst_vaapi_context_get_surface_formats (decoder->context);
+
+ if (attribs.formats->len == 0) {
+ g_array_unref (attribs.formats);
+ return NULL;
+ }
+
+ if (min_width)
+ *min_width = attribs.min_width;
+ if (min_height)
+ *min_height = attribs.min_height;
+ if (max_width)
+ *max_width = attribs.max_width;
+ if (max_height)
+ *max_height = attribs.max_height;
+ if (mem_types)
+ *mem_types = attribs.mem_types;
+ return attribs.formats;
+}
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.h b/gst-libs/gst/vaapi/gstvaapidecoder.h
index b9bca4b2..2c55e2e1 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder.h
+++ b/gst-libs/gst/vaapi/gstvaapidecoder.h
@@ -103,9 +103,6 @@ gst_vaapi_decoder_set_codec_state_changed_func (GstVaapiDecoder * decoder,
GstCaps *
gst_vaapi_decoder_get_caps (GstVaapiDecoder * decoder);
-GArray *
-gst_vaapi_decoder_get_surface_formats (GstVaapiDecoder * decoder);
-
gboolean
gst_vaapi_decoder_put_buffer (GstVaapiDecoder * decoder, GstBuffer * buf);
@@ -139,6 +136,11 @@ gst_vaapi_decoder_reset (GstVaapiDecoder * decoder);
gboolean
gst_vaapi_decoder_update_caps (GstVaapiDecoder * decoder, GstCaps * caps);
+GArray *
+gst_vaapi_decoder_get_surface_attributes (GstVaapiDecoder * decoder,
+ gint * min_width, gint * min_height, gint * max_width, gint * max_height,
+ guint * mem_types);
+
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVaapiDecoder, gst_object_unref)
G_END_DECLS