Skip to content

Commit e77df31

Browse files
committed
read GIMI track-ID from iinf box
1 parent c0aefd3 commit e77df31

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

libheif/sequences/track.cc

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -305,24 +305,27 @@ Track::Track(HeifContext* ctx, const std::shared_ptr<Box_trak>& trak_box)
305305
auto iloc = meta->get_child_box<Box_iloc>();
306306
auto idat = meta->get_child_box<Box_idat>();
307307

308-
auto infe_boxes = meta->get_child_boxes<Box_infe>();
309-
for (const auto& box : infe_boxes) {
310-
if (box->get_item_type_4cc() == fourcc("uri ") &&
311-
box->get_item_uri_type() == "urn:uuid:15beb8e4-944d-5fc6-a3dd-cb5a7e655c73") {
312-
heif_item_id id = box->get_item_ID();
313-
314-
std::vector<uint8_t> data;
315-
Error err = iloc->read_data(id, ctx->get_heif_file()->get_reader(), idat, &data, ctx->get_security_limits());
316-
if (err) {
317-
// TODO
318-
}
319-
320-
Result contentIdResult = vector_to_string(data);
321-
if (contentIdResult.error) {
322-
// TODO
308+
auto iinf = meta->get_child_box<Box_iinf>();
309+
if (iinf) {
310+
auto infe_boxes = iinf->get_child_boxes<Box_infe>();
311+
for (const auto& box : infe_boxes) {
312+
if (box->get_item_type_4cc() == fourcc("uri ") &&
313+
box->get_item_uri_type() == "urn:uuid:15beb8e4-944d-5fc6-a3dd-cb5a7e655c73") {
314+
heif_item_id id = box->get_item_ID();
315+
316+
std::vector<uint8_t> data;
317+
Error err = iloc->read_data(id, ctx->get_heif_file()->get_reader(), idat, &data, ctx->get_security_limits());
318+
if (err) {
319+
// TODO
320+
}
321+
322+
Result contentIdResult = vector_to_string(data);
323+
if (contentIdResult.error) {
324+
// TODO
325+
}
326+
327+
m_track_info.gimi_track_content_id = contentIdResult.value;
323328
}
324-
325-
m_track_info.gimi_track_content_id = contentIdResult.value;
326329
}
327330
}
328331
}

0 commit comments

Comments
 (0)