From bb380557458a05774ccd22ba93fb7b24b50a61d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Fri, 13 Mar 2020 21:49:15 +0100 Subject: libs: remove GstVaapiPixmap GstVaapiPixmap is an abstract base class which only implementation were GstVaapiPixmapX11. This class were used for a special type of rendering in the tests apps, utterly unrelated in GStreamer. Since gstreamer-vaapi is no longer a general-user wrapper for VA-API we should remove this unused API. This removal drops libxrender dependency. --- tests/internal/output.c | 16 ++-------- tests/internal/output.h | 9 ------ tests/internal/simple-decoder.c | 67 +---------------------------------------- tests/internal/test-decode.c | 30 +----------------- 4 files changed, 4 insertions(+), 118 deletions(-) (limited to 'tests') diff --git a/tests/internal/output.c b/tests/internal/output.c index b100f032..2182d5ab 100644 --- a/tests/internal/output.c +++ b/tests/internal/output.c @@ -29,7 +29,6 @@ #if USE_X11 # include # include -# include #endif #if USE_GLX # include @@ -56,14 +55,12 @@ static const VideoOutputInfo g_video_outputs[] = { #if USE_X11 {"x11", gst_vaapi_display_x11_new, - gst_vaapi_window_x11_new, - gst_vaapi_pixmap_x11_new}, + gst_vaapi_window_x11_new}, #endif #if USE_GLX {"glx", gst_vaapi_display_glx_new, - gst_vaapi_window_glx_new, - gst_vaapi_pixmap_x11_new}, + gst_vaapi_window_glx_new}, #endif #if USE_DRM {"drm", @@ -228,12 +225,3 @@ video_output_create_window (GstVaapiDisplay * display, guint width, gst_vaapi_window_set_fullscreen (window, TRUE); return window; } - -GstVaapiPixmap * -video_output_create_pixmap (GstVaapiDisplay * display, GstVideoFormat format, - guint width, guint height) -{ - if (!g_video_output || !g_video_output->create_pixmap) - return NULL; - return g_video_output->create_pixmap (display, format, width, height); -} diff --git a/tests/internal/output.h b/tests/internal/output.h index 7d109f24..69299157 100644 --- a/tests/internal/output.h +++ b/tests/internal/output.h @@ -26,21 +26,16 @@ #include #include #include -#include typedef GstVaapiDisplay *(*CreateDisplayFunc)(const gchar *display_name); typedef GstVaapiWindow *(*CreateWindowFunc)(GstVaapiDisplay *display, guint width, guint height); -typedef GstVaapiPixmap *(*CreatePixmapFunc)(GstVaapiDisplay *display, - GstVideoFormat format, guint width, guint height); - typedef struct _VideoOutputInfo VideoOutputInfo; struct _VideoOutputInfo { const gchar *name; CreateDisplayFunc create_display; CreateWindowFunc create_window; - CreatePixmapFunc create_pixmap; }; gboolean @@ -58,8 +53,4 @@ video_output_create_display(const gchar *display_name); GstVaapiWindow * video_output_create_window(GstVaapiDisplay *display, guint width, guint height); -GstVaapiPixmap * -video_output_create_pixmap(GstVaapiDisplay *display, GstVideoFormat format, - guint width, guint height); - #endif /* OUTPUT_H */ diff --git a/tests/internal/simple-decoder.c b/tests/internal/simple-decoder.c index 34f17d5b..f6b14998 100644 --- a/tests/internal/simple-decoder.c +++ b/tests/internal/simple-decoder.c @@ -35,12 +35,10 @@ #include #include #include -#include #include "codec.h" #include "output.h" static gchar *g_codec_str; -static gboolean g_use_pixmap; static gboolean g_benchmark; static GOptionEntry g_options[] = { @@ -48,10 +46,6 @@ static GOptionEntry g_options[] = { 0, G_OPTION_ARG_STRING, &g_codec_str, "suggested codec", NULL}, - {"pixmap", 0, - 0, - G_OPTION_ARG_NONE, &g_use_pixmap, - "use render-to-pixmap", NULL}, {"benchmark", 0, 0, G_OPTION_ARG_NONE, &g_benchmark, @@ -100,10 +94,6 @@ typedef struct guint32 frame_duration; guint surface_width; guint surface_height; - GstVaapiPixmap *pixmaps[2]; - guint pixmap_id; - guint pixmap_width; - guint pixmap_height; GstVaapiWindow *window; guint window_width; guint window_height; @@ -434,43 +424,6 @@ ensure_window_size (App * app, GstVaapiSurface * surface) &app->window_width, &app->window_height); } -static gboolean -ensure_pixmaps (App * app, GstVaapiSurface * surface, - const GstVaapiRectangle * crop_rect) -{ - GstVaapiPixmap *pixmaps[G_N_ELEMENTS (app->pixmaps)]; - guint num_pixmaps, i, width, height; - gboolean success = FALSE; - - if (crop_rect) { - width = crop_rect->width; - height = crop_rect->height; - } else - gst_vaapi_surface_get_size (surface, &width, &height); - if (app->pixmap_width == width && app->pixmap_height == height) - return TRUE; - - for (i = 0, num_pixmaps = 0; i < G_N_ELEMENTS (pixmaps); i++) { - GstVaapiPixmap *const pixmap = - video_output_create_pixmap (app->display, GST_VIDEO_FORMAT_xRGB, - width, height); - if (!pixmap) - goto end; - pixmaps[num_pixmaps++] = pixmap; - } - - for (i = 0; i < num_pixmaps; i++) - gst_vaapi_pixmap_replace (&app->pixmaps[i], pixmaps[i]); - app->pixmap_width = width; - app->pixmap_height = height; - success = TRUE; - -end: - for (i = 0; i < num_pixmaps; i++) - gst_vaapi_pixmap_replace (&pixmaps[i], NULL); - return success; -} - static inline void renderer_wait_until (App * app, GstClockTime pts) { @@ -500,8 +453,6 @@ renderer_process (App * app, RenderFrame * rfp) ensure_window_size (app, surface); crop_rect = gst_vaapi_surface_proxy_get_crop_rect (rfp->proxy); - if (g_use_pixmap && !ensure_pixmaps (app, surface, crop_rect)) - SEND_ERROR ("failed to create intermediate pixmaps"); if (!gst_vaapi_surface_sync (surface)) SEND_ERROR ("failed to sync decoded surface"); @@ -509,19 +460,7 @@ renderer_process (App * app, RenderFrame * rfp) if (G_LIKELY (!g_benchmark)) renderer_wait_until (app, rfp->pts); - if (G_UNLIKELY (g_use_pixmap)) { - GstVaapiPixmap *const pixmap = app->pixmaps[app->pixmap_id]; - - if (!gst_vaapi_pixmap_put_surface (pixmap, surface, crop_rect, - GST_VAAPI_PICTURE_STRUCTURE_FRAME)) - SEND_ERROR ("failed to render to pixmap"); - - if (!gst_vaapi_window_put_pixmap (app->window, pixmap, NULL, NULL)) - SEND_ERROR ("failed to render surface %" GST_VAAPI_ID_FORMAT, - 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, + 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))); @@ -594,8 +533,6 @@ stop_renderer (App * app) static void app_free (App * app) { - guint i; - if (!app) return; @@ -605,8 +542,6 @@ app_free (App * app) } g_free (app->file_name); - for (i = 0; i < G_N_ELEMENTS (app->pixmaps); i++) - gst_vaapi_pixmap_replace (&app->pixmaps[i], NULL); gst_vaapi_decoder_replace (&app->decoder, NULL); gst_vaapi_window_replace (&app->window, NULL); gst_vaapi_display_replace (&app->display, NULL); diff --git a/tests/internal/test-decode.c b/tests/internal/test-decode.c index ef16aa15..3940e716 100644 --- a/tests/internal/test-decode.c +++ b/tests/internal/test-decode.c @@ -38,17 +38,12 @@ pause (void) } static gchar *g_codec_str; -static gboolean g_use_pixmap; static GOptionEntry g_options[] = { {"codec", 'c', 0, G_OPTION_ARG_STRING, &g_codec_str, "codec to test", NULL}, - {"pixmap", 0, - 0, - G_OPTION_ARG_NONE, &g_use_pixmap, - "use render-to-pixmap", NULL}, {NULL,} }; @@ -57,7 +52,6 @@ main (int argc, char *argv[]) { GstVaapiDisplay *display, *display2; GstVaapiWindow *window; - GstVaapiPixmap *pixmap = NULL; GstVaapiDecoder *decoder; GstVaapiSurfaceProxy *proxy; GstVaapiSurface *surface; @@ -104,34 +98,12 @@ main (int argc, char *argv[]) gst_vaapi_window_show (window); - if (g_use_pixmap) { - guint width, height; - - if (crop_rect) { - width = crop_rect->width; - height = crop_rect->height; - } else - gst_vaapi_surface_get_size (surface, &width, &height); - - pixmap = video_output_create_pixmap (display, GST_VIDEO_FORMAT_xRGB, - width, height); - if (!pixmap) - g_error ("could not create pixmap"); - - if (!gst_vaapi_pixmap_put_surface (pixmap, surface, crop_rect, - GST_VAAPI_PICTURE_STRUCTURE_FRAME)) - g_error ("could not render to pixmap"); - - 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, + if (!gst_vaapi_window_put_surface (window, surface, crop_rect, NULL, GST_VAAPI_PICTURE_STRUCTURE_FRAME)) g_error ("could not render surface"); pause (); - if (pixmap) - gst_vaapi_pixmap_unref (pixmap); gst_vaapi_surface_proxy_unref (proxy); gst_object_unref (decoder); gst_object_unref (window); -- cgit v1.2.1