emotion: fix shutdown of gstreamer plugin.
authorcedric <cedric>
Fri, 24 Jun 2011 14:52:59 +0000 (14:52 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 24 Jun 2011 14:52:59 +0000 (14:52 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/emotion@60666 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/gstreamer/emotion_gstreamer.c

index 0c3f6fd..1712184 100644 (file)
@@ -353,13 +353,18 @@ em_shutdown(void *video)
    if (!ev)
      return 0;
 
+   if (ev->pipeline)
+     {
+       gst_element_set_state(ev->pipeline, GST_STATE_NULL);
+       gst_object_unref(ev->pipeline);
+       ev->pipeline = NULL;
+     }
+
    EINA_LIST_FREE(ev->audio_streams, astream)
      free(astream);
    EINA_LIST_FREE(ev->video_streams, vstream)
      free(vstream);
 
-   gst_deinit();
-
    free(ev);
 
    return 1;
@@ -670,6 +675,12 @@ em_file_close(void *video)
    if (!ev)
      return;
 
+   if (ev->eos_bus)
+     {
+        gst_object_unref(GST_OBJECT(ev->eos_bus));
+        ev->eos_bus = NULL;
+     }
+
    /* we clear the stream lists */
    EINA_LIST_FREE(ev->audio_streams, astream)
      free(astream);
@@ -683,24 +694,11 @@ em_file_close(void *video)
         ev->eos_timer = NULL;
      }
 
-   if (ev->eos_bus)
-     {
-        gst_object_unref(GST_OBJECT(ev->eos_bus));
-        ev->eos_bus = NULL;
-     }
-
    if (ev->metadata)
      {
         _free_metadata(ev->metadata);
         ev->metadata = NULL;
      }
-
-   if (ev->pipeline)
-     {
-        gst_element_set_state(ev->pipeline, GST_STATE_NULL);
-        gst_object_unref(ev->pipeline);
-        ev->pipeline = NULL;
-     }
 }
 
 static void
@@ -1415,6 +1413,8 @@ void
 gstreamer_module_shutdown(void)
 {
    _emotion_module_unregister("gstreamer");
+
+   gst_deinit();
 }
 
 #ifndef EMOTION_STATIC_BUILD_GSTREAMER