mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
tests: port to new video format API.
This commit is contained in:
parent
09397fa0d8
commit
cb92e7ca79
5 changed files with 25 additions and 25 deletions
|
@ -24,7 +24,7 @@
|
|||
GstVaapiImage *
|
||||
image_generate(
|
||||
GstVaapiDisplay *display,
|
||||
GstVaapiImageFormat format,
|
||||
GstVideoFormat format,
|
||||
guint width,
|
||||
guint height
|
||||
)
|
||||
|
@ -257,7 +257,7 @@ image_draw_rectangle(
|
|||
guint32 color
|
||||
)
|
||||
{
|
||||
const GstVaapiImageFormat image_format = gst_vaapi_image_get_format(image);
|
||||
const GstVideoFormat image_format = gst_vaapi_image_get_format(image);
|
||||
const guint image_width = gst_vaapi_image_get_width(image);
|
||||
const guint image_height = gst_vaapi_image_get_height(image);
|
||||
GstVaapiDisplay *display;
|
||||
|
@ -267,11 +267,11 @@ image_draw_rectangle(
|
|||
guint i;
|
||||
|
||||
static const struct {
|
||||
GstVaapiImageFormat format;
|
||||
GstVideoFormat format;
|
||||
DrawRectFunc draw_rect;
|
||||
}
|
||||
map[] = {
|
||||
#define _(FORMAT) { GST_VAAPI_IMAGE_##FORMAT, draw_rect_##FORMAT }
|
||||
#define _(FORMAT) { GST_VIDEO_FORMAT_##FORMAT, draw_rect_##FORMAT }
|
||||
_(ARGB),
|
||||
_(BGRA),
|
||||
_(RGBA),
|
||||
|
@ -302,7 +302,7 @@ image_draw_rectangle(
|
|||
stride[i] = gst_vaapi_image_get_pitch(image, i);
|
||||
}
|
||||
|
||||
if (gst_vaapi_image_format_is_yuv(image_format))
|
||||
if (gst_video_format_is_yuv(image_format))
|
||||
color = argb2yuv(color);
|
||||
|
||||
if (x < 0)
|
||||
|
@ -324,7 +324,7 @@ gboolean
|
|||
image_upload(GstVaapiImage *image, GstVaapiSurface *surface)
|
||||
{
|
||||
GstVaapiDisplay *display;
|
||||
GstVaapiImageFormat format;
|
||||
GstVideoFormat format;
|
||||
GstVaapiSubpicture *subpicture;
|
||||
|
||||
display = gst_vaapi_object_get_display(GST_VAAPI_OBJECT(surface));
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
GstVaapiImage *
|
||||
image_generate(
|
||||
GstVaapiDisplay *display,
|
||||
GstVaapiImageFormat format,
|
||||
GstVideoFormat format,
|
||||
guint width,
|
||||
guint height
|
||||
);
|
||||
|
|
|
@ -126,22 +126,22 @@ print_format_caps(GstCaps *caps, const gchar *name)
|
|||
for (i = 0; i < gst_caps_get_size(caps); i++) {
|
||||
GstStructure * const structure = gst_caps_get_structure(caps, i);
|
||||
const VAImageFormat *va_format;
|
||||
GstVaapiImageFormat format;
|
||||
GstVideoFormat format;
|
||||
|
||||
if (!structure)
|
||||
g_error("could not get caps structure %d", i);
|
||||
|
||||
g_print(" %s:", gst_structure_get_name(structure));
|
||||
|
||||
format = gst_vaapi_image_format_from_structure(structure);
|
||||
if (!format)
|
||||
format = gst_video_format_from_structure(structure);
|
||||
if (format == GST_VIDEO_FORMAT_UNKNOWN)
|
||||
g_error("could not determine format");
|
||||
|
||||
va_format = gst_vaapi_image_format_get_va_format(format);
|
||||
va_format = gst_video_format_to_va_format(format);
|
||||
if (!va_format)
|
||||
g_error("could not determine VA format");
|
||||
|
||||
if (gst_vaapi_image_format_is_yuv(format))
|
||||
if (gst_video_format_is_yuv(format))
|
||||
print_format_caps_yuv(va_format);
|
||||
else
|
||||
print_format_caps_rgb(va_format);
|
||||
|
|
|
@ -71,7 +71,7 @@ main(int argc, char *argv[])
|
|||
if (!surface)
|
||||
g_error("could not create VA surface");
|
||||
|
||||
image = image_generate(display, GST_VAAPI_IMAGE_NV12, width, height);
|
||||
image = image_generate(display, GST_VIDEO_FORMAT_NV12, width, height);
|
||||
if (!image)
|
||||
g_error("could not create VA image");
|
||||
if (!image_upload(image, surface))
|
||||
|
|
|
@ -52,24 +52,24 @@ create_test_surface(GstVaapiDisplay *display, guint width, guint height)
|
|||
guint i;
|
||||
|
||||
static const GstVaapiChromaType chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420;
|
||||
static const GstVaapiImageFormat image_formats[] = {
|
||||
GST_VAAPI_IMAGE_NV12,
|
||||
GST_VAAPI_IMAGE_YV12,
|
||||
GST_VAAPI_IMAGE_I420,
|
||||
GST_VAAPI_IMAGE_AYUV,
|
||||
GST_VAAPI_IMAGE_ARGB,
|
||||
GST_VAAPI_IMAGE_BGRA,
|
||||
GST_VAAPI_IMAGE_RGBA,
|
||||
GST_VAAPI_IMAGE_ABGR,
|
||||
0
|
||||
static const GstVideoFormat image_formats[] = {
|
||||
GST_VIDEO_FORMAT_NV12,
|
||||
GST_VIDEO_FORMAT_YV12,
|
||||
GST_VIDEO_FORMAT_I420,
|
||||
GST_VIDEO_FORMAT_AYUV,
|
||||
GST_VIDEO_FORMAT_ARGB,
|
||||
GST_VIDEO_FORMAT_BGRA,
|
||||
GST_VIDEO_FORMAT_RGBA,
|
||||
GST_VIDEO_FORMAT_ABGR,
|
||||
GST_VIDEO_FORMAT_UNKNOWN
|
||||
};
|
||||
|
||||
surface = gst_vaapi_surface_new(display, chroma_type, width, height);
|
||||
if (!surface)
|
||||
g_error("could not create Gst/VA surface");
|
||||
|
||||
for (i = 0; image_formats[i]; i++) {
|
||||
const GstVaapiImageFormat format = image_formats[i];
|
||||
for (i = 0; image_formats[i] != GST_VIDEO_FORMAT_UNKNOWN; i++) {
|
||||
const GstVideoFormat format = image_formats[i];
|
||||
|
||||
image = image_generate(display, format, width, height);
|
||||
if (!image)
|
||||
|
|
Loading…
Reference in a new issue