[rygel-gst-0-10-plugins] Small code tweaks.



commit 27899bedec22392e02652c67ee6111479ea8c2d4
Author: Krzesimir Nowak <krnowak openismus com>
Date:   Mon Feb 11 13:54:10 2013 +0100

    Small code tweaks.

 src/media-export/rygel-media-export-item-factory.c |   22 +++++++------------
 1 files changed, 8 insertions(+), 14 deletions(-)
---
diff --git a/src/media-export/rygel-media-export-item-factory.c b/src/media-export/rygel-media-export-item-factory.c
index 2c49b01..5a7a9e5 100644
--- a/src/media-export/rygel-media-export-item-factory.c
+++ b/src/media-export/rygel-media-export-item-factory.c
@@ -39,23 +39,22 @@ rygel_media_export_item_factory_create_simple (RygelMediaContainer *parent, GFil
 
   title =  g_strdup (g_file_info_get_display_name (info));
   mime = g_content_type_get_mime_type (g_file_info_get_content_type (info));
+  id = rygel_media_export_media_cache_get_id (file);
 
   if (g_str_has_prefix (mime, "video/")) {
-    gchar *id = rygel_media_export_media_cache_get_id (file);
     item = RYGEL_MEDIA_ITEM (rygel_media_export_video_item_new (id, parent, title, RYGEL_VIDEO_ITEM_UPNP_CLASS));
-    g_free (id);
   } else if (g_str_has_prefix (mime, "image/")) {
-    gchar *id = rygel_media_export_media_cache_get_id (file);
     item = RYGEL_MEDIA_ITEM (rygel_media_export_photo_item_new (id, parent, title, RYGEL_PHOTO_ITEM_UPNP_CLASS));
-    g_free (id);
   } else /* if (g_str_has_prefix (mime, "audio/") ||
     g_strcmp0 (mime, "application/ogg") == 0) */ {
-    gchar *id = rygel_media_export_media_cache_get_id (file);
     item = RYGEL_MEDIA_ITEM (rygel_media_export_music_item_new (id, parent, title, RYGEL_MUSIC_ITEM_UPNP_CLASS));
-    g_free (id);
   } /* TODO: playlist */
+  g_free (id);
+  g_free (title);
 
   rygel_media_item_set_mime_type (item, mime);
+  g_free (mime);
+
   rygel_media_item_set_size (item,
     (gint64) g_file_info_get_size (info));
   rygel_media_object_set_modified (RYGEL_MEDIA_OBJECT (item),
@@ -65,9 +64,6 @@ rygel_media_export_item_factory_create_simple (RygelMediaContainer *parent, GFil
   rygel_media_item_add_uri (item, uri);
   g_free (uri);
 
-  g_free (mime);
-  g_free (title);
-
   return item;
 }
 
@@ -123,11 +119,8 @@ rygel_media_export_item_factory_create_from_info (RygelMediaContainer *parent, G
     result = NULL;
   }
 
-  g_list_foreach (audio_streams, (GFunc) gst_mini_object_unref, NULL);
-  g_list_free (audio_streams);
-
-  g_list_foreach (video_streams, (GFunc) gst_mini_object_unref, NULL);
-  g_list_free (video_streams);
+  gst_discoverer_stream_info_list_free (audio_streams);
+  gst_discoverer_stream_info_list_free (video_streams);
 
   g_free (id);
 
@@ -289,6 +282,7 @@ RygelMediaItem *rygel_media_export_item_factory_fill_music_item (RygelMediaExpor
 
       g_object_unref (thumb);
       g_object_unref (store); /* TODO: Did get_default() return a reference()? */
+      break;
     }
     default:
       break;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]