From 4cf1213b0452cac6c69f8c76f3d76618aa1d6bc7 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Fri, 3 May 2013 19:02:23 +0200 Subject: [PATCH] videopool: simplify creation of video objects pool. --- gst-libs/gst/vaapi/gstvaapiimagepool.c | 14 ++++++-------- gst-libs/gst/vaapi/gstvaapisurfacepool.c | 12 +++++------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapiimagepool.c b/gst-libs/gst/vaapi/gstvaapiimagepool.c index 1699c2f544..311f9f0bec 100644 --- a/gst-libs/gst/vaapi/gstvaapiimagepool.c +++ b/gst-libs/gst/vaapi/gstvaapiimagepool.c @@ -50,16 +50,14 @@ static gboolean gst_vaapi_image_pool_set_caps(GstVaapiVideoPool *base_pool, GstCaps *caps) { GstVaapiImagePool * const pool = GST_VAAPI_IMAGE_POOL(base_pool); - GstStructure *structure; - gint width, height; + GstVideoInfo vi; - structure = gst_caps_get_structure(caps, 0); - gst_structure_get_int(structure, "width", &width); - gst_structure_get_int(structure, "height", &height); + if (!gst_video_info_from_caps(&vi, caps)) + return FALSE; - pool->format = gst_vaapi_image_format_from_caps(caps); - pool->width = width; - pool->height = height; + pool->format = gst_vaapi_image_format_from_video(GST_VIDEO_INFO_FORMAT(&vi)); + pool->width = GST_VIDEO_INFO_WIDTH(&vi); + pool->height = GST_VIDEO_INFO_HEIGHT(&vi); return TRUE; } diff --git a/gst-libs/gst/vaapi/gstvaapisurfacepool.c b/gst-libs/gst/vaapi/gstvaapisurfacepool.c index 33118a653c..d57fb849a2 100644 --- a/gst-libs/gst/vaapi/gstvaapisurfacepool.c +++ b/gst-libs/gst/vaapi/gstvaapisurfacepool.c @@ -50,16 +50,14 @@ static gboolean gst_vaapi_surface_pool_set_caps(GstVaapiVideoPool *base_pool, GstCaps *caps) { GstVaapiSurfacePool * const pool = GST_VAAPI_SURFACE_POOL(base_pool); - GstStructure *structure; - gint width, height; + GstVideoInfo vi; - structure = gst_caps_get_structure(caps, 0); - gst_structure_get_int(structure, "width", &width); - gst_structure_get_int(structure, "height", &height); + if (!gst_video_info_from_caps(&vi, caps)) + return FALSE; pool->chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420; - pool->width = width; - pool->height = height; + pool->width = GST_VIDEO_INFO_WIDTH(&vi); + pool->height = GST_VIDEO_INFO_HEIGHT(&vi); return TRUE; }