diff options
author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2013-07-08 17:01:21 +0200 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2013-07-08 18:52:56 +0200 |
commit | 0829d94f38d88f5f59311023ce193993ce088800 (patch) | |
tree | 0e108db33649052ff06096ec9dce7acca87e40b9 /tests | |
parent | 5bbab30859b599a8473dda2b83744eaefaff4fd2 (diff) | |
download | gstreamer-vaapi-0829d94f38d88f5f59311023ce193993ce088800.tar.gz |
tests: add basic support for video cropping.
Change generic decoder of sample I-frame to return a GstVaapiSurfaceProxy
instead of a plain GstVaapiSurface. This means that we can now retrieve
the frame cropping rectangle from the surface proxy, along with additional
information if ever needed.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/decoder.c | 10 | ||||
-rw-r--r-- | tests/decoder.h | 2 | ||||
-rw-r--r-- | tests/test-decode.c | 12 | ||||
-rw-r--r-- | tests/test-subpicture.c | 8 |
4 files changed, 18 insertions, 14 deletions
diff --git a/tests/decoder.c b/tests/decoder.c index b051f46b..f9326583 100644 --- a/tests/decoder.c +++ b/tests/decoder.c @@ -171,10 +171,9 @@ decoder_put_buffers(GstVaapiDecoder *decoder) return TRUE; } -GstVaapiSurface * +GstVaapiSurfaceProxy * decoder_get_surface(GstVaapiDecoder *decoder) { - GstVaapiSurface *surface; GstVaapiSurfaceProxy *proxy; GstVaapiDecoderStatus status; @@ -185,12 +184,7 @@ decoder_get_surface(GstVaapiDecoder *decoder) GST_ERROR("failed to get decoded surface (decoder status %d)", status); return NULL; } - - /* Note: we only have a single I-frame to decode, so this is fine - to just release the surface proxy right away */ - surface = gst_vaapi_surface_proxy_get_surface(proxy); - gst_vaapi_surface_proxy_unref(proxy); - return surface; + return proxy; } const gchar * diff --git a/tests/decoder.h b/tests/decoder.h index 7ab95719..b13712e5 100644 --- a/tests/decoder.h +++ b/tests/decoder.h @@ -30,7 +30,7 @@ decoder_new(GstVaapiDisplay *display, const gchar *codec_name); gboolean decoder_put_buffers(GstVaapiDecoder *decoder); -GstVaapiSurface * +GstVaapiSurfaceProxy * decoder_get_surface(GstVaapiDecoder *decoder); const gchar * diff --git a/tests/test-decode.c b/tests/test-decode.c index 2d49a6c3..cff76122 100644 --- a/tests/test-decode.c +++ b/tests/test-decode.c @@ -51,7 +51,9 @@ main(int argc, char *argv[]) GstVaapiDisplay *display, *display2; GstVaapiWindow *window; GstVaapiDecoder *decoder; + GstVaapiSurfaceProxy *proxy; GstVaapiSurface *surface; + const GstVaapiRectangle *crop_rect; static const guint win_width = 640; static const guint win_height = 480; @@ -85,18 +87,22 @@ main(int argc, char *argv[]) if (!decoder_put_buffers(decoder)) g_error("could not fill decoder with sample data"); - surface = decoder_get_surface(decoder); - if (!surface) + proxy = decoder_get_surface(decoder); + if (!proxy) g_error("could not get decoded surface"); + surface = gst_vaapi_surface_proxy_get_surface(proxy); + crop_rect = gst_vaapi_surface_proxy_get_crop_rect(proxy); + gst_vaapi_window_show(window); - if (!gst_vaapi_window_put_surface(window, surface, NULL, NULL, + if (!gst_vaapi_window_put_surface(window, surface, crop_rect, NULL, GST_VAAPI_PICTURE_STRUCTURE_FRAME)) g_error("could not render surface"); pause(); + gst_vaapi_surface_proxy_unref(proxy); gst_vaapi_decoder_unref(decoder); gst_vaapi_window_unref(window); gst_vaapi_display_unref(display); diff --git a/tests/test-subpicture.c b/tests/test-subpicture.c index 0f828aea..87cbace6 100644 --- a/tests/test-subpicture.c +++ b/tests/test-subpicture.c @@ -77,6 +77,7 @@ main(int argc, char *argv[]) GstVaapiDisplay *display; GstVaapiWindow *window; GstVaapiDecoder *decoder; + GstVaapiSurfaceProxy *proxy; GstVaapiSurface *surface; GstBuffer *buffer; VideoSubpictureInfo subinfo; @@ -113,10 +114,12 @@ main(int argc, char *argv[]) if (!decoder_put_buffers(decoder)) g_error("could not fill decoder with sample data"); - surface = decoder_get_surface(decoder); - if (!surface) + proxy = decoder_get_surface(decoder); + if (!proxy) g_error("could not get decoded surface"); + surface = gst_vaapi_surface_proxy_get_surface(proxy); + subpicture_get_info(&subinfo); buffer = gst_buffer_new_and_alloc(subinfo.data_size); upload_subpicture(buffer, &subinfo); @@ -171,6 +174,7 @@ main(int argc, char *argv[]) pause(); gst_video_overlay_composition_unref(compo); + gst_vaapi_surface_proxy_unref(proxy); gst_vaapi_decoder_unref(decoder); gst_vaapi_window_unref(window); gst_vaapi_display_unref(display); |