Commit 8926c433 for libheif

commit 8926c433f6a3b7e1e44eebdb670c8e96754580f9
Author: Dirk Farin <dirk.farin@gmail.com>
Date:   Thu Dec 18 17:43:40 2025 +0100

    [BSD3] ignore unsupported track types instead of throwing error

diff --git a/go/heif/heif.go b/go/heif/heif.go
index 643ecc60..ec319782 100644
--- a/go/heif/heif.go
+++ b/go/heif/heif.go
@@ -369,6 +369,8 @@ const (

 	SuberrorUnsupportedHeaderCompressionMethod = C.heif_suberror_Unsupported_header_compression_method

+	SubErrorUnsupportedTrackType = C.heif_suberror_Unsupported_track_type
+
 	// --- Encoder_plugin_error ---

 	SuberrorUnsupportedBitDepth = C.heif_suberror_Unsupported_bit_depth
diff --git a/libheif/api/libheif/heif_emscripten.h b/libheif/api/libheif/heif_emscripten.h
index a8689b22..46bec33a 100644
--- a/libheif/api/libheif/heif_emscripten.h
+++ b/libheif/api/libheif/heif_emscripten.h
@@ -518,6 +518,7 @@ EMSCRIPTEN_BINDINGS(libheif) {
     .value("heif_suberror_Unsupported_item_construction_method", heif_suberror_Unsupported_item_construction_method)
     .value("heif_suberror_Unsupported_header_compression_method", heif_suberror_Unsupported_header_compression_method)
     .value("heif_suberror_Unsupported_bit_depth", heif_suberror_Unsupported_bit_depth)
+    .value("heif_suberror_Unsupported_track_type", heif_suberror_Unsupported_track_type)
     .value("heif_suberror_Wrong_tile_image_pixel_depth", heif_suberror_Wrong_tile_image_pixel_depth)
     .value("heif_suberror_Unknown_NCLX_color_primaries", heif_suberror_Unknown_NCLX_color_primaries)
     .value("heif_suberror_Unknown_NCLX_transfer_characteristics", heif_suberror_Unknown_NCLX_transfer_characteristics)
diff --git a/libheif/api/libheif/heif_error.h b/libheif/api/libheif/heif_error.h
index b28063ea..0c247fbf 100644
--- a/libheif/api/libheif/heif_error.h
+++ b/libheif/api/libheif/heif_error.h
@@ -254,6 +254,8 @@ enum heif_suberror_code

   heif_suberror_Unsupported_essential_property = 3007,

+  heif_suberror_Unsupported_track_type = 3008,
+
   // --- Encoder_plugin_error ---

   heif_suberror_Unsupported_bit_depth = 4000,
diff --git a/libheif/context.cc b/libheif/context.cc
index 958abef8..e5f3d2fa 100644
--- a/libheif/context.cc
+++ b/libheif/context.cc
@@ -1862,15 +1862,27 @@ Error HeifContext::interpret_heif_file_sequences()
   auto tracks = moov->get_child_boxes<Box_trak>();
   for (const auto& track_box : tracks) {
     auto trackResult = Track::alloc_track(this, track_box);
-    if (!trackResult) {
-      return trackResult.error();
+    bool skip_track = false;
+
+    if (auto err = trackResult.error()) {
+      if (err.error_code == heif_error_Unsupported_feature &&
+          err.sub_error_code == heif_suberror_Unsupported_track_type) {
+        // ignore error, skip track
+        skip_track = true;
+      }
+      else {
+        return trackResult.error();
+      }
     }

-    auto track = *trackResult;
-    m_tracks.insert({track->get_id(), track});
+    if (!skip_track) {
+      assert(*trackResult);
+      auto track = *trackResult;
+      m_tracks.insert({track->get_id(), track});

-    if (track->is_visual_track() && m_visual_track_id == 0) {
-      m_visual_track_id = track->get_id();
+      if (track->is_visual_track() && m_visual_track_id == 0) {
+        m_visual_track_id = track->get_id();
+      }
     }
   }

diff --git a/libheif/sequences/track.cc b/libheif/sequences/track.cc
index 5cd2153f..93be0c77 100644
--- a/libheif/sequences/track.cc
+++ b/libheif/sequences/track.cc
@@ -571,8 +571,8 @@ Result<std::shared_ptr<Track>> Track::alloc_track(HeifContext* ctx, const std::s
       std::stringstream sstr;
       sstr << "Track with unsupported handler type '" << fourcc_to_string(hdlr->get_handler_type()) << "'.";
       return Error{
-        heif_error_Unsupported_filetype,
-        heif_suberror_Unspecified,
+        heif_error_Unsupported_feature,
+        heif_suberror_Unsupported_track_type,
         sstr.str()
       };
     }
diff --git a/libheif/sequences/track.h b/libheif/sequences/track.h
index b445e66a..5dd8c0b6 100644
--- a/libheif/sequences/track.h
+++ b/libheif/sequences/track.h
@@ -132,7 +132,8 @@ public:

   virtual ~Track() = default;

-  // Allocate a Track of the correct sub-class (visual or metadata)
+  // Allocate a Track of the correct sub-class (visual or metadata).
+  // For tracks with an unsupported handler type, heif_error_Unsupported_feature/heif_suberror_Unsupported_track_type is returned.
   static Result<std::shared_ptr<Track>> alloc_track(HeifContext*, const std::shared_ptr<Box_trak>&);

   // load track from file