Commit 5442d681 for libheif
commit 5442d681ad824ff4eb15bc02df22afeb85c9a2e4
Author: Dirk Farin <dirk.farin@gmail.com>
Date: Wed Jan 28 23:39:34 2026 +0100
accept input files with meta box but no 'pict' handler
diff --git a/libheif/file.cc b/libheif/file.cc
index 89d0e8fa..507ea29b 100644
--- a/libheif/file.cc
+++ b/libheif/file.cc
@@ -143,6 +143,16 @@ Error HeifFile::read(const std::shared_ptr<StreamReader>& reader)
}
+bool HeifFile::has_images() const
+{
+ if (!m_meta_box) {
+ return false;
+ }
+
+ return m_hdlr_box && m_hdlr_box->get_handler_type() == fourcc("pict");
+}
+
+
void HeifFile::new_empty_file()
{
//m_input_stream.reset();
@@ -423,8 +433,7 @@ Error HeifFile::parse_heif_images()
if (m_hdlr_box &&
m_hdlr_box->get_handler_type() != fourcc("pict")) {
- return Error(heif_error_Invalid_input,
- heif_suberror_No_pict_handler);
+ return {};
}
diff --git a/libheif/file.h b/libheif/file.h
index 16376ad0..df025717 100644
--- a/libheif/file.h
+++ b/libheif/file.h
@@ -73,7 +73,7 @@ public:
Error read_from_memory(const void* data, size_t size, bool copy);
- bool has_images() const { return m_meta_box != nullptr; }
+ bool has_images() const;
bool has_sequences() const { return m_moov_box != nullptr; }