Skip to content

Commit ed7aaae

Browse files
committed
add public API to set GIMI content ID to image handles (e.g. for grid images)
1 parent ec450bc commit ed7aaae

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

libheif/api/libheif/heif_image_handle.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "heif_image_handle.h"
2222
#include "api_structs.h"
23+
#include "box.h"
2324
#include <climits>
2425
#include <string>
2526

@@ -175,3 +176,12 @@ const char* heif_image_handle_get_gimi_content_id(const heif_image_handle* handl
175176
strcpy(idstring, id.c_str());
176177
return idstring;
177178
}
179+
180+
181+
void heif_image_handle_set_gimi_content_id(heif_image_handle* handle, const char* content_id)
182+
{
183+
auto gimi_box = std::make_shared<Box_gimi_content_id>();
184+
gimi_box->set_content_id(content_id);
185+
handle->context->add_property(handle->image->get_id(), gimi_box, false);
186+
handle->image->set_gimi_sample_content_id(content_id);
187+
}

libheif/api/libheif/heif_image_handle.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ heif_context* heif_image_handle_get_context(const heif_image_handle* handle);
122122
LIBHEIF_API
123123
const char* heif_image_handle_get_gimi_content_id(const heif_image_handle* handle);
124124

125+
LIBHEIF_API
126+
void heif_image_handle_set_gimi_content_id(heif_image_handle* handle, const char* content_id);
127+
125128
#ifdef __cplusplus
126129
}
127130
#endif

0 commit comments

Comments
 (0)