mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
Move GstVaapiSurfaceRenderFlags conversion to get_PutSurface_flags_from_GstVaapiSurfaceRenderFlags().
This commit is contained in:
parent
6179b6495e
commit
edea5998f5
3 changed files with 34 additions and 14 deletions
|
@ -18,7 +18,9 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "gstvaapiutils.h"
|
||||
#include "gstvaapisurface.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
@ -96,3 +98,31 @@ const char *string_of_VAEntrypoint(VAEntrypoint entrypoint)
|
|||
}
|
||||
return "<unknown>";
|
||||
}
|
||||
|
||||
/**
|
||||
* get_PutSurface_flags_from_GstVaapiSurfaceRenderFlags:
|
||||
*
|
||||
* Converts #GstVaapiSurfaceRenderFlags to flags suitable for
|
||||
* vaPutSurface().
|
||||
*/
|
||||
guint get_PutSurface_flags_from_GstVaapiSurfaceRenderFlags(guint flags)
|
||||
{
|
||||
const guint va_top_bottom_fields = (VA_TOP_FIELD|VA_BOTTOM_FIELD);
|
||||
guint va_flags = 0;
|
||||
|
||||
if (flags & GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD)
|
||||
va_flags |= VA_TOP_FIELD;
|
||||
if (flags & GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD)
|
||||
va_flags |= VA_BOTTOM_FIELD;
|
||||
if ((va_flags & va_top_bottom_fields) == va_top_bottom_fields) {
|
||||
va_flags &= ~va_top_bottom_fields;
|
||||
va_flags |= VA_FRAME_PICTURE;
|
||||
}
|
||||
|
||||
if (flags & GST_VAAPI_COLOR_STANDARD_ITUR_BT_709)
|
||||
va_flags |= VA_SRC_BT709;
|
||||
else if (flags & GST_VAAPI_COLOR_STANDARD_ITUR_BT_601)
|
||||
va_flags |= VA_SRC_BT601;
|
||||
|
||||
return va_flags;
|
||||
}
|
||||
|
|
|
@ -45,4 +45,7 @@ const char *string_of_VAProfile(VAProfile profile)
|
|||
const char *string_of_VAEntrypoint(VAEntrypoint entrypoint)
|
||||
attribute_hidden;
|
||||
|
||||
guint get_PutSurface_flags_from_GstVaapiSurfaceRenderFlags(guint flags)
|
||||
attribute_hidden;
|
||||
|
||||
#endif /* GST_VAAPI_UTILS_H */
|
||||
|
|
|
@ -177,7 +177,6 @@ gst_vaapi_window_x11_render(
|
|||
GstVaapiDisplay *display;
|
||||
VASurfaceID surface_id;
|
||||
VAStatus status;
|
||||
guint va_flags = 0;
|
||||
|
||||
display = gst_vaapi_surface_get_display(surface);
|
||||
if (!display)
|
||||
|
@ -187,18 +186,6 @@ gst_vaapi_window_x11_render(
|
|||
if (surface_id == VA_INVALID_ID)
|
||||
return FALSE;
|
||||
|
||||
if (flags & GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD)
|
||||
va_flags |= VA_TOP_FIELD;
|
||||
if (flags & GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD)
|
||||
va_flags |= VA_BOTTOM_FIELD;
|
||||
if ((va_flags ^ (VA_TOP_FIELD|VA_BOTTOM_FIELD)) == 0)
|
||||
va_flags = VA_FRAME_PICTURE;
|
||||
|
||||
if (flags & GST_VAAPI_COLOR_STANDARD_ITUR_BT_709)
|
||||
va_flags |= VA_SRC_BT709;
|
||||
else if (flags & GST_VAAPI_COLOR_STANDARD_ITUR_BT_601)
|
||||
va_flags |= VA_SRC_BT601;
|
||||
|
||||
GST_VAAPI_DISPLAY_LOCK(display);
|
||||
status = vaPutSurface(
|
||||
GST_VAAPI_DISPLAY_VADISPLAY(display),
|
||||
|
@ -213,7 +200,7 @@ gst_vaapi_window_x11_render(
|
|||
dst_rect->w,
|
||||
dst_rect->h,
|
||||
NULL, 0,
|
||||
va_flags
|
||||
get_PutSurface_flags_from_GstVaapiSurfaceRenderFlags(flags)
|
||||
);
|
||||
GST_VAAPI_DISPLAY_UNLOCK(display);
|
||||
if (!vaapi_check_status(status, "vaPutSurface()"))
|
||||
|
|
Loading…
Reference in a new issue