mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
tests: inforce gstreamer code-style
This commit is contained in:
parent
018ea8b2fc
commit
74ebee5339
18 changed files with 8345 additions and 8445 deletions
|
@ -24,7 +24,8 @@
|
|||
#include <gst/vaapi/gstvaapidisplay.h>
|
||||
#include "codec.h"
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
const gchar *codec_str;
|
||||
GstVaapiCodec codec;
|
||||
const gchar *caps_str;
|
||||
|
@ -90,7 +91,8 @@ identify_codec_from_string(const gchar *codec_str)
|
|||
return 0;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
GMappedFile *file;
|
||||
guint8 *data;
|
||||
guint size;
|
||||
|
@ -185,8 +187,8 @@ identify_codec(const gchar *filename)
|
|||
g_list_free (type_list);
|
||||
|
||||
if (cip->probability >= GST_TYPE_FIND_LIKELY)
|
||||
codec = gst_vaapi_profile_get_codec(
|
||||
gst_vaapi_profile_from_caps(cip->caps));
|
||||
codec =
|
||||
gst_vaapi_profile_get_codec (gst_vaapi_profile_from_caps (cip->caps));
|
||||
|
||||
codec_identifier_free (cip);
|
||||
return codec;
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
typedef void (*GetVideoInfoFunc) (VideoDecodeInfo * info);
|
||||
|
||||
typedef struct _CodecDefs CodecDefs;
|
||||
struct _CodecDefs {
|
||||
struct _CodecDefs
|
||||
{
|
||||
const gchar *codec_str;
|
||||
GetVideoInfoFunc get_video_info;
|
||||
};
|
||||
|
@ -102,8 +103,7 @@ decoder_new(GstVaapiDisplay *display, const gchar *codec_name)
|
|||
if (info.width > 0 && info.height > 0)
|
||||
gst_caps_set_simple (caps,
|
||||
"width", G_TYPE_INT, info.width,
|
||||
"height", G_TYPE_INT, info.height,
|
||||
NULL);
|
||||
"height", G_TYPE_INT, info.height, NULL);
|
||||
|
||||
switch (gst_vaapi_profile_get_codec (info.profile)) {
|
||||
case GST_VAAPI_CODEC_H264:
|
||||
|
|
188
tests/image.c
188
tests/image.c
|
@ -25,24 +25,12 @@
|
|||
#include "image.h"
|
||||
|
||||
static gboolean
|
||||
image_draw_rectangle(
|
||||
GstVaapiImage *image,
|
||||
gint x,
|
||||
gint y,
|
||||
guint width,
|
||||
guint height,
|
||||
guint32 color,
|
||||
guint32 flags
|
||||
);
|
||||
image_draw_rectangle (GstVaapiImage * image,
|
||||
gint x, gint y, guint width, guint height, guint32 color, guint32 flags);
|
||||
|
||||
static gboolean
|
||||
image_draw_color_rectangles(
|
||||
GstVaapiImage *image,
|
||||
guint width,
|
||||
guint height,
|
||||
const guint32 colors[4],
|
||||
guint32 flags
|
||||
)
|
||||
image_draw_color_rectangles (GstVaapiImage * image,
|
||||
guint width, guint height, const guint32 colors[4], guint32 flags)
|
||||
{
|
||||
const guint w = width / 2;
|
||||
const guint h = height / 2;
|
||||
|
@ -59,24 +47,15 @@ image_draw_color_rectangles(
|
|||
}
|
||||
|
||||
GstVaapiImage *
|
||||
image_generate(
|
||||
GstVaapiDisplay *display,
|
||||
GstVideoFormat format,
|
||||
guint width,
|
||||
guint height
|
||||
)
|
||||
image_generate (GstVaapiDisplay * display,
|
||||
GstVideoFormat format, guint width, guint height)
|
||||
{
|
||||
return image_generate_full (display, format, width, height, 0);
|
||||
}
|
||||
|
||||
GstVaapiImage *
|
||||
image_generate_full(
|
||||
GstVaapiDisplay *display,
|
||||
GstVideoFormat format,
|
||||
guint width,
|
||||
guint height,
|
||||
guint32 flags
|
||||
)
|
||||
image_generate_full (GstVaapiDisplay * display,
|
||||
GstVideoFormat format, guint width, guint height, guint32 flags)
|
||||
{
|
||||
GstVaapiImage *image;
|
||||
|
||||
|
@ -103,8 +82,7 @@ image_generate_full(
|
|||
bgr_colors : inv_colors),
|
||||
GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD))
|
||||
goto error;
|
||||
}
|
||||
else if (!image_draw_color_rectangles(image, width, height, rgb_colors, 0))
|
||||
} else if (!image_draw_color_rectangles (image, width, height, rgb_colors, 0))
|
||||
goto error;
|
||||
return image;
|
||||
|
||||
|
@ -113,25 +91,12 @@ error:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
typedef void (*DrawRectFunc)(
|
||||
guchar *pixels[3],
|
||||
guint stride[3],
|
||||
gint x,
|
||||
gint y,
|
||||
guint width,
|
||||
guint height,
|
||||
guint32 color
|
||||
);
|
||||
typedef void (*DrawRectFunc) (guchar * pixels[3],
|
||||
guint stride[3], gint x, gint y, guint width, guint height, guint32 color);
|
||||
|
||||
static void draw_rect_ARGB(
|
||||
guchar *pixels[3],
|
||||
guint stride[3],
|
||||
gint x,
|
||||
gint y,
|
||||
guint width,
|
||||
guint height,
|
||||
guint32 color
|
||||
)
|
||||
static void
|
||||
draw_rect_ARGB (guchar * pixels[3],
|
||||
guint stride[3], gint x, gint y, guint width, guint height, guint32 color)
|
||||
{
|
||||
guint i, j;
|
||||
|
||||
|
@ -144,15 +109,9 @@ static void draw_rect_ARGB(
|
|||
}
|
||||
}
|
||||
|
||||
static void draw_rect_BGRA(
|
||||
guchar *pixels[3],
|
||||
guint stride[3],
|
||||
gint x,
|
||||
gint y,
|
||||
guint width,
|
||||
guint height,
|
||||
guint32 color
|
||||
)
|
||||
static void
|
||||
draw_rect_BGRA (guchar * pixels[3],
|
||||
guint stride[3], gint x, gint y, guint width, guint height, guint32 color)
|
||||
{
|
||||
// Converts ARGB color to BGRA
|
||||
color = GUINT32_SWAP_LE_BE (color);
|
||||
|
@ -160,15 +119,9 @@ static void draw_rect_BGRA(
|
|||
draw_rect_ARGB (pixels, stride, x, y, width, height, color);
|
||||
}
|
||||
|
||||
static void draw_rect_RGBA(
|
||||
guchar *pixels[3],
|
||||
guint stride[3],
|
||||
gint x,
|
||||
gint y,
|
||||
guint width,
|
||||
guint height,
|
||||
guint32 color
|
||||
)
|
||||
static void
|
||||
draw_rect_RGBA (guchar * pixels[3],
|
||||
guint stride[3], gint x, gint y, guint width, guint height, guint32 color)
|
||||
{
|
||||
// Converts ARGB color to RGBA
|
||||
color = ((color >> 24) & 0xff) | ((color & 0xffffff) << 8);
|
||||
|
@ -176,33 +129,21 @@ static void draw_rect_RGBA(
|
|||
draw_rect_ARGB (pixels, stride, x, y, width, height, color);
|
||||
}
|
||||
|
||||
static void draw_rect_ABGR(
|
||||
guchar *pixels[3],
|
||||
guint stride[3],
|
||||
gint x,
|
||||
gint y,
|
||||
guint width,
|
||||
guint height,
|
||||
guint32 color
|
||||
)
|
||||
static void
|
||||
draw_rect_ABGR (guchar * pixels[3],
|
||||
guint stride[3], gint x, gint y, guint width, guint height, guint32 color)
|
||||
{
|
||||
// Converts ARGB color to ABGR
|
||||
color = ((color & 0xff00ff00) |
|
||||
((color >> 16) & 0xff) |
|
||||
((color & 0xff) << 16));
|
||||
((color >> 16) & 0xff) | ((color & 0xff) << 16));
|
||||
|
||||
draw_rect_ARGB (pixels, stride, x, y, width, height, color);
|
||||
}
|
||||
|
||||
static void draw_rect_NV12( // Y, UV planes
|
||||
static void
|
||||
draw_rect_NV12 ( // Y, UV planes
|
||||
guchar * pixels[3],
|
||||
guint stride[3],
|
||||
gint x,
|
||||
gint y,
|
||||
guint width,
|
||||
guint height,
|
||||
guint32 color
|
||||
)
|
||||
guint stride[3], gint x, gint y, guint width, guint height, guint32 color)
|
||||
{
|
||||
const guchar Y = color >> 16;
|
||||
const guchar Cb = color >> 8;
|
||||
|
@ -228,15 +169,10 @@ static void draw_rect_NV12( // Y, UV planes
|
|||
}
|
||||
}
|
||||
|
||||
static void draw_rect_YV12( // Y, V, U planes
|
||||
static void
|
||||
draw_rect_YV12 ( // Y, V, U planes
|
||||
guchar * pixels[3],
|
||||
guint stride[3],
|
||||
gint x,
|
||||
gint y,
|
||||
guint width,
|
||||
guint height,
|
||||
guint32 color
|
||||
)
|
||||
guint stride[3], gint x, gint y, guint width, guint height, guint32 color)
|
||||
{
|
||||
const guchar Y = color >> 16;
|
||||
const guchar Cb = color >> 8;
|
||||
|
@ -263,15 +199,10 @@ static void draw_rect_YV12( // Y, V, U planes
|
|||
}
|
||||
}
|
||||
|
||||
static void draw_rect_I420( // Y, U, V planes
|
||||
static void
|
||||
draw_rect_I420 ( // Y, U, V planes
|
||||
guchar * pixels[3],
|
||||
guint stride[3],
|
||||
gint x,
|
||||
gint y,
|
||||
guint width,
|
||||
guint height,
|
||||
guint32 color
|
||||
)
|
||||
guint stride[3], gint x, gint y, guint width, guint height, guint32 color)
|
||||
{
|
||||
guchar *new_pixels[3] = { pixels[0], pixels[2], pixels[1] };
|
||||
guint new_stride[3] = { stride[0], stride[2], stride[1] };
|
||||
|
@ -279,7 +210,8 @@ static void draw_rect_I420( // Y, U, V planes
|
|||
draw_rect_YV12 (new_pixels, new_stride, x, y, width, height, color);
|
||||
}
|
||||
|
||||
static void draw_rect_YUV422(guchar *pixels[3], guint stride[3],
|
||||
static void
|
||||
draw_rect_YUV422 (guchar * pixels[3], guint stride[3],
|
||||
gint x, gint y, guint width, guint height, guint32 color)
|
||||
{
|
||||
guint i, j;
|
||||
|
@ -293,7 +225,8 @@ static void draw_rect_YUV422(guchar *pixels[3], guint stride[3],
|
|||
}
|
||||
}
|
||||
|
||||
static void draw_rect_YUY2(guchar *pixels[3], guint stride[3],
|
||||
static void
|
||||
draw_rect_YUY2 (guchar * pixels[3], guint stride[3],
|
||||
gint x, gint y, guint width, guint height, guint32 color)
|
||||
{
|
||||
const guchar Y = color >> 16;
|
||||
|
@ -304,7 +237,8 @@ static void draw_rect_YUY2(guchar *pixels[3], guint stride[3],
|
|||
draw_rect_YUV422 (pixels, stride, x, y, width, height, GUINT32_TO_BE (color));
|
||||
}
|
||||
|
||||
static void draw_rect_UYVY(guchar *pixels[3], guint stride[3],
|
||||
static void
|
||||
draw_rect_UYVY (guchar * pixels[3], guint stride[3],
|
||||
gint x, gint y, guint width, guint height, guint32 color)
|
||||
{
|
||||
const guchar Y = color >> 16;
|
||||
|
@ -315,15 +249,9 @@ static void draw_rect_UYVY(guchar *pixels[3], guint stride[3],
|
|||
draw_rect_YUV422 (pixels, stride, x, y, width, height, GUINT32_TO_BE (color));
|
||||
}
|
||||
|
||||
static void draw_rect_AYUV(
|
||||
guchar *pixels[3],
|
||||
guint stride[3],
|
||||
gint x,
|
||||
gint y,
|
||||
guint width,
|
||||
guint height,
|
||||
guint32 color
|
||||
)
|
||||
static void
|
||||
draw_rect_AYUV (guchar * pixels[3],
|
||||
guint stride[3], gint x, gint y, guint width, guint height, guint32 color)
|
||||
{
|
||||
guint i, j;
|
||||
|
||||
|
@ -336,7 +264,8 @@ static void draw_rect_AYUV(
|
|||
}
|
||||
}
|
||||
|
||||
static inline guint32 argb2yuv(guint32 color)
|
||||
static inline guint32
|
||||
argb2yuv (guint32 color)
|
||||
{
|
||||
const gint32 r = (color >> 16) & 0xff;
|
||||
const gint32 g = (color >> 8) & 0xff;
|
||||
|
@ -350,15 +279,8 @@ static inline guint32 argb2yuv(guint32 color)
|
|||
}
|
||||
|
||||
gboolean
|
||||
image_draw_rectangle(
|
||||
GstVaapiImage *image,
|
||||
gint x,
|
||||
gint y,
|
||||
guint width,
|
||||
guint height,
|
||||
guint32 color,
|
||||
guint32 flags
|
||||
)
|
||||
image_draw_rectangle (GstVaapiImage * image,
|
||||
gint x, gint y, guint width, guint height, guint32 color, guint32 flags)
|
||||
{
|
||||
const GstVideoFormat image_format = gst_vaapi_image_get_format (image);
|
||||
const guint image_width = gst_vaapi_image_get_width (image);
|
||||
|
@ -369,7 +291,8 @@ image_draw_rectangle(
|
|||
DrawRectFunc draw_rect = NULL;
|
||||
guint i;
|
||||
|
||||
static const struct {
|
||||
static const struct
|
||||
{
|
||||
GstVideoFormat format;
|
||||
DrawRectFunc draw_rect;
|
||||
}
|
||||
|
@ -377,16 +300,10 @@ image_draw_rectangle(
|
|||
#define _(FORMAT) { GST_VIDEO_FORMAT_##FORMAT, draw_rect_##FORMAT }
|
||||
_(ARGB),
|
||||
_(BGRA),
|
||||
_(RGBA),
|
||||
_(ABGR),
|
||||
_(NV12),
|
||||
_(YV12),
|
||||
_(I420),
|
||||
_(YUY2),
|
||||
_(UYVY),
|
||||
_(AYUV),
|
||||
_(RGBA), _(ABGR), _(NV12), _(YV12), _(I420), _(YUY2), _(UYVY), _(AYUV),
|
||||
#undef _
|
||||
{ 0, }
|
||||
{
|
||||
0,}
|
||||
};
|
||||
|
||||
for (i = 0; !draw_rect && map[i].format; i++)
|
||||
|
@ -474,8 +391,7 @@ image_upload(GstVaapiImage *image, GstVaapiSurface *surface)
|
|||
if (!subpicture)
|
||||
g_error ("could not create VA subpicture");
|
||||
|
||||
if (!gst_vaapi_surface_associate_subpicture(surface, subpicture,
|
||||
NULL, NULL))
|
||||
if (!gst_vaapi_surface_associate_subpicture (surface, subpicture, NULL, NULL))
|
||||
g_error ("could not associate subpicture to surface");
|
||||
|
||||
/* The surface holds a reference to the subpicture. This is safe */
|
||||
|
|
|
@ -52,28 +52,24 @@ static const VideoOutputInfo g_video_outputs[] = {
|
|||
#if USE_WAYLAND
|
||||
{"wayland",
|
||||
gst_vaapi_display_wayland_new,
|
||||
gst_vaapi_window_wayland_new
|
||||
},
|
||||
gst_vaapi_window_wayland_new},
|
||||
#endif
|
||||
#if USE_X11
|
||||
{"x11",
|
||||
gst_vaapi_display_x11_new,
|
||||
gst_vaapi_window_x11_new,
|
||||
gst_vaapi_pixmap_x11_new
|
||||
},
|
||||
gst_vaapi_pixmap_x11_new},
|
||||
#endif
|
||||
#if USE_GLX
|
||||
{"glx",
|
||||
gst_vaapi_display_glx_new,
|
||||
gst_vaapi_window_glx_new,
|
||||
gst_vaapi_pixmap_x11_new
|
||||
},
|
||||
gst_vaapi_pixmap_x11_new},
|
||||
#endif
|
||||
#if USE_DRM
|
||||
{"drm",
|
||||
gst_vaapi_display_drm_new,
|
||||
gst_vaapi_window_drm_new
|
||||
},
|
||||
gst_vaapi_window_drm_new},
|
||||
#endif
|
||||
{NULL,}
|
||||
};
|
||||
|
@ -216,7 +212,8 @@ video_output_create_display(const gchar *display_name)
|
|||
}
|
||||
|
||||
GstVaapiWindow *
|
||||
video_output_create_window(GstVaapiDisplay *display, guint width, guint height)
|
||||
video_output_create_window (GstVaapiDisplay * display, guint width,
|
||||
guint height)
|
||||
{
|
||||
GstVaapiWindow *window;
|
||||
|
||||
|
|
|
@ -59,25 +59,29 @@ static GOptionEntry g_options[] = {
|
|||
{NULL,}
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
APP_RUNNING,
|
||||
APP_GOT_EOS,
|
||||
APP_GOT_ERROR,
|
||||
} AppEvent;
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
APP_ERROR_NONE,
|
||||
APP_ERROR_DECODER,
|
||||
APP_ERROR_RENDERER,
|
||||
} AppError;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
GstVaapiSurfaceProxy *proxy;
|
||||
GstClockTime pts;
|
||||
GstClockTime duration;
|
||||
} RenderFrame;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
GMutex mutex;
|
||||
GMappedFile *file;
|
||||
gchar *file_name;
|
||||
|
@ -189,8 +193,7 @@ get_decoder_status_string(GstVaapiDecoderStatus status)
|
|||
DEFINE_STATUS (ERROR_NO_SURFACE, "no surface vailable");
|
||||
DEFINE_STATUS (ERROR_INVALID_SURFACE, "invalid surface");
|
||||
DEFINE_STATUS (ERROR_BITSTREAM_PARSER, "bitstream parser error");
|
||||
DEFINE_STATUS(ERROR_UNSUPPORTED_PROFILE,
|
||||
"unsupported profile");
|
||||
DEFINE_STATUS (ERROR_UNSUPPORTED_PROFILE, "unsupported profile");
|
||||
DEFINE_STATUS (ERROR_UNSUPPORTED_CHROMA_FORMAT,
|
||||
"unsupported chroma-format");
|
||||
DEFINE_STATUS (ERROR_INVALID_PARAMETER, "invalid parameter");
|
||||
|
@ -335,8 +338,8 @@ app_set_framerate(App *app, guint fps_n, guint fps_d)
|
|||
if (fps_n != app->fps_n || fps_d != app->fps_d) {
|
||||
app->fps_n = fps_n;
|
||||
app->fps_d = fps_d;
|
||||
app->frame_duration = gst_util_uint64_scale(
|
||||
GST_TIME_AS_USECONDS(GST_SECOND), fps_d, fps_n);
|
||||
app->frame_duration =
|
||||
gst_util_uint64_scale (GST_TIME_AS_USECONDS (GST_SECOND), fps_d, fps_n);
|
||||
}
|
||||
g_mutex_unlock (&app->mutex);
|
||||
}
|
||||
|
@ -444,8 +447,7 @@ ensure_pixmaps(App *app, GstVaapiSurface *surface,
|
|||
if (crop_rect) {
|
||||
width = crop_rect->width;
|
||||
height = crop_rect->height;
|
||||
}
|
||||
else
|
||||
} else
|
||||
gst_vaapi_surface_get_size (surface, &width, &height);
|
||||
if (app->pixmap_width == width && app->pixmap_height == height)
|
||||
return TRUE;
|
||||
|
@ -521,8 +523,7 @@ renderer_process(App *app, RenderFrame *rfp)
|
|||
GST_VAAPI_ID_ARGS (pixmap));
|
||||
|
||||
app->pixmap_id = (app->pixmap_id + 1) % G_N_ELEMENTS (app->pixmaps);
|
||||
}
|
||||
else if (!gst_vaapi_window_put_surface(app->window, surface,
|
||||
} else if (!gst_vaapi_window_put_surface (app->window, surface,
|
||||
crop_rect, NULL, GST_VAAPI_PICTURE_STRUCTURE_FRAME))
|
||||
SEND_ERROR ("failed to render surface %" GST_VAAPI_ID_FORMAT,
|
||||
GST_VAAPI_ID_ARGS (gst_vaapi_surface_get_id (surface)));
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
/* Set to 1 to check display cache works (shared VA display) */
|
||||
#define CHECK_DISPLAY_CACHE 1
|
||||
|
||||
static inline void pause(void)
|
||||
static inline void
|
||||
pause (void)
|
||||
{
|
||||
g_print ("Press any key to continue...\n");
|
||||
getchar ();
|
||||
|
@ -110,8 +111,7 @@ main(int argc, char *argv[])
|
|||
if (crop_rect) {
|
||||
width = crop_rect->width;
|
||||
height = crop_rect->height;
|
||||
}
|
||||
else
|
||||
} else
|
||||
gst_vaapi_surface_get_size (surface, &width, &height);
|
||||
|
||||
pixmap = video_output_create_pixmap (display, GST_VIDEO_FORMAT_xRGB,
|
||||
|
@ -125,8 +125,7 @@ main(int argc, char *argv[])
|
|||
|
||||
if (!gst_vaapi_window_put_pixmap (window, pixmap, NULL, NULL))
|
||||
g_error ("could not render pixmap");
|
||||
}
|
||||
else if (!gst_vaapi_window_put_surface(window, surface, crop_rect, NULL,
|
||||
} else if (!gst_vaapi_window_put_surface (window, surface, crop_rect, NULL,
|
||||
GST_VAAPI_PICTURE_STRUCTURE_FRAME))
|
||||
g_error ("could not render surface");
|
||||
|
||||
|
|
|
@ -101,9 +101,7 @@ print_format_yuv(const VAImageFormat *va_format)
|
|||
|
||||
g_print (" fourcc '%c%c%c%c'",
|
||||
fourcc & 0xff,
|
||||
(fourcc >> 8) & 0xff,
|
||||
(fourcc >> 16) & 0xff,
|
||||
(fourcc >> 24) & 0xff);
|
||||
(fourcc >> 8) & 0xff, (fourcc >> 16) & 0xff, (fourcc >> 24) & 0xff);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -145,7 +143,8 @@ print_formats(GArray *formats, const gchar *name)
|
|||
}
|
||||
|
||||
typedef struct _GstVaapiDisplayProperty GstVaapiDisplayProperty;
|
||||
struct _GstVaapiDisplayProperty {
|
||||
struct _GstVaapiDisplayProperty
|
||||
{
|
||||
const gchar *name;
|
||||
GValue value;
|
||||
};
|
||||
|
@ -309,7 +308,8 @@ main(int argc, char *argv[])
|
|||
g_print ("\n");
|
||||
|
||||
g_print ("#\n");
|
||||
g_print("# Create display with gst_vaapi_display_new_with_display() [vaGetDisplayDRM()]\n");
|
||||
g_print
|
||||
("# Create display with gst_vaapi_display_new_with_display() [vaGetDisplayDRM()]\n");
|
||||
g_print ("#\n");
|
||||
{
|
||||
int drm_device;
|
||||
|
@ -347,10 +347,9 @@ main(int argc, char *argv[])
|
|||
display2 = gst_vaapi_display_x11_new (NULL);
|
||||
|
||||
/* Check for the same X11 display */
|
||||
g_assert(gst_vaapi_display_x11_get_display(
|
||||
GST_VAAPI_DISPLAY_X11(display)) ==
|
||||
gst_vaapi_display_x11_get_display(
|
||||
GST_VAAPI_DISPLAY_X11(display2)));
|
||||
g_assert (gst_vaapi_display_x11_get_display (GST_VAAPI_DISPLAY_X11
|
||||
(display)) ==
|
||||
gst_vaapi_display_x11_get_display (GST_VAAPI_DISPLAY_X11 (display2)));
|
||||
|
||||
/* Check for the same VA display */
|
||||
g_assert (gst_vaapi_display_get_display (display) ==
|
||||
|
@ -363,10 +362,9 @@ main(int argc, char *argv[])
|
|||
|
||||
/* Check for the different X11 display */
|
||||
/* XXX: it is also desired to cache underlying X11 displays */
|
||||
g_assert(gst_vaapi_display_x11_get_display(
|
||||
GST_VAAPI_DISPLAY_X11(display)) !=
|
||||
gst_vaapi_display_x11_get_display(
|
||||
GST_VAAPI_DISPLAY_X11(display2)));
|
||||
g_assert (gst_vaapi_display_x11_get_display (GST_VAAPI_DISPLAY_X11
|
||||
(display)) !=
|
||||
gst_vaapi_display_x11_get_display (GST_VAAPI_DISPLAY_X11 (display2)));
|
||||
|
||||
/* Check for different VA display */
|
||||
g_assert (gst_vaapi_display_get_display (display) !=
|
||||
|
@ -418,7 +416,8 @@ main(int argc, char *argv[])
|
|||
g_print ("\n");
|
||||
|
||||
g_print ("#\n");
|
||||
g_print("# Create display with gst_vaapi_display_new_with_display() [vaGetDisplay()]\n");
|
||||
g_print
|
||||
("# Create display with gst_vaapi_display_new_with_display() [vaGetDisplay()]\n");
|
||||
g_print ("#\n");
|
||||
{
|
||||
Display *x11_display;
|
||||
|
@ -456,10 +455,9 @@ main(int argc, char *argv[])
|
|||
display2 = gst_vaapi_display_glx_new (NULL);
|
||||
|
||||
/* Check for the same X11 display */
|
||||
g_assert(gst_vaapi_display_x11_get_display(
|
||||
GST_VAAPI_DISPLAY_X11(display)) ==
|
||||
gst_vaapi_display_x11_get_display(
|
||||
GST_VAAPI_DISPLAY_X11(display2)));
|
||||
g_assert (gst_vaapi_display_x11_get_display (GST_VAAPI_DISPLAY_X11
|
||||
(display)) ==
|
||||
gst_vaapi_display_x11_get_display (GST_VAAPI_DISPLAY_X11 (display2)));
|
||||
|
||||
/* Check for the same VA display */
|
||||
g_assert (gst_vaapi_display_get_display (display) ==
|
||||
|
@ -470,10 +468,9 @@ main(int argc, char *argv[])
|
|||
display2 = gst_vaapi_display_x11_new (NULL);
|
||||
|
||||
/* Check for the same X11 display */
|
||||
g_assert(gst_vaapi_display_x11_get_display(
|
||||
GST_VAAPI_DISPLAY_X11(display)) ==
|
||||
gst_vaapi_display_x11_get_display(
|
||||
GST_VAAPI_DISPLAY_X11(display2)));
|
||||
g_assert (gst_vaapi_display_x11_get_display (GST_VAAPI_DISPLAY_X11
|
||||
(display)) ==
|
||||
gst_vaapi_display_x11_get_display (GST_VAAPI_DISPLAY_X11 (display2)));
|
||||
|
||||
/* Check for the same VA display */
|
||||
g_assert (gst_vaapi_display_get_display (display) ==
|
||||
|
@ -515,7 +512,8 @@ main(int argc, char *argv[])
|
|||
|
||||
#ifdef HAVE_VA_VA_GLX_H
|
||||
g_print ("#\n");
|
||||
g_print("# Create display with gst_vaapi_display_new_with_display() [vaGetDisplayGLX()]\n");
|
||||
g_print
|
||||
("# Create display with gst_vaapi_display_new_with_display() [vaGetDisplayGLX()]\n");
|
||||
g_print ("#\n");
|
||||
{
|
||||
Display *x11_display;
|
||||
|
|
|
@ -78,7 +78,8 @@ app_error_quark(void)
|
|||
return g_quark;
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
APP_ERROR_NONE,
|
||||
APP_ERROR_CREATE_TEST_SURFACE,
|
||||
} AppError;
|
||||
|
@ -226,7 +227,6 @@ parse_crop_rect(const gchar *str, GstVaapiRectangle *crop_rect)
|
|||
crop_rect->y = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Format: '('? <X> ',' <Y> ')'? <WIDTH> 'x' <HEIGHT>
|
||||
if (sscanf (str, "(%d,%d):%ux%u", &crop_rect->x, &crop_rect->y,
|
||||
&crop_rect->width, &crop_rect->height) == 4 ||
|
||||
|
@ -293,7 +293,8 @@ end:
|
|||
}
|
||||
|
||||
static inline gboolean
|
||||
parse_deinterlace(const gchar *str, GstVaapiDeinterlaceMethod *deinterlace_ptr)
|
||||
parse_deinterlace (const gchar * str,
|
||||
GstVaapiDeinterlaceMethod * deinterlace_ptr)
|
||||
{
|
||||
g_return_val_if_fail (deinterlace_ptr != NULL, FALSE);
|
||||
|
||||
|
@ -347,8 +348,7 @@ main(int argc, char *argv[])
|
|||
g_error ("failed to parse deinterlace method `%s'", g_deinterlace_str);
|
||||
|
||||
if (!parse_deinterlace_flags (g_deinterlace_flags_str, &deinterlace_flags))
|
||||
g_error("failed to parse deinterlace flags `%s'",
|
||||
g_deinterlace_flags_str);
|
||||
g_error ("failed to parse deinterlace flags `%s'", g_deinterlace_flags_str);
|
||||
|
||||
display = video_output_create_display (NULL);
|
||||
if (!display)
|
||||
|
@ -398,8 +398,7 @@ main(int argc, char *argv[])
|
|||
if (!gst_vaapi_filter_set_deinterlacing (filter, deinterlace_method,
|
||||
deinterlace_flags))
|
||||
g_error ("failed to set deinterlacing method");
|
||||
}
|
||||
else if (deinterlace_flags) {
|
||||
} else if (deinterlace_flags) {
|
||||
if (deinterlace_flags & GST_VAAPI_DEINTERLACE_FLAG_TOPFIELD)
|
||||
filter_flags = GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD;
|
||||
else
|
||||
|
|
|
@ -1040,7 +1040,8 @@ static const guchar h264_clip[H264_CLIP_DATA_SIZE] = {
|
|||
0x00, 0x01, 0x0a
|
||||
};
|
||||
|
||||
void h264_get_video_info(VideoDecodeInfo *info)
|
||||
void
|
||||
h264_get_video_info (VideoDecodeInfo * info)
|
||||
{
|
||||
info->profile = GST_VAAPI_PROFILE_H264_MAIN;
|
||||
info->width = H264_CLIP_WIDTH;
|
||||
|
|
|
@ -2071,7 +2071,8 @@ static const guchar jpeg_clip[JPEG_CLIP_DATA_SIZE] = {
|
|||
0xd9
|
||||
};
|
||||
|
||||
void jpeg_get_video_info(VideoDecodeInfo *info)
|
||||
void
|
||||
jpeg_get_video_info (VideoDecodeInfo * info)
|
||||
{
|
||||
info->profile = GST_VAAPI_PROFILE_JPEG_BASELINE;
|
||||
info->width = JPEG_CLIP_WIDTH;
|
||||
|
|
|
@ -1640,7 +1640,8 @@ static const guchar mpeg2_clip[MPEG2_CLIP_DATA_SIZE] = {
|
|||
0x00, 0x01, 0xb7
|
||||
};
|
||||
|
||||
void mpeg2_get_video_info(VideoDecodeInfo *info)
|
||||
void
|
||||
mpeg2_get_video_info (VideoDecodeInfo * info)
|
||||
{
|
||||
info->profile = GST_VAAPI_PROFILE_MPEG2_SIMPLE;
|
||||
info->width = MPEG2_CLIP_WIDTH;
|
||||
|
|
|
@ -1663,7 +1663,8 @@ static const guchar mpeg4_clip[MPEG4_CLIP_DATA_SIZE] = {
|
|||
0x4b, 0xff, 0x36, 0x23, 0x04, 0x83, 0x7a, 0x46
|
||||
};
|
||||
|
||||
void mpeg4_get_video_info(VideoDecodeInfo *info)
|
||||
void
|
||||
mpeg4_get_video_info (VideoDecodeInfo * info)
|
||||
{
|
||||
info->profile = GST_VAAPI_PROFILE_MPEG4_SIMPLE;
|
||||
info->width = MPEG4_CLIP_WIDTH;
|
||||
|
|
|
@ -1421,7 +1421,8 @@ static const guint32 text[] = {
|
|||
0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
};
|
||||
|
||||
void subpicture_get_info(VideoSubpictureInfo *info)
|
||||
void
|
||||
subpicture_get_info (VideoSubpictureInfo * info)
|
||||
{
|
||||
info->width = SUBPICTURE_WIDTH;
|
||||
info->height = SUBPICTURE_HEIGHT;
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
#include "output.h"
|
||||
#include "test-subpicture-data.h"
|
||||
|
||||
static inline void pause(void)
|
||||
static inline void
|
||||
pause (void)
|
||||
{
|
||||
g_print ("Press any key to continue...\n");
|
||||
getchar ();
|
||||
|
|
|
@ -28,13 +28,15 @@
|
|||
#include <gst/vaapi/gstvaapiimage.h>
|
||||
#include "image.h"
|
||||
|
||||
static inline void pause(void)
|
||||
static inline void
|
||||
pause (void)
|
||||
{
|
||||
g_print ("Press any key to continue...\n");
|
||||
getchar ();
|
||||
}
|
||||
|
||||
static inline guint gl_get_current_texture_2d(void)
|
||||
static inline guint
|
||||
gl_get_current_texture_2d (void)
|
||||
{
|
||||
GLint texture;
|
||||
glGetIntegerv (GL_TEXTURE_BINDING_2D, &texture);
|
||||
|
@ -92,13 +94,8 @@ main(int argc, char *argv[])
|
|||
g_print ("# Create texture with gst_vaapi_texture_glx_new()\n");
|
||||
g_print ("#\n");
|
||||
{
|
||||
texture = gst_vaapi_texture_glx_new(
|
||||
display,
|
||||
GL_TEXTURE_2D,
|
||||
GL_RGBA,
|
||||
width,
|
||||
height
|
||||
);
|
||||
texture = gst_vaapi_texture_glx_new (display,
|
||||
GL_TEXTURE_2D, GL_RGBA, width, height);
|
||||
if (!texture)
|
||||
g_error ("could not create VA texture");
|
||||
|
||||
|
@ -127,24 +124,12 @@ main(int argc, char *argv[])
|
|||
glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri (target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
|
||||
glTexImage2D(
|
||||
target,
|
||||
0,
|
||||
GL_RGBA8,
|
||||
width, height,
|
||||
0,
|
||||
format,
|
||||
GL_UNSIGNED_BYTE,
|
||||
NULL
|
||||
);
|
||||
glTexImage2D (target,
|
||||
0, GL_RGBA8, width, height, 0, format, GL_UNSIGNED_BYTE, NULL);
|
||||
glDisable (target);
|
||||
|
||||
texture = gst_vaapi_texture_glx_new_wrapped(
|
||||
display,
|
||||
texture_id,
|
||||
target,
|
||||
format
|
||||
);
|
||||
texture = gst_vaapi_texture_glx_new_wrapped (display,
|
||||
texture_id, target, format);
|
||||
if (!texture)
|
||||
g_error ("could not create VA texture");
|
||||
|
||||
|
|
|
@ -1769,7 +1769,8 @@ static const guchar vc1_clip[VC1_CLIP_DATA_SIZE] = {
|
|||
0x0f, 0x55, 0xbf, 0x40, 0x00, 0x00, 0x01, 0x0a
|
||||
};
|
||||
|
||||
void vc1_get_video_info(VideoDecodeInfo *info)
|
||||
void
|
||||
vc1_get_video_info (VideoDecodeInfo * info)
|
||||
{
|
||||
info->profile = GST_VAAPI_PROFILE_VC1_ADVANCED;
|
||||
info->width = VC1_CLIP_WIDTH;
|
||||
|
|
|
@ -168,7 +168,8 @@ main(int argc, char *argv[])
|
|||
g_print ("# Create window with gst_vaapi_window_x11_new_with_xid()\n");
|
||||
g_print ("#\n");
|
||||
{
|
||||
Display * const dpy = gst_vaapi_display_x11_get_display(GST_VAAPI_DISPLAY_X11(display));
|
||||
Display *const dpy =
|
||||
gst_vaapi_display_x11_get_display (GST_VAAPI_DISPLAY_X11 (display));
|
||||
Window rootwin, win;
|
||||
int screen;
|
||||
unsigned long white_pixel, black_pixel;
|
||||
|
@ -178,13 +179,8 @@ main(int argc, char *argv[])
|
|||
white_pixel = WhitePixel (dpy, screen);
|
||||
black_pixel = BlackPixel (dpy, screen);
|
||||
|
||||
win = XCreateSimpleWindow(
|
||||
dpy,
|
||||
rootwin,
|
||||
0, 0, win_width, win_height,
|
||||
0, black_pixel,
|
||||
white_pixel
|
||||
);
|
||||
win = XCreateSimpleWindow (dpy,
|
||||
rootwin, 0, 0, win_width, win_height, 0, black_pixel, white_pixel);
|
||||
if (!win)
|
||||
g_error ("could not create X window");
|
||||
|
||||
|
|
Loading…
Reference in a new issue