mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
Fix gst_vaapi_display_has_{decoder,encoder}() to check for the entrypoint too.
This commit is contained in:
parent
1b76d72b98
commit
ee000a357b
2 changed files with 57 additions and 44 deletions
|
@ -35,6 +35,12 @@ GST_DEBUG_CATEGORY(gst_debug_vaapi);
|
||||||
|
|
||||||
G_DEFINE_TYPE(GstVaapiDisplay, gst_vaapi_display, G_TYPE_OBJECT);
|
G_DEFINE_TYPE(GstVaapiDisplay, gst_vaapi_display, G_TYPE_OBJECT);
|
||||||
|
|
||||||
|
typedef struct _GstVaapiConfig GstVaapiConfig;
|
||||||
|
struct _GstVaapiConfig {
|
||||||
|
GstVaapiProfile profile;
|
||||||
|
GstVaapiEntrypoint entrypoint;
|
||||||
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
|
@ -124,23 +130,30 @@ compare_rgb_formats(gconstpointer a, gconstpointer b)
|
||||||
(gint)gst_vaapi_image_format_get_score(fmt2));
|
(gint)gst_vaapi_image_format_get_score(fmt2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if profiles array contains profile */
|
/* Check if configs array contains profile at entrypoint */
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
find_profile(GArray *profiles, GstVaapiProfile profile)
|
find_config(
|
||||||
|
GArray *configs,
|
||||||
|
GstVaapiProfile profile,
|
||||||
|
GstVaapiEntrypoint entrypoint
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
GstVaapiConfig *config;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
for (i = 0; i < profiles->len; i++)
|
for (i = 0; i < configs->len; i++) {
|
||||||
if (g_array_index(profiles, GstVaapiProfile, i) == profile)
|
config = &g_array_index(configs, GstVaapiConfig, i);
|
||||||
|
if (config->profile == profile && config->entrypoint == entrypoint)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert profiles array to GstCaps */
|
/* Convert configs array to profiles as GstCaps */
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
get_profile_caps(GArray *profiles)
|
get_profile_caps(GArray *configs)
|
||||||
{
|
{
|
||||||
GstVaapiProfile profile;
|
GstVaapiConfig *config;
|
||||||
GstCaps *out_caps, *caps;
|
GstCaps *out_caps, *caps;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
|
@ -148,11 +161,11 @@ get_profile_caps(GArray *profiles)
|
||||||
if (!out_caps)
|
if (!out_caps)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < profiles->len; i++) {
|
for (i = 0; i < configs->len; i++) {
|
||||||
profile = g_array_index(profiles, GstVaapiProfile, i);
|
config = &g_array_index(configs, GstVaapiConfig, i);
|
||||||
caps = gst_vaapi_profile_get_caps(profile);
|
caps = gst_vaapi_profile_get_caps(config->profile);
|
||||||
if (caps)
|
if (caps)
|
||||||
gst_caps_append(out_caps, caps);
|
gst_caps_merge(out_caps, caps);
|
||||||
}
|
}
|
||||||
return out_caps;
|
return out_caps;
|
||||||
}
|
}
|
||||||
|
@ -322,19 +335,18 @@ gst_vaapi_display_create(GstVaapiDisplay *display)
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
GST_DEBUG(" %s", string_of_VAProfile(profiles[i]));
|
GST_DEBUG(" %s", string_of_VAProfile(profiles[i]));
|
||||||
|
|
||||||
priv->decoders = g_array_new(FALSE, FALSE, sizeof(GstVaapiProfile));
|
priv->decoders = g_array_new(FALSE, FALSE, sizeof(GstVaapiConfig));
|
||||||
if (!priv->decoders)
|
if (!priv->decoders)
|
||||||
goto end;
|
goto end;
|
||||||
priv->encoders = g_array_new(FALSE, FALSE, sizeof(GstVaapiProfile));
|
priv->encoders = g_array_new(FALSE, FALSE, sizeof(GstVaapiConfig));
|
||||||
if (!priv->encoders)
|
if (!priv->encoders)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
GstVaapiProfile profile;
|
GstVaapiConfig config;
|
||||||
gboolean has_decoder = FALSE, has_encoder = FALSE;
|
|
||||||
|
|
||||||
profile = gst_vaapi_profile(profiles[i]);
|
config.profile = gst_vaapi_profile(profiles[i]);
|
||||||
if (!profile)
|
if (!config.profile)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
status = vaQueryConfigEntrypoints(
|
status = vaQueryConfigEntrypoints(
|
||||||
|
@ -346,25 +358,18 @@ gst_vaapi_display_create(GstVaapiDisplay *display)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
for (j = 0; j < num_entrypoints; j++) {
|
for (j = 0; j < num_entrypoints; j++) {
|
||||||
switch (entrypoints[j]) {
|
config.entrypoint = gst_vaapi_entrypoint(entrypoints[j]);
|
||||||
case VAEntrypointVLD:
|
switch (config.entrypoint) {
|
||||||
case VAEntrypointIZZ:
|
case GST_VAAPI_ENTRYPOINT_VLD:
|
||||||
case VAEntrypointIDCT:
|
case GST_VAAPI_ENTRYPOINT_IDCT:
|
||||||
case VAEntrypointMoComp:
|
case GST_VAAPI_ENTRYPOINT_MOCO:
|
||||||
case VAEntrypointDeblocking:
|
g_array_append_val(priv->decoders, config);
|
||||||
has_decoder = TRUE;
|
|
||||||
break;
|
break;
|
||||||
#if VA_CHECK_VERSION(0,30,0)
|
case GST_VAAPI_ENTRYPOINT_SLICE_ENCODE:
|
||||||
case VAEntrypointEncSlice:
|
g_array_append_val(priv->encoders, config);
|
||||||
has_encoder = TRUE;
|
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (has_decoder)
|
|
||||||
g_array_append_val(priv->decoders, profile);
|
|
||||||
if (has_encoder)
|
|
||||||
g_array_append_val(priv->encoders, profile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* VA image formats */
|
/* VA image formats */
|
||||||
|
@ -780,20 +785,23 @@ gst_vaapi_display_get_decode_caps(GstVaapiDisplay *display)
|
||||||
* gst_vaapi_display_has_decoder:
|
* gst_vaapi_display_has_decoder:
|
||||||
* @display: a #GstVaapiDisplay
|
* @display: a #GstVaapiDisplay
|
||||||
* @profile: a #VAProfile
|
* @profile: a #VAProfile
|
||||||
|
* @entrypoint: a #GstVaaiEntrypoint
|
||||||
*
|
*
|
||||||
* Returns whether VA @display supports @profile for decoding.
|
* Returns whether VA @display supports @profile for decoding at the
|
||||||
|
* specified @entrypoint.
|
||||||
*
|
*
|
||||||
* Return value: %TRUE if VA @display supports @profile for decoding.
|
* Return value: %TRUE if VA @display supports @profile for decoding.
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_has_decoder(
|
gst_vaapi_display_has_decoder(
|
||||||
GstVaapiDisplay *display,
|
GstVaapiDisplay *display,
|
||||||
GstVaapiProfile profile
|
GstVaapiProfile profile,
|
||||||
|
GstVaapiEntrypoint entrypoint
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display), FALSE);
|
g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display), FALSE);
|
||||||
|
|
||||||
return find_profile(display->priv->decoders, profile);
|
return find_config(display->priv->decoders, profile, entrypoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -816,20 +824,23 @@ gst_vaapi_display_get_encode_caps(GstVaapiDisplay *display)
|
||||||
* gst_vaapi_display_has_encoder:
|
* gst_vaapi_display_has_encoder:
|
||||||
* @display: a #GstVaapiDisplay
|
* @display: a #GstVaapiDisplay
|
||||||
* @profile: a #VAProfile
|
* @profile: a #VAProfile
|
||||||
|
* @entrypoint: a #GstVaapiEntrypoint
|
||||||
*
|
*
|
||||||
* Returns whether VA @display supports @profile for encoding.
|
* Returns whether VA @display supports @profile for encoding at the
|
||||||
|
* specified @entrypoint.
|
||||||
*
|
*
|
||||||
* Return value: %TRUE if VA @display supports @profile for encoding.
|
* Return value: %TRUE if VA @display supports @profile for encoding.
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_has_encoder(
|
gst_vaapi_display_has_encoder(
|
||||||
GstVaapiDisplay *display,
|
GstVaapiDisplay *display,
|
||||||
GstVaapiProfile profile
|
GstVaapiProfile profile,
|
||||||
|
GstVaapiEntrypoint entrypoint
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display), FALSE);
|
g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display), FALSE);
|
||||||
|
|
||||||
return find_profile(display->priv->encoders, profile);
|
return find_config(display->priv->encoders, profile, entrypoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -147,8 +147,9 @@ gst_vaapi_display_get_decode_caps(GstVaapiDisplay *display);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_has_decoder(
|
gst_vaapi_display_has_decoder(
|
||||||
GstVaapiDisplay *display,
|
GstVaapiDisplay *display,
|
||||||
GstVaapiProfile profile
|
GstVaapiProfile profile,
|
||||||
|
GstVaapiEntrypoint entrypoint
|
||||||
);
|
);
|
||||||
|
|
||||||
GstCaps *
|
GstCaps *
|
||||||
|
@ -156,8 +157,9 @@ gst_vaapi_display_get_encode_caps(GstVaapiDisplay *display);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_has_encoder(
|
gst_vaapi_display_has_encoder(
|
||||||
GstVaapiDisplay *display,
|
GstVaapiDisplay *display,
|
||||||
GstVaapiProfile profile
|
GstVaapiProfile profile,
|
||||||
|
GstVaapiEntrypoint entrypoint
|
||||||
);
|
);
|
||||||
|
|
||||||
GstCaps *
|
GstCaps *
|
||||||
|
|
Loading…
Reference in a new issue