[tracker/miner-web-review: 65/74] tracker-extract: Fixes for the GStreamer extractor



commit 4123d709ccbc01aba9638d8cdc5aabc1c018b029
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Feb 26 12:09:40 2010 +0100

    tracker-extract: Fixes for the GStreamer extractor
    
    This patch avoids a critical in case of a bug in tagreadbin
    NB #158636. I also added the rdf:type in case there's no tag cache.

 src/tracker-extract/tracker-extract-gstreamer.c |   27 +++++++++++++++++++---
 1 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index e9c25dc..682b3fd 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -266,12 +266,15 @@ add_fraction_gst_tag (TrackerSparqlBuilder         *metadata,
 
 	ret = gst_tag_list_copy_value (&n, tag_list, tag);
 
-	f = (gfloat)gst_value_get_fraction_numerator (&n)/
+	/* Hack to avoid criticals, remove when NB# 158636 is fixed */
+	if (GST_VALUE_HOLDS_FRACTION (&n)) {
+		f = (gfloat)gst_value_get_fraction_numerator (&n)/
 		gst_value_get_fraction_denominator (&n);
 
-	if (ret) {
-		tracker_sparql_builder_predicate (metadata, key);
-		tracker_sparql_builder_object_double (metadata, (gdouble) f);
+		if (ret) {
+			tracker_sparql_builder_predicate (metadata, key);
+			tracker_sparql_builder_object_double (metadata, (gdouble) f);
+		}
 	}
 }
 
@@ -748,6 +751,22 @@ extract_metadata (MetadataExtractor      *extractor,
 		g_free (album_uri);
 
 		add_string_gst_tag (metadata, uri, "nfo:codec", extractor->tagcache, GST_TAG_AUDIO_CODEC);
+	} else {
+		if (extractor->mime == EXTRACT_MIME_AUDIO)
+			needs_audio = TRUE;
+
+		tracker_sparql_builder_predicate (metadata, "a");
+
+		if (needs_audio) {
+			tracker_sparql_builder_object (metadata, "nmm:MusicPiece");
+			tracker_sparql_builder_object (metadata, "nfo:Audio");
+		} 
+
+		if (extractor->mime == EXTRACT_MIME_VIDEO) {
+			tracker_sparql_builder_object (metadata, "nmm:Video");
+		} else if (!needs_audio) {
+			tracker_sparql_builder_object (metadata, "nfo:Image");
+		}
 	}
 
 



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