[evince/wip/chpe/xmp: 9/11] djvu: Extract XMP metadata
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/wip/chpe/xmp: 9/11] djvu: Extract XMP metadata
- Date: Sat, 4 Dec 2021 00:43:06 +0000 (UTC)
commit d57376996e477bdfb839befa2d206f119c6b53c7
Author: Christian Persch <chpe src gnome org>
Date: Sat Dec 4 01:42:14 2021 +0100
djvu: Extract XMP metadata
Based on a patch by Daniel Bershatsky.
https://gitlab.gnome.org/GNOME/evince/-/merge_requests/342
backend/djvu/djvu-document.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
---
diff --git a/backend/djvu/djvu-document.c b/backend/djvu/djvu-document.c
index 45cf33d15..e72508130 100644
--- a/backend/djvu/djvu-document.c
+++ b/backend/djvu/djvu-document.c
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
/*
* Copyright (C) 2005, Nickolay V. Shmyrev <nshmyrev yandex ru>
*
@@ -25,6 +24,7 @@
#include "djvu-links.h"
#include "djvu-document-private.h"
#include "ev-file-exporter.h"
+#include "ev-document-info.h"
#include "ev-document-misc.h"
#include "ev-document-find.h"
#include "ev-document-links.h"
@@ -522,6 +522,31 @@ djvu_document_get_thumbnail_surface (EvDocument *document,
return surface;
}
+static EvDocumentInfo *
+djvu_document_get_info (EvDocument *document)
+{
+ DjvuDocument *djvu_document = DJVU_DOCUMENT (document);
+ const char *xmp;
+ miniexp_t anno;
+ EvDocumentInfo *info;
+
+ info = ev_document_info_new ();
+
+ anno = ddjvu_document_get_anno (djvu_document->d_document, 1);
+ if (anno == miniexp_nil) {
+ ddjvu_miniexp_release (djvu_document->d_document, anno);
+ return info;
+ }
+
+ xmp = ddjvu_anno_get_xmp (anno);
+ if (xmp != NULL) {
+ ev_document_info_set_from_xmp (info, xmp);
+ }
+
+ ddjvu_miniexp_release (djvu_document->d_document, anno);
+ return info;
+}
+
static void
djvu_document_finalize (GObject *object)
{
@@ -566,6 +591,7 @@ djvu_document_class_init (DjvuDocumentClass *klass)
ev_document_class->render = djvu_document_render;
ev_document_class->get_thumbnail = djvu_document_get_thumbnail;
ev_document_class->get_thumbnail_surface = djvu_document_get_thumbnail_surface;
+ ev_document_class->get_info = djvu_document_get_info;
}
static gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]