Skip to content

Commit

Permalink
Just use one ItemPropertyAssociation box.
Browse files Browse the repository at this point in the history
  • Loading branch information
ledyba-z committed Apr 15, 2022
1 parent 6559989 commit 2232b3f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/AVIFBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,23 @@ void AVIFBuilder::fillFrameInfo(uint16_t const itemID, AVIFBuilder::Frame const&
metaBox.primaryItemBox = pitm;
}
{ // fill ItemPropertiesBox
ItemPropertyAssociation assoc{};
ItemPropertiesBox& propertiesBox = metaBox.itemPropertiesBox;
// Just only one ItemPropertyAssociation box to comply with HEIF requirements.
// See: https://github.com/link-u/avif-sample-images/issues/4
ItemPropertyAssociation& assoc =
propertiesBox.associations.empty()
? propertiesBox.associations.emplace_back(ItemPropertyAssociation{})
: propertiesBox.associations[0];
ItemPropertyAssociation::Item item{};
item.itemID = itemID;
ItemPropertiesBox& propertiesBox = metaBox.itemPropertiesBox;
{
// FIXME(ledyba-z): Is it really correct?
// https://aomediacodec.github.io/av1-isobmff/#av1sampleentry-semantics
propertiesBox.propertyContainers.properties.emplace_back(PixelAspectRatioBox {
.hSpacing = 1,
.vSpacing = 1,
});
item.entries.emplace_back(ItemPropertyAssociation::Item::Entry{
item.entries.emplace_back(ItemPropertyAssociation::Item::Entry {
.essential = false,
.propertyIndex = static_cast<uint16_t>(propertiesBox.propertyContainers.properties.size()),
});
Expand Down Expand Up @@ -427,7 +432,6 @@ void AVIFBuilder::fillFrameInfo(uint16_t const itemID, AVIFBuilder::Frame const&
});
}
assoc.items.emplace_back(item);
propertiesBox.associations.emplace_back(assoc);
}
this->fileBox_.mediaDataBoxes.push_back(MediaDataBox {
.offset = 0, // TODO: fill it later.
Expand Down

0 comments on commit 2232b3f

Please sign in to comment.