mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 00:31:13 +00:00
libs: window: allow choosing the format for the vpp pool
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/346>
This commit is contained in:
parent
856b9d5980
commit
72d32a91d2
2 changed files with 23 additions and 1 deletions
|
@ -98,6 +98,19 @@ error_unsupported_format:
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gst_vaapi_window_set_vpp_format_internal (GstVaapiWindow * window,
|
||||
GstVideoFormat format, guint flags)
|
||||
{
|
||||
if (window->surface_pool_format == format &&
|
||||
window->surface_pool_flags == flags)
|
||||
return;
|
||||
|
||||
gst_vaapi_video_pool_replace (&window->surface_pool, NULL);
|
||||
window->surface_pool_format = format;
|
||||
window->surface_pool_flags = flags;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
ensure_filter_surface_pool (GstVaapiWindow * window)
|
||||
{
|
||||
|
@ -109,7 +122,8 @@ ensure_filter_surface_pool (GstVaapiWindow * window)
|
|||
/* Ensure VA surface pool is created */
|
||||
/* XXX: optimize the surface format to use. e.g. YUY2 */
|
||||
window->surface_pool = gst_vaapi_surface_pool_new (display,
|
||||
GST_VIDEO_FORMAT_NV12, window->width, window->height, 0);
|
||||
window->surface_pool_format, window->width, window->height,
|
||||
window->surface_pool_flags);
|
||||
if (!window->surface_pool) {
|
||||
GST_WARNING ("failed to create surface pool for conversion");
|
||||
return FALSE;
|
||||
|
@ -229,6 +243,8 @@ gst_vaapi_window_new_internal (GType type, GstVaapiDisplay * display,
|
|||
if (!window)
|
||||
return NULL;
|
||||
|
||||
window->surface_pool_format = GST_VIDEO_FORMAT_NV12;
|
||||
|
||||
window->use_foreign_window = id != GST_VAAPI_ID_INVALID;
|
||||
GST_VAAPI_WINDOW_ID (window) = window->use_foreign_window ? id : 0;
|
||||
|
||||
|
|
|
@ -83,6 +83,8 @@ struct _GstVaapiWindow
|
|||
guint check_geometry:1;
|
||||
|
||||
/* for conversion */
|
||||
GstVideoFormat surface_pool_format;
|
||||
guint surface_pool_flags;
|
||||
GstVaapiVideoPool *surface_pool;
|
||||
GstVaapiFilter *filter;
|
||||
gboolean has_vpp;
|
||||
|
@ -138,6 +140,10 @@ gst_vaapi_window_vpp_convert_internal (GstVaapiWindow * window,
|
|||
GstVaapiSurface * surface, const GstVaapiRectangle * src_rect,
|
||||
const GstVaapiRectangle * dst_rect, guint flags);
|
||||
|
||||
void
|
||||
gst_vaapi_window_set_vpp_format_internal (GstVaapiWindow * window,
|
||||
GstVideoFormat format, guint flags);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GST_VAAPI_WINDOW_PRIV_H */
|
||||
|
|
Loading…
Reference in a new issue