Improve gst_vaapi_image_new() sanity checks.

This commit is contained in:
gb 2010-03-18 12:56:53 +00:00
parent 941e7d8d63
commit f80e194549

View file

@ -373,6 +373,8 @@ gst_vaapi_image_new(
guint height guint height
) )
{ {
GstVaapiImage *image;
g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display), NULL); g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display), NULL);
g_return_val_if_fail(width > 0, NULL); g_return_val_if_fail(width > 0, NULL);
g_return_val_if_fail(height > 0, NULL); g_return_val_if_fail(height > 0, NULL);
@ -380,12 +382,22 @@ gst_vaapi_image_new(
GST_DEBUG("format %" GST_FOURCC_FORMAT ", size %ux%u", GST_DEBUG("format %" GST_FOURCC_FORMAT ", size %ux%u",
GST_FOURCC_ARGS(format), width, height); GST_FOURCC_ARGS(format), width, height);
return g_object_new(GST_VAAPI_TYPE_IMAGE, image = g_object_new(
"display", display, GST_VAAPI_TYPE_IMAGE,
"format", format, "display", display,
"width", width, "format", format,
"height", height, "width", width,
NULL); "height", height,
NULL
);
if (!image)
return NULL;
if (!image->priv->is_constructed) {
g_object_unref(image);
return NULL;
}
return image;
} }
VAImageID VAImageID