2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software Foundation,
14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * The Original Code is Copyright (C) 2005 Blender Foundation
17 * All rights reserved.
20 /** \file blender/imbuf/IMB_metadata.h
25 #ifndef __IMB_METADATA_H__
26 #define __IMB_METADATA_H__
32 /** The metadata is a list of key/value pairs (both char *) that can me
33 * saved in the header of several image formats.
34 * Apart from some common keys like
35 * 'Software' and 'Description' (png standard) we'll use keys within the
36 * Blender namespace, so should be called 'Blender::StampInfo' or 'Blender::FrameNum'
39 * The keys & values are stored in ID properties, in the group "metadata".
42 /** Ensure that the metadata property is a valid IDProperty object.
43 * This is a no-op when *metadata != NULL.
45 void IMB_metadata_ensure(struct IDProperty **metadata);
46 void IMB_metadata_free(struct IDProperty *metadata);
48 /** Read the field from the image info into the field.
49 * \param metadata: the IDProperty that contains the metadata
50 * \param key: the key of the field
51 * \param value: the data in the field, first one found with key is returned,
52 * memory has to be allocated by user.
53 * \param len: length of value buffer allocated by user.
54 * \return - 1 (true) if metadata is present and value for the key found, 0 (false) otherwise
56 bool IMB_metadata_get_field(struct IDProperty *metadata, const char *key, char *value, const size_t len);
58 /** Set user data in the metadata.
59 * If the field already exists its value is overwritten, otherwise the field
60 * will be added with the given value.
61 * \param metadata: the IDProperty that contains the metadata
62 * \param key: the key of the field
63 * \param value: the data to be written to the field. zero terminated string
65 void IMB_metadata_set_field(struct IDProperty *metadata, const char *key, const char *value);
67 void IMB_metadata_copy(struct ImBuf *dimb, struct ImBuf *simb);
68 struct IDProperty *IMB_anim_load_metadata(struct anim *anim);
70 #endif /* __IMB_METADATA_H__ */