Commit ae9e45b7 for libheif
commit ae9e45b7742aef42cee8b2ce7a60174008706c75
Author: Dirk Farin <dirk.farin@gmail.com>
Date: Mon Oct 26 11:31:39 2026 +0100
Number the 'stsc' entries written for new chunks
Box_stsc::add_chunk() wrote first_chunk = 1 into every entry. A track with
more than one chunk (written when the compression format changes within a
sequence) therefore got a table in which all entries start at chunk 1.
Each entry describes one chunk, so number them 1, 2, 3, ...
diff --git a/libheif/sequences/seq_boxes.cc b/libheif/sequences/seq_boxes.cc
index 8c39aef0..cf0c71e3 100644
--- a/libheif/sequences/seq_boxes.cc
+++ b/libheif/sequences/seq_boxes.cc
@@ -1046,7 +1046,7 @@ const Box_stsc::SampleToChunk* Box_stsc::get_chunk(uint32_t idx) const
void Box_stsc::add_chunk(uint32_t description_index)
{
SampleToChunk entry{};
- entry.first_chunk = 1; // TODO
+ entry.first_chunk = static_cast<uint32_t>(m_entries.size() + 1); // each entry describes one chunk
entry.samples_per_chunk = 0;
entry.sample_description_index = description_index;
m_entries.push_back(entry);