tracker r2203 - in branches/indexer-split: . src/tracker-extract
- From: mottela svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2203 - in branches/indexer-split: . src/tracker-extract
- Date: Mon, 8 Sep 2008 19:32:13 +0000 (UTC)
Author: mottela
Date: Mon Sep 8 19:32:13 2008
New Revision: 2203
URL: http://svn.gnome.org/viewvc/tracker?rev=2203&view=rev
Log:
Changed image extractors to take native metadata over exif/xmp
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/tracker-extract/tracker-extract-jpeg.c
branches/indexer-split/src/tracker-extract/tracker-extract-png.c
branches/indexer-split/src/tracker-extract/tracker-extract-tiff.c
Modified: branches/indexer-split/src/tracker-extract/tracker-extract-jpeg.c
==============================================================================
--- branches/indexer-split/src/tracker-extract/tracker-extract-jpeg.c (original)
+++ branches/indexer-split/src/tracker-extract/tracker-extract-jpeg.c Mon Sep 8 19:32:13 2008
@@ -205,13 +205,7 @@
jpeg_calc_output_dimensions(&cinfo);
*/
-
- g_hash_table_insert (metadata, g_strdup ("Image:Width"),
- g_strdup_printf ("%u", (unsigned int) cinfo.image_width));
- g_hash_table_insert (metadata, g_strdup ("Image:Height"),
- g_strdup_printf ("%u", (unsigned int) cinfo.image_height));
-
-
+
marker = (struct jpeg_marker_struct *) &cinfo.marker_list;
while(marker) {
@@ -249,6 +243,12 @@
marker = marker->next;
}
+ /* We want native size to have priority over EXIF, XMP etc */
+ g_hash_table_insert (metadata, g_strdup ("Image:Width"),
+ g_strdup_printf ("%u", (unsigned int) cinfo.image_width));
+ g_hash_table_insert (metadata, g_strdup ("Image:Height"),
+ g_strdup_printf ("%u", (unsigned int) cinfo.image_height));
+
jpeg_destroy_decompress(&cinfo);
fclose (jpeg);
Modified: branches/indexer-split/src/tracker-extract/tracker-extract-png.c
==============================================================================
--- branches/indexer-split/src/tracker-extract/tracker-extract-png.c (original)
+++ branches/indexer-split/src/tracker-extract/tracker-extract-png.c Mon Sep 8 19:32:13 2008
@@ -110,15 +110,6 @@
png_init_io (png_ptr, png);
png_read_info (png_ptr, info_ptr);
- /* read header bits */
- if (png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth,
- &color_type, &interlace_type, &compression_type, &filter_type)) {
- g_hash_table_insert (metadata, g_strdup ("Image:Width"),
- g_strdup_printf ("%ld", width));
- g_hash_table_insert (metadata, g_strdup ("Image:Height"),
- g_strdup_printf ("%ld", height));
- }
-
if (png_get_text (png_ptr, info_ptr, &text_ptr, &num_text) > 0) {
gint i;
for (i = 0; i < num_text; i++) {
@@ -153,6 +144,15 @@
}
}
+ /* Read size from header. We want native have higher priority than EXIF etc */
+ if (png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth,
+ &color_type, &interlace_type, &compression_type, &filter_type)) {
+ g_hash_table_insert (metadata, g_strdup ("Image:Width"),
+ g_strdup_printf ("%ld", width));
+ g_hash_table_insert (metadata, g_strdup ("Image:Height"),
+ g_strdup_printf ("%ld", height));
+ }
+
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
fclose (png);
Modified: branches/indexer-split/src/tracker-extract/tracker-extract-tiff.c
==============================================================================
--- branches/indexer-split/src/tracker-extract/tracker-extract-tiff.c (original)
+++ branches/indexer-split/src/tracker-extract/tracker-extract-tiff.c Mon Sep 8 19:32:13 2008
@@ -117,48 +117,6 @@
g_error("Could not open image\n");
return;
}
-
- for (tag = tags; tag->name; ++tag) {
- switch (tag->type) {
- case TIFF_TAGTYPE_STRING:
- if (!TIFFGetField(image, tag->tag, &buffer)) {
- continue;
- }
- break;
- case TIFF_TAGTYPE_UINT16:
- if (!TIFFGetField(image, tag->tag, &varui32)) {
- continue;
- }
-
- sprintf(buffer,"%i",varui16);
- break;
- case TIFF_TAGTYPE_UINT32:
- if (!TIFFGetField(image, tag->tag, &varui32)) {
- continue;
- }
-
- sprintf(buffer,"%i",varui32);
- break;
- case TIFF_TAGTYPE_DOUBLE:
- if (!TIFFGetField(image, tag->tag, &vardouble)) {
- continue;
- }
-
- sprintf(buffer,"%f",vardouble);
- break;
- default:
- continue;
- break;
- }
-
- if (tag->post) {
- g_hash_table_insert (metadata, g_strdup (tag->name),
- g_strdup ((*tag->post) (buffer)));
- } else {
- g_hash_table_insert (metadata, g_strdup (tag->name),
- g_strdup (buffer));
- }
- }
/* FIXME There are problems between XMP data embedded with different tools
due to bugs in the original spec (type) */
@@ -223,6 +181,49 @@
}
}
+ /* We want to give native tags priority over XMP/Exif */
+ for (tag = tags; tag->name; ++tag) {
+ switch (tag->type) {
+ case TIFF_TAGTYPE_STRING:
+ if (!TIFFGetField(image, tag->tag, &buffer)) {
+ continue;
+ }
+ break;
+ case TIFF_TAGTYPE_UINT16:
+ if (!TIFFGetField(image, tag->tag, &varui32)) {
+ continue;
+ }
+
+ sprintf(buffer,"%i",varui16);
+ break;
+ case TIFF_TAGTYPE_UINT32:
+ if (!TIFFGetField(image, tag->tag, &varui32)) {
+ continue;
+ }
+
+ sprintf(buffer,"%i",varui32);
+ break;
+ case TIFF_TAGTYPE_DOUBLE:
+ if (!TIFFGetField(image, tag->tag, &vardouble)) {
+ continue;
+ }
+
+ sprintf(buffer,"%f",vardouble);
+ break;
+ default:
+ continue;
+ break;
+ }
+
+ if (tag->post) {
+ g_hash_table_insert (metadata, g_strdup (tag->name),
+ g_strdup ((*tag->post) (buffer)));
+ } else {
+ g_hash_table_insert (metadata, g_strdup (tag->name),
+ g_strdup (buffer));
+ }
+ }
+
TIFFClose(image);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]