diff options
author | Martijn Berger <martijn.berger@gmail.com> | 2015-01-31 19:15:43 +0300 |
---|---|---|
committer | Martijn Berger <martijn.berger@gmail.com> | 2015-01-31 19:15:43 +0300 |
commit | 5ac7e23e886361f7d74d5d6367e63b688bcda361 (patch) | |
tree | debd7e0798338ecab16de51ebb94d89bbab096af /source/blender/imbuf/intern/jpeg.c | |
parent | f90891d87e351ef1c9509007a18dc72ee5025809 (diff) |
Blender metadata changes to accommodate non string data
Work towards T42418
For now got rid of linked list holding key,value pairs for metadata in favour of ID properties.
Reviewers: campbellbarton, sergey
Reviewed By: sergey
Projects: #bf_blender
Differential Revision: https://developer.blender.org/D872
Diffstat (limited to 'source/blender/imbuf/intern/jpeg.c')
-rw-r--r-- | source/blender/imbuf/intern/jpeg.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index 6093a1477ce..310e517e38d 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -41,6 +41,8 @@ #include "BLI_string.h" #include "BLI_fileops.h" +#include "BKE_idprop.h" + #include "imbuf.h" #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" @@ -479,7 +481,6 @@ static void write_jpeg(struct jpeg_compress_struct *cinfo, struct ImBuf *ibuf) uchar *rect; int x, y; char neogeo[128]; - ImMetaData *iptr; char *text; jpeg_start_compress(cinfo, true); @@ -491,28 +492,28 @@ static void write_jpeg(struct jpeg_compress_struct *cinfo, struct ImBuf *ibuf) jpeg_write_marker(cinfo, 0xe1, (JOCTET *) neogeo, 10); if (ibuf->metadata) { + IDProperty *prop; /* key + max value + "Blender" */ text = MEM_mallocN(530, "stamp info read"); - iptr = ibuf->metadata; - while (iptr) { - if (STREQ(iptr->key, "None")) { - jpeg_write_marker(cinfo, JPEG_COM, (JOCTET *) iptr->value, strlen(iptr->value) + 1); - goto next_stamp_info; - } + for (prop = ibuf->metadata->data.group.first; prop; prop = prop->next) { + if (prop->type == IDP_STRING) { + int text_len; + if (!strcmp(prop->name, "None")) { + jpeg_write_marker(cinfo, JPEG_COM, (JOCTET *) IDP_String(prop), prop->len + 1); + } - /* - * The JPEG format don't support a pair "key/value" - * like PNG, so we "encode" the stamp in a - * single string: - * "Blender:key:value" - * - * The first "Blender" is a simple identify to help - * in the read process. - */ - sprintf(text, "Blender:%s:%s", iptr->key, iptr->value); - jpeg_write_marker(cinfo, JPEG_COM, (JOCTET *) text, strlen(text) + 1); -next_stamp_info: - iptr = iptr->next; + /* + * The JPEG format don't support a pair "key/value" + * like PNG, so we "encode" the stamp in a + * single string: + * "Blender:key:value" + * + * The first "Blender" is a simple identify to help + * in the read process. + */ + text_len = sprintf(text, "Blender:%s:%s", prop->name, IDP_String(prop)); + jpeg_write_marker(cinfo, JPEG_COM, (JOCTET *) text, text_len + 1); + } } MEM_freeN(text); } |