mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-10 10:04:23 +00:00
libs: display: delay getting screen resolution
Instead of extracting the screen resolution at GstVaapiDisplay creation, this patch delay it until the screen size is requested for first time. https://bugzilla.gnome.org/show_bug.cgi?id=782212
This commit is contained in:
parent
66e4593c33
commit
63a76c9dd0
2 changed files with 28 additions and 5 deletions
|
@ -782,6 +782,25 @@ gst_vaapi_display_calculate_pixel_aspect_ratio (GstVaapiDisplay * display)
|
|||
priv->par_d = par[index][windex ^ 1];
|
||||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_ensure_screen_resolution (GstVaapiDisplay * display)
|
||||
{
|
||||
GstVaapiDisplayPrivate *const priv = GST_VAAPI_DISPLAY_GET_PRIVATE (display);
|
||||
const GstVaapiDisplayClass *const klass =
|
||||
GST_VAAPI_DISPLAY_GET_CLASS (display);
|
||||
|
||||
if (priv->got_scrres)
|
||||
return;
|
||||
|
||||
if (klass->get_size)
|
||||
klass->get_size (display, &priv->width, &priv->height);
|
||||
if (klass->get_size_mm)
|
||||
klass->get_size_mm (display, &priv->width_mm, &priv->height_mm);
|
||||
|
||||
gst_vaapi_display_calculate_pixel_aspect_ratio (display);
|
||||
priv->got_scrres = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_destroy (GstVaapiDisplay * display)
|
||||
{
|
||||
|
@ -869,11 +888,6 @@ gst_vaapi_display_create_unlocked (GstVaapiDisplay * display,
|
|||
return FALSE;
|
||||
priv->display = info.va_display;
|
||||
priv->native_display = info.native_display;
|
||||
if (klass->get_size)
|
||||
klass->get_size (display, &priv->width, &priv->height);
|
||||
if (klass->get_size_mm)
|
||||
klass->get_size_mm (display, &priv->width_mm, &priv->height_mm);
|
||||
gst_vaapi_display_calculate_pixel_aspect_ratio (display);
|
||||
break;
|
||||
}
|
||||
if (!priv->display)
|
||||
|
@ -1379,6 +1393,8 @@ gst_vaapi_display_get_width (GstVaapiDisplay * display)
|
|||
{
|
||||
g_return_val_if_fail (display != NULL, 0);
|
||||
|
||||
gst_vaapi_display_ensure_screen_resolution (display);
|
||||
|
||||
return GST_VAAPI_DISPLAY_GET_PRIVATE (display)->width;
|
||||
}
|
||||
|
||||
|
@ -1395,6 +1411,8 @@ gst_vaapi_display_get_height (GstVaapiDisplay * display)
|
|||
{
|
||||
g_return_val_if_fail (display != NULL, 0);
|
||||
|
||||
gst_vaapi_display_ensure_screen_resolution (display);
|
||||
|
||||
return GST_VAAPI_DISPLAY_GET_PRIVATE (display)->height;
|
||||
}
|
||||
|
||||
|
@ -1412,6 +1430,8 @@ gst_vaapi_display_get_size (GstVaapiDisplay * display, guint * pwidth,
|
|||
{
|
||||
g_return_if_fail (GST_VAAPI_DISPLAY (display));
|
||||
|
||||
gst_vaapi_display_ensure_screen_resolution (display);
|
||||
|
||||
if (pwidth)
|
||||
*pwidth = GST_VAAPI_DISPLAY_GET_PRIVATE (display)->width;
|
||||
|
||||
|
@ -1433,6 +1453,8 @@ gst_vaapi_display_get_pixel_aspect_ratio (GstVaapiDisplay * display,
|
|||
{
|
||||
g_return_if_fail (display != NULL);
|
||||
|
||||
gst_vaapi_display_ensure_screen_resolution (display);
|
||||
|
||||
if (par_n)
|
||||
*par_n = GST_VAAPI_DISPLAY_GET_PRIVATE (display)->par_n;
|
||||
|
||||
|
|
|
@ -128,6 +128,7 @@ struct _GstVaapiDisplayPrivate
|
|||
guint use_foreign_display:1;
|
||||
guint has_vpp:1;
|
||||
guint has_profiles:1;
|
||||
guint got_scrres:1;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue