{
GstMsdkDec *thiz = GST_MSDKDEC (decoder);
- if (thiz->context)
- gst_object_replace ((GstObject **) & thiz->context, NULL);
+ gst_clear_object (&thiz->context);
return TRUE;
}
if (thiz->do_realloc || !thiz->pool) {
GstVideoCodecState *output_state =
gst_video_decoder_get_output_state (GST_VIDEO_DECODER (thiz));
- if (thiz->pool)
- gst_object_replace ((GstObject **) & thiz->pool, NULL);
+ gst_clear_object (&thiz->pool);
GST_INFO_OBJECT (decoder, "create new MSDK bufferpool");
thiz->pool =
gst_msdkdec_create_buffer_pool (thiz, &output_state->info, min_buffers);
GstMsdkDec *thiz = GST_MSDKDEC (object);
g_array_unref (thiz->tasks);
- g_object_unref (thiz->adapter);
+ thiz->tasks = NULL;
+ g_clear_object (&thiz->adapter);
/* NULL is the empty list. */
if (G_UNLIKELY (thiz->decoded_msdk_surfaces != NULL)) {
GST_DEBUG_OBJECT (thiz, "Closing encoder with context %" GST_PTR_FORMAT,
thiz->context);
- gst_object_replace ((GstObject **) & thiz->msdk_pool, NULL);
- gst_object_replace ((GstObject **) & thiz->msdk_converted_pool, NULL);
+ gst_clear_object (&thiz->msdk_pool);
+ gst_clear_object (&thiz->msdk_converted_pool);
if (thiz->use_video_memory)
gst_msdk_frame_free (thiz->context, &thiz->alloc_resp);
goto done;
}
/* Release current pool because we are going to create a new one */
- gst_object_replace ((GstObject **) & thiz->msdk_converted_pool, NULL);
+ gst_clear_object (&thiz->msdk_converted_pool);
}
/* Otherwise create a new pool */
gst_video_codec_state_unref (thiz->input_state);
thiz->input_state = NULL;
- gst_object_replace ((GstObject **) & thiz->context, NULL);
+ gst_clear_object (&thiz->context);
return TRUE;
}
gst_video_codec_state_unref (thiz->input_state);
thiz->input_state = NULL;
- gst_object_replace ((GstObject **) & thiz->msdk_pool, NULL);
- gst_object_replace ((GstObject **) & thiz->msdk_converted_pool, NULL);
+ gst_clear_object (&thiz->msdk_pool);
+ gst_clear_object (&thiz->msdk_converted_pool);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
msdk_status_to_string (status));
}
- if (thiz->context)
- gst_object_replace ((GstObject **) & thiz->context, NULL);
+ gst_clear_object (&thiz->context);
memset (&thiz->param, 0, sizeof (thiz->param));
- if (thiz->sinkpad_buffer_pool)
- gst_object_unref (thiz->sinkpad_buffer_pool);
- thiz->sinkpad_buffer_pool = NULL;
- if (thiz->srcpad_buffer_pool)
- gst_object_unref (thiz->srcpad_buffer_pool);
- thiz->srcpad_buffer_pool = NULL;
+ gst_clear_object (&thiz->sinkpad_buffer_pool);
+ gst_clear_object (&thiz->srcpad_buffer_pool);
thiz->buffer_duration = GST_CLOCK_TIME_NONE;
gst_video_info_init (&thiz->sinkpad_info);
no_vpp:
GST_OBJECT_UNLOCK (thiz);
- if (thiz->context)
- gst_object_replace ((GstObject **) & thiz->context, NULL);
+ gst_clear_object (&thiz->context);
return FALSE;
}