/* Convert configs array to profiles as GstCaps */
static GArray *
-get_profiles (GPtrArray * configs)
+get_profiles (GPtrArray * configs, GstVaapiCodec codec)
{
GstVaapiProfileConfig *config;
GArray *out_profiles;
for (i = 0; i < configs->len; i++) {
config = g_ptr_array_index (configs, i);
- g_array_append_val (out_profiles, config->profile);
+ if (!codec || (codec == gst_vaapi_profile_get_codec (config->profile)))
+ g_array_append_val (out_profiles, config->profile);
}
return out_profiles;
}
* reference to the resulting array of #GstVaapiProfile elements, so
* it shall be released with g_array_unref() after usage.
*
- * Return value: a newly allocated #GArray, or %NULL or error or if
+ * Return value: a newly allocated #GArray, or %NULL if error or if
* decoding is not supported at all
*/
GArray *
if (!ensure_profiles (display))
return NULL;
- return get_profiles (GST_VAAPI_DISPLAY_GET_PRIVATE (display)->decoders);
+ return get_profiles (GST_VAAPI_DISPLAY_GET_PRIVATE (display)->decoders, 0);
}
/**
* reference to the resulting array of #GstVaapiProfile elements, so
* it shall be released with g_array_unref() after usage.
*
- * Return value: a newly allocated #GArray, or %NULL or error or if
+ * Return value: a newly allocated #GArray, or %NULL if error or if
* encoding is not supported at all
*/
GArray *
if (!ensure_profiles (display))
return NULL;
- return get_profiles (GST_VAAPI_DISPLAY_GET_PRIVATE (display)->encoders);
+ return get_profiles (GST_VAAPI_DISPLAY_GET_PRIVATE (display)->encoders, 0);
+}
+
+/**
+ * gst_vaapi_display_get_encode_profiles_by_codec:
+ * @display: a #GstVaapiDisplay
+ * @codec: a #GstVaapiCodec
+ *
+ * Gets the supported profiles which belongs to @codec for encoding.
+ * The caller owns an extra reference to the resulting array of
+ * #GstVaapiProfile elements, so it shall be released with g_array_unref()
+ * after usage.
+ *
+ * Return value: a newly allocated #GArray, or %NULL if error or if
+ * no encoding profile is found specified by the @codec.
+ */
+GArray *
+gst_vaapi_display_get_encode_profiles_by_codec (GstVaapiDisplay * display,
+ GstVaapiCodec codec)
+{
+ g_return_val_if_fail (display != NULL, NULL);
+
+ if (!ensure_profiles (display))
+ return NULL;
+ return get_profiles (GST_VAAPI_DISPLAY_GET_PRIVATE (display)->encoders,
+ codec);
}
/**