static void gst_bus_dispose (GObject * object) { GstBus *bus = GST_BUS (object); if (bus->priv->queue) { GstMessage *message; g_mutex_lock (&bus->priv->queue_lock); do { message = gst_atomic_queue_pop (bus->priv->queue); if (message) gst_message_unref (message); } while (message != NULL); gst_atomic_queue_unref (bus->priv->queue); bus->priv->queue = NULL; g_mutex_unlock (&bus->priv->queue_lock); g_mutex_clear (&bus->priv->queue_lock); if (bus->priv->poll) gst_poll_free (bus->priv->poll); bus->priv->poll = NULL; } G_OBJECT_CLASS (parent_class)->dispose (object); }
static void destroy_stream(GstScreamStream *stream) { clear_packet_queue(stream->packet_queue); gst_atomic_queue_unref(stream->packet_queue); g_free(stream); }
static void gst_v4l2_allocator_finalize (GObject * obj) { GstV4l2Allocator *allocator = (GstV4l2Allocator *) obj; GST_LOG_OBJECT (obj, "called"); v4l2_close (allocator->video_fd); gst_atomic_queue_unref (allocator->free_queue); G_OBJECT_CLASS (parent_class)->finalize (obj); }
static void gst_buffer_pool_finalize (GObject * object) { GstBufferPool *pool; GstBufferPoolPrivate *priv; pool = GST_BUFFER_POOL_CAST (object); priv = pool->priv; GST_DEBUG_OBJECT (pool, "finalize"); gst_buffer_pool_set_active (pool, FALSE); gst_atomic_queue_unref (priv->queue); gst_poll_free (priv->poll); gst_structure_free (priv->config); g_rec_mutex_clear (&priv->rec_lock); if (priv->allocator) gst_object_unref (priv->allocator); G_OBJECT_CLASS (gst_buffer_pool_parent_class)->finalize (object); }
/* Close the decoder instance */ static void CloseDecoder( vlc_object_t *p_this ) { decoder_t *p_dec = ( decoder_t* )p_this; decoder_sys_t *p_sys = p_dec->p_sys; gboolean b_running = p_sys->b_running; if( b_running ) { GstMessage *p_msg; GstFlowReturn i_ret; p_sys->b_running = false; /* Send EOS to the pipeline */ i_ret = gst_app_src_end_of_stream( GST_APP_SRC_CAST( p_sys->p_decode_src )); msg_Dbg( p_dec, "app src eos: %s", gst_flow_get_name( i_ret ) ); /* and catch it on the bus with a timeout */ p_msg = gst_bus_timed_pop_filtered( p_sys->p_bus, 2000000000ULL, GST_MESSAGE_EOS | GST_MESSAGE_ERROR ); if( p_msg ) { switch( GST_MESSAGE_TYPE( p_msg ) ){ case GST_MESSAGE_EOS: msg_Dbg( p_dec, "got eos" ); break; default: p_dec->b_error = default_msg_handler( p_dec, p_msg ); if( p_dec->b_error ) msg_Err( p_dec, "pipeline may not close gracefully" ); break; } gst_message_unref( p_msg ); } else msg_Warn( p_dec, "no message, pipeline may not close gracefully" ); } /* Remove any left-over buffers from the queue */ if( p_sys->p_que ) { GstBuffer *p_buf; while( ( p_buf = gst_atomic_queue_pop( p_sys->p_que ) ) ) gst_buffer_unref( p_buf ); gst_atomic_queue_unref( p_sys->p_que ); } if( b_running && gst_element_set_state( p_sys->p_decoder, GST_STATE_NULL ) != GST_STATE_CHANGE_SUCCESS ) msg_Err( p_dec, "failed to change the state to NULL," \ "pipeline may not close gracefully" ); if( p_sys->p_allocator ) gst_object_unref( p_sys->p_allocator ); if( p_sys->p_bus ) gst_object_unref( p_sys->p_bus ); if( p_sys->p_decode_src ) gst_object_unref( p_sys->p_decode_src ); if( p_sys->p_decode_in ) gst_object_unref( p_sys->p_decode_in ); if( p_sys->p_decode_out ) gst_object_unref( p_sys->p_decode_out ); if( p_sys->p_decoder ) gst_object_unref( p_sys->p_decoder ); free( p_sys ); }