[gnome-photos/wip/rishi/buffer-decoder: 7/10] raw rawspeed
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/buffer-decoder: 7/10] raw rawspeed
- Date: Sun, 2 Jun 2019 13:14:23 +0000 (UTC)
commit 2309264378a5941d311df2b823f31b7589bbeb77
Author: Debarshi Ray <debarshir gnome org>
Date: Sun Jun 2 10:26:48 2019 +0000
raw rawspeed
meson.build | 2 +-
src/meson.build | 6 ++++
src/photos-rawspeed.cpp | 74 +++++++++++++++++++++++++++++++++++++++++++++++++
src/photos-rawspeed.h | 31 +++++++++++++++++++++
4 files changed, 112 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index d3b60622..a1e19af9 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project(
'gnome-photos',
- 'c',
+ ['c', 'cpp'],
version: '3.33.1',
license: 'GPL3+',
default_options: 'buildtype=debugoptimized',
diff --git a/src/meson.build b/src/meson.build
index fed2f2ea..5752133d 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -22,6 +22,7 @@ sources = files(
'photos-pipeline.c',
'photos-png-count.c',
'photos-quarks.c',
+ 'photos-rawspeed.cpp',
)
thumbnailer_dbus = 'photos-thumbnailer-dbus'
@@ -82,6 +83,10 @@ libgnome_photos_built_sources_resources = gnome.compile_resources(
libgnome_photos_built_headers += libgnome_photos_built_sources_resources[1]
sources += libgnome_photos_built_sources_resources
+cppflags = [
+ '-DPACKAGE_DATA_DIR="@0@"'.format(photos_pkg_datadir),
+]
+
deps = [
babl_dep,
gegl_dep,
@@ -100,6 +105,7 @@ deps = [
libgnome_photos = shared_library(
meson.project_name(),
sources,
+ cpp_args: cppflags,
dependencies: deps,
include_directories: top_inc,
install: true,
diff --git a/src/photos-rawspeed.cpp b/src/photos-rawspeed.cpp
new file mode 100644
index 00000000..66cdbe40
--- /dev/null
+++ b/src/photos-rawspeed.cpp
@@ -0,0 +1,74 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2019 Red Hat, Inc.
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "config.h"
+
+#include <string>
+
+#include <RawSpeed-API.h>
+
+#include "photos-error.h"
+#include "photos-rawspeed.h"
+
+
+static rawspeed::CameraMetaData *metadata;
+
+
+static gboolean
+photos_rawspeed_ensure_metadata (GError **error)
+{
+ static GError *local_error = NULL;
+ static gsize once_init_value = 0;
+ gboolean ret_val = FALSE;
+
+ if (g_once_init_enter (&once_init_value))
+ {
+ const std::string path = PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "cameras.xml";
+
+ try
+ {
+ metadata = new rawspeed::CameraMetaData (path.c_str());
+ }
+ catch (rawspeed::RawspeedException &e)
+ {
+ g_set_error (&local_error, PHOTOS_ERROR, 0, e.what());
+ }
+
+ g_once_init_leave (&once_init_value, 1);
+ }
+
+ if (local_error != NULL)
+ {
+ g_propagate_error (error, g_error_copy (local_error));
+ goto out;
+ }
+
+ ret_val = TRUE;
+
+ out:
+ return ret_val;
+}
+
+
+GeglBuffer *
+photos_rawspeed_decode_bytes (GBytes *bytes, GError **error)
+{
+ photos_rawspeed_ensure_metadata (NULL);
+ return NULL;
+}
diff --git a/src/photos-rawspeed.h b/src/photos-rawspeed.h
new file mode 100644
index 00000000..7b2bb185
--- /dev/null
+++ b/src/photos-rawspeed.h
@@ -0,0 +1,31 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2019 Red Hat, Inc.
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef PHOTOS_RAWSPEED_H
+#define PHOTOS_RAWSPEED_H
+
+#include <gegl.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+GeglBuffer *photos_rawspeed_decode_bytes (GBytes *bytes, GError **error);
+
+G_END_DECLS
+
+#endif /* PHOTOS_RAWSPEED_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]