Skip to content

Commit

Permalink
add heif_image_handle_get_context() (see #555)
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Jul 20, 2023
1 parent 7e9293d commit 7629ce9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libheif/heif.cc
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,14 @@ int heif_image_handle_get_ispe_height(const struct heif_image_handle* handle)
}


struct heif_context* heif_image_handle_get_context(const struct heif_image_handle* handle)
{
auto ctx = new heif_context();
ctx->context = handle->context;
return ctx;
}


struct heif_error heif_image_handle_get_preferred_decoding_colorspace(const struct heif_image_handle* image_handle,
enum heif_colorspace* out_colorspace,
enum heif_chroma* out_chroma)
Expand Down
11 changes: 11 additions & 0 deletions libheif/heif.h
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,17 @@ int heif_image_handle_get_ispe_width(const struct heif_image_handle* handle);
LIBHEIF_API
int heif_image_handle_get_ispe_height(const struct heif_image_handle* handle);

// This gets the context associated with the image handle.
// Note that you have to release the returned context with heif_context_free() in any case.
//
// This means: when you have several image-handles that originate from the same file and you get the
// context of each of them, the returned pointer may be different even though it refers to the same
// logical context. You have to call heif_context_free() on all those context pointers.
// After you freed a context pointer, you can still use the context through a different pointer that you
// might have acquired from elsewhere.
LIBHEIF_API
struct heif_context* heif_image_handle_get_context(const struct heif_image_handle* handle);


// ------------------------- depth images -------------------------

Expand Down

0 comments on commit 7629ce9

Please sign in to comment.