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) gst_vaapi_image_pool_set_caps(GstVaapiVideoPool *base_pool, GstCaps *caps)
{ {
GstVaapiImagePool * const pool = GST_VAAPI_IMAGE_POOL(base_pool); GstVaapiImagePool * const pool = GST_VAAPI_IMAGE_POOL(base_pool);
GstStructure *structure; GstVideoInfo vi;
gint width, height;
structure = gst_caps_get_structure(caps, 0); if (!gst_video_info_from_caps(&vi, caps))
gst_structure_get_int(structure, "width", &width); return FALSE;
gst_structure_get_int(structure, "height", &height);
pool->format = gst_vaapi_image_format_from_caps(caps); pool->format = gst_vaapi_image_format_from_video(GST_VIDEO_INFO_FORMAT(&vi));
pool->width = width; pool->width = GST_VIDEO_INFO_WIDTH(&vi);
pool->height = height; pool->height = GST_VIDEO_INFO_HEIGHT(&vi);
return TRUE; return TRUE;
} }

View file

@ -50,16 +50,14 @@ static gboolean
gst_vaapi_surface_pool_set_caps(GstVaapiVideoPool *base_pool, GstCaps *caps) gst_vaapi_surface_pool_set_caps(GstVaapiVideoPool *base_pool, GstCaps *caps)
{ {
GstVaapiSurfacePool * const pool = GST_VAAPI_SURFACE_POOL(base_pool); GstVaapiSurfacePool * const pool = GST_VAAPI_SURFACE_POOL(base_pool);
GstStructure *structure; GstVideoInfo vi;
gint width, height;
structure = gst_caps_get_structure(caps, 0); if (!gst_video_info_from_caps(&vi, caps))
gst_structure_get_int(structure, "width", &width); return FALSE;
gst_structure_get_int(structure, "height", &height);
pool->chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420; pool->chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420;
pool->width = width; pool->width = GST_VIDEO_INFO_WIDTH(&vi);
pool->height = height; pool->height = GST_VIDEO_INFO_HEIGHT(&vi);
return TRUE; return TRUE;
} }