New refcounting policy. All getters return a reference, not a copy. So the user shall reference the object itself, should he wish so.

This commit is contained in:
gb 2010-03-11 12:30:12 +00:00
parent e59eff6902
commit ac1243b28c
3 changed files with 7 additions and 11 deletions

View file

@ -123,7 +123,7 @@ gst_vaapi_image_set_property(
switch (prop_id) {
case PROP_DISPLAY:
priv->display = g_object_ref(g_value_get_pointer(value));
priv->display = g_object_ref(g_value_get_object(value));
break;
case PROP_WIDTH:
priv->width = g_value_get_uint(value);
@ -148,12 +148,11 @@ gst_vaapi_image_get_property(
GParamSpec *pspec
)
{
GstVaapiImage * const image = GST_VAAPI_IMAGE(object);
GstVaapiImagePrivate * const priv = image->priv;
GstVaapiImage * const image = GST_VAAPI_IMAGE(object);
switch (prop_id) {
case PROP_DISPLAY:
g_value_set_pointer(value, g_object_ref(priv->display));
g_value_set_pointer(value, gst_vaapi_image_get_display(image));
break;
case PROP_IMAGE_ID:
g_value_set_uint(value, gst_vaapi_image_get_id(image));
@ -296,7 +295,7 @@ gst_vaapi_image_get_display(GstVaapiImage *image)
{
g_return_val_if_fail(GST_VAAPI_IS_IMAGE(image), NULL);
return g_object_ref(image->priv->display);
return image->priv->display;
}
guint

View file

@ -60,7 +60,6 @@ gst_vaapi_subpicture_destroy(GstVaapiSubpicture *subpicture)
gst_vaapi_display_get_display(display),
priv->subpicture_id
);
g_object_unref(display);
if (!vaapi_check_status(status, "vaDestroySubpicture()"))
g_warning("failed to destroy subpicture 0x%08x\n",
priv->subpicture_id);
@ -94,7 +93,6 @@ gst_vaapi_subpicture_create(GstVaapiSubpicture *subpicture)
gst_vaapi_image_get_id(priv->image),
&subpicture_id
);
g_object_unref(display);
if (!vaapi_check_status(status, "vaCreateSubpicture()"))
return FALSE;
@ -218,7 +216,7 @@ gst_vaapi_subpicture_get_image(GstVaapiSubpicture *subpicture)
{
g_return_val_if_fail(GST_VAAPI_IS_SUBPICTURE(subpicture), NULL);
return g_object_ref(subpicture->priv->image);
return subpicture->priv->image;
}
void

View file

@ -138,8 +138,7 @@ gst_vaapi_surface_get_property(GObject *object,
switch (prop_id) {
case PROP_DISPLAY:
/* gst_vaapi_surface_get_display() already refs the object */
g_value_take_object(value, gst_vaapi_surface_get_display(surface));
g_value_set_object(value, gst_vaapi_surface_get_display(surface));
break;
case PROP_SURFACE_ID:
g_value_set_uint(value, gst_vaapi_surface_get_id(surface));
@ -272,7 +271,7 @@ gst_vaapi_surface_get_display(GstVaapiSurface *surface)
{
g_return_val_if_fail(GST_VAAPI_IS_SURFACE(surface), NULL);
return g_object_ref(surface->priv->display);
return surface->priv->display;
}
guint