diff -r 992abe7045a2 -r b81aea41900f gst-plugins-mythtv/src/gstmythtvsrc.c --- a/gst-plugins-mythtv/src/gstmythtvsrc.c Fri Apr 13 20:32:42 2007 +0100 +++ b/gst-plugins-mythtv/src/gstmythtvsrc.c Fri Apr 13 21:03:50 2007 +0100 @@ -113,6 +113,8 @@ PROP_GMYTHTV_CHANNEL_NUM }; +static void gst_mythtv_src_clear (GstMythtvSrc *mythtv_src); + static void gst_mythtv_src_finalize (GObject * gobject); static GstFlowReturn gst_mythtv_src_create (GstPushSrc * psrc, @@ -297,37 +299,45 @@ } static void +gst_mythtv_src_clear (GstMythtvSrc *mythtv_src) +{ + + if (mythtv_src->spawn_livetv) { + g_object_unref (mythtv_src->spawn_livetv); + mythtv_src->spawn_livetv = NULL; + } + + if (mythtv_src->file) { + g_object_unref (mythtv_src->file); + mythtv_src->file = NULL; + } + + if (mythtv_src->backend_info) { + g_object_unref (mythtv_src->backend_info); + mythtv_src->backend_info = NULL; + } + + if (mythtv_src->uri_name) { + g_free (mythtv_src->uri_name); + } + + if (mythtv_src->user_agent) { + g_free (mythtv_src->user_agent); + } + + if (mythtv_src->bytes_queue) { + g_byte_array_free (mythtv_src->bytes_queue, TRUE); + mythtv_src->bytes_queue = NULL; + } + +} + +static void gst_mythtv_src_finalize (GObject * gobject) { GstMythtvSrc *this = GST_MYTHTV_SRC (gobject); - if (this->spawn_livetv) { - g_object_unref (this->spawn_livetv); - this->spawn_livetv = NULL; - } - - if (this->file) { - g_object_unref (this->file); - this->file = NULL; - } - - if (this->backend_info) { - g_object_unref (this->backend_info); - this->backend_info = NULL; - } - - if (this->uri_name) { - g_free (this->uri_name); - } - - if (this->user_agent) { - g_free (this->user_agent); - } - - if (this->bytes_queue) { - g_byte_array_free (this->bytes_queue, TRUE); - this->bytes_queue = NULL; - } + gst_mythtv_src_clear (this); G_OBJECT_CLASS (parent_class)->finalize (gobject); } @@ -828,16 +838,11 @@ static gboolean gst_mythtv_src_stop (GstBaseSrc * bsrc) { - GstMythtvSrc *src; + GstMythtvSrc *src = GST_MYTHTV_SRC (bsrc); + + gst_mythtv_src_clear (src); - src = GST_MYTHTV_SRC (bsrc); - - if (src->uri_name) { - g_free (src->uri_name); - src->uri_name = NULL; - } - - src->eos = FALSE; + /* src->eos = FALSE; */ return TRUE; }