[tracker] tracker-extract: gupnp-dlna: Update to gupnp-dlna 0.5 API



commit c1eaf636c4e6107b8dc79258072d5e4e963ff8ba
Author: Arun Raghavan <arun raghavan collabora co uk>
Date:   Mon Jan 17 16:38:41 2011 +0530

    tracker-extract: gupnp-dlna: Update to gupnp-dlna 0.5 API
    
    GstDiscoverer has been moved to gst-plugins-base as aof 0.10.31, and
    gupnp-dlna 0.5 drops the internal copy of GstDiscoverer in favour of the
    -base version. This updates the gupnp-dlna extractor to use the updated
    API resulting from this change.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=639739

 configure.ac                                     |    2 +-
 src/tracker-extract/tracker-extract-gupnp-dlna.c |   64 +++++++++++-----------
 2 files changed, 32 insertions(+), 34 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2df7c61..57eba27 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1514,7 +1514,7 @@ AC_ARG_ENABLE(video-extractor,
               [enable_video_extractor=auto])
 
 PKG_CHECK_MODULES(GUPNP_DLNA,
-                  [gupnp-dlna-1.0 >= 0.3],
+                  [gupnp-dlna-1.0 >= 0.5],
                   [have_gupnp_dlna=yes],
                   [have_gupnp_dlna=no])
 
diff --git a/src/tracker-extract/tracker-extract-gupnp-dlna.c b/src/tracker-extract/tracker-extract-gupnp-dlna.c
index 39303b7..9f39e20 100644
--- a/src/tracker-extract/tracker-extract-gupnp-dlna.c
+++ b/src/tracker-extract/tracker-extract-gupnp-dlna.c
@@ -832,8 +832,9 @@ extract_gupnp_dlna (const gchar           *uri,
 	}
 
 	if (dlna_info) {
-		GstDiscovererInformation *info     = NULL;
-		GList                    *iter;
+		GstDiscovererInfo *info = NULL;
+		GList             *streams;
+		GList             *iter;
 
 		gchar *artist, *album, *scount;
 
@@ -841,44 +842,40 @@ extract_gupnp_dlna (const gchar           *uri,
 		scount = NULL;
 		artist = NULL;
 
-		info = gupnp_dlna_information_get_info (dlna_info);
+		info = (GstDiscovererInfo *) gupnp_dlna_information_get_info (dlna_info);
 
-		iter = g_list_first (info->stream_list);
+		streams = iter = gst_discoverer_info_get_stream_list (info);
 
 		while (iter != NULL) {
-			GstStreamInformation *stream   = NULL;
-			GstTagList           *tmp      = NULL;
+			GstDiscovererStreamInfo *stream = NULL;
+			GstTagList              *tmp    = NULL;
 
 			stream = iter->data;
 
-			if (stream->misc == NULL) {
-				g_debug ("misc NULL");
-			}
-
-			switch (stream->streamtype) {
-			case GST_STREAM_AUDIO:
-				extractor.has_audio = TRUE;
-				extractor.sample_rate = ((GstStreamAudioInformation *)stream)->sample_rate;
-				extractor.bitrate     = ((GstStreamAudioInformation *)stream)->bitrate;
-				extractor.channels    = ((GstStreamAudioInformation *)stream)->channels;
-				break;
-			case GST_STREAM_VIDEO:
-				extractor.has_video    = TRUE;
-				extractor.frame_rate   = (gfloat)gst_value_get_fraction_numerator (&((GstStreamVideoInformation *)stream)->frame_rate)/
-				                            gst_value_get_fraction_denominator (&((GstStreamVideoInformation *)stream)->frame_rate);
-				extractor.width        = ((GstStreamVideoInformation *)stream)->width;
-				extractor.height       = ((GstStreamVideoInformation *)stream)->height;
-				extractor.aspect_ratio = (gfloat)gst_value_get_fraction_numerator (&((GstStreamVideoInformation *)stream)->pixel_aspect_ratio)/
-				                            gst_value_get_fraction_denominator (&((GstStreamVideoInformation *)stream)->pixel_aspect_ratio);
-				break;
-			case GST_STREAM_IMAGE:
-				extractor.has_image = TRUE;
-				break;
-			default:
-				break;
+			if (G_TYPE_CHECK_INSTANCE_TYPE (stream, GST_TYPE_DISCOVERER_AUDIO_INFO)) {
+				GstDiscovererAudioInfo *audio  = (GstDiscovererAudioInfo *)stream;
+				extractor.has_audio            = TRUE;
+				extractor.sample_rate          = gst_discoverer_audio_info_get_sample_rate (audio);
+				extractor.bitrate              = gst_discoverer_audio_info_get_bitrate (audio);
+				extractor.channels             = gst_discoverer_audio_info_get_channels (audio);
+			} else if (G_TYPE_CHECK_INSTANCE_TYPE (stream, GST_TYPE_DISCOVERER_VIDEO_INFO)) {
+				GstDiscovererVideoInfo *video  = (GstDiscovererVideoInfo *)stream;
+				if (gst_discoverer_video_info_is_image (video)) {
+					extractor.has_image    = TRUE;
+				} else {
+					extractor.has_video    = TRUE;
+					extractor.frame_rate   = (gfloat)gst_discoverer_video_info_get_framerate_num (video)/
+								gst_discoverer_video_info_get_framerate_denom (video);
+					extractor.width        = gst_discoverer_video_info_get_width (video);
+					extractor.height       = gst_discoverer_video_info_get_height (video);
+					extractor.aspect_ratio = (gfloat)gst_discoverer_video_info_get_par_num (video)/
+								gst_discoverer_video_info_get_par_denom (video);
+				}
+			} else {
+				/* Unknown type - do nothing */
 			}
 
-			tmp = gst_tag_list_merge (extractor.tags, stream->tags, GST_TAG_MERGE_APPEND);
+			tmp = gst_tag_list_merge (extractor.tags, gst_discoverer_stream_info_get_tags (stream), GST_TAG_MERGE_APPEND);
 			if (extractor.tags) {
 				gst_tag_list_free (extractor.tags);
 			}
@@ -887,7 +884,7 @@ extract_gupnp_dlna (const gchar           *uri,
 			iter = g_list_next (iter);
 		}
 
-		extractor.duration = info->duration / GST_SECOND;
+		extractor.duration = gst_discoverer_info_get_duration (info) / GST_SECOND;
 
 		extractor.dlna_profile = gupnp_dlna_information_get_name (dlna_info);
 
@@ -908,6 +905,7 @@ extract_gupnp_dlna (const gchar           *uri,
 		extract_metadata (&extractor, uri, preupdate, metadata, &artist, &album, &scount);
 
 		gst_tag_list_free (extractor.tags);
+		gst_discoverer_stream_info_list_free (streams);
 		g_free (artist);
 		g_free (album);
 		g_free (scount);



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