[tracker] tracker-extract-mp3: Only set nfo:codec and nfo:channels once



commit 900e1039b641174fb9d8d309a5d2e94057dbf8e8
Author: Jürg Billeter <j bitron ch>
Date:   Thu Sep 24 18:57:54 2009 +0200

    tracker-extract-mp3: Only set nfo:codec and nfo:channels once

 src/tracker-extract/tracker-extract-mp3.c |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index 9852bc5..24bb051 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -790,18 +790,12 @@ mp3_parse_header (const gchar *data,
 
 	switch (header & mpeg_ver_mask) {
 	case 0x1000:
-		tracker_sparql_builder_predicate (metadata, "nfo:codec");
-		tracker_sparql_builder_object_string (metadata, "MPEG");
 		mpeg_ver = MPEG_V2;
 		break;
 	case 0x1800:
-		tracker_sparql_builder_predicate (metadata, "nfo:codec");
-		tracker_sparql_builder_object_string (metadata, "MPEG");
 		mpeg_ver = MPEG_V1;
 		break;
 	case 0:
-		tracker_sparql_builder_predicate (metadata, "nfo:codec");
-		tracker_sparql_builder_object_string (metadata, "MPEG");
 		mpeg_ver = MPEG_V25;
 		break;
 	default:
@@ -835,13 +829,6 @@ mp3_parse_header (const gchar *data,
 
 	spfp8 = spf_table[idx_num];
 
-	tracker_sparql_builder_predicate (metadata, "nfo:channels");
-	if ((header & ch_mask) == ch_mask) {
-		tracker_sparql_builder_object_int64 (metadata, 1);
-	} else {
-		tracker_sparql_builder_object_int64 (metadata, 2);
-	}
-
 	/* We assume mpeg version, layer and channels are constant in frames */
 	do {
 		frames++;
@@ -885,6 +872,16 @@ mp3_parse_header (const gchar *data,
 		return FALSE;
 	}
 
+	tracker_sparql_builder_predicate (metadata, "nfo:codec");
+	tracker_sparql_builder_object_string (metadata, "MPEG");
+
+	tracker_sparql_builder_predicate (metadata, "nfo:channels");
+	if ((header & ch_mask) == ch_mask) {
+		tracker_sparql_builder_object_int64 (metadata, 1);
+	} else {
+		tracker_sparql_builder_object_int64 (metadata, 2);
+	}
+
 	avg_bps /= frames;
 
 	if (filedata->duration == 0) {



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