Author: post
Date: 2010-02-13 18:23:29 +0100 (Sat, 13 Feb 2010)
New Revision: 3217
Modified:
trunk/librawstudio/rs-dcp-file.c
trunk/librawstudio/rs-profile-camera.c
trunk/librawstudio/rs-profile-factory.c
trunk/librawstudio/rs-tiff-ifd.c
trunk/librawstudio/rs-tiff.c
trunk/librawstudio/rs-tiff.h
Log:
Don't retain complete DCP profile in memory, but load it when it is needed.
Modified: trunk/librawstudio/rs-dcp-file.c
===================================================================
--- trunk/librawstudio/rs-dcp-file.c 2010-02-13 17:16:51 UTC (rev 3216)
+++ trunk/librawstudio/rs-dcp-file.c 2010-02-13 17:23:29 UTC (rev 3217)
@@ -27,7 +27,7 @@
gchar *signature;
gchar *name;
gchar *copyright;
- gchar *id;
+ gchar *id;
};
static gboolean read_file_header(RSTiff *tiff);
@@ -80,6 +80,13 @@
if (rs_tiff_get_ushort(tiff, 2) != 0x4352)
ret = TRUE;
+ RSDcpFile *dcp_file = RS_DCP_FILE(tiff);
+
+ /* Load and cache basic DCP information */
+ (rs_dcp_file_get_name(dcp_file));
+ (rs_dcp_file_get_model(dcp_file));
+ (rs_dcp_file_get_signature(dcp_file));
+
return ret;
}
Modified: trunk/librawstudio/rs-profile-camera.c
===================================================================
--- trunk/librawstudio/rs-profile-camera.c 2010-02-13 17:16:51 UTC (rev
3216)
+++ trunk/librawstudio/rs-profile-camera.c 2010-02-13 17:23:29 UTC (rev
3217)
@@ -61,7 +61,6 @@
xml_model = xmlGetProp(exif,
BAD_CAST "model");
if (g_strcmp0((gchar *)
xml_model, model) == 0)
{
- printf("%s - %s -
%s\n", xml_unique_id, xml_make, xml_model);
xmlFree(xml_make);
xmlFree(xml_model);
const gchar *unique_id
= g_strdup((gchar *) xml_unique_id);
@@ -81,5 +80,6 @@
camera = camera->next;
}
xmlFree(doc);
+ printf("\033[31mCould not find unique camera: Make:'%s'.
Model:'%s'\033[0m\n", make, model);
return NULL;
}
Modified: trunk/librawstudio/rs-profile-factory.c
===================================================================
--- trunk/librawstudio/rs-profile-factory.c 2010-02-13 17:16:51 UTC (rev
3216)
+++ trunk/librawstudio/rs-profile-factory.c 2010-02-13 17:23:29 UTC (rev
3217)
@@ -70,6 +70,7 @@
FACTORY_MODEL_COLUMN_ID, rs_dcp_get_id(profile),
-1);
readable = TRUE;
+ rs_tiff_free_data(RS_TIFF(profile));
}
return readable;
Modified: trunk/librawstudio/rs-tiff-ifd.c
===================================================================
--- trunk/librawstudio/rs-tiff-ifd.c 2010-02-13 17:16:51 UTC (rev 3216)
+++ trunk/librawstudio/rs-tiff-ifd.c 2010-02-13 17:23:29 UTC (rev 3217)
@@ -58,6 +58,8 @@
{
ifd->dispose_has_run = TRUE;
g_object_unref(ifd->tiff);
+ g_list_foreach(ifd->entries, (GFunc)g_object_unref, NULL);
+ g_list_free(ifd->entries);
}
G_OBJECT_CLASS(rs_tiff_ifd_parent_class)->dispose (object);
Modified: trunk/librawstudio/rs-tiff.c
===================================================================
--- trunk/librawstudio/rs-tiff.c 2010-02-13 17:16:51 UTC (rev 3216)
+++ trunk/librawstudio/rs-tiff.c 2010-02-13 17:23:29 UTC (rev 3217)
@@ -52,9 +52,11 @@
if (!tiff->dispose_has_run)
{
tiff->dispose_has_run = TRUE;
- g_free(tiff->map);
+ if (tiff->map)
+ g_free(tiff->map);
+ g_list_foreach(tiff->ifds, (GFunc)g_object_unref, NULL);
+ g_list_free(tiff->ifds);
}
-
G_OBJECT_CLASS(rs_tiff_parent_class)->dispose(object);
}
@@ -171,6 +173,9 @@
RSTiffIfdEntry *ret = NULL;
g_assert(RS_IS_TIFF(tiff));
+ if (tiff->ifds == 0)
+ read_from_file(tiff);
+
if (ifd_num <= tiff->num_ifd)
ifd = g_list_nth_data(tiff->ifds, ifd_num);
@@ -195,3 +200,15 @@
return ret;
}
+
+void
+rs_tiff_free_data(RSTiff * tiff)
+{
+ if (tiff->map)
+ g_free(tiff->map);
+ tiff->map = NULL;
+
+ g_list_foreach(tiff->ifds, (GFunc)g_object_unref, NULL);
+ g_list_free(tiff->ifds);
+ tiff->ifds = 0;
+}
Modified: trunk/librawstudio/rs-tiff.h
===================================================================
--- trunk/librawstudio/rs-tiff.h 2010-02-13 17:16:51 UTC (rev 3216)
+++ trunk/librawstudio/rs-tiff.h 2010-02-13 17:23:29 UTC (rev 3217)
@@ -67,6 +67,10 @@
gchar *
rs_tiff_get_ascii(RSTiff *tiff, guint ifd_num, gushort tag);
+/* Free allocated data. This will cause the file to be reloaded on next access
*/
+void
+rs_tiff_free_data(RSTiff *tiff);
+
G_END_DECLS
#endif /* RS_TIFF_H */
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit