Author: akv
Date: 2010-02-12 23:23:43 +0100 (Fri, 12 Feb 2010)
New Revision: 3181
Added:
trunk/librawstudio/rs-profile-camera.c
trunk/librawstudio/rs-profile-camera.h
Modified:
trunk/librawstudio/Makefile.am
Log:
Added rs-profile-camera.c|h to look in xml file to help find the correct DCP
profile for a camera.
Modified: trunk/librawstudio/Makefile.am
===================================================================
--- trunk/librawstudio/Makefile.am 2010-02-12 22:06:45 UTC (rev 3180)
+++ trunk/librawstudio/Makefile.am 2010-02-12 22:23:43 UTC (rev 3181)
@@ -52,6 +52,7 @@
rs-dcp-file.h \
rs-profile-factory.h \
rs-profile-selector.h \
+ rs-profile-camera.h \
x86-cpu.h \
md5.h
@@ -97,6 +98,7 @@
rs-dcp-file.c rs-dcp-file.h \
rs-profile-factory.c rs-profile-factory.h rs-profile-factory-model.h \
rs-profile-selector.c rs-profile-selector.h \
+ rs-profile-camera.c rs-profile-camera.h \
rs-stock.c rs-stock.h \
md5.c md5.h
Added: trunk/librawstudio/rs-profile-camera.c
===================================================================
--- trunk/librawstudio/rs-profile-camera.c (rev 0)
+++ trunk/librawstudio/rs-profile-camera.c 2010-02-12 22:23:43 UTC (rev
3181)
@@ -0,0 +1,84 @@
+/*
+ * * Copyright (C) 2006-2010 Anders Brander <[email protected]>,
+ * * Anders Kvist <[email protected]> and Klaus Post <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
+ */
+
+#include <glib-2.0/glib.h>
+#include "config.h"
+#include <libxml/encoding.h>
+#include <libxml/xmlwriter.h>
+#include "rs-utils.h"
+
+const gchar *
+rs_profile_camera_find(gchar *make, gchar *model)
+{
+ xmlDocPtr doc;
+ xmlNodePtr cur;
+ xmlNodePtr camera = NULL;
+ xmlNodePtr exif = NULL;
+ xmlChar *xml_unique_id, *xml_make, *xml_model;
+
+ const gchar *filename = g_build_filename(PACKAGE_DATA_DIR, PACKAGE,
"rawstudio-cameras.xml", NULL);
+
+ if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR))
+ return NULL;
+
+ doc = xmlParseFile(filename);
+ if (!doc)
+ return NULL;
+
+ cur = xmlDocGetRootElement(doc);
+
+ camera = cur->xmlChildrenNode;
+ while(camera)
+ {
+ if (!xmlStrcmp(camera->name, BAD_CAST "camera"))
+ {
+ xml_unique_id = xmlGetProp(camera, BAD_CAST
"unique_id");
+
+ exif = camera->xmlChildrenNode;
+ while(exif)
+ {
+ if (!xmlStrcmp(exif->name, BAD_CAST "exif"))
+ {
+ xml_make = xmlGetProp(exif, BAD_CAST
"make");
+ if (g_strcmp0((gchar *) xml_make, make)
== 0)
+ {
+ 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);
+ xmlFree(xml_unique_id);
+ return unique_id;
+ }
+ xmlFree(xml_model);
+ }
+ xmlFree(xml_make);
+ }
+ exif = exif->next;
+
+ }
+ xmlFree(xml_unique_id);
+ }
+ camera = camera->next;
+ }
+ xmlFree(doc);
+ return NULL;
+}
Added: trunk/librawstudio/rs-profile-camera.h
===================================================================
--- trunk/librawstudio/rs-profile-camera.h (rev 0)
+++ trunk/librawstudio/rs-profile-camera.h 2010-02-12 22:23:43 UTC (rev
3181)
@@ -0,0 +1,31 @@
+/*
+ * * Copyright (C) 2006-2010 Anders Brander <[email protected]>,
+ * * Anders Kvist <[email protected]> and Klaus Post <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
+ */
+
+#ifndef RS_PROFILE_CAMERA_H
+#define RS_PROFILE_CAMERA_H
+
+typedef struct {
+ gchar *make;
+ gchar *model;
+ gchar *unique_id;
+} rs_profile_camera;
+
+const gchar * rs_profile_camera_find(gchar *make, gchar *model);
+
+#endif /* RS_PROFILE_CAMERA_H */
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit