From 2b0c2abd4d943c7c628a69c53ef524d3404cc0cb Mon Sep 17 00:00:00 2001 From: Dirk Farin Date: Wed, 1 Nov 2023 20:00:32 +0100 Subject: [PATCH] add API to add custom compatible brands (#1001) --- libheif/file.h | 1 + libheif/heif.cc | 7 +++++++ libheif/heif.h | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/libheif/file.h b/libheif/file.h index 93405aada6..7213ce6134 100644 --- a/libheif/file.h +++ b/libheif/file.h @@ -83,6 +83,7 @@ class HeifFile Error get_compressed_image_data(heif_item_id ID, std::vector* out_data) const; + std::shared_ptr get_ftyp_box() { return m_ftyp_box; } std::shared_ptr get_infe_box(heif_item_id imageID) { diff --git a/libheif/heif.cc b/libheif/heif.cc index 0990c46675..1df56ae7a8 100644 --- a/libheif/heif.cc +++ b/libheif/heif.cc @@ -1964,6 +1964,13 @@ struct heif_error heif_context_write(struct heif_context* ctx, } +void heif_context_add_compatible_brand(struct heif_context* ctx, + heif_brand2 compatible_brand) +{ + ctx->context->get_heif_file()->get_ftyp_box()->add_compatible_brand(compatible_brand); +} + + int heif_context_get_encoder_descriptors(struct heif_context* ctx, enum heif_compression_format format, const char* name, diff --git a/libheif/heif.h b/libheif/heif.h index 2cbfc8c3fd..7c2b4ebdf7 100644 --- a/libheif/heif.h +++ b/libheif/heif.h @@ -1700,6 +1700,10 @@ struct heif_error heif_context_write(struct heif_context*, struct heif_writer* writer, void* userdata); +// Add a compatible brand that is now added automatically by libheif when encoding images (e.g. some application brands like 'geo1'). +LIBHEIF_API +void heif_context_add_compatible_brand(struct heif_context* ctx, + heif_brand2 compatible_brand); // ----- encoder -----