videopool: simplify creation of video objects pool.

This commit is contained in:
Gwenole Beauchesne 2013-05-03 19:02:23 +02:00
parent c2abeb1290
commit 4cf1213b04
2 changed files with 11 additions and 15 deletions

View file

@ -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;
}

View file

@ -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;
}