mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-03 16:09:39 +00:00
plugins: use g_clear_object() wherever applicable.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
dba174906a
commit
5ff0837b32
5 changed files with 21 additions and 72 deletions
|
@ -459,10 +459,7 @@ gst_vaapidecode_finalize(GObject *object)
|
|||
decode->srcpad_caps = NULL;
|
||||
}
|
||||
|
||||
if (decode->display) {
|
||||
g_object_unref(decode->display);
|
||||
decode->display = NULL;
|
||||
}
|
||||
g_clear_object(&decode->display);
|
||||
|
||||
if (decode->allowed_caps) {
|
||||
gst_caps_unref(decode->allowed_caps);
|
||||
|
@ -546,10 +543,7 @@ gst_vaapidecode_change_state(GstElement *element, GstStateChange transition)
|
|||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||
gst_vaapidecode_destroy(decode);
|
||||
if (decode->display) {
|
||||
g_object_unref(decode->display);
|
||||
decode->display = NULL;
|
||||
}
|
||||
g_clear_object(&decode->display);
|
||||
decode->is_ready = FALSE;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -222,15 +222,8 @@ gst_vaapidownload_destroy(GstVaapiDownload *download)
|
|||
download->allowed_caps = NULL;
|
||||
}
|
||||
|
||||
if (download->images) {
|
||||
g_object_unref(download->images);
|
||||
download->images = NULL;
|
||||
}
|
||||
|
||||
if (download->display) {
|
||||
g_object_unref(download->display);
|
||||
download->display = NULL;
|
||||
}
|
||||
g_clear_object(&download->images);
|
||||
g_clear_object(&download->display);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -319,10 +312,8 @@ gst_vaapidownload_stop(GstBaseTransform *trans)
|
|||
{
|
||||
GstVaapiDownload * const download = GST_VAAPIDOWNLOAD(trans);
|
||||
|
||||
if (download->display) {
|
||||
g_object_unref(download->display);
|
||||
download->display = NULL;
|
||||
}
|
||||
g_clear_object(&download->display);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -531,8 +522,7 @@ gst_vaapidownload_ensure_image_pool(GstVaapiDownload *download, GstCaps *caps)
|
|||
download->image_format = format;
|
||||
download->image_width = width;
|
||||
download->image_height = height;
|
||||
if (download->images)
|
||||
g_object_unref(download->images);
|
||||
g_clear_object(&download->images);
|
||||
download->images = gst_vaapi_image_pool_new(download->display, caps);
|
||||
if (!download->images)
|
||||
return FALSE;
|
||||
|
|
|
@ -213,10 +213,7 @@ gst_vaapipostproc_destroy(GstVaapiPostproc *postproc)
|
|||
{
|
||||
gst_caps_replace(&postproc->postproc_caps, NULL);
|
||||
|
||||
if (postproc->display) {
|
||||
g_object_unref(postproc->display);
|
||||
postproc->display = NULL;
|
||||
}
|
||||
g_clear_object(&postproc->display);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -229,15 +229,8 @@ gst_vaapisink_xoverlay_iface_init(GstXOverlayClass *iface)
|
|||
static void
|
||||
gst_vaapisink_destroy(GstVaapiSink *sink)
|
||||
{
|
||||
if (sink->texture) {
|
||||
g_object_unref(sink->texture);
|
||||
sink->texture = NULL;
|
||||
}
|
||||
|
||||
if (sink->display) {
|
||||
g_object_unref(sink->display);
|
||||
sink->display = NULL;
|
||||
}
|
||||
g_clear_object(&sink->texture);
|
||||
g_clear_object(&sink->display);
|
||||
|
||||
gst_caps_replace(&sink->caps, NULL);
|
||||
}
|
||||
|
@ -402,10 +395,7 @@ gst_vaapisink_ensure_window_xid(GstVaapiSink *sink, guintptr window_id)
|
|||
gst_vaapi_window_x11_get_xid(GST_VAAPI_WINDOW_X11(sink->window)) == xid)
|
||||
return TRUE;
|
||||
|
||||
if (sink->window) {
|
||||
g_object_unref(sink->window);
|
||||
sink->window = NULL;
|
||||
}
|
||||
g_clear_object(&sink->window);
|
||||
|
||||
#if USE_VAAPISINK_GLX
|
||||
if (sink->use_glx)
|
||||
|
@ -429,15 +419,9 @@ gst_vaapisink_stop(GstBaseSink *base_sink)
|
|||
{
|
||||
GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
|
||||
|
||||
if (sink->window) {
|
||||
g_object_unref(sink->window);
|
||||
sink->window = NULL;
|
||||
}
|
||||
g_clear_object(&sink->window);
|
||||
g_clear_object(&sink->display);
|
||||
|
||||
if (sink->display) {
|
||||
g_object_unref(sink->display);
|
||||
sink->display = NULL;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -688,8 +672,7 @@ gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *buffer)
|
|||
gst_video_buffer_get_overlay_composition(buffer);
|
||||
|
||||
if (sink->display != gst_vaapi_video_buffer_get_display (vbuffer)) {
|
||||
if (sink->display)
|
||||
g_object_unref (sink->display);
|
||||
g_clear_object(&sink->display);
|
||||
sink->display = g_object_ref (gst_vaapi_video_buffer_get_display (vbuffer));
|
||||
}
|
||||
|
||||
|
|
|
@ -208,20 +208,9 @@ gst_video_context_interface_init(GstVideoContextInterface *iface)
|
|||
static void
|
||||
gst_vaapiupload_destroy(GstVaapiUpload *upload)
|
||||
{
|
||||
if (upload->images) {
|
||||
g_object_unref(upload->images);
|
||||
upload->images = NULL;
|
||||
}
|
||||
|
||||
if (upload->surfaces) {
|
||||
g_object_unref(upload->surfaces);
|
||||
upload->surfaces = NULL;
|
||||
}
|
||||
|
||||
if (upload->display) {
|
||||
g_object_unref(upload->display);
|
||||
upload->display = NULL;
|
||||
}
|
||||
g_clear_object(&upload->images);
|
||||
g_clear_object(&upload->surfaces);
|
||||
g_clear_object(&upload->display);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -394,10 +383,8 @@ gst_vaapiupload_stop(GstBaseTransform *trans)
|
|||
{
|
||||
GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans);
|
||||
|
||||
if (upload->display) {
|
||||
g_object_unref(upload->display);
|
||||
upload->display = NULL;
|
||||
}
|
||||
g_clear_object(&upload->display);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -523,8 +510,7 @@ gst_vaapiupload_ensure_image_pool(GstVaapiUpload *upload, GstCaps *caps)
|
|||
if (width != upload->image_width || height != upload->image_height) {
|
||||
upload->image_width = width;
|
||||
upload->image_height = height;
|
||||
if (upload->images)
|
||||
g_object_unref(upload->images);
|
||||
g_clear_object(&upload->images);
|
||||
upload->images = gst_vaapi_image_pool_new(upload->display, caps);
|
||||
if (!upload->images)
|
||||
return FALSE;
|
||||
|
@ -545,8 +531,7 @@ gst_vaapiupload_ensure_surface_pool(GstVaapiUpload *upload, GstCaps *caps)
|
|||
if (width != upload->surface_width || height != upload->surface_height) {
|
||||
upload->surface_width = width;
|
||||
upload->surface_height = height;
|
||||
if (upload->surfaces)
|
||||
g_object_unref(upload->surfaces);
|
||||
g_clear_object(&upload->surfaces);
|
||||
upload->surfaces = gst_vaapi_surface_pool_new(upload->display, caps);
|
||||
if (!upload->surfaces)
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in a new issue