![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
The XMP-sidecar half of what used to be common/exif.cc.
More...
#include <errno.h>#include <glib.h>#include <glib/gstdio.h>#include <time.h>#include <cmath>#include <cstdlib>#include <cstring>#include <fstream>#include <iostream>#include <sstream>#include <string>#include <exiv2/exiv2.hpp>#include <pugixml.hpp>#include "common/xmp_sidecar.h"#include "metadata/exif.h"#include "metadata/exif_internal.h"#include "caches/image_cache.h"#include "common/conf.h"#include "common/datetime.h"#include "common/deprecations.h"#include "history/history.h"#include "common/utility.h"#include "common/variables.h"#include "database/colorlabel_repository.h"#include "database/database.h"#include "database/history_repository.h"#include "database/image_repository.h"#include "database/metadata_repository.h"#include "develop/blend.h"#include "develop/iop_order.h"#include "develop/masks.h"#include "imageio/imageio_core.h"#include "metadata/metadata.h"#include "metadata/notify.h"#include "metadata/tags.h"#include "system/macros.h"#include "system/mem_alloc.h"
Include dependency graph for xmp_sidecar.cc:Go to the source code of this file.
Data Structures | |
| struct | history_entry_t |
| struct | mask_entry_t |
| struct | _xmp_mask_ctx_t |
| struct | _xmp_history_ctx_t |
| struct | _xmp_metadata_ctx_t |
Macros | |
| #define | __STDC_FORMAT_MACROS |
| #define | WIDEN(s) (s) |
| #define | DT_XMP_EXIF_VERSION 5 |
| #define | ERROR_CODE(a) (a) |
Variables | |
| const char * | dt_xmp_keys [] |
| static const guint | dt_xmp_keys_n = G_N_ELEMENTS(dt_xmp_keys) |
The XMP-sidecar half of what used to be common/exif.cc.
Cut out of a 4775-line translation unit that was doing two unrelated jobs. This one serialises the development – history stack, mask shapes, module order – into and out of the XMP document; the other, the photograph's own tags, is metadata/exif.cc. See common/xmp_sidecar.h, including why this is not in src/metadata.
Definition in file xmp_sidecar.cc.
| #define __STDC_FORMAT_MACROS |
Definition at line 73 of file xmp_sidecar.cc.
| #define DT_XMP_EXIF_VERSION 5 |
Definition at line 140 of file xmp_sidecar.cc.
| #define ERROR_CODE | ( | a | ) | (a) |
Definition at line 2189 of file xmp_sidecar.cc.
| #define WIDEN | ( | s | ) | (s) |
Definition at line 107 of file xmp_sidecar.cc.
| GTimeSpan _convert_unix_to_gtimespan | ( | const time_t | unix | ) |
Definition at line 1760 of file xmp_sidecar.cc.
References dt_datetime_gdatetime_to_gtimespan(), and L.
Referenced by read_xmp_timestamps().
Definition at line 147 of file xmp_sidecar.cc.
References dt_exif_get_exiv2_taglist(), IS_NULL_PTR, L, and t.
Referenced by dt_exif_xmp_attach_export().
|
static |
Definition at line 1904 of file xmp_sidecar.cc.
References dt_exif_xmp_encode(), dt_free, dt_image_cache_get(), dt_image_cache_read_release(), IS_NULL_PTR, L, and value.
Referenced by _exif_xmp_read_data(), and _exif_xmp_read_data_export().
|
static |
Definition at line 1928 of file xmp_sidecar.cc.
References _exif_xmp_append_history_hash(), dt_datetime_gtimespan_to_exif(), DT_DATETIME_LENGTH, dt_free, dt_free_gpointer(), DT_IMAGE_AUTO_PRESETS_APPLIED, dt_image_get_xmp_rating_from_flags(), dt_image_repository_get_xmp_row(), dt_image_repository_xmp_row_cleanup(), DT_IOP_ORDER_ANSEL_RAW, DT_IOP_ORDER_CUSTOM, dt_ioppr_get_iop_order_list(), dt_ioppr_get_iop_order_version(), dt_ioppr_has_multiple_instances(), dt_ioppr_serialize_text_iop_order_list(), dt_set_xmp_dt_history(), dt_set_xmp_dt_metadata(), dt_set_xmp_exif_geotag(), dt_tag_get_hierarchical(), dt_tag_get_list(), DT_XMP_EXIF_VERSION, FALSE, dt_image_xmp_row_t::filename, L, row, set_xmp_timestamps(), and TRUE.
Referenced by dt_exif_xmp_read_string(), and dt_exif_xmp_write_with_imgpath().
|
static |
Definition at line 2051 of file xmp_sidecar.cc.
References _exif_xmp_append_history_hash(), dt_datetime_gtimespan_to_exif(), DT_DATETIME_LENGTH, dt_free, dt_free_gpointer(), DT_IMAGE_AUTO_PRESETS_APPLIED, dt_image_get_xmp_rating_from_flags(), dt_image_repository_get_xmp_row(), dt_image_repository_xmp_row_cleanup(), DT_IOP_ORDER_ANSEL_RAW, DT_IOP_ORDER_CUSTOM, dt_ioppr_get_iop_order_list(), dt_ioppr_get_iop_order_version(), dt_ioppr_has_multiple_instances(), dt_ioppr_serialize_text_iop_order_list(), DT_META_DT_HISTORY, DT_META_EXIF, DT_META_GEOTAG, DT_META_HIERARCHICAL_TAG, DT_META_METADATA, DT_META_TAG, dt_remove_xmp_exif_geotag(), dt_set_xmp_dt_history(), dt_set_xmp_dt_metadata(), dt_set_xmp_exif_geotag(), dt_tag_get_hierarchical_export(), dt_tag_get_list_export(), DT_XMP_EXIF_VERSION, dt_image_xmp_row_t::filename, dt_export_metadata_t::flags, L, row, and TRUE.
Referenced by dt_exif_xmp_attach_export().
Definition at line 1196 of file xmp_sidecar.cc.
References L, MAX, history_entry_t::multi_priority, and history_entry_t::operation.
|
static |
Definition at line 2277 of file xmp_sidecar.cc.
Referenced by dt_exif_xmp_attach_export().
Definition at line 1881 of file xmp_sidecar.cc.
Referenced by dt_set_xmp_dt_metadata().
|
static |
Definition at line 1660 of file xmp_sidecar.cc.
References dt_exif_xmp_encode(), dt_free, IS_NULL_PTR, key, L, and _xmp_history_ctx_t::xmpData.
Referenced by dt_set_xmp_dt_history().
|
static |
Definition at line 1618 of file xmp_sidecar.cc.
References dt_exif_xmp_encode(), dt_free, key, L, mask_id, mask_name, and _xmp_mask_ctx_t::xmpData.
Referenced by dt_set_xmp_dt_history().
Definition at line 1863 of file xmp_sidecar.cc.
References dt_conf_get_int(), dt_free, DT_METADATA_FLAG_HIDDEN, DT_METADATA_FLAG_PRIVATE, dt_metadata_get_key(), dt_metadata_get_name(), dt_metadata_get_type(), DT_METADATA_TYPE_INTERNAL, dt_util_dstrcat(), flag, L, name, value, and _xmp_metadata_ctx_t::xmpData.
Referenced by dt_set_xmp_dt_metadata().
|
static |
Definition at line 1170 of file xmp_sidecar.cc.
References add_mask_entries_to_db(), add_mask_entry_to_db(), DT_MASKS_GROUP, i, IS_NULL_PTR, L, mask_id, mask_entry_t::mask_nb, mask_entry_t::mask_points, mask_entry_t::mask_points_len, and mask_entry_t::mask_type.
Referenced by add_mask_entries_to_db(), and dt_exif_xmp_read().
|
static |
Definition at line 1134 of file xmp_sidecar.cc.
References mask_entry_t::already_added, dt_history_repository_write_mask_item(), L, mask_entry_t::mask_id, mask_entry_t::mask_name, mask_entry_t::mask_nb, mask_entry_t::mask_num, mask_entry_t::mask_points, mask_entry_t::mask_points_len, mask_entry_t::mask_src, mask_entry_t::mask_src_len, mask_entry_t::mask_type, mask_entry_t::mask_version, TRUE, and mask_entry_t::version.
Referenced by add_mask_entries_to_db(), add_non_clone_mask_entries_to_db(), and dt_exif_xmp_read().
|
static |
Definition at line 1163 of file xmp_sidecar.cc.
References add_mask_entry_to_db(), DT_MASKS_CLONE, DT_MASKS_NON_CLONE, mask_entry_t::mask_type, and value.
Referenced by dt_exif_xmp_read().
| int dt_exif_read_blob | ( | uint8_t ** | blob, |
| const char * | path, | ||
| const int32_t | imgid, | ||
| const int | sRGB, | ||
| const int | out_width, | ||
| const int | out_height, | ||
| const int | dng_mode | ||
| ) |
write exif to blob, return length in bytes. blob will be allocated by the function. sRGB should be true if sRGB colorspace is used as output.
Definition at line 249 of file xmp_sidecar.cc.
References darktable_package_string, dt_conf_get_int(), DT_DATETIME_EXIF_LENGTH, dt_datetime_img_to_exif(), DT_DATETIME_LENGTH, dt_datetime_now_to_exif(), dt_free, dt_free_gpointer(), dt_image_cache_get(), dt_image_cache_read_release(), dt_metadata_get(), dt_remove_exif_geotag(), dt_remove_exif_keys(), i, IS_NULL_PTR, L, read_metadata_threadsafe, sRGB, and WIDEN.
Referenced by dt_control_merge_hdr_job_run(), and dt_imageio_export_with_flags().
write xmp packet inside an image.
Definition at line 2321 of file xmp_sidecar.cc.
References _exif_get_exiv2_tag_type(), _exif_xmp_read_data_export(), _remove_xmp_keys(), dt_exif_read_exif_tag(), dt_free, dt_image_full_path(), dt_image_path_append_version(), DT_META_EXIF, DT_META_GEOTAG, dt_remove_exif_geotag(), dt_remove_exif_key(), dt_remove_iptc_key(), dt_remove_known_keys(), dt_remove_xmp_key(), dt_remove_xmp_keys(), dt_variables_expand(), dt_variables_params_destroy(), dt_variables_params_init(), dt_variables_set_tags_flags(), FALSE, i, IS_NULL_PTR, key, L, lock, m, PATH_MAX, read_metadata_threadsafe, TRUE, type, and WIDEN.
Referenced by dt_imageio_export_with_flags().
| int dt_exif_xmp_read | ( | dt_image_t * | img, |
| const char * | filename, | ||
| const int | history_only | ||
| ) |
read xmp sidecar file.
Definition at line 1212 of file xmp_sidecar.cc.
References add_mask_entries_to_db(), add_mask_entry_to_db(), add_non_clone_mask_entries_to_db(), history_entry_t::blendop_params, history_entry_t::blendop_params_len, history_entry_t::blendop_version, dt_database_get_last_error(), dt_database_release_transaction, dt_database_rollback_transaction(), dt_database_start_transaction, dt_deprecated(), dt_exif_decode_xmp_data(), dt_exif_xmp_decode(), dt_free, dt_free_gpointer(), dt_history_repository_count_mask_items(), dt_history_repository_delete_history(), dt_history_repository_delete_masks_history(), dt_history_repository_get_next_num(), dt_history_repository_set_end(), dt_history_repository_shift_nums(), dt_history_repository_write_item(), DT_IMAGE_AUTO_PRESETS_APPLIED, DT_IMAGE_NO_LEGACY_PRESETS, DT_IOP_ORDER_ANSEL_RAW, DT_IOP_ORDER_LEGACY, dt_ioppr_deserialize_text_iop_order_list(), dt_ioppr_get_iop_order_link(), dt_ioppr_get_iop_order_list_version(), dt_ioppr_insert_missing_modules(), dt_ioppr_write_iop_order_list(), dt_sort_iop_list_by_order_f(), history_entry_t::enabled, FALSE, dt_image_t::flags, free_history_entry(), free_mask_entry(), dt_image_t::history_hash, dt_image_t::id, dt_iop_order_entry_t::instance, history_entry_t::iop_order, dt_iop_order_entry_t::iop_order_f, IS_NULL_PTR, L, dt_image_raw_parameters_t::legacy, dt_image_t::legacy_flip, MIN, history_entry_t::modversion, history_entry_t::multi_name, history_entry_t::multi_priority, history_entry_t::num, dt_iop_order_entry_t::o, history_entry_t::operation, dt_iop_order_entry_t::operation, out, history_entry_t::params, history_entry_t::params_len, read_history_v1(), read_history_v2(), read_masks(), read_masks_v3(), read_metadata_threadsafe, read_xmp_timestamps(), TRUE, dt_image_raw_parameters_t::user_flip, and WIDEN.
Referenced by _history_load_and_apply_apply(), _image_import_internal(), dt_image_read_duplicates(), and main().
| char * dt_exif_xmp_read_string | ( | const int32_t | imgid | ) |
get the xmp blob for imgid.
Definition at line 2192 of file xmp_sidecar.cc.
References _exif_xmp_read_data(), dt_image_full_path(), dt_image_path_append_version(), dt_remove_known_keys(), ERROR_CODE, FALSE, L, lock, PATH_MAX, and WIDEN.
Referenced by write_image(), and write_image().
| int dt_exif_xmp_write_with_imgpath | ( | const dt_image_t * | image, |
| const char * | filename, | ||
| const char * | imgpath | ||
| ) |
Definition at line 2578 of file xmp_sidecar.cc.
References _exif_xmp_read_data(), dt_free, DT_METADATA_NOTICE_MESSAGE, dt_metadata_notify(), dt_read_file(), dt_remove_known_keys(), ERROR_CODE, dt_image_t::id, IS_NULL_PTR, L, lock, TRUE, and WIDEN.
Referenced by _write_sidecar_file_from_image_locked(), and write_image().
|
static |
Definition at line 233 of file xmp_sidecar.cc.
References dt_remove_exif_keys(), and L.
Referenced by dt_exif_read_blob(), and dt_exif_xmp_attach_export().
|
static |
Definition at line 2295 of file xmp_sidecar.cc.
References key.
Referenced by dt_exif_xmp_attach_export().
|
static |
Definition at line 2308 of file xmp_sidecar.cc.
Referenced by dt_exif_xmp_attach_export().
|
static |
Definition at line 193 of file xmp_sidecar.cc.
References dt_xmp_keys, dt_xmp_keys_n, i, key, and L.
Referenced by dt_exif_xmp_attach_export(), dt_exif_xmp_read_string(), and dt_exif_xmp_write_with_imgpath().
|
static |
Definition at line 1801 of file xmp_sidecar.cc.
References dt_remove_xmp_keys(), and L.
Referenced by _exif_xmp_read_data_export(), and dt_set_xmp_exif_geotag().
|
static |
Definition at line 2264 of file xmp_sidecar.cc.
Referenced by dt_exif_xmp_attach_export().
|
static |
Definition at line 213 of file xmp_sidecar.cc.
Referenced by dt_exif_xmp_attach_export(), dt_remove_xmp_exif_geotag(), and set_xmp_timestamps().
|
static |
Definition at line 1709 of file xmp_sidecar.cc.
References _xmp_append_history(), _xmp_append_mask(), dt_history_repository_foreach_mask_item(), dt_history_repository_foreach_row(), L, and MIN.
Referenced by _exif_xmp_read_data(), and _exif_xmp_read_data_export().
|
static |
Definition at line 1889 of file xmp_sidecar.cc.
References _xmp_append_colorlabel(), _xmp_append_metadata(), dt_colorlabel_repository_foreach(), dt_metadata_repository_foreach(), L, and v.
Referenced by _exif_xmp_read_data(), and _exif_xmp_read_data_export().
|
static |
Definition at line 1815 of file xmp_sidecar.cc.
References double(), dt_free, dt_remove_xmp_exif_geotag(), and L.
Referenced by _exif_xmp_read_data(), and _exif_xmp_read_data_export().
Definition at line 662 of file xmp_sidecar.cc.
References history_entry_t::blendop_params, dt_free, history_entry_t::multi_name, history_entry_t::operation, and history_entry_t::params.
Referenced by dt_exif_xmp_read(), and read_history_v2().
| void free_mask_entry | ( | gpointer | data | ) |
Definition at line 954 of file xmp_sidecar.cc.
References dt_free, mask_entry_t::mask_name, mask_entry_t::mask_points, and mask_entry_t::mask_src.
Referenced by dt_exif_xmp_read(), read_masks(), and read_masks_v3().
|
static |
Definition at line 642 of file xmp_sidecar.cc.
References history_entry_t::blendop_params, history_entry_t::blendop_version, history_entry_t::enabled, history_entry_t::iop_order, IS_NULL_PTR, history_entry_t::modversion, history_entry_t::multi_name, history_entry_t::multi_priority, history_entry_t::operation, and history_entry_t::params.
|
static |
Definition at line 675 of file xmp_sidecar.cc.
References history_entry_t::blendop_version, dt_exif_xmp_decode(), and L.
Referenced by dt_exif_xmp_read().
|
static |
Definition at line 810 of file xmp_sidecar.cc.
References dt_exif_xmp_decode(), dt_free, free_history_entry(), history_entry_t::have_modversion, history_entry_t::have_operation, history_entry_t::have_params, key, L, n, and TRUE.
Referenced by dt_exif_xmp_read().
|
static |
Definition at line 963 of file xmp_sidecar.cc.
References dt_exif_xmp_decode(), free_mask_entry(), i, L, mask_entry_t::mask_id, mask_id, mask_entry_t::mask_name, mask_name, mask_entry_t::mask_nb, mask_entry_t::mask_points, mask_entry_t::mask_points_len, mask_entry_t::mask_src, mask_entry_t::mask_src_len, mask_entry_t::mask_type, mask_entry_t::mask_version, and mask_entry_t::version.
Referenced by dt_exif_xmp_read().
|
static |
Definition at line 1029 of file xmp_sidecar.cc.
References dt_exif_xmp_decode(), dt_free, free_mask_entry(), key, L, and n.
Referenced by dt_exif_xmp_read().
|
static |
Definition at line 1773 of file xmp_sidecar.cc.
References _convert_unix_to_gtimespan(), dt_image_t::change_timestamp, dt_image_t::export_timestamp, L, and dt_image_t::print_timestamp.
Referenced by dt_exif_xmp_read().
|
static |
Definition at line 1738 of file xmp_sidecar.cc.
References dt_image_timestamps_t::change_timestamp, dt_image_repository_get_timestamps(), dt_remove_xmp_keys(), dt_image_timestamps_t::export_timestamp, dt_image_timestamps_t::has_change, dt_image_timestamps_t::has_export, dt_image_timestamps_t::has_import, dt_image_timestamps_t::has_print, dt_image_timestamps_t::import_timestamp, L, and dt_image_timestamps_t::print_timestamp.
Referenced by _exif_xmp_read_data().
| const char* dt_xmp_keys[] |
Definition at line 171 of file xmp_sidecar.cc.
Referenced by dt_remove_known_keys().
|
static |
Definition at line 189 of file xmp_sidecar.cc.
Referenced by dt_remove_known_keys().